1.进步优化UI系统 加载问题 性能问题 Canvas重绘问题 边界处理问题 2.优化对象池和游戏对象池的性能 游戏对象池根据窗口 策略定期清理 3.优化整个AppService 和ServiceWorld结构 固定三大类 具体参考代码
72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
using System;
|
|
using AlicizaX.Debugger.Runtime;
|
|
using AlicizaX.Localization.Runtime;
|
|
using AlicizaX.Resource.Runtime;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace AlicizaX
|
|
{
|
|
public class ModuleDynamicBind : MonoBehaviour
|
|
{
|
|
[SerializeField] private ResourceComponent resourceComponent;
|
|
[SerializeField] private DebuggerComponent debuggerComponent;
|
|
[SerializeField] private LocalizationComponent localizationComponent;
|
|
private ModuleDynamicBindInfo _dynamicBindInfo;
|
|
|
|
private void OnValidate()
|
|
{
|
|
resourceComponent = GetComponentInChildren<ResourceComponent>();
|
|
debuggerComponent = GetComponentInChildren<DebuggerComponent>();
|
|
localizationComponent = GetComponentInChildren<LocalizationComponent>();
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (Application.isEditor) return;
|
|
TextAsset text = null;
|
|
if (AppServices.TryGet<IResourceService>(out var resourceService))
|
|
{
|
|
text = resourceService.LoadAsset<TextAsset>("ModuleDynamicBindInfo");
|
|
}
|
|
|
|
if (text == null)
|
|
{
|
|
text = Resources.Load<TextAsset>("ModuleDynamicBindInfo");
|
|
}
|
|
|
|
if (text == null)
|
|
{
|
|
Log.Warning("ModuleDynamicBindInfo not found.");
|
|
return;
|
|
}
|
|
|
|
_dynamicBindInfo = Utility.Json.ToObject<ModuleDynamicBindInfo>(text.text);
|
|
|
|
if (resourceComponent != null)
|
|
{
|
|
resourceComponent.SetPlayMode(_dynamicBindInfo.ResMode);
|
|
resourceComponent.SetDecryptionServices(_dynamicBindInfo.DecryptionServices);
|
|
}
|
|
|
|
if (debuggerComponent != null)
|
|
{
|
|
debuggerComponent.SetActiveMode(_dynamicBindInfo.DebuggerActiveWindowType);
|
|
}
|
|
|
|
if (localizationComponent != null)
|
|
{
|
|
localizationComponent.SetLanguage(_dynamicBindInfo.Language);
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct ModuleDynamicBindInfo
|
|
{
|
|
public DebuggerActiveWindowType DebuggerActiveWindowType;
|
|
public int ResMode;
|
|
public string Language;
|
|
public string DecryptionServices;
|
|
}
|
|
}
|