mod:结构大改,深度绑定Unity;完成初步改造
parent
0bc9ba4822
commit
958d5d48aa
|
@ -13,6 +13,7 @@ _ReSharper.CSharp/
|
|||
~$*.xlsx.meta
|
||||
|
||||
#Unity相关目录
|
||||
*.sln
|
||||
.gradle
|
||||
Bundles
|
||||
Library
|
||||
|
@ -20,11 +21,10 @@ Logs
|
|||
UserSettings
|
||||
*.csproj
|
||||
*.vsconfig
|
||||
ProjectSettings/RiderScriptEditorPersistedState.asset
|
||||
HybridCLRData
|
||||
Builds
|
||||
ProjectSettings
|
||||
/ProjectSettings
|
||||
Packages
|
||||
|
||||
#Unity/Assets
|
||||
Unity/Assets/DemoGame/GameRes/Codes/
|
||||
|
@ -43,4 +43,3 @@ obj/
|
|||
Temp/
|
||||
yoo
|
||||
/Assets/DemoGame/GameScript/Hotfix/Generate
|
||||
*.sln
|
||||
|
|
|
@ -374,6 +374,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: 2800259146936183769}
|
||||
m_Layer: 5
|
||||
m_Name: UIAnalysisReport
|
||||
m_TagString: Untagged
|
||||
|
@ -462,6 +463,18 @@ MonoBehaviour:
|
|||
go: {fileID: 3629523032732396268}
|
||||
- name: btn_Close
|
||||
go: {fileID: 2697064222727683036}
|
||||
--- !u!114 &2800259146936183769
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bbbe8e7dd2a14e8e883c315c6548fadc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &5317604574928387220
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -259,6 +259,7 @@ GameObject:
|
|||
- component: {fileID: 698078448984834475}
|
||||
- component: {fileID: 668918620521492242}
|
||||
- component: {fileID: 9115275115095225745}
|
||||
- component: {fileID: 2279161542270385328}
|
||||
m_Layer: 5
|
||||
m_Name: UIAnswer
|
||||
m_TagString: Untagged
|
||||
|
@ -372,6 +373,18 @@ MonoBehaviour:
|
|||
go: {fileID: 9202602478924319093}
|
||||
- name: btn_Finish
|
||||
go: {fileID: 5820743778285733619}
|
||||
--- !u!114 &2279161542270385328
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 756482867217720017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6671bdd083df41728c3ff3db6378756f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1024254765518223612
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -500,6 +500,7 @@ GameObject:
|
|||
- component: {fileID: 550302411564123129}
|
||||
- component: {fileID: 291995725713535194}
|
||||
- component: {fileID: -8407002671156803367}
|
||||
- component: {fileID: -9131199328991421552}
|
||||
m_Layer: 5
|
||||
m_Name: UIBasicInformation
|
||||
m_TagString: Untagged
|
||||
|
@ -593,6 +594,18 @@ MonoBehaviour:
|
|||
go: {fileID: 3249870284026512454}
|
||||
- name: txt_Tips
|
||||
go: {fileID: 4912361159165114271}
|
||||
--- !u!114 &-9131199328991421552
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3397518291152337347}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 74f502e15a4a4b7395115b6a9ffcad28, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4001767378608646931
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -146,6 +146,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: -985440187916247387}
|
||||
m_Layer: 5
|
||||
m_Name: UIBigTips
|
||||
m_TagString: Untagged
|
||||
|
@ -228,6 +229,18 @@ MonoBehaviour:
|
|||
Datas:
|
||||
- name: txt_Tips
|
||||
go: {fileID: 3399441290911741623}
|
||||
--- !u!114 &-985440187916247387
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8092e0a6ecd1401bad5f73c247b49aa5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &6714752182229787685
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -87,6 +87,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: -1151308275079064170}
|
||||
m_Layer: 5
|
||||
m_Name: UIBlack
|
||||
m_TagString: Untagged
|
||||
|
@ -175,3 +176,15 @@ MonoBehaviour:
|
|||
go: {fileID: 0}
|
||||
- name: txt_Score
|
||||
go: {fileID: 0}
|
||||
--- !u!114 &-1151308275079064170
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dd9abc3083384dc5a310404193297e5c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
|
|
@ -490,6 +490,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: -4724590772860326454}
|
||||
m_Layer: 5
|
||||
m_Name: UIDialogue
|
||||
m_TagString: Untagged
|
||||
|
@ -576,6 +577,18 @@ MonoBehaviour:
|
|||
go: {fileID: 683421145250387970}
|
||||
- name: btn_Close
|
||||
go: {fileID: 1392729977172397}
|
||||
--- !u!114 &-4724590772860326454
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 47c41230b1874478bbbe83c3db07af2d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &6455988744588681074
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -490,6 +490,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: -1210113770028888665}
|
||||
m_Layer: 5
|
||||
m_Name: UIIntroduce
|
||||
m_TagString: Untagged
|
||||
|
@ -576,6 +577,18 @@ MonoBehaviour:
|
|||
go: {fileID: 683421145250387970}
|
||||
- name: btn_Close
|
||||
go: {fileID: 1392729977172397}
|
||||
--- !u!114 &-1210113770028888665
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: feafec9a827447d589afa0c665de32a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &6455988744588681074
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -166,6 +166,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 248032507418089783}
|
||||
- component: {fileID: -3171479879712486959}
|
||||
m_Layer: 5
|
||||
m_Name: UILoading
|
||||
m_TagString: Untagged
|
||||
|
@ -247,3 +248,15 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Datas: []
|
||||
--- !u!114 &-3171479879712486959
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1d9c1bdf5bce4e559542978292cf76c5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
|
|
@ -427,6 +427,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: 950412098625172911}
|
||||
m_Layer: 5
|
||||
m_Name: UIMain
|
||||
m_TagString: Untagged
|
||||
|
@ -512,12 +513,24 @@ MonoBehaviour:
|
|||
Datas:
|
||||
- name: btn_Start
|
||||
go: {fileID: 5311715019834057590}
|
||||
- name: txt_Score
|
||||
- name: txt_Time
|
||||
go: {fileID: 7341890073962984069}
|
||||
- name: txt_Progress
|
||||
go: {fileID: 2605278743245872664}
|
||||
- name: txt_Score
|
||||
go: {fileID: 5876990461323761607}
|
||||
--- !u!114 &950412098625172911
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa25c2c4db4499db3e86b30518ea692, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4804850453455257046
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -490,6 +490,7 @@ GameObject:
|
|||
- component: {fileID: 4142826567245113225}
|
||||
- component: {fileID: 446002385128238495}
|
||||
- component: {fileID: 8769046888857752082}
|
||||
- component: {fileID: 6551479780972282114}
|
||||
m_Layer: 5
|
||||
m_Name: UIMinTips
|
||||
m_TagString: Untagged
|
||||
|
@ -576,6 +577,18 @@ MonoBehaviour:
|
|||
go: {fileID: 683421145250387970}
|
||||
- name: btn_Close
|
||||
go: {fileID: 1392729977172397}
|
||||
--- !u!114 &6551479780972282114
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4142826567245113227}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f3a6ff210a2c4f5098ef1a728f5021dd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &6455988744588681074
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -500,6 +500,7 @@ GameObject:
|
|||
- component: {fileID: 550302411564123129}
|
||||
- component: {fileID: 291995725713535194}
|
||||
- component: {fileID: -8407002671156803367}
|
||||
- component: {fileID: 6085230108405065134}
|
||||
m_Layer: 5
|
||||
m_Name: UITaskList
|
||||
m_TagString: Untagged
|
||||
|
@ -592,6 +593,18 @@ MonoBehaviour:
|
|||
go: {fileID: 3249870284026512454}
|
||||
- name: txt_Tips
|
||||
go: {fileID: 0}
|
||||
--- !u!114 &6085230108405065134
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3397518291152337347}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8bdfce83cded4259bdd1b1ad0d38590a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4001767378608646931
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using ZGame;
|
||||
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class TestEventArgs : GameEventArgs
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class UIHideOrShowEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(UIHideOrShowEventArgs).GetHashCode();
|
||||
public override int Id => EventId;
|
||||
public UIType UIType;
|
||||
|
||||
public UIHideOrShowEventArgs(UIType uiType)
|
||||
{
|
||||
UIType = uiType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GameEventPool
|
||||
{
|
||||
private static Dictionary<string, List<GameEventArgs>> pool = new Dictionary<string, List<GameEventArgs>>();
|
||||
private static Dictionary<string, List<GameEventArgs>> cache = new Dictionary<string, List<GameEventArgs>>();
|
||||
|
||||
public static T TakeOut<T>() where T : GameEventArgs, new()
|
||||
{
|
||||
string name = nameof(T);
|
||||
T args;
|
||||
if (pool.TryGetValue(name, out var list) && list.Count > 0)
|
||||
{
|
||||
args = (T)list[0];
|
||||
list.RemoveAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
args = new T();
|
||||
}
|
||||
|
||||
AddCache(name, args);
|
||||
return args;
|
||||
}
|
||||
|
||||
public static void Put<T>(T args) where T : GameEventArgs
|
||||
{
|
||||
string name = nameof(T);
|
||||
if (cache.TryGetValue(name, out var list))
|
||||
{
|
||||
list.Remove(args);
|
||||
AddPool(name, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
}
|
||||
|
||||
static void AddCache(string name, GameEventArgs args)
|
||||
{
|
||||
if (cache.TryGetValue(name, out var list)) list.Add(args);
|
||||
else cache.Add(name, new List<GameEventArgs>() { args });
|
||||
}
|
||||
|
||||
static void AddPool(string name, GameEventArgs args)
|
||||
{
|
||||
if (pool.TryGetValue(name, out var list)) list.Add(args);
|
||||
else pool.Add(name, new List<GameEventArgs>() { args });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e14e6d6332c4e8b8fd480d7731b0f2f
|
||||
timeCreated: 1731031488
|
|
@ -1,8 +1,9 @@
|
|||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class GameObjectBase<T> : IBehaviour, ICreateBindingGo
|
||||
public class GameObjectBase<T> : MonoBehaviour, IBehaviour //, ICreateBindingGo
|
||||
{
|
||||
private GameObject _go;
|
||||
private long _id;
|
||||
|
@ -16,26 +17,20 @@ namespace ZC
|
|||
|
||||
public bool isPause => this._isPause;
|
||||
|
||||
protected GameObjectBase(GameObject go = null)
|
||||
#region mono
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
this._id = IDGenerator.Generate();
|
||||
Debug.Log($"name is {typeof(T)}, id is {this._id}");
|
||||
if (go == null)
|
||||
{
|
||||
var name = typeof(T).FullName;
|
||||
this._go = new GameObject(name);
|
||||
_go.transform.SetParent(ZCGame.ObjectPool);
|
||||
this._go.name = name;
|
||||
}
|
||||
else
|
||||
this._go = go;
|
||||
OnInit();
|
||||
}
|
||||
|
||||
public void SetGo(GameObject go)
|
||||
private void OnDestroy()
|
||||
{
|
||||
this._go = go;
|
||||
OnDispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual void OnInit()
|
||||
{
|
||||
this._isDisposed = false;
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class GameEntry
|
||||
{
|
||||
public static void Init(GameObject go, EPlayMode playMode)
|
||||
{
|
||||
Debug.Log("热更成功了");
|
||||
ZCGame zcGame = new ZCGame(go);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 91d311a248764f499955c2ea204a53b8
|
||||
timeCreated: 1720680742
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Unity.Loader;
|
||||
using UnityEngine;
|
||||
using ZGame;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace ZC
|
|||
EventManager.Instance.Subscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent);
|
||||
|
||||
testZhongLi = new TestZhongLi();
|
||||
ZCGame.ObjectManager.Add(testZhongLi);
|
||||
// Global.ObjectManager.Add(testZhongLi);
|
||||
}
|
||||
|
||||
private void DeleteModelEvent(object sender, GameEventArgs e)
|
||||
|
@ -49,7 +49,6 @@ namespace ZC
|
|||
base.Dispose();
|
||||
EventManager.Instance.Unsubscribe(LoadModelEventArgs.EventId, this.LoadModelEvent);
|
||||
EventManager.Instance.Unsubscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent);
|
||||
ZCGame.ObjectManager.Remove(this.testZhongLi.Id);
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Cysharp.Threading.Tasks;
|
||||
using Unity.Loader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZC
|
||||
|
@ -17,7 +18,7 @@ namespace ZC
|
|||
Debug.Log("加载的是:" + loadAssetAsync);
|
||||
// ZCGame.ProcedureManager.ChangeProcedure(ProcedureType.GameSceneLogicProcedure);
|
||||
|
||||
ZCGame.UIManager.CreateUI(UIType.MainUI, AssetConst.Assets_DemoGame_GameRes_UIPanel_UIMain_prefab, UILayer.High);
|
||||
Global.UIManager.CreateUI(UIType.MainUI, AssetConst.Assets_DemoGame_GameRes_UIPanel_UIMain_prefab, UILayer.High);
|
||||
}).Forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Unity.Loader;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using YooAsset;
|
||||
|
@ -45,7 +46,7 @@ namespace ZC
|
|||
public ResourcesLocalComponent()
|
||||
{
|
||||
resourcePackage = YooAssets.GetPackage("DefaultPackage");
|
||||
var transform = ZCGame.Self.transform;
|
||||
var transform = Global.Self.transform;
|
||||
|
||||
Min = transform.Find("UI/UICanvas/Min");
|
||||
Low = transform.Find("UI/UICanvas/Low");
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace ZC
|
|||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.AnalysisReportUI);
|
||||
EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.AnalysisReportUI));
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ZC
|
|||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.DialogueUI);
|
||||
EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.DialogueUI));
|
||||
callback?.Invoke();
|
||||
callback = null;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using UnityEngine.UI;
|
||||
using ZGame;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ZC
|
|||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.IntroduceUI);
|
||||
EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.IntroduceUI));
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ZC
|
|||
private TMP_Text txt_Score;
|
||||
private TMP_Text txt_Progress;
|
||||
private TMP_Text txt_Time;
|
||||
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
@ -25,6 +25,7 @@ namespace ZC
|
|||
Global.updateTime += UpdateTime;
|
||||
Global.updateScore += UpdateScore;
|
||||
Global.updateProgress += UpdateProgress;
|
||||
UpdateTime(String.Empty);
|
||||
}
|
||||
|
||||
private void UpdateTime(string obj)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ZC
|
|||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.IntroduceUI);
|
||||
EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.MinTipsUI));
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class ZCGame
|
||||
{
|
||||
private GameObject _self;
|
||||
private Transform _objectPool;
|
||||
private bool isDisposed;
|
||||
private bool isPause;
|
||||
private float gameTime;
|
||||
|
||||
public static ZCGame _zcGame;
|
||||
private ObjectManager _objectManager;
|
||||
private UIManager _uiManager;
|
||||
private ProcedureManager _procedureManager;
|
||||
private ResourcesLocalComponent _resourcesLocalComponent;
|
||||
|
||||
public static GameObject Self => _zcGame._self;
|
||||
public static Transform ObjectPool => _zcGame._objectPool;
|
||||
public static float GameTime => _zcGame.gameTime;
|
||||
|
||||
public static IObjectManager ObjectManager => _zcGame._objectManager;
|
||||
public static IUIManager UIManager => _zcGame._uiManager;
|
||||
public static IProcedureManager ProcedureManager => _zcGame._procedureManager;
|
||||
public static IResourcesLocalComponent ResourcesLocalComponent => _zcGame._resourcesLocalComponent;
|
||||
|
||||
public ZCGame(GameObject self)
|
||||
{
|
||||
_zcGame = this;
|
||||
this._self = self;
|
||||
this._objectPool = self.transform.Find("ObjectPool");
|
||||
this.isDisposed = false;
|
||||
this.isPause = false;
|
||||
|
||||
AssemblyManager.Initialize();
|
||||
|
||||
this.UpdateGame().Forget();
|
||||
}
|
||||
|
||||
async UniTask UpdateGame()
|
||||
{
|
||||
this.Init();
|
||||
while (!this.isDisposed)
|
||||
{
|
||||
await UniTask.Yield();
|
||||
if (!Application.isPlaying) // 关闭应用的时候自动调用
|
||||
{
|
||||
this.isDisposed = true;
|
||||
this.Dispose();
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.isPause) continue;
|
||||
|
||||
this.gameTime += Time.fixedTime;
|
||||
this.Update(this.gameTime);
|
||||
this.LateUpdate(this.gameTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
this.isPause = true;
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
this.isPause = false;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
this._objectManager = new ObjectManager();
|
||||
this._objectManager.OnInit();
|
||||
|
||||
this._uiManager = new UIManager();
|
||||
this._procedureManager = new ProcedureManager();
|
||||
this._resourcesLocalComponent = new ResourcesLocalComponent();
|
||||
|
||||
this._objectManager.Add(this._uiManager);
|
||||
this._objectManager.Add(this._procedureManager);
|
||||
|
||||
this._procedureManager.ChangeProcedure(ProcedureType.LoadingGameSceneProcedure);
|
||||
}
|
||||
|
||||
void Update(float time)
|
||||
{
|
||||
this._objectManager.OnUpdate(time);
|
||||
}
|
||||
|
||||
void LateUpdate(float time)
|
||||
{
|
||||
}
|
||||
|
||||
void Dispose()
|
||||
{
|
||||
this._objectManager.OnDispose();
|
||||
_resourcesLocalComponent.Dispose();
|
||||
Debug.Log("关闭应用了");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3f38ff28c125416bbedbbdd0b168fde2
|
||||
timeCreated: 1720688289
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class DeleteModelEventArgs : GameEventArgs
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
/// <summary>
|
||||
/// 补丁包初始化失败
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class EnterSingleModeEventArgs : GameEventArgs
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏逻辑事件基类。
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
/// <summary>
|
||||
/// game初始化完成(资源、ui等初始化完成)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class LoadModelEventArgs : GameEventArgs
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class LoadingGameSceneFinishEventArgs : GameEventArgs
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public enum UpdatePackageCallbackType
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class EventManager : IEventManager
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件管理器接口。
|
||||
|
|
|
@ -13,9 +13,6 @@ namespace Unity.Loader
|
|||
[SerializeField] EPlayMode playMode;
|
||||
[SerializeField] private string packageName = "DefaultPackage";
|
||||
|
||||
ZCGame zcGame;
|
||||
|
||||
private float time;
|
||||
private GlobalData _globalData;
|
||||
|
||||
public GlobalData Data => _globalData;
|
||||
|
@ -24,28 +21,29 @@ namespace Unity.Loader
|
|||
public static Action<string> updateTime;
|
||||
public static Action<string> updateScore;
|
||||
public static Action<string> updateProgress;
|
||||
|
||||
|
||||
|
||||
|
||||
private Transform _objectPool;
|
||||
private bool isDisposed;
|
||||
private bool isPause;
|
||||
private float gameTime;
|
||||
|
||||
public static Global _global;
|
||||
private ObjectManager _objectManager;
|
||||
|
||||
private UIManager _uiManager;
|
||||
private ProcedureManager _procedureManager;
|
||||
private ResourcesLocalComponent _resourcesLocalComponent;
|
||||
|
||||
public static Transform Self => _global.transform;
|
||||
public static Transform ObjectPool => _global._objectPool;
|
||||
public static float GameTime => _global.gameTime;
|
||||
|
||||
public static IObjectManager ObjectManager => _global._objectManager;
|
||||
public static IUIManager UIManager => _global._uiManager;
|
||||
public static IProcedureManager ProcedureManager => _global._procedureManager;
|
||||
public static IResourcesLocalComponent ResourcesLocalComponent => _global._resourcesLocalComponent;
|
||||
|
||||
|
||||
#region mono
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_global = this;
|
||||
|
@ -55,32 +53,50 @@ namespace Unity.Loader
|
|||
private void Start()
|
||||
{
|
||||
this._initializePackage = new InitializePackage(playMode, this.packageName, FinishCallback);
|
||||
|
||||
_globalData = new GlobalData();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
time += Time.fixedTime;
|
||||
if (this.isPause) return;
|
||||
|
||||
this.gameTime += Time.fixedTime;
|
||||
updateTime?.Invoke(_globalData.runTimeStr);
|
||||
// Debug.Log($"{_globalData.runTimeStr}");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
isDisposed = true;
|
||||
_globalData.Dispose();
|
||||
_procedureManager.OnDispose();
|
||||
_uiManager.OnDispose();
|
||||
|
||||
_resourcesLocalComponent.Dispose();
|
||||
Debug.Log("关闭应用了");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void FinishCallback()
|
||||
{
|
||||
// yoo init finish
|
||||
Debug.Log($"yoo init finish {DateTime.Now}");
|
||||
|
||||
|
||||
this._objectPool = transform.Find("ObjectPool");
|
||||
this.isDisposed = false;
|
||||
this.isPause = false;
|
||||
_globalData = new GlobalData();
|
||||
|
||||
AssemblyManager.Initialize();
|
||||
|
||||
this._uiManager = new UIManager();
|
||||
this._procedureManager = new ProcedureManager();
|
||||
this._resourcesLocalComponent = new ResourcesLocalComponent();
|
||||
|
||||
_uiManager.OnInit();
|
||||
_procedureManager.OnInit();
|
||||
|
||||
this._procedureManager.ChangeProcedure(ProcedureType.LoadingGameSceneProcedure);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ using System.IO;
|
|||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using ZGame;
|
||||
using ZC;
|
||||
|
||||
namespace Unity.Loader
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using UnityEngine;
|
|||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ZGame
|
||||
namespace ZC
|
||||
{
|
||||
public class UILoading : MonoBehaviour
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue