From 81ec8e4879329f5c96ad7b4d325ef872c42cf72e Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Wed, 17 Sep 2025 10:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E6=8E=89=E7=AE=A1=E7=90=86=E5=B1=82?= =?UTF-8?q?=E9=80=BB=E8=BE=91GC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppSettings/Filter/FilterManager.cs | 15 +++++++----- .../KeyMapperSetting/Model/EmuCoreBinder.cs | 2 +- .../Manager/AppSettings/ScreenScaler.cs | 23 +++++++++++++++---- .../InputResolver/InputResolver.cs | 2 +- .../UI/CommandDispatcher/CommandListener.cs | 4 ++-- 5 files changed, 31 insertions(+), 15 deletions(-) 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 ed60f1df..785d6257 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs @@ -51,7 +51,7 @@ namespace AxibugEmuOnline.Client.Settings { //获得激活的滤镜 Filter activeFilter = null; - foreach (var filter in Filters) + foreach (var filter in m_filters) { if (!filter.m_setting.Enable) continue; activeFilter = filter; @@ -83,13 +83,16 @@ namespace AxibugEmuOnline.Client.Settings renderGraphic.texture = result; } + // 获取 RawImage 在屏幕上的四个顶点的世界坐标 + Vector3[] corners = new Vector3[4]; Vector2 GetRawImageScreenResolution(RawImage rawImage) { // 获取 RawImage 的 RectTransform RectTransform rectTransform = rawImage.rectTransform; - - // 获取 RawImage 在屏幕上的四个顶点的世界坐标 - Vector3[] corners = new Vector3[4]; + for (int i = 0; i < corners.Length; i++) + { + corners[0] = Vector3.zero; + } rectTransform.GetWorldCorners(corners); // 左下角和右上角的屏幕坐标 @@ -124,7 +127,7 @@ namespace AxibugEmuOnline.Client.Settings /// public void EnableFilter(Filter filter) { - foreach (var selfFiler in Filters) + foreach (var selfFiler in m_filters) { if (selfFiler != filter) selfFiler.m_setting.Enable = false; else selfFiler.m_setting.Enable = true; @@ -137,7 +140,7 @@ namespace AxibugEmuOnline.Client.Settings public void ShutDownFilter() { //关闭所有后处理效果 - foreach (var filter in Filters) + foreach (var filter in m_filters) filter.m_setting.Enable = false; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/KeyMapperSetting/Model/EmuCoreBinder.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/KeyMapperSetting/Model/EmuCoreBinder.cs index 669e2756..02f71bf0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/KeyMapperSetting/Model/EmuCoreBinder.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/KeyMapperSetting/Model/EmuCoreBinder.cs @@ -285,7 +285,7 @@ public abstract class EmuCoreBinder : InternalEmuCoreBinder, } private List m_caches = new List(); - public IEnumerable GetBinding(T emuBtn) + public List GetBinding(T emuBtn) { m_caches.Clear(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/ScreenScaler.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/ScreenScaler.cs index b2313c4f..4856a623 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/ScreenScaler.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/ScreenScaler.cs @@ -1,4 +1,5 @@ using AxibugProtobuf; +using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; @@ -9,13 +10,25 @@ namespace AxibugEmuOnline.Client.Settings /// public class ScreenScaler { + string key_GlobalMode = nameof(ScreenScaler) + ".GlobalMode"; + Dictionary cache_PlatMode = new Dictionary(); + string get_key_PlatMode(RomPlatformType platform) { + if (cache_PlatMode.ContainsKey(platform)) + return cache_PlatMode[platform]; + string val = nameof(ScreenScaler)+".PlatMode." + platform; + cache_PlatMode[platform] = val; + return val; + } + /// /// 全局设置的缩放模式 /// public EnumScalerMode GlobalMode { - get => (EnumScalerMode)AxiPlayerPrefs.GetInt($"{nameof(ScreenScaler)}.GlobalMode", 0); - set => AxiPlayerPrefs.SetInt($"{nameof(ScreenScaler)}.GlobalMode", (int)value); + //get => (EnumScalerMode)AxiPlayerPrefs.GetInt($"{nameof(ScreenScaler)}.GlobalMode", 0); + //set => AxiPlayerPrefs.SetInt($"{nameof(ScreenScaler)}.GlobalMode", (int)value); + get => (EnumScalerMode)AxiPlayerPrefs.GetInt(key_GlobalMode, 0); + set => AxiPlayerPrefs.SetInt(key_GlobalMode, (int)value); } /// @@ -25,7 +38,7 @@ namespace AxibugEmuOnline.Client.Settings /// public EnumScalerMode GetMode(RomPlatformType platform) { - int setVal = AxiPlayerPrefs.GetInt($"{nameof(ScreenScaler)}.PlatMode.{platform}", -1); + int setVal = AxiPlayerPrefs.GetInt(get_key_PlatMode(platform), -1); if (setVal == -1) return GlobalMode; else @@ -34,14 +47,14 @@ namespace AxibugEmuOnline.Client.Settings public bool IsSetMode(RomPlatformType platform) { - int setVal = AxiPlayerPrefs.GetInt($"{nameof(ScreenScaler)}.PlatMode.{platform}", -1); + int setVal = AxiPlayerPrefs.GetInt(get_key_PlatMode(platform), -1); return setVal != -1; } public void SetMode(RomPlatformType platform, EnumScalerMode? mode) { int setVal = mode == null ? -1 : (int)mode; - AxiPlayerPrefs.SetInt($"{nameof(ScreenScaler)}.PlatMode.{platform}", setVal); + AxiPlayerPrefs.SetInt(get_key_PlatMode(platform), setVal); } /// diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputResolver.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputResolver.cs index c681bb0a..48cca5a5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputResolver.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputResolver.cs @@ -52,7 +52,7 @@ namespace AxibugEmuOnline.Client.InputDevices /// 获得所有当前已连入的输入设备 /// /// - public IEnumerable GetDevices() + public List GetDevices() { m_devicesResultCache.Clear(); m_devicesResultCache.AddRange(m_devices.Values); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs index aecb1c3f..d71e32b4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs @@ -19,7 +19,7 @@ namespace AxibugEmuOnline.Client m_checkCmds = Enum.GetValues(typeof(EnumCommand)) as EnumCommand[]; } - IEnumerable GetCommand() + List GetCommand() { if (CheckFrame == Time.frameCount) return m_commands; @@ -39,7 +39,7 @@ namespace AxibugEmuOnline.Client return m_commands; } - public void Update(IEnumerable executers) + public void Update(List executers) { foreach (var cmd in GetCommand()) {