diff --git a/AxibugEmuOnline.Client/Assets/Resources/IMPORTENT.prefab b/AxibugEmuOnline.Client/Assets/Resources/IMPORTENT.prefab index 89847668..e5815a63 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/IMPORTENT.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/IMPORTENT.prefab @@ -736,6 +736,34 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: -5 objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 734174642832146072, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab index 11326206..d539bc20 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab @@ -175,10 +175,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 4232056520494431727} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &377334483991090399 CanvasRenderer: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab index 30f2e593..87e53efb 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab @@ -826,6 +826,7 @@ RectTransform: m_Children: - {fileID: 6503369113137645357} - {fileID: 1714682891259844147} + - {fileID: 366056510674839125} - {fileID: 4264754383554125665} m_Father: {fileID: 4478785627166277610} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -875,6 +876,103 @@ MonoBehaviour: m_MenuNameTxt: {fileID: 1824253632728291860} m_Icon: {fileID: 394891843266770919} ExpandFlag: {fileID: 1501213187178026014} + ApplyFlag: {fileID: 3335801350916860509} +--- !u!1 &3335801350916860509 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 366056510674839125} + - component: {fileID: 8134207541370216537} + - component: {fileID: 9115911462236684960} + - component: {fileID: 630275888015180765} + m_Layer: 5 + m_Name: ApplyFlag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &366056510674839125 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3335801350916860509} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2780569438310375802} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8134207541370216537 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3335801350916860509} + m_CullTransparentMesh: 1 +--- !u!114 &9115911462236684960 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3335801350916860509} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: eba3f71cfd582184cb08d7a56e6428d2, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &630275888015180765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3335801350916860509} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 30 + m_PreferredHeight: 30 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &4124172888520656882 GameObject: m_ObjectHideFlags: 0 @@ -1126,7 +1224,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.25} m_AnchorMax: {x: 1, y: 0.75} - m_AnchoredPosition: {x: -5.0000153, y: 0} + m_AnchoredPosition: {x: -5, y: 0} m_SizeDelta: {x: -20, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &5174902406667317058 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs index d02cca7a..47c23e13 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs @@ -176,7 +176,8 @@ namespace AxibugEmuOnline.Client if (filter != null) { string presetName = value.Item2; - preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); + if (presetName == filter.DefaultPreset.Name) preset = filter.DefaultPreset; + else preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); } return new GetFilterSetting_result() 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 90347fb0..31bd1d14 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI_FilterSetting.cs @@ -5,7 +5,7 @@ using static AxibugEmuOnline.Client.FilterManager; namespace AxibugEmuOnline.Client { - public class InGameUI_FilterSetting : ExpandMenu + public class InGameUI_FilterSetting : ExpandMenu { private InGameUI m_gameUI; @@ -26,15 +26,17 @@ namespace AxibugEmuOnline.Client { private RomFile m_rom; + public override bool IsApplied => App.settings.Filter.GetFilterSetting(m_rom).filter == null; public FilterNone(RomFile rom) : base("取消滤镜", null) { m_rom = rom; + + var currentFilterSetting = App.settings.Filter.GetFilterSetting(m_rom); } public override void OnExcute(OptionUI optionUI, ref bool cancelHide) { App.settings.Filter.ShutDownFilter(); - App.settings.Filter.SetupFilter(m_rom, null, null); } } @@ -44,6 +46,19 @@ namespace AxibugEmuOnline.Client private Filter m_filter; private List m_presetsMenuItems; + public override bool IsApplied + { + get + { + foreach (FilterPresetMenu preset in m_presetsMenuItems) + { + if (preset.IsApplied) return true; + } + + return false; + } + } + public FilterMenu(RomFile rom, Filter filter) : base(filter.Name, null) { m_filter = filter; @@ -63,6 +78,16 @@ namespace AxibugEmuOnline.Client private RomFile m_rom; private Filter m_filter; + public override bool IsApplied + { + get + { + var setting = App.settings.Filter.GetFilterSetting(m_rom); + return setting.filter == m_filter && setting.preset == m_preset; + } + } + + public FilterPresetMenu(RomFile rom, Filter filter, FilterPreset preset) : base(preset.Name, null) { m_preset = preset; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs index b4399722..4de0cb41 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs @@ -270,17 +270,17 @@ namespace AxibugEmuOnline.Client private void CreateRuntimeMenuItem(OptionMenu menuData) { if (menuData is ExecuteMenu) - { - ExecuteMenu executeMenu = (ExecuteMenu)menuData; - var menuUI = Instantiate(TEMPLATE_EXECUTEITEM.gameObject, TEMPLATE_EXECUTEITEM.transform.parent).GetComponent(); + { + ExecuteMenu executeMenu = (ExecuteMenu)menuData; + var menuUI = Instantiate(TEMPLATE_EXECUTEITEM.gameObject, TEMPLATE_EXECUTEITEM.transform.parent).GetComponent(); menuUI.gameObject.SetActive(true); menuUI.SetData(this, executeMenu); m_runtimeMenuItems.Add(menuUI); } else if (menuData is ValueSetMenu) { - var valueSetMenu = (ValueSetMenu)menuData; - var menuUI = Instantiate(TEMPLATE_VALUEEDITITEM.gameObject, TEMPLATE_VALUEEDITITEM.transform.parent).GetComponent(); + var valueSetMenu = (ValueSetMenu)menuData; + var menuUI = Instantiate(TEMPLATE_VALUEEDITITEM.gameObject, TEMPLATE_VALUEEDITITEM.transform.parent).GetComponent(); menuUI.gameObject.SetActive(true); menuUI.SetData(this, valueSetMenu); m_runtimeMenuItems.Add(menuUI); @@ -384,13 +384,15 @@ namespace AxibugEmuOnline.Client /// public abstract class ExecuteMenu : OptionMenu { + /// 设置这个值以控制菜单中显示"已应用"标记 + public virtual bool IsApplied { get; } protected ExecuteMenu(string name, Sprite icon = null) : base(name, icon) { } public abstract void OnExcute(OptionUI optionUI, ref bool cancelHide); } /// - /// 带有展开行为的菜单 + /// 带有展开行为的可执行菜单 /// public abstract class ExpandMenu : ExecuteMenu { @@ -403,6 +405,19 @@ namespace AxibugEmuOnline.Client } protected abstract List GetOptionMenus(); + } + /// + /// 带有值类型显示和编辑的菜单 + /// + public abstract class ValueSetMenu : OptionMenu + { + protected ValueSetMenu(string name) : base(name) { } + + public abstract Type ValueType { get; } + public abstract object ValueRaw { get; } + public abstract void OnValueChanged(object newValue); + public abstract object Min { get; } + public abstract object Max { get; } } /// 不要直接继承这个类 @@ -423,17 +438,5 @@ namespace AxibugEmuOnline.Client public virtual void OnShow(OptionUI_MenuItem ui) { } public virtual void OnHide() { } } - /// - /// 带有值类型显示和编辑的菜单 - /// - public abstract class ValueSetMenu : OptionMenu - { - protected ValueSetMenu(string name) : base(name) { } - public abstract Type ValueType { get; } - public abstract object ValueRaw { get; } - public abstract void OnValueChanged(object newValue); - public abstract object Min { get; } - public abstract object Max { get; } - } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_ExecuteItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_ExecuteItem.cs index bc92bb61..8228f985 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_ExecuteItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_ExecuteItem.cs @@ -1,21 +1,28 @@ -using UnityEngine; +using UnityEngine; namespace AxibugEmuOnline.Client { public class OptionUI_ExecuteItem : OptionUI_MenuItem { public GameObject ExpandFlag; + public GameObject ApplyFlag; protected override void OnSetData(OptionMenu menuData) { base.OnSetData(menuData); ExpandFlag.SetActiveEx(IsExpandMenu); + ApplyFlag.SetActiveEx(IsApplied); } public override void OnExecute(OptionUI optionUI, ref bool cancelHide) { MenuData.OnExcute(optionUI, ref cancelHide); } + + protected override void Update() + { + ApplyFlag.SetActiveEx(IsApplied); + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_MenuItem.cs index 09256466..b492a171 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI_MenuItem.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using UnityEngine.UI; namespace AxibugEmuOnline.Client @@ -31,6 +31,7 @@ namespace AxibugEmuOnline.Client } public bool IsExpandMenu => m_Menu is ExpandMenu; + public bool IsApplied => m_Menu is ExecuteMenu om && om.IsApplied; protected abstract void OnSetData(OptionMenu menuData); @@ -39,6 +40,7 @@ namespace AxibugEmuOnline.Client public virtual void OnRight() { } public abstract void OnFocus(); public virtual void OnHide() { } + protected virtual void Update() { } } public abstract class OptionUI_MenuItem : OptionUI_MenuItem diff --git a/AxibugEmuOnline.Client/ProjectSettings/ProjectSettings.asset b/AxibugEmuOnline.Client/ProjectSettings/ProjectSettings.asset index 1a1165fd..799f3ae3 100644 --- a/AxibugEmuOnline.Client/ProjectSettings/ProjectSettings.asset +++ b/AxibugEmuOnline.Client/ProjectSettings/ProjectSettings.asset @@ -47,7 +47,7 @@ PlayerSettings: defaultScreenWidthWeb: 960 defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 - m_ActiveColorSpace: 1 + m_ActiveColorSpace: 0 unsupportedMSAAFallback: 0 m_SpriteBatchMaxVertexCount: 65535 m_SpriteBatchVertexThreshold: 300