Compare commits

...

5 Commits

Author SHA1 Message Date
zxl 13f67d8a54 Merge pull request 'ttt' (#1) from ttt into xiugai-20241107
Reviewed-on: #1
2024-11-27 22:24:29 +08:00
zxl 31e77ef272 mod:优化处理方式;
目前逻辑为:
UI在面板上跟物体进行深度绑定,但是UI通过工厂进行创建;
场景物体在面板上跟物体进行深度绑定,但是场景物体通过工厂进行创建;
2024-11-08 17:25:44 +08:00
zxl 958d5d48aa mod:结构大改,深度绑定Unity;完成初步改造 2024-11-08 11:05:33 +08:00
zxl 0bc9ba4822 Merge remote-tracking branch 'origin/xiugai-20241107' into ttt 2024-11-08 09:13:49 +08:00
zxl 73282fbdef mod:修改playerbase的位置 2024-11-08 09:12:53 +08:00
56 changed files with 475 additions and 262 deletions

5
.gitignore vendored
View File

@ -13,6 +13,7 @@ _ReSharper.CSharp/
~$*.xlsx.meta ~$*.xlsx.meta
#Unity相关目录 #Unity相关目录
*.sln
.gradle .gradle
Bundles Bundles
Library Library
@ -20,11 +21,10 @@ Logs
UserSettings UserSettings
*.csproj *.csproj
*.vsconfig *.vsconfig
ProjectSettings/RiderScriptEditorPersistedState.asset
HybridCLRData HybridCLRData
Builds Builds
ProjectSettings ProjectSettings
/ProjectSettings Packages
#Unity/Assets #Unity/Assets
Unity/Assets/DemoGame/GameRes/Codes/ Unity/Assets/DemoGame/GameRes/Codes/
@ -43,4 +43,3 @@ obj/
Temp/ Temp/
yoo yoo
/Assets/DemoGame/GameScript/Hotfix/Generate /Assets/DemoGame/GameScript/Hotfix/Generate
*.sln

View File

@ -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":[]}]}]}

View File

@ -374,6 +374,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: 2800259146936183769}
m_Layer: 5 m_Layer: 5
m_Name: UIAnalysisReport m_Name: UIAnalysisReport
m_TagString: Untagged m_TagString: Untagged
@ -462,6 +463,18 @@ MonoBehaviour:
go: {fileID: 3629523032732396268} go: {fileID: 3629523032732396268}
- name: btn_Close - name: btn_Close
go: {fileID: 2697064222727683036} 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 --- !u!1 &5317604574928387220
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -259,6 +259,7 @@ GameObject:
- component: {fileID: 698078448984834475} - component: {fileID: 698078448984834475}
- component: {fileID: 668918620521492242} - component: {fileID: 668918620521492242}
- component: {fileID: 9115275115095225745} - component: {fileID: 9115275115095225745}
- component: {fileID: 2279161542270385328}
m_Layer: 5 m_Layer: 5
m_Name: UIAnswer m_Name: UIAnswer
m_TagString: Untagged m_TagString: Untagged
@ -372,6 +373,18 @@ MonoBehaviour:
go: {fileID: 9202602478924319093} go: {fileID: 9202602478924319093}
- name: btn_Finish - name: btn_Finish
go: {fileID: 5820743778285733619} 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 --- !u!1 &1024254765518223612
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -500,6 +500,7 @@ GameObject:
- component: {fileID: 550302411564123129} - component: {fileID: 550302411564123129}
- component: {fileID: 291995725713535194} - component: {fileID: 291995725713535194}
- component: {fileID: -8407002671156803367} - component: {fileID: -8407002671156803367}
- component: {fileID: -9131199328991421552}
m_Layer: 5 m_Layer: 5
m_Name: UIBasicInformation m_Name: UIBasicInformation
m_TagString: Untagged m_TagString: Untagged
@ -593,6 +594,18 @@ MonoBehaviour:
go: {fileID: 3249870284026512454} go: {fileID: 3249870284026512454}
- name: txt_Tips - name: txt_Tips
go: {fileID: 4912361159165114271} 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 --- !u!1 &4001767378608646931
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -146,6 +146,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: -985440187916247387}
m_Layer: 5 m_Layer: 5
m_Name: UIBigTips m_Name: UIBigTips
m_TagString: Untagged m_TagString: Untagged
@ -228,6 +229,18 @@ MonoBehaviour:
Datas: Datas:
- name: txt_Tips - name: txt_Tips
go: {fileID: 3399441290911741623} 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 --- !u!1 &6714752182229787685
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -87,6 +87,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: -1151308275079064170}
m_Layer: 5 m_Layer: 5
m_Name: UIBlack m_Name: UIBlack
m_TagString: Untagged m_TagString: Untagged
@ -175,3 +176,15 @@ MonoBehaviour:
go: {fileID: 0} go: {fileID: 0}
- name: txt_Score - name: txt_Score
go: {fileID: 0} 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:

