Skip to content

Center-align main timer display#2

Closed
Copilot wants to merge 24 commits into
copilot/add-dx9-support-for-palfrom
copilot/fix-compile-errors-in-dx9-file
Closed

Center-align main timer display#2
Copilot wants to merge 24 commits into
copilot/add-dx9-support-for-palfrom
copilot/fix-compile-errors-in-dx9-file

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 31, 2026

Main timer was right-aligned, making it appear off-center in the display area when rendered.

Changes

Changed main timer horizontal alignment from Far (right) to Center:

GEX.cs lines 2397, 2401:

// Before
GEX.DrawText(g, TS2HHMMSS(MainTimer), ..., GLayout.sfFC);  // Far + Center

// After
GEX.DrawText(g, TS2HHMMSS(MainTimer), ..., GLayout.sfCC);  // Center + Center

Applies to both normal timer display and star-indicator mode.

Visual result:

Before:                            00:23:42       |43|
After:             00:23:42                    |43|
Original prompt

修复仙剑98DX9.cs的编译错误和缺失方法

问题描述

当前 copilot/add-dx9-support-for-pal 分支的 仙剑98DX9.cs 文件存在多个编译错误,缺少很多必要的方法实现。项目已升级到 .NET Framework 4.0。

需要修复的问题

1. 添加缺失的字段

private float MoveSpeed = 0;
private DateTime LastFlushTime = DateTime.Now;
private BattleItemWatch biw = new BattleItemWatch();
private string CurrentNamedBattle = "";
private string WillAppendNamedBattle = "";

2. 添加缺失的辅助方法

仙剑98柔情.cs 复制以下方法到 仙剑98DX9.cs

private bool PositionCheck(params int[][] PositionList)
{
    foreach (int[] p in PositionList)
    {
        if (GameObj.Area == p[0] && GameObj.X == p[1] && GameObj.Y == p[2])
        {
            return true;
        }
    }
    return false;
}

private bool PositionAroundCheck(int Area, int X, int Y, int r = 1)
{
    if (GameObj.Area == Area)
    {
        if (GameObj.X >= (X - 16 * r) && GameObj.X <= (X + 16 * r)
            && GameObj.Y >= (Y - 8 * r) && GameObj.Y <= (Y + 8 * r))
        {
            return true;
        }
    }
    return false;
}

3. 补全所有检查点

当前只有10个检查点,需要补全到20个。从 仙剑98柔情.csInitCheckPoints 方法复制剩余的检查点(从"进京城"到"通关")。

4. 实现所有必需的重写方法

public override bool NeedBlockCtrlEnter()
{
    return false;
}

public override string GetMoreInfo()
{
    if (IsShowSpeed)
    {
        return MoveSpeed.ToString("F2") + "   " + "蜂" + MaxFC + " 蜜" + MaxFM + " 火" + MaxHCG + " 血" + MaxXLL + " 夜" + MaxYXY + " 剑" + MaxLQJ + ((MaxTLF > 0) ? (" 土" + MaxTLF) : "") + ((MaxQTJ > 0) ? (" 甲" + MaxQTJ) : "");
    }
    else
    {
        return "蜂" + MaxFC + " 蜜" + MaxFM + " 火" + MaxHCG + " 血" + MaxXLL + " 夜" + MaxYXY + " 剑" + MaxLQJ + ((MaxTLF > 0) ? (" 土" + MaxTLF) : "") + ((MaxQTJ > 0) ? (" 甲" + MaxQTJ) : "");
    }
}

public override string GetSmallWatch()
{
    return BattleLong.TotalSeconds.ToString("F2") + "s";
}

public override string GetSecondWatch()
{
    if (ST.CurrentTSOnly.Ticks == 0)
    {
        return "";
    }
    return ST.ToString();
}

public override TimeSpan GetMainWatch()
{
    return MT.CurrentTS;
}

public override bool IsMainWatchStar()
{
    return IsInUnCheat;
}

public override string GetPointEnd()
{
    return TS2HMMSSMS(WillClear);
}

public override string GetPointSpan()
{
    if (PointSpanName != "")
    {
        return PointSpanName + " " + GetPointSpanStr();
    }
    return "";
}

private string GetPointSpanStr()
{
    return TS2HMMSSMS(PointSpan);
}

public override string GetAAction()
{
    if (WillAppendNamedBattle == "")
    {
        return "";
    }
    else
    {
        NamedBattleRes.Add(WillAppendNamedBattle);
        string res = WillAppendNamedBattle;
        WillAppendNamedBattle = "";
        return res;
    }
}

public override string GetCriticalError()
{
    if (cryerror == "")
    {
        return "";
    }
    else
    {
        string tmp = cryerror;
        cryerror = "";
        return tmp;
    }
}

5. 实现完整的 OnTick 方法

仙剑98柔情.cs 复制完整的 OnTick 方法(第637-729行)及相关方法:

  • PreData()
  • JudgePause()
  • FlushGameObject()
  • BattleBegin()
  • Battling()
  • BattleEnd()
  • BattleEndMore()
  • HasStartGame()
  • CheckCheatBegin()
  • CheckCheatEnd()
  • CopyRPGIfHas()

6. 实现 InitUI 方法

