From 3b7684e449277b433af669a6c0604933dabe420e Mon Sep 17 00:00:00 2001 From: Coloryr <402067010@qq.com> Date: Fri, 16 Aug 2024 19:36:43 +0800 Subject: [PATCH] up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新UI布局 修复自定义窗口问题 --- .github/workflows/dotnet-build.yml | 6 +- src/ColorMC.Core/CoreMain.cs | 12 +- src/ColorMC.CustomGui/CustomUI.cs | 1 + src/ColorMC.Gui/ColorMC.Gui.csproj | 5 + src/ColorMC.Gui/Manager/WindowManager.cs | 2 +- src/ColorMC.Gui/Objs/Results.cs | 2 +- .../Resource/Language/gui_zh-cn.json | 4 +- .../UI/Controls/Add/AddControl.axaml | 144 +++++----- .../UI/Controls/Add/AddControl.axaml.cs | 15 - .../UI/Controls/Add/AddModPackControl.axaml | 84 +++--- .../Controls/Add/AddModPackControl.axaml.cs | 7 - .../UI/Controls/Custom/ICustomControl.cs | 1 + .../Controls/Items/FileItemControl.axaml.cs | 4 +- .../Items/FileModVersionControl.axaml | 36 +++ .../Items/FileModVersionControl.axaml.cs | 13 + .../Items/FileVersionItemControl.axaml | 39 +++ .../Items/FileVersionItemControl.axaml.cs | 147 ++++++++++ .../UI/Model/Add/AddControlModel.cs | 88 ++++-- .../UI/Model/Add/AddModPackControlModel.cs | 67 ++++- .../UI/Model/Items/DownloadModModel.cs | 2 +- .../UI/Model/Items/FileDisplayModel.cs | 54 ---- .../UI/Model/Items/FileItemDisplayModel.cs | 61 ----- .../UI/Model/Items/FileItemModel.cs | 118 +++++--- .../UI/Model/Items/FileVersionItemModel.cs | 111 ++++++++ src/ColorMC.Gui/UI/Model/SelectItemModel.cs | 14 +- src/ColorMC.Gui/UI/Windows/IAddWindow.cs | 4 + src/ColorMC.Gui/UIBinding/BaseBinding.cs | 3 +- src/ColorMC.Gui/UIBinding/GameBinding.cs | 2 +- src/ColorMC.Gui/UIBinding/WebBinding.cs | 258 ++++++------------ src/ColorMC.Gui/Utils/DllAssembly.cs | 10 +- src/ColorMC.Launcher/Program.cs | 2 +- src/ColorMC.sln | 27 +- 32 files changed, 808 insertions(+), 535 deletions(-) create mode 100644 src/ColorMC.Gui/UI/Controls/Items/FileModVersionControl.axaml create mode 100644 src/ColorMC.Gui/UI/Controls/Items/FileModVersionControl.axaml.cs create mode 100644 src/ColorMC.Gui/UI/Controls/Items/FileVersionItemControl.axaml create mode 100644 src/ColorMC.Gui/UI/Controls/Items/FileVersionItemControl.axaml.cs delete mode 100644 src/ColorMC.Gui/UI/Model/Items/FileDisplayModel.cs delete mode 100644 src/ColorMC.Gui/UI/Model/Items/FileItemDisplayModel.cs create mode 100644 src/ColorMC.Gui/UI/Model/Items/FileVersionItemModel.cs diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 7388676b8..c24f8ad0a 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -17,7 +17,7 @@ jobs: - name: 设置.NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.303 + dotnet-version: 8.0.401 - name: Read version number id: version @@ -181,7 +181,7 @@ jobs: - name: 设置.NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.300 + dotnet-version: 8.0.401 - name: Read version number id: version @@ -245,7 +245,7 @@ jobs: - name: 设置.NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.303 + dotnet-version: 8.0.401 - name: 更新源码 shell: cmd diff --git a/src/ColorMC.Core/CoreMain.cs b/src/ColorMC.Core/CoreMain.cs index 4b6c44725..f34e7ecb8 100644 --- a/src/ColorMC.Core/CoreMain.cs +++ b/src/ColorMC.Core/CoreMain.cs @@ -258,12 +258,12 @@ public static void KillGame(string uuid) } /// - /// 启动器产生错误 + /// 启动器产生错误,并打开窗口显示 /// /// /// /// - public static void OnError(string text, Exception? e, bool close) + internal static void OnError(string text, Exception? e, bool close) { Error?.Invoke(text, e, close); Logs.Error(text, e); @@ -274,7 +274,7 @@ public static void OnError(string text, Exception? e, bool close) /// /// /// - public static void OnGameLog(GameSettingObj obj, string? text) + internal static void OnGameLog(GameSettingObj obj, string? text) { GameLog?.Invoke(obj, text); } @@ -283,18 +283,18 @@ public static void OnGameLog(GameSettingObj obj, string? text) /// 语言重载 /// /// - public static void OnLanguageReload(LanguageType type) + internal static void OnLanguageReload(LanguageType type) { LanguageReload?.Invoke(type); } /// - /// 游戏推出 + /// 游戏退出 /// /// /// /// - public static void OnGameExit(GameSettingObj obj, LoginObj obj1, int code) + internal static void OnGameExit(GameSettingObj obj, LoginObj obj1, int code) { Games.TryRemove(obj.UUID, out _); GameExit?.Invoke(obj, obj1, code); diff --git a/src/ColorMC.CustomGui/CustomUI.cs b/src/ColorMC.CustomGui/CustomUI.cs index 7d70c4a57..a7abc4193 100644 --- a/src/ColorMC.CustomGui/CustomUI.cs +++ b/src/ColorMC.CustomGui/CustomUI.cs @@ -5,6 +5,7 @@ namespace ColorMC.CustomGui; public class CustomUI : ICustomControl { + public string LauncherApi => "A29"; /// /// 返回主界面 一般不用动 /// diff --git a/src/ColorMC.Gui/ColorMC.Gui.csproj b/src/ColorMC.Gui/ColorMC.Gui.csproj index a22598e7c..0b7ef4f8e 100644 --- a/src/ColorMC.Gui/ColorMC.Gui.csproj +++ b/src/ColorMC.Gui/ColorMC.Gui.csproj @@ -345,4 +345,9 @@ + + + FileVersionItemControl.axaml + + diff --git a/src/ColorMC.Gui/Manager/WindowManager.cs b/src/ColorMC.Gui/Manager/WindowManager.cs index deedabbcb..865d2c53b 100644 --- a/src/ColorMC.Gui/Manager/WindowManager.cs +++ b/src/ColorMC.Gui/Manager/WindowManager.cs @@ -279,7 +279,7 @@ public static bool ShowCustom(bool test = false) { var data = App.Lang("WindowManager.Error1"); Logs.Error(data, e); - ShowError(data, e, true); + ShowError(data, e, !test); } return false; diff --git a/src/ColorMC.Gui/Objs/Results.cs b/src/ColorMC.Gui/Objs/Results.cs index adf1146d2..5449fc137 100644 --- a/src/ColorMC.Gui/Objs/Results.cs +++ b/src/ColorMC.Gui/Objs/Results.cs @@ -39,7 +39,7 @@ public record ModDownloadRes { public DownloadItemObj Item; public ModInfoObj Info; - public List List; + public List List; } public record GetJavaListRes diff --git a/src/ColorMC.Gui/Resource/Language/gui_zh-cn.json b/src/ColorMC.Gui/Resource/Language/gui_zh-cn.json index 71c04f7fa..15bcfecc9 100644 --- a/src/ColorMC.Gui/Resource/Language/gui_zh-cn.json +++ b/src/ColorMC.Gui/Resource/Language/gui_zh-cn.json @@ -683,8 +683,7 @@ "AddModPackWindow.Text12": "安装所选", "AddModPackWindow.Text13": "没有资源", "AddModPackWindow.Text14": "下一页", - "AddModPackWindow.Text15": "下载次数", - "AddModPackWindow.Text16": "发布时间", + "AddModPackWindow.Text16": "发布时间:", "AddModPackWindow.Info1": "是否安装整合包 {0}", "AddModPackWindow.Info2": "正在搜索整合包中", "AddModPackWindow.Info3": "正在获取整合包版本中", @@ -719,6 +718,7 @@ "AddWindow.Info11": "正在下载", "AddWindow.Info13": "正在加载Optifine列表", "AddWindow.Info14": "选择下载源", + "AddWindow.Info15": "是否切换模组版本", "AddWindow.Error1": "你还没有选择资源", "AddWindow.Error2": "资源数据加载失败", "AddWindow.Error3": "资源版本数据加载失败", diff --git a/src/ColorMC.Gui/UI/Controls/Add/AddControl.axaml b/src/ColorMC.Gui/UI/Controls/Add/AddControl.axaml index c4c568ee4..bc7700279 100644 --- a/src/ColorMC.Gui/UI/Controls/Add/AddControl.axaml +++ b/src/ColorMC.Gui/UI/Controls/Add/AddControl.axaml @@ -13,7 +13,10 @@ x:DataType="model:AddControlModel" mc:Ignorable="d"> - + - - - + + + @@ -196,38 +202,40 @@ ToolTip.VerticalOffset="-30" /> - - - - - - - - - - - - + + + + + + + + + + +