View File

@ -490,6 +490,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: -4724590772860326454}
m_Layer: 5 m_Layer: 5
m_Name: UIDialogue m_Name: UIDialogue
m_TagString: Untagged m_TagString: Untagged
@ -576,6 +577,18 @@ MonoBehaviour:
go: {fileID: 683421145250387970} go: {fileID: 683421145250387970}
- name: btn_Close - name: btn_Close
go: {fileID: 1392729977172397} 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 --- !u!1 &6455988744588681074
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -490,6 +490,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: -1210113770028888665}
m_Layer: 5 m_Layer: 5
m_Name: UIIntroduce m_Name: UIIntroduce
m_TagString: Untagged m_TagString: Untagged
@ -576,6 +577,18 @@ MonoBehaviour:
go: {fileID: 683421145250387970} go: {fileID: 683421145250387970}
- name: btn_Close - name: btn_Close
go: {fileID: 1392729977172397} 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 --- !u!1 &6455988744588681074
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -166,6 +166,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 248032507418089783} - component: {fileID: 248032507418089783}
- component: {fileID: -3171479879712486959}
m_Layer: 5 m_Layer: 5
m_Name: UILoading m_Name: UILoading
m_TagString: Untagged m_TagString: Untagged
@ -247,3 +248,15 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Datas: [] 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:

View File

@ -427,6 +427,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: 950412098625172911}
m_Layer: 5 m_Layer: 5
m_Name: UIMain m_Name: UIMain
m_TagString: Untagged m_TagString: Untagged
@ -512,12 +513,24 @@ MonoBehaviour:
Datas: Datas:
- name: btn_Start - name: btn_Start
go: {fileID: 5311715019834057590} go: {fileID: 5311715019834057590}
- name: txt_Score - name: txt_Time
go: {fileID: 7341890073962984069} go: {fileID: 7341890073962984069}
- name: txt_Progress - name: txt_Progress
go: {fileID: 2605278743245872664} go: {fileID: 2605278743245872664}
- name: txt_Score - name: txt_Score
go: {fileID: 5876990461323761607} 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 --- !u!1 &4804850453455257046
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -490,6 +490,7 @@ GameObject:
- component: {fileID: 4142826567245113225} - component: {fileID: 4142826567245113225}
- component: {fileID: 446002385128238495} - component: {fileID: 446002385128238495}
- component: {fileID: 8769046888857752082} - component: {fileID: 8769046888857752082}
- component: {fileID: 6551479780972282114}
m_Layer: 5 m_Layer: 5
m_Name: UIMinTips m_Name: UIMinTips
m_TagString: Untagged m_TagString: Untagged
@ -576,6 +577,18 @@ MonoBehaviour:
go: {fileID: 683421145250387970} go: {fileID: 683421145250387970}
- name: btn_Close - name: btn_Close
go: {fileID: 1392729977172397} 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 --- !u!1 &6455988744588681074
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -500,6 +500,7 @@ GameObject:
- component: {fileID: 550302411564123129} - component: {fileID: 550302411564123129}
- component: {fileID: 291995725713535194} - component: {fileID: 291995725713535194}
- component: {fileID: -8407002671156803367} - component: {fileID: -8407002671156803367}
- component: {fileID: 6085230108405065134}
m_Layer: 5 m_Layer: 5
m_Name: UITaskList m_Name: UITaskList
m_TagString: Untagged m_TagString: Untagged
@ -592,6 +593,18 @@ MonoBehaviour:
go: {fileID: 3249870284026512454} go: {fileID: 3249870284026512454}
- name: txt_Tips - name: txt_Tips
go: {fileID: 0} 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 --- !u!1 &4001767378608646931
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1,5 +1,4 @@
using ZGame; 
namespace ZC namespace ZC
{ {
public class TestEventArgs : GameEventArgs public class TestEventArgs : GameEventArgs

View File

@ -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 });
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7e14e6d6332c4e8b8fd480d7731b0f2f
timeCreated: 1731031488

View File

@ -1,14 +1,16 @@
using UnityEngine; using System;
using UnityEngine;
namespace ZC namespace ZC
{ {
public class GameObjectBase<T> : 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;
@ -16,24 +18,17 @@ namespace ZC
public bool isPause => this._isPause; public bool isPause => this._isPause;
protected GameObjectBase(GameObject go = null) private void Awake()
{ {
this._id = IDGenerator.Generate(); _binding = gameObject.GetComponent<GameObjectBinding>();
Debug.Log($"name is {typeof(T)}, id is {this._id}"); OnInit();
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;
} }
public void SetGo(GameObject go) public void SetID(long id)
{ {
this._go = go; if (_id != 0)
throw new ArgumentException("id 不允许二次修改,一次固定的!");
_id = id;
} }
public virtual void OnInit() public virtual void OnInit()
@ -59,6 +54,7 @@ namespace ZC
public virtual void OnDispose() public virtual void OnDispose()
{ {
this._isDisposed = true; this._isDisposed = true;
DestroyImmediate(this.gameObject);
} }
} }
} }

View File

@ -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);
}
} }
} }

View File

@ -13,26 +13,31 @@ 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()
{ {
long timestamp = TimeGen(); lock (o)
if (lastTimestamp == timestamp)
{ {
sequence = (sequence + 1) & 4095L; long timestamp = TimeGen();
if (sequence == 0)
if (lastTimestamp == timestamp)
{ {
timestamp = TilNextMillis(lastTimestamp); sequence = (sequence + 1) & 4095L;
if (sequence == 0)
{
timestamp = TilNextMillis(lastTimestamp);
}
}
else
{
sequence = 0L;
} }
}
else
{
sequence = 0L;
}
lastTimestamp = timestamp; lastTimestamp = timestamp;
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)

View File

@ -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);
} }

View File

@ -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;
}
} }
} }

View File

@ -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);
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 91d311a248764f499955c2ea204a53b8
timeCreated: 1720680742

View File

@ -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)

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Unity.Loader;
using UnityEngine; using UnityEngine;
using ZGame;
namespace ZC namespace ZC
{ {
@ -17,7 +17,7 @@ namespace ZC
EventManager.Instance.Subscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent); EventManager.Instance.Subscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent);
testZhongLi = new TestZhongLi(); testZhongLi = new TestZhongLi();
ZCGame.ObjectManager.Add(testZhongLi); // Global.ObjectManager.Add(testZhongLi);
} }
private void DeleteModelEvent(object sender, GameEventArgs e) private void DeleteModelEvent(object sender, GameEventArgs e)
@ -49,7 +49,6 @@ namespace ZC
base.Dispose(); base.Dispose();
EventManager.Instance.Unsubscribe(LoadModelEventArgs.EventId, this.LoadModelEvent); EventManager.Instance.Unsubscribe(LoadModelEventArgs.EventId, this.LoadModelEvent);
EventManager.Instance.Unsubscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent); EventManager.Instance.Unsubscribe(DeleteModelEventArgs.EventId, this.DeleteModelEvent);
ZCGame.ObjectManager.Remove(this.testZhongLi.Id);
} }
public override void OnEnter() public override void OnEnter()

View File

@ -1,4 +1,5 @@
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using Unity.Loader;
using UnityEngine; using UnityEngine;
namespace ZC namespace ZC
@ -6,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();
@ -13,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);
ZCGame.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();

View File

