From 2bd16a9125d53c8802e1f6cb7e65fa162e737442 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Tue, 7 Jan 2025 20:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=9F=BA=E7=B1=BB,=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/BgSettingsUI/UI_BgSettingItem_Color.cs | 9 +++--- .../AppMain/UI/BgSettingsUI/UI_FilterItem.cs | 13 +++++--- .../Script/AppMain/UI/GamesUI/RomItem.cs | 2 ++ .../AppMain/UI/GamesUI/RomListMenuItem.cs | 31 +++++++++++++++++-- .../UI/InGameUI/InGameUI_FilterSetting.cs | 16 +++++----- .../AppMain/UI/InGameUI/InGameUI_LoadState.cs | 11 ++----- .../AppMain/UI/InGameUI/InGameUI_QuitGame.cs | 6 ++-- .../AppMain/UI/InGameUI/InGameUI_Reset.cs | 6 ++-- .../AppMain/UI/InGameUI/InGameUI_SaveState.cs | 7 +++-- .../AppMain/UI/InGameUI/InGameUI_Scaler.cs | 8 ++--- .../Script/AppMain/UI/MenuItemController.cs | 2 +- .../Script/AppMain/UI/OptionUI/OptionUI.cs | 25 ++++++--------- .../Assets/Script/AppMain/UI/ThirdMenuRoot.cs | 2 +- 13 files changed, 82 insertions(+), 56 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_BgSettingItem_Color.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_BgSettingItem_Color.cs index 2676a2d4..ee7b52bd 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_BgSettingItem_Color.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_BgSettingItem_Color.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client.ClientCore; +锘縰sing AxibugEmuOnline.Client.ClientCore; using AxibugEmuOnline.Client.UI; using DG.Tweening; using DG.Tweening.Core; @@ -9,7 +9,7 @@ using UnityEngine; namespace AxibugEmuOnline.Client { /// - /// 背景颜色设置UI + /// 鑳屾櫙棰滆壊璁剧疆UI /// public class UI_BgSettingItem_Color : MenuItem, IVirtualItem { @@ -34,7 +34,7 @@ namespace AxibugEmuOnline.Client var color = Datacontext.CurrentColor; Icon.GetMaterial().SetColor("_Color1", color.color1); Icon.GetMaterial().SetColor("_Color2", color.color2); - SetBaseInfo("主题色", "设置主题色", color.Name); + SetBaseInfo("涓婚鑹", "璁剧疆涓婚鑹", color.Name); } public void SetDependencyProperty(object data) @@ -58,8 +58,9 @@ namespace AxibugEmuOnline.Client public class ColorOption : ExecuteMenu { public XMBColor Color; + public override string Name => Color.Name; - public ColorOption(XMBColor color) : base(color.Name) + public ColorOption(XMBColor color) { Color = color; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_FilterItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_FilterItem.cs index 548702f9..e7dd6ab2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_FilterItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/BgSettingsUI/UI_FilterItem.cs @@ -70,7 +70,9 @@ namespace AxibugEmuOnline.Client { private Filter m_filter; - public Opt_CreatePreset(Filter filter) : base("鍒涘缓婊ら暅棰勮", Resources.LoadAll("Icons/XMB-Icons/misc")[0]) + public override string Name => "鍒涘缓婊ら暅棰勮"; + public override Sprite Icon => Resources.LoadAll("Icons/XMB-Icons/misc")[0]; + public Opt_CreatePreset(Filter filter) { m_filter = filter; } @@ -101,7 +103,9 @@ namespace AxibugEmuOnline.Client private OptionUI_MenuItem m_ui; private List m_menu; - public Opt_Presets(Filter filter, FilterPreset preset) : base(preset.Name, null) + public override string Name => m_preset.Name; + + public Opt_Presets(Filter filter, FilterPreset preset) { m_filter = filter; m_preset = preset; @@ -151,8 +155,8 @@ namespace AxibugEmuOnline.Client public override bool Visible => m_param.ValueType.IsEnum || m_param.ValueType == typeof(float); + public override string Name => m_param.Name; public Opt_ParamEditor(Filter filter, FilterEffect.EditableParamerter editParam, FilterPreset preset) - : base(editParam.Name) { m_filter = filter; m_param = editParam; @@ -179,8 +183,9 @@ namespace AxibugEmuOnline.Client { private Filter m_filter; private FilterPreset m_preset; + public override string Name => "鍒犻櫎棰勮"; - public Opt_Delete(Filter filter, FilterPreset preset) : base("鍒犻櫎棰勮", null) + public Opt_Delete(Filter filter, FilterPreset preset) { m_filter = filter; m_preset = preset; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs index 297c4304..f3462659 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs @@ -24,6 +24,8 @@ namespace AxibugEmuOnline.Client public int Index { get; set; } + public bool IsFav { get; } + private RomLib m_romlib => App.nesRomLib; private RomFile m_romfile; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomListMenuItem.cs index 5a7241fa..47ade89c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomListMenuItem.cs @@ -68,8 +68,9 @@ namespace AxibugEmuOnline.Client public class OptMenu_Search : ExecuteMenu { private RomListMenuItem m_romListUI; + public override string Name => "鎼滅储"; - public OptMenu_Search(RomListMenuItem romListUI, Sprite icon = null) : base("鎼滅储", icon) + public OptMenu_Search(RomListMenuItem romListUI) { m_romListUI = romListUI; } @@ -90,9 +91,10 @@ namespace AxibugEmuOnline.Client { private RomListMenuItem m_ui; + public override string Name => "鏄剧ず鍏ㄩ儴"; public override bool Visible => !string.IsNullOrWhiteSpace(m_ui.SearchKey); - public OptMenu_ShowAll(RomListMenuItem romListUI, Sprite icon = null) : base("鏄剧ず鍏ㄩ儴", icon) + public OptMenu_ShowAll(RomListMenuItem romListUI) { m_ui = romListUI; } @@ -103,5 +105,30 @@ namespace AxibugEmuOnline.Client m_ui.RefreshUI(); } } + + public class OptMenu_Fav : ExecuteMenu + { + private RomListMenuItem m_romListUI; + private ThirdMenuRoot m_romListSub; + + public override string Name + { + get + { + var isFav = (m_romListSub.GetItemUIByIndex(m_romListSub.SelectIndex) as RomItem).IsFav; + return isFav ? "鏀惰棌" : "鍙栨秷鏀惰棌"; + } + } + + public OptMenu_Fav(RomListMenuItem romListUI) + { + m_romListUI = romListUI; + m_romListSub = m_romListUI.SubMenuItemGroup as ThirdMenuRoot; + } + + public override void OnExcute(OptionUI optionUI, ref bool cancelHide) + { + } + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs index 31bd1d14..14c684f2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs @@ -8,8 +8,9 @@ namespace AxibugEmuOnline.Client public class InGameUI_FilterSetting : ExpandMenu { private InGameUI m_gameUI; + public override string Name => "婊ら暅"; - public InGameUI_FilterSetting(InGameUI gameUI) : base("婊ら暅", null) + public InGameUI_FilterSetting(InGameUI gameUI) { m_gameUI = gameUI; } @@ -26,12 +27,11 @@ namespace AxibugEmuOnline.Client { private RomFile m_rom; + public override string Name => "鍙栨秷婊ら暅"; public override bool IsApplied => App.settings.Filter.GetFilterSetting(m_rom).filter == null; - public FilterNone(RomFile rom) : base("鍙栨秷婊ら暅", null) + public FilterNone(RomFile rom) { m_rom = rom; - - var currentFilterSetting = App.settings.Filter.GetFilterSetting(m_rom); } public override void OnExcute(OptionUI optionUI, ref bool cancelHide) @@ -58,8 +58,8 @@ namespace AxibugEmuOnline.Client return false; } } - - public FilterMenu(RomFile rom, Filter filter) : base(filter.Name, null) + public override string Name => m_filter.Name; + public FilterMenu(RomFile rom, Filter filter) { m_filter = filter; m_presetsMenuItems = new List { new FilterPresetMenu(rom, m_filter, m_filter.DefaultPreset) }; @@ -87,8 +87,8 @@ namespace AxibugEmuOnline.Client } } - - public FilterPresetMenu(RomFile rom, Filter filter, FilterPreset preset) : base(preset.Name, null) + public override string Name => m_preset.Name; + public FilterPresetMenu(RomFile rom, Filter filter, FilterPreset preset) { m_preset = preset; m_rom = rom; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_LoadState.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_LoadState.cs index c6ddd582..9aa0d1b5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_LoadState.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_LoadState.cs @@ -1,14 +1,12 @@ -using AxibugEmuOnline.Client.ClientCore; -using System.Diagnostics; - -namespace AxibugEmuOnline.Client +锘縩amespace AxibugEmuOnline.Client { public class InGameUI_LoadState : ExecuteMenu { private InGameUI m_gameUI; public override bool Visible => !m_gameUI.IsNetPlay; + public override string Name => "璇诲彇蹇収"; - public InGameUI_LoadState(InGameUI gameUI) : base("读取快照", null) + public InGameUI_LoadState(InGameUI gameUI) { m_gameUI = gameUI; } @@ -18,12 +16,9 @@ namespace AxibugEmuOnline.Client if (m_gameUI.IsNetPlay) return; object state = m_gameUI.GetQuickState(); - Stopwatch sw = Stopwatch.StartNew(); if (state != null) { m_gameUI.Core.LoadState(state); - sw.Stop(); - App.log.Info($"{m_gameUI.RomFile.Platform}====>快照加载耗时:{sw.Elapsed.TotalMilliseconds}ms"); } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_QuitGame.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_QuitGame.cs index 03ed5166..1c05924b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_QuitGame.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_QuitGame.cs @@ -1,11 +1,11 @@ -namespace AxibugEmuOnline.Client +锘縩amespace AxibugEmuOnline.Client { public class InGameUI_QuitGame : ExecuteMenu { private InGameUI m_gameUI; + public override string Name => "閫鍑"; - - public InGameUI_QuitGame(InGameUI gameUI) : base("退出", null) + public InGameUI_QuitGame(InGameUI gameUI) { m_gameUI = gameUI; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Reset.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Reset.cs index 02cbbaf7..a804dd66 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Reset.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Reset.cs @@ -1,14 +1,14 @@ -using AxibugEmuOnline.Client.ClientCore; +锘縰sing AxibugEmuOnline.Client.ClientCore; namespace AxibugEmuOnline.Client { public class InGameUI_Reset : ExecuteMenu { private InGameUI m_gameUI; - + public override string Name => "澶嶄綅"; public override bool Visible => !m_gameUI.IsNetPlay || App.roomMgr.IsHost; - public InGameUI_Reset(InGameUI gameUI) : base("复位", null) + public InGameUI_Reset(InGameUI gameUI) { m_gameUI = gameUI; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_SaveState.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_SaveState.cs index 8c44d1ee..c6cbee4d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_SaveState.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_SaveState.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client.ClientCore; +锘縰sing AxibugEmuOnline.Client.ClientCore; using System.Diagnostics; namespace AxibugEmuOnline.Client @@ -8,8 +8,9 @@ namespace AxibugEmuOnline.Client private InGameUI m_gameUI; public override bool Visible => !m_gameUI.IsNetPlay; + public override string Name => "淇濆瓨蹇収"; - public InGameUI_SaveState(InGameUI gameUI) : base("保存快照", null) + public InGameUI_SaveState(InGameUI gameUI) { m_gameUI = gameUI; } @@ -23,7 +24,7 @@ namespace AxibugEmuOnline.Client m_gameUI.SaveQuickState(state); sw.Stop(); - App.log.Info($"{m_gameUI.RomFile.Platform}====>获取快照耗时:{sw.Elapsed.TotalMilliseconds}ms"); + App.log.Info($"{m_gameUI.RomFile.Platform}====>鑾峰彇蹇収鑰楁椂:{sw.Elapsed.TotalMilliseconds}ms"); } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Scaler.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Scaler.cs index 2fc9d92c..4eb06201 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Scaler.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_Scaler.cs @@ -8,8 +8,8 @@ namespace AxibugEmuOnline.Client public class InGameUI_Scaler : ExpandMenu { private List m_subMenus = new List(); - - public InGameUI_Scaler(InGameUI inGameUI) : base("灞忓箷姣斾緥", null) + public override string Name => "灞忓箷姣斾緥"; + public InGameUI_Scaler(InGameUI inGameUI) { m_subMenus.Add(new Scale(inGameUI, null)); foreach (EnumScalerMode scaleModeValue in Enum.GetValues(typeof(EnumScalerMode))) @@ -48,8 +48,8 @@ namespace AxibugEmuOnline.Client else return false; } } - - public Scale(InGameUI inGameUI, EnumScalerMode? mode) : base(ModeToName(mode), null) + public override string Name => ModeToName(m_mode); + public Scale(InGameUI inGameUI, EnumScalerMode? mode) { m_mode = mode; m_gameUI = inGameUI; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItemController.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItemController.cs index 841bad89..90b0ae00 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItemController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItemController.cs @@ -42,7 +42,7 @@ namespace AxibugEmuOnline.Client if (m_selectIndex == -1) SelectIndex = 0; } - protected virtual MenuItem GetItemUIByIndex(int index) + public virtual MenuItem GetItemUIByIndex(int index) { return m_runtimeMenuUI[SelectIndex]; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs index 4de0cb41..c208606f 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs @@ -35,18 +35,20 @@ namespace AxibugEmuOnline.Client value = Mathf.Clamp(value, 0, m_runtimeMenuItems.Count - 1); if (m_selectIndex == value) return; - var gap = value - m_selectIndex; - + var gap = value - m_selectIndex; + + var temp = value; while (!m_runtimeMenuItems[value].Visible) { - var temp = value; if (gap > 0) { - temp++; + temp++; + if (temp >= m_runtimeMenuItems.Count) return; } else { temp--; + if (temp < 0) return; } if (temp >= 0 && temp < m_runtimeMenuItems.Count) @@ -386,7 +388,6 @@ namespace AxibugEmuOnline.Client { /// 璁剧疆杩欎釜鍊间互鎺у埗鑿滃崟涓樉绀"宸插簲鐢"鏍囪 public virtual bool IsApplied { get; } - protected ExecuteMenu(string name, Sprite icon = null) : base(name, icon) { } public abstract void OnExcute(OptionUI optionUI, ref bool cancelHide); } @@ -396,7 +397,7 @@ namespace AxibugEmuOnline.Client /// public abstract class ExpandMenu : ExecuteMenu { - protected ExpandMenu(string name, Sprite icon = null) : base(name, icon) { } + protected ExpandMenu() : base() { } public sealed override void OnExcute(OptionUI optionUI, ref bool cancelHide) { @@ -411,7 +412,7 @@ namespace AxibugEmuOnline.Client /// public abstract class ValueSetMenu : OptionMenu { - protected ValueSetMenu(string name) : base(name) { } + protected ValueSetMenu() : base() { } public abstract Type ValueType { get; } public abstract object ValueRaw { get; } @@ -423,17 +424,11 @@ namespace AxibugEmuOnline.Client /// 涓嶈鐩存帴缁ф壙杩欎釜绫 public abstract class OptionMenu { - public string Name { get; protected set; } - public Sprite Icon { get; protected set; } + public abstract string Name { get; } + public virtual Sprite Icon { get; } public virtual bool Visible => true; public virtual bool Enable => true; - protected OptionMenu(string name, Sprite icon = null) - { - Name = name; - Icon = icon; - } - public virtual void OnFocus() { } public virtual void OnShow(OptionUI_MenuItem ui) { } public virtual void OnHide() { } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs index 0a615d61..f8bd88ac 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs @@ -45,7 +45,7 @@ namespace AxibugEmuOnline.Client SelectIndex = selectIndex; } - protected override MenuItem GetItemUIByIndex(int index) + public override MenuItem GetItemUIByIndex(int index) { return itemGroup.GetItemUIByDataIndex(index)?.GetComponent(); }