diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs new file mode 100644 index 0000000..4197be4 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs @@ -0,0 +1,63 @@ +using AxibugEmuOnline.Client.ClientCore; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using static AxibugEmuOnline.Client.FilterManager; + +namespace AxibugEmuOnline.Client +{ + public class InGameUI_FilterSetting : ExpandMenu + { + private InGameUI m_gameUI; + + public InGameUI_FilterSetting(InGameUI gameUI) : base("ΒΛΎ΅", null) + { + m_gameUI = gameUI; + } + + protected override List GetOptionMenus() + { + return App.filter.Filters.Select(f => new FilterMenu(m_gameUI.RomFile, f) as OptionMenu).ToList(); + } + + public class FilterMenu : ExpandMenu + { + private Filter m_filter; + private List m_presetsMenuItems; + + public FilterMenu(RomFile rom, Filter filter) : base(filter.Name, null) + { + m_filter = filter; + m_presetsMenuItems = new List { new FilterPresetMenu(rom, m_filter, m_filter.DefaultPreset) }; + m_presetsMenuItems.AddRange(m_filter.Presets.Select(preset => new FilterPresetMenu(rom, m_filter, preset))); + } + + protected override List GetOptionMenus() + { + return m_presetsMenuItems; + } + } + + public class FilterPresetMenu : ExecuteMenu + { + private FilterPreset m_preset; + private RomFile m_rom; + private Filter m_filter; + + public FilterPresetMenu(RomFile rom, Filter filter, FilterPreset preset) : base(preset.Name, null) + { + m_preset = preset; + m_rom = rom; + m_filter = filter; + } + + public override void OnExcute(OptionUI optionUI, ref bool cancelHide) + { + m_filter.ApplyPreset(m_preset); + App.filter.EnableFilter(m_filter); + + App.filter.SetupFilter(m_rom, m_filter, m_preset); + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs.meta new file mode 100644 index 0000000..3b91ead --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_FilterSetting.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b6c80949e93f37f42a1af843fa9d77fa \ No newline at end of file