@ -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()
{ {
@ -31,7 +32,7 @@ namespace ZC
var procedureType = procedureAttribute.ProcedureType; var procedureType = procedureAttribute.ProcedureType;
_procedures.Add(procedureType, (IProcedure)Activator.CreateInstance(type, false)); _procedures.Add(procedureType, (IProcedure)Activator.CreateInstance(type, false));
} }
foreach (var procedureBase in _procedures.Values) foreach (var procedureBase in _procedures.Values)
{ {
procedureBase.Init(); procedureBase.Init();
@ -94,6 +95,5 @@ namespace ZC
return null; return null;
} }
} }
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using Unity.Loader;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using YooAsset; using YooAsset;
@ -28,7 +29,8 @@ namespace ZC
{ {
if (instance == null) if (instance == null)
{ {
instance = new ResourcesLocalComponent(); throw new NullReferenceException();
// instance = new ResourcesLocalComponent();
} }
return instance; return instance;
@ -44,8 +46,10 @@ namespace ZC
public ResourcesLocalComponent() public ResourcesLocalComponent()
{ {
instance = this;
resourcePackage = YooAssets.GetPackage("DefaultPackage"); resourcePackage = YooAssets.GetPackage("DefaultPackage");
var transform = ZCGame.Self.transform; var transform = Global.Self.transform;
Min = transform.Find("UI/UICanvas/Min"); Min = transform.Find("UI/UICanvas/Min");
Low = transform.Find("UI/UICanvas/Low"); Low = transform.Find("UI/UICanvas/Low");
@ -131,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)
@ -145,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)

View File

@ -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("没找到?");
// }
} }
} }
} }

View File

@ -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);

View File

@ -27,7 +27,7 @@ namespace ZC
private void ClickClose() private void ClickClose()
{ {
ZCGame.UIManager.HideUI(UIType.AnalysisReportUI); EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.AnalysisReportUI));
closeAction?.Invoke(); closeAction?.Invoke();
closeAction = null; closeAction = null;
} }

View File

@ -31,7 +31,7 @@ namespace ZC
private void ClickClose() private void ClickClose()
{ {
ZCGame.UIManager.HideUI(UIType.DialogueUI); EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.DialogueUI));
callback?.Invoke(); callback?.Invoke();
callback = null; callback = null;
} }

View File

@ -1,5 +1,4 @@
using UnityEngine.UI; using UnityEngine.UI;
using ZGame;
namespace ZC namespace ZC
{ {

View File

@ -25,7 +25,7 @@ namespace ZC
private void ClickClose() private void ClickClose()
{ {
ZCGame.UIManager.HideUI(UIType.IntroduceUI); EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.IntroduceUI));
closeAction?.Invoke(); closeAction?.Invoke();
closeAction = null; closeAction = null;
} }

View File

@ -12,7 +12,7 @@ namespace ZC
private TMP_Text txt_Score; private TMP_Text txt_Score;
private TMP_Text txt_Progress; private TMP_Text txt_Progress;
private TMP_Text txt_Time; private TMP_Text txt_Time;
public override void Init() public override void Init()
{ {
base.Init(); base.Init();
@ -25,6 +25,7 @@ namespace ZC
Global.updateTime += UpdateTime; Global.updateTime += UpdateTime;
Global.updateScore += UpdateScore; Global.updateScore += UpdateScore;
Global.updateProgress += UpdateProgress; Global.updateProgress += UpdateProgress;
UpdateTime(String.Empty);
} }
private void UpdateTime(string obj) private void UpdateTime(string obj)

View File

@ -24,7 +24,7 @@ namespace ZC
private void ClickClose() private void ClickClose()
{ {
ZCGame.UIManager.HideUI(UIType.IntroduceUI); EventManager.Instance.FireNow(this, new UIHideOrShowEventArgs(UIType.MinTipsUI));
closeAction?.Invoke(); closeAction?.Invoke();
closeAction = null; closeAction = null;
} }

View File

@ -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);
} }
} }
} }

View File

@ -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))

View File

@ -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("关闭应用了");
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 3f38ff28c125416bbedbbdd0b168fde2
timeCreated: 1720688289

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
public class DeleteModelEventArgs : GameEventArgs public class DeleteModelEventArgs : GameEventArgs
{ {

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
/// <summary> /// <summary>
/// 补丁包初始化失败 /// 补丁包初始化失败

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
public class EnterSingleModeEventArgs : GameEventArgs public class EnterSingleModeEventArgs : GameEventArgs
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace ZGame namespace ZC
{ {
/// <summary> /// <summary>
/// 游戏逻辑事件基类。 /// 游戏逻辑事件基类。

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
/// <summary> /// <summary>
/// game初始化完成资源、ui等初始化完成 /// game初始化完成资源、ui等初始化完成

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
public class LoadModelEventArgs : GameEventArgs public class LoadModelEventArgs : GameEventArgs
{ {

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
public class LoadingGameSceneFinishEventArgs : GameEventArgs public class LoadingGameSceneFinishEventArgs : GameEventArgs
{ {

View File

@ -1,4 +1,4 @@
namespace ZGame namespace ZC
{ {
public enum UpdatePackageCallbackType public enum UpdatePackageCallbackType
{ {

View File

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace ZGame namespace ZC
{ {
public class EventManager : IEventManager public class EventManager : IEventManager
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace ZGame namespace ZC
{ {
/// <summary> /// <summary>
/// 事件管理器接口。 /// 事件管理器接口。

View File

@ -8,14 +8,13 @@ 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;
[SerializeField] private string packageName = "DefaultPackage"; [SerializeField] private string packageName = "DefaultPackage";
ZCGame zcGame;
private float time;
private GlobalData _globalData; private GlobalData _globalData;
public GlobalData Data => _globalData; public GlobalData Data => _globalData;
@ -24,27 +23,34 @@ namespace Unity.Loader
public static Action<string> updateTime; public static Action<string> updateTime;
public static Action<string> updateScore; public static Action<string> updateScore;
public static Action<string> updateProgress; public static Action<string> updateProgress;
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 ObjectManager _objectManager;
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 ObjectPool => _global._objectPool; public static Transform ObjectPool => _global._objectPool;
public static float GameTime => _global.gameTime; public static float GameTime => _global.gameTime;
public static IObjectManager ObjectManager => _global._objectManager;
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
private void Awake() private void Awake()
{ {
@ -55,32 +61,57 @@ namespace Unity.Loader
private void Start() private void Start()
{ {
this._initializePackage = new InitializePackage(playMode, this.packageName, FinishCallback); this._initializePackage = new InitializePackage(playMode, this.packageName, FinishCallback);
_globalData = new GlobalData();
} }
private void Update() private void Update()
{ {
time += Time.fixedTime; if (!_isInitFinish || this.isPause) return;
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()
{ {
isDisposed = true;
_globalData.Dispose(); _globalData.Dispose();
_procedureManager.OnDispose();
_uiManager.OnDispose();
_objectManager.OnDispose();
_resourcesLocalComponent.Dispose();
Debug.Log("关闭应用了");
} }
#endregion
private void FinishCallback() private void FinishCallback()
{ {
// yoo init finish // yoo init finish
Debug.Log($"yoo init finish {DateTime.Now}"); Debug.Log($"yoo init finish {DateTime.Now}");
this._objectPool = transform.Find("ObjectPool"); this._objectPool = transform.Find("ObjectPool");
this.isDisposed = false; this.isDisposed = false;
this.isPause = false; this.isPause = false;
_globalData = new GlobalData();
AssemblyManager.Initialize(); AssemblyManager.Initialize();
this._resourcesLocalComponent = new ResourcesLocalComponent();
this._objectManager = new ObjectManager();
this._uiManager = new UIManager();
this._procedureManager = new ProcedureManager();
_objectManager.OnInit();
_uiManager.OnInit();
_procedureManager.OnInit();
_isInitFinish = true;
this._procedureManager.ChangeProcedure(ProcedureType.LoadingGameSceneProcedure);
} }
} }
} }

View File

@ -4,7 +4,7 @@ using System.IO;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using UnityEngine; using UnityEngine;
using YooAsset; using YooAsset;
using ZGame; using ZC;
namespace Unity.Loader namespace Unity.Loader
{ {

View File

@ -5,7 +5,7 @@ using UnityEngine;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using UnityEngine.UI; using UnityEngine.UI;
namespace ZGame namespace ZC
{ {
public class UILoading : MonoBehaviour public class UILoading : MonoBehaviour
{ {

View File

@ -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