干掉管理层逻辑GC

This commit is contained in:
sin365 2025-09-17 10:17:55 +08:00
parent acf1071ea2
commit 81ec8e4879
5 changed files with 31 additions and 15 deletions

View File

@ -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
/// <param name="filter"></param>
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;
}

View File

@ -285,7 +285,7 @@ public abstract class EmuCoreBinder<T> : InternalEmuCoreBinder,
}
private List<InputControl_C> m_caches = new List<InputControl_C>();
public IEnumerable<InputControl_C> GetBinding(T emuBtn)
public List<InputControl_C> GetBinding(T emuBtn)
{
m_caches.Clear();

View File

@ -1,4 +1,5 @@
using AxibugProtobuf;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@ -9,13 +10,25 @@ namespace AxibugEmuOnline.Client.Settings
/// </summary>
public class ScreenScaler
{
string key_GlobalMode = nameof(ScreenScaler) + ".GlobalMode";
Dictionary<RomPlatformType, string> cache_PlatMode = new Dictionary<RomPlatformType, string>();
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;
}
/// <summary>
/// 全局设置的缩放模式
/// </summary>
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);
}
/// <summary>
@ -25,7 +38,7 @@ namespace AxibugEmuOnline.Client.Settings
/// <returns></returns>
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);
}
/// <summary>

View File

@ -52,7 +52,7 @@ namespace AxibugEmuOnline.Client.InputDevices
/// 获得所有当前已连入的输入设备
/// </summary>
/// <returns></returns>
public IEnumerable<InputDevice_D> GetDevices()
public List<InputDevice_D> GetDevices()
{
m_devicesResultCache.Clear();
m_devicesResultCache.AddRange(m_devices.Values);

View File

@ -19,7 +19,7 @@ namespace AxibugEmuOnline.Client
m_checkCmds = Enum.GetValues(typeof(EnumCommand)) as EnumCommand[];
}
IEnumerable<CommandState> GetCommand()
List<CommandState> GetCommand()
{
if (CheckFrame == Time.frameCount)
return m_commands;
@ -39,7 +39,7 @@ namespace AxibugEmuOnline.Client
return m_commands;
}
public void Update(IEnumerable<CommandExecuter> executers)
public void Update(List<CommandExecuter> executers)
{
foreach (var cmd in GetCommand())
{