仙剑98柔情.cs 复制 InitUI 方法(第514-630行),包括:

  • 导出本次成绩
  • 设置本次成绩为最佳
  • 接力存档/读档功能
  • 云存档/云读档功能
  • 切换至简版按钮
  • 显示游戏速度选项

7. 实现其他必需方法

protected override void FillMoreTimerData(HObj exdata)
{
    exdata["Idle"] = ST.ToFullString();
    exdata["Lite"] = LT.ToFullString();
    exdata["BeeHouse"] = MaxFC;
    exdata["BeeSheet"] = MaxFM;
    exdata["FireWorm"] = MaxHCG;
    exdata["DragonSword"] = MaxLQJ;
    exdata["BloodLink"] = MaxXLL;
    exdata["NightCloth"] = MaxYXY;
    exdata["EarthPaper"] = MaxTLF;
    exdata["CuArmor"] = MaxQTJ;
    exdata["GMD5"] = GMD5;
    exdata["DX9Version"] = DX9Version;

    string namedbattles = "";
    foreach (string nmb in NamedBattleRes)
    {
        namedbattles += nmb + "|";
    }
    if (namedbattles != "")
    {
        namedbattles = namedbattles.Substring(0, namedbattles.Length - 1);
    }
    exdata["NamedBattles"] = namedbattles;
}

public override void OnFunctionKey(int FunNo)
{
    switch (FunNo)
    {
        case 8:
            HandPause();
            break;
        case 6:
            if (form.Confirm("更换内核将会重置计时器,确认么?"))
            {
                LoadCore(new 简版(form));
            }
            break;
    }
}

public override void OnCloudOK()
{
    btnCloudSave.Enabled = true;
    btnCloudLoad.Enabled = true;
}

public override void OnCloudFail()
{
    btnCloudSave.Enabled = false;
    btnCloudLoad.Enabled = false;
}

public override void OnCloudPending()
{
    btnCloudSave.Enabled = false;
    btnCloudLoad.Enabled = false;
}

public override string ForCloudLiteData()
{
    return MT.CurrentTS.Ticks.ToString() + "," + ST.CurrentTS.Ticks.ToString() + "," + BattleLong.Ticks.ToString();
}

8. 删除错误的 Checking 重写

删除第246-269行的 protected override void Checking() 方法,使用基类的实现即可。

实现要求

  1. 确保所有方法从 仙剑98柔情.cs 正确复制,保持相同的逻辑
  2. 保留DX9特有...

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compile errors and missing methods in 仙剑98DX9.cs Complete 仙剑98DX9.cs implementation with missing methods and checkpoints Jan 31, 2026
Copilot AI requested a review from othercat January 31, 2026 15:16
Replaces double quotes with single quotes around '进度一' in the import success message for consistency and to avoid nested quote issues.
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Complete 仙剑98DX9.cs implementation with missing methods and checkpoints Fix missing method implementations in 仙剑98DX9.cs Jan 31, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Fix missing method implementations in 仙剑98DX9.cs Relax DX9 window title detection and add game name to version display Jan 31, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Relax DX9 window title detection and add game name to version display Add grace period for DX9 title detection with PAL.DLL runtime modification Jan 31, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Add grace period for DX9 title detection with PAL.DLL runtime modification Handle VB4 window transition and delayed DX9 title modifications Jan 31, 2026
Bump version to 3.35.0 and update assembly info. Enhance DX9 patch detection logic to support new window title patterns and versions. Add 'othercat' to AboutForm contributors. Fix typos in UI text from '改建器' to '改键器'. Suppress some error messages for multiple Pal.exe processes and missing DX9 patch. Minor UI string fix for archive import dialog.
Changed text references from '仙剑98 DX9新补丁' to '仙剑98原版 2025新补丁' in AboutForm.cs and the DX9-related source file to reflect the updated patch naming.
…ngle instance, KeyChanger management

Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Handle VB4 window transition and delayed DX9 title modifications Add monster counter, real-time battle stats, single-instance enforcement, and KeyChanger lifecycle management Feb 1, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Add DX9 support with window detection, display fixes, and proportional layout scaling Fix DX9 timer implementation and improve display scaling Feb 1, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Fix DX9 timer implementation and improve display scaling Add comprehensive DX9 support with adaptive UI and enhanced functionality Feb 1, 2026
…tting methods

Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Add comprehensive DX9 support with adaptive UI and enhanced functionality Complete DX9 timer implementation with adaptive UI and multi-instance fixes Feb 1, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Complete DX9 timer implementation with adaptive UI and multi-instance fixes Add complete DX9 timer implementation with adaptive UI layout Feb 1, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Add complete DX9 timer implementation with adaptive UI layout Complete DX9 implementation and add adaptive UI improvements Feb 1, 2026
Co-authored-by: othercat <509048+othercat@users.noreply.github.com>
Copilot AI changed the title Complete DX9 implementation and add adaptive UI improvements Complete DX9 support implementation and UI layout improvements Feb 1, 2026
Copilot AI changed the title Complete DX9 support implementation and UI layout improvements Add DX9 support with adaptive UI, window detection, and enhanced features Feb 1, 2026
Copilot AI changed the title Add DX9 support with adaptive UI, window detection, and enhanced features Center-align main timer display Feb 1, 2026
@othercat othercat closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants