mod:优化处理方式;
目前逻辑为: UI在面板上跟物体进行深度绑定,但是UI通过工厂进行创建; 场景物体在面板上跟物体进行深度绑定,但是场景物体通过工厂进行创建;pull/1/head
parent
958d5d48aa
commit
31e77ef272
|
@ -1 +1 @@
|
||||||
{"ChildData":[{"Title":"大众","Type":0,"parent":null,"ChildData":[{"Title":"宝来","Type":0,"parent":null,"ChildData":[]},{"Title":"帕沙特","Type":0,"parent":null,"ChildData":[]}]},{"Title":"长安","Type":0,"parent":null,"ChildData":[{"Title":"cs35","Type":0,"parent":null,"ChildData":[]},{"Title":"cs55","Type":0,"parent":null,"ChildData":[]},{"Title":"cs75","Type":0,"parent":null,"ChildData":[]}]},{"Title":"吉利","Type":0,"parent":null,"ChildData":[{"Title":"星瑞","Type":0,"parent":null,"ChildData":[]},{"Title":"几何","Type":0,"parent":null,"ChildData":[]}]}],"name":"","hideFlags":0}
|
{"ChildData":[{"Title":"1.精神的撒打发打发","Type":0,"parent":null,"ChildData":[{"Title":"1.1.阿飞的方式方法","Type":0,"parent":null,"ChildData":[{"Title":"1.2.发的是凤飞飞","Type":0,"parent":null,"ChildData":[]}]}]},{"Title":"2.非官方的个人各方","Type":0,"parent":null,"ChildData":[{"Title":"2.1.丰富和提高提高电网","Type":0,"parent":null,"ChildData":[]},{"Title":"2.2.供热公司v的方法去外地","Type":0,"parent":null,"ChildData":[]},{"Title":"2.3.稳定个人观点v分","Type":0,"parent":null,"ChildData":[]},{"Title":"2.4.如果人工投入股市大幅","Type":0,"parent":null,"ChildData":[]}]},{"Title":"3.Greg突然感到十分发","Type":0,"parent":null,"ChildData":[{"Title":"3.1.而该人士对此娃娃","Type":0,"parent":null,"ChildData":[]},{"Title":"3.2.更高尚的人格力量地方","Type":0,"parent":null,"ChildData":[]},{"Title":"3.3.供电公司对方的身份","Type":0,"parent":null,"ChildData":[]},{"Title":"3.4.官方山豆根士大夫","Type":0,"parent":null,"ChildData":[]}]}]}
|
|
@ -3,13 +3,14 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace ZC
|
namespace ZC
|
||||||
{
|
{
|
||||||
public class GameObjectBase<T> : MonoBehaviour, IBehaviour //, ICreateBindingGo
|
public class GameObjectBase<T> : MonoBehaviour, IBehaviour
|
||||||
{
|
{
|
||||||
private GameObject _go;
|
private long _id = 0;
|
||||||
private long _id;
|
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
private bool _isPause;
|
private bool _isPause;
|
||||||
public GameObject go => this._go;
|
GameObjectBinding _binding;
|
||||||
|
|
||||||
|
public GameObjectBinding binding => _binding;
|
||||||
|
|
||||||
public long Id => this._id;
|
public long Id => this._id;
|
||||||
|
|
||||||
|
@ -17,20 +18,19 @@ namespace ZC
|
||||||
|
|
||||||
public bool isPause => this._isPause;
|
public bool isPause => this._isPause;
|
||||||
|
|
||||||
#region mono
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
_binding = gameObject.GetComponent<GameObjectBinding>();
|
||||||
OnInit();
|
OnInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
public void SetID(long id)
|
||||||
{
|
{
|
||||||
OnDispose();
|
if (_id != 0)
|
||||||
|
throw new ArgumentException("id 不允许二次修改,一次固定的!");
|
||||||
|
_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public virtual void OnInit()
|
public virtual void OnInit()
|
||||||
{
|
{
|
||||||
this._isDisposed = false;
|
this._isDisposed = false;
|
||||||
|
@ -54,6 +54,7 @@ namespace ZC
|
||||||
public virtual void OnDispose()
|
public virtual void OnDispose()
|
||||||
{
|
{
|
||||||
this._isDisposed = true;
|
this._isDisposed = true;
|
||||||
|
DestroyImmediate(this.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,43 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Unity.Loader;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ZC
|
namespace ZC
|
||||||
{
|
{
|
||||||
public static class GameObjectFactory
|
public static class GameObjectFactory
|
||||||
{
|
{
|
||||||
// public static T Create<T>(GameObject go = null) where T : GameObjectBase
|
private static Transform parent;
|
||||||
// {
|
|
||||||
// var t = new T();
|
public static T CreateGameObject<T>(string path) where T : GameObjectBase<T>
|
||||||
// var id = t.GetHashCode();
|
{
|
||||||
//
|
var go = ResourcesLocalComponent.Instance.LoadGameObjectSync(path);
|
||||||
// t.OnInit();
|
if (parent == null)
|
||||||
// ZCGame.ObjectManager.Add(t);
|
parent = Global.ObjectPool;
|
||||||
// return t;
|
go.transform.SetParent(parent);
|
||||||
// }
|
var objectBase = go.AddComponent<T>();
|
||||||
|
objectBase.SetID(IDGenerator.Generate());
|
||||||
|
Global.ObjectManager.Add(objectBase);
|
||||||
|
return objectBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteGameObject(long id)
|
||||||
|
{
|
||||||
|
Global.ObjectManager.Remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class UIGameObjectFactory
|
||||||
|
{
|
||||||
|
private static Transform parent;
|
||||||
|
|
||||||
|
public static T CreateUI<T>(UIType uiType, string path, UILayer uiLayer) where T : UIBase
|
||||||
|
{
|
||||||
|
return Global.UIManager.CreateUI<T>(uiType, path, uiLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteUI(UIType uiType)
|
||||||
|
{
|
||||||
|
Global.UIManager.DeleteUI(uiType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,11 @@ namespace ZC
|
||||||
private static readonly long twepoch = 1288834974657L; // Twitter Snowflake算法中的自定义起始时间
|
private static readonly long twepoch = 1288834974657L; // Twitter Snowflake算法中的自定义起始时间
|
||||||
private static readonly long machineId = 1L; // 机器码,可以自定义
|
private static readonly long machineId = 1L; // 机器码,可以自定义
|
||||||
|
|
||||||
|
static object o = new object();
|
||||||
|
|
||||||
public static long Generate()
|
public static long Generate()
|
||||||
|
{
|
||||||
|
lock (o)
|
||||||
{
|
{
|
||||||
long timestamp = TimeGen();
|
long timestamp = TimeGen();
|
||||||
|
|
||||||
|
@ -34,6 +38,7 @@ namespace ZC
|
||||||
|
|
||||||
return (timestamp - twepoch) << 22 | machineId << 12 | sequence;
|
return (timestamp - twepoch) << 22 | machineId << 12 | sequence;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static long TilNextMillis(long lastTimestamp)
|
private static long TilNextMillis(long lastTimestamp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace ZC
|
||||||
public interface ICreateBindingGo
|
public interface ICreateBindingGo
|
||||||
{
|
{
|
||||||
GameObject go { get; }
|
GameObject go { get; }
|
||||||
|
GameObjectBinding binding { get; }
|
||||||
void SetGo(GameObject go);
|
void SetGo(GameObject go);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,39 @@ namespace ZC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
internal abstract class ManagerBase<T> : GameObjectBase<T>, IManager
|
internal abstract class ManagerBase<T> : IBehaviour, IManager
|
||||||
{
|
{
|
||||||
|
private long _id = IDGenerator.Generate();
|
||||||
|
private bool _isDisposed = false;
|
||||||
|
private bool _isPause = false;
|
||||||
|
|
||||||
|
public long Id => this._id;
|
||||||
|
|
||||||
|
public bool isDisposed => this._isDisposed;
|
||||||
|
|
||||||
|
public bool isPause => this._isPause;
|
||||||
|
|
||||||
|
public virtual void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnUpdate(float dateTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnPause()
|
||||||
|
{
|
||||||
|
this._isPause = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResume()
|
||||||
|
{
|
||||||
|
this._isPause = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnDispose()
|
||||||
|
{
|
||||||
|
this._isDisposed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,12 +13,11 @@ namespace ZC
|
||||||
{
|
{
|
||||||
base.OnInit();
|
base.OnInit();
|
||||||
|
|
||||||
// string filePath = $"{Application.dataPath}/DemoGame/GameRes/Config/TaskListData.json";
|
string filePath = $"{Application.dataPath}/DemoGame/GameRes/Config/TaskListData.json";
|
||||||
// var textAsset = ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(AssetConst.Assets_DemoGame_GameRes_UIPanel_UIBattle_prefab);
|
var textAsset = ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(filePath);
|
||||||
// // var json = File.ReadAllText(textAsset.text);
|
var datas = JsonConvert.DeserializeObject<TaskListDatas>(textAsset.text);
|
||||||
// var datas = JsonConvert.DeserializeObject<TaskListDatas>(textAsset.text);
|
_datas = datas;
|
||||||
// _datas = datas;
|
_datas.Init();
|
||||||
// _datas.Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState(string title, TaskListType type)
|
public void SetState(string title, TaskListType type)
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace ZC
|
||||||
[Procedure(ProcedureType.LoadingGameSceneProcedure)]
|
[Procedure(ProcedureType.LoadingGameSceneProcedure)]
|
||||||
class LoadingGameSceneProcedure : ProcedureBase
|
class LoadingGameSceneProcedure : ProcedureBase
|
||||||
{
|
{
|
||||||
|
private TestZhongLi _testZhongLi;
|
||||||
|
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
base.OnEnter();
|
base.OnEnter();
|
||||||
|
@ -14,14 +16,32 @@ namespace ZC
|
||||||
UniTask.Create(async () =>
|
UniTask.Create(async () =>
|
||||||
{
|
{
|
||||||
// await ResourcesLocalComponent.Instance.LoadSceneAsync(AssetConst.Assets_DemoGame_GameRes_Scene_Game_unity);
|
// await ResourcesLocalComponent.Instance.LoadSceneAsync(AssetConst.Assets_DemoGame_GameRes_Scene_Game_unity);
|
||||||
var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetConst.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
// var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetConst.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||||
Debug.Log("加载的是:" + loadAssetAsync);
|
// Debug.Log("加载的是:" + loadAssetAsync);
|
||||||
|
_testZhongLi = GameObjectFactory.CreateGameObject<TestZhongLi>(AssetConst
|
||||||
|
.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||||
// ZCGame.ProcedureManager.ChangeProcedure(ProcedureType.GameSceneLogicProcedure);
|
// ZCGame.ProcedureManager.ChangeProcedure(ProcedureType.GameSceneLogicProcedure);
|
||||||
|
|
||||||
Global.UIManager.CreateUI(UIType.MainUI, AssetConst.Assets_DemoGame_GameRes_UIPanel_UIMain_prefab, UILayer.High);
|
UIGameObjectFactory.CreateUI<MainUI>(UIType.MainUI,
|
||||||
|
AssetConst.Assets_DemoGame_GameRes_UIPanel_UIMain_prefab, UILayer.High);
|
||||||
}).Forget();
|
}).Forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnUpdate(float dateTime)
|
||||||
|
{
|
||||||
|
base.OnUpdate(dateTime);
|
||||||
|
if (Input.GetKeyDown(KeyCode.A))
|
||||||
|
{
|
||||||
|
GameObjectFactory.DeleteGameObject(_testZhongLi.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.W))
|
||||||
|
{
|
||||||
|
_testZhongLi = GameObjectFactory.CreateGameObject<TestZhongLi>(AssetConst
|
||||||
|
.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnLeave()
|
public override void OnLeave()
|
||||||
{
|
{
|
||||||
base.OnLeave();
|
base.OnLeave();
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace ZC
|
||||||
{
|
{
|
||||||
private Dictionary<ProcedureType, IProcedure> _procedures = new Dictionary<ProcedureType, IProcedure>();
|
private Dictionary<ProcedureType, IProcedure> _procedures = new Dictionary<ProcedureType, IProcedure>();
|
||||||
private IProcedure currentProcedure;
|
private IProcedure currentProcedure;
|
||||||
|
public ProcedureType CurrentProcedureType => currentProcedure.procedureType;
|
||||||
|
|
||||||
public override void OnInit()
|
public override void OnInit()
|
||||||
{
|
{
|
||||||
|
@ -94,6 +95,5 @@ namespace ZC
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,7 +29,8 @@ namespace ZC
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
instance = new ResourcesLocalComponent();
|
throw new NullReferenceException();
|
||||||
|
// instance = new ResourcesLocalComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -45,6 +46,8 @@ namespace ZC
|
||||||
|
|
||||||
public ResourcesLocalComponent()
|
public ResourcesLocalComponent()
|
||||||
{
|
{
|
||||||
|
instance = this;
|
||||||
|
|
||||||
resourcePackage = YooAssets.GetPackage("DefaultPackage");
|
resourcePackage = YooAssets.GetPackage("DefaultPackage");
|
||||||
var transform = Global.Self.transform;
|
var transform = Global.Self.transform;
|
||||||
|
|
||||||
|
@ -132,7 +135,8 @@ namespace ZC
|
||||||
return loadAssetAsync.AssetObject;
|
return loadAssetAsync.AssetObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask<GameObject> LoadAssetAndInsAsync(string location, Transform parent = null, uint priority = 0)
|
public async UniTask<GameObject> LoadAssetAndInsAsync(string location, Transform parent = null,
|
||||||
|
uint priority = 0)
|
||||||
{
|
{
|
||||||
var loadAssetAsync = YooAssets.LoadAssetAsync(location, priority);
|
var loadAssetAsync = YooAssets.LoadAssetAsync(location, priority);
|
||||||
while (!loadAssetAsync.IsDone)
|
while (!loadAssetAsync.IsDone)
|
||||||
|
@ -146,7 +150,8 @@ namespace ZC
|
||||||
return instantiateOperation.Result;
|
return instantiateOperation.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 100U, Action<float> callback = null)
|
public async UniTask LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single,
|
||||||
|
bool suspendLoad = false, uint priority = 100U, Action<float> callback = null)
|
||||||
{
|
{
|
||||||
var loadAssetAsync = YooAssets.LoadSceneAsync(location, sceneMode, suspendLoad, priority);
|
var loadAssetAsync = YooAssets.LoadSceneAsync(location, sceneMode, suspendLoad, priority);
|
||||||
while (!loadAssetAsync.IsDone)
|
while (!loadAssetAsync.IsDone)
|
||||||
|
|
|
@ -12,19 +12,20 @@ namespace ZC
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (SystemInfo.supportsGyroscope)
|
transform.Rotate(Vector3.up);
|
||||||
{
|
// if (SystemInfo.supportsGyroscope)
|
||||||
var gyro = Input.gyro;
|
// {
|
||||||
gyro.enabled = true;
|
// var gyro = Input.gyro;
|
||||||
Debug.Log($"{gyro.rotationRate} , {gyro.attitude}");
|
// gyro.enabled = true;
|
||||||
// Camera.main.transform.Rotate(gyro.rotationRate);
|
// Debug.Log($"{gyro.rotationRate} , {gyro.attitude}");
|
||||||
Camera.main.transform.rotation = gyro.attitude;
|
// // Camera.main.transform.Rotate(gyro.rotationRate);
|
||||||
Debug.Log($"raw: {Input.compass.rawVector}");
|
// Camera.main.transform.rotation = gyro.attitude;
|
||||||
}
|
// Debug.Log($"raw: {Input.compass.rawVector}");
|
||||||
else
|
// }
|
||||||
{
|
// else
|
||||||
// Debug.Log("没找到?");
|
// {
|
||||||
}
|
// // Debug.Log("没找到?");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ namespace ZC
|
||||||
public interface IUIManager
|
public interface IUIManager
|
||||||
{
|
{
|
||||||
TMP_FontAsset font { get; set; }
|
TMP_FontAsset font { get; set; }
|
||||||
IUI CreateUI(UIType uiType, string path, UILayer uiLayer);
|
T CreateUI<T>(UIType uiType, string path, UILayer uiLayer) where T : UIBase;
|
||||||
|
void DeleteUI(UIType uiType);
|
||||||
|
|
||||||
IUI ShowUI(UIType uiType);
|
IUI ShowUI(UIType uiType);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace ZC
|
||||||
|
|
||||||
public abstract class UIBase : MonoBehaviour, IUI
|
public abstract class UIBase : MonoBehaviour, IUI
|
||||||
{
|
{
|
||||||
private bool _isPause;
|
private bool _isPause = true;
|
||||||
private bool _isActive;
|
private bool _isActive = false;
|
||||||
private CanvasGroup _group;
|
private CanvasGroup _group;
|
||||||
|
|
||||||
public bool isPause => _isPause;
|
public bool isPause => _isPause;
|
||||||
|
@ -31,15 +31,11 @@ namespace ZC
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_isPause = true;
|
|
||||||
_isActive = false;
|
|
||||||
_uiGameObjectBinding = GetComponent<GameObjectBinding>();
|
_uiGameObjectBinding = GetComponent<GameObjectBinding>();
|
||||||
Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -86,6 +82,7 @@ namespace ZC
|
||||||
{
|
{
|
||||||
_isActive = false;
|
_isActive = false;
|
||||||
_isPause = true;
|
_isPause = true;
|
||||||
|
DestroyImmediate(this.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,32 +52,28 @@ namespace ZC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IUI CreateUI(UIType uiType, string path, UILayer uiLayer)
|
public T CreateUI<T>(UIType uiType, string path, UILayer uiLayer) where T : UIBase
|
||||||
{
|
{
|
||||||
var gameObject = ResourcesLocalComponent.Instance.LoadUIGameObjectSync(path, uiLayer);
|
var gameObject = ResourcesLocalComponent.Instance.LoadUIGameObjectSync(path, uiLayer);
|
||||||
|
var uiBase = gameObject.AddComponent<T>();
|
||||||
// if (!this._types.TryGetValue(uiType, out var type))
|
|
||||||
// {
|
|
||||||
// throw new InvalidOperationException();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (Activator.CreateInstance(type, false) is not UIBase ui)
|
|
||||||
// throw new NullReferenceException();
|
|
||||||
// ui.SetGameObject(gameObject);
|
|
||||||
var uiBase = gameObject.GetComponent<UIBase>();
|
|
||||||
uiBase.Init();
|
uiBase.Init();
|
||||||
uiBase.Close();
|
uiBase.Close();
|
||||||
_uiDic.Add(uiType, uiBase);
|
_uiDic.Add(uiType, uiBase);
|
||||||
|
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// view
|
|
||||||
// var addComponent = gameObject.GetComponent<UIInfo>();
|
|
||||||
// addComponent.SetStart(ui, this.font);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
return uiBase;
|
return uiBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteUI(UIType uiType)
|
||||||
|
{
|
||||||
|
if (_uiDic.TryGetValue(uiType, out var ui))
|
||||||
|
{
|
||||||
|
ui.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NullReferenceException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IUI ShowUI(UIType uiType)
|
public IUI ShowUI(UIType uiType)
|
||||||
{
|
{
|
||||||
if (_uiDic.TryGetValue(uiType, out var ui))
|
if (_uiDic.TryGetValue(uiType, out var ui))
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace Unity.Loader
|
||||||
{
|
{
|
||||||
public class Global : MonoBehaviour
|
public class Global : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private static Global _global;
|
||||||
|
|
||||||
private InitializePackage _initializePackage;
|
private InitializePackage _initializePackage;
|
||||||
|
|
||||||
[SerializeField] EPlayMode playMode;
|
[SerializeField] EPlayMode playMode;
|
||||||
|
@ -26,12 +28,13 @@ namespace Unity.Loader
|
||||||
private Transform _objectPool;
|
private Transform _objectPool;
|
||||||
private bool isDisposed;
|
private bool isDisposed;
|
||||||
private bool isPause;
|
private bool isPause;
|
||||||
|
private bool _isInitFinish;
|
||||||
private float gameTime;
|
private float gameTime;
|
||||||
|
|
||||||
public static Global _global;
|
|
||||||
|
|
||||||
private UIManager _uiManager;
|
private UIManager _uiManager;
|
||||||
private ProcedureManager _procedureManager;
|
private ProcedureManager _procedureManager;
|
||||||
|
private ObjectManager _objectManager;
|
||||||
private ResourcesLocalComponent _resourcesLocalComponent;
|
private ResourcesLocalComponent _resourcesLocalComponent;
|
||||||
|
|
||||||
public static Transform Self => _global.transform;
|
public static Transform Self => _global.transform;
|
||||||
|
@ -39,8 +42,13 @@ namespace Unity.Loader
|
||||||
public static float GameTime => _global.gameTime;
|
public static float GameTime => _global.gameTime;
|
||||||
public static IUIManager UIManager => _global._uiManager;
|
public static IUIManager UIManager => _global._uiManager;
|
||||||
public static IProcedureManager ProcedureManager => _global._procedureManager;
|
public static IProcedureManager ProcedureManager => _global._procedureManager;
|
||||||
|
public static IObjectManager ObjectManager => _global._objectManager;
|
||||||
public static IResourcesLocalComponent ResourcesLocalComponent => _global._resourcesLocalComponent;
|
public static IResourcesLocalComponent ResourcesLocalComponent => _global._resourcesLocalComponent;
|
||||||
|
|
||||||
|
#region 可视化
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region mono
|
#region mono
|
||||||
|
|
||||||
|
@ -57,11 +65,14 @@ namespace Unity.Loader
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (this.isPause) return;
|
if (!_isInitFinish || this.isPause) return;
|
||||||
|
|
||||||
this.gameTime += Time.fixedTime;
|
this.gameTime += Time.fixedTime;
|
||||||
updateTime?.Invoke(_globalData.runTimeStr);
|
updateTime?.Invoke(_globalData.runTimeStr);
|
||||||
// Debug.Log($"{_globalData.runTimeStr}");
|
|
||||||
|
_procedureManager.OnUpdate(gameTime);
|
||||||
|
// _uiManager.OnUpdate(gameTime);
|
||||||
|
// _objectManager.OnUpdate(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
|
@ -70,6 +81,7 @@ namespace Unity.Loader
|
||||||
_globalData.Dispose();
|
_globalData.Dispose();
|
||||||
_procedureManager.OnDispose();
|
_procedureManager.OnDispose();
|
||||||
_uiManager.OnDispose();
|
_uiManager.OnDispose();
|
||||||
|
_objectManager.OnDispose();
|
||||||
|
|
||||||
_resourcesLocalComponent.Dispose();
|
_resourcesLocalComponent.Dispose();
|
||||||
Debug.Log("关闭应用了");
|
Debug.Log("关闭应用了");
|
||||||
|
@ -89,13 +101,16 @@ namespace Unity.Loader
|
||||||
|
|
||||||
AssemblyManager.Initialize();
|
AssemblyManager.Initialize();
|
||||||
|
|
||||||
|
this._resourcesLocalComponent = new ResourcesLocalComponent();
|
||||||
|
this._objectManager = new ObjectManager();
|
||||||
this._uiManager = new UIManager();
|
this._uiManager = new UIManager();
|
||||||
this._procedureManager = new ProcedureManager();
|
this._procedureManager = new ProcedureManager();
|
||||||
this._resourcesLocalComponent = new ResourcesLocalComponent();
|
|
||||||
|
|
||||||
|
_objectManager.OnInit();
|
||||||
_uiManager.OnInit();
|
_uiManager.OnInit();
|
||||||
_procedureManager.OnInit();
|
_procedureManager.OnInit();
|
||||||
|
|
||||||
|
_isInitFinish = true;
|
||||||
this._procedureManager.ChangeProcedure(ProcedureType.LoadingGameSceneProcedure);
|
this._procedureManager.ChangeProcedure(ProcedureType.LoadingGameSceneProcedure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ RenderSettings:
|
||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 0}
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
|
@ -3264,10 +3265,22 @@ PrefabInstance:
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: IngameDebugConsole
|
value: IngameDebugConsole
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 11414302, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
|
propertyPath: m_Value
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 11452418, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
|
propertyPath: startMinimized
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 11490438, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
- target: {fileID: 11490438, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
propertyPath: m_BlockingMask.m_Bits
|
propertyPath: m_BlockingMask.m_Bits
|
||||||
value: 55
|
value: 55
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 22400762, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -0.000061035156
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
- target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
propertyPath: m_AnchorMax.x
|
propertyPath: m_AnchorMax.x
|
||||||
value: 0
|
value: 0
|
||||||
|
@ -3276,6 +3289,10 @@ PrefabInstance:
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
- target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 0
|
||||||
|
|
Loading…
Reference in New Issue