ttt #1
|
@ -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
|
||||
|
|
|
@ -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":[]}]}]}
|
|
@ -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,14 +1,16 @@
|
|||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public class GameObjectBase<T> : IBehaviour, ICreateBindingGo
|
||||
public class GameObjectBase<T> : MonoBehaviour, IBehaviour
|
||||
{
|
||||
private GameObject _go;
|
||||
private long _id;
|
||||
private long _id = 0;
|
||||
private bool _isDisposed;
|
||||
private bool _isPause;
|
||||
public GameObject go => this._go;
|
||||
GameObjectBinding _binding;
|
||||
|
||||
public GameObjectBinding binding => _binding;
|
||||
|
||||
public long Id => this._id;
|
||||
|
||||
|
@ -16,24 +18,17 @@ namespace ZC
|
|||
|
||||
public bool isPause => this._isPause;
|
||||
|
||||
protected GameObjectBase(GameObject go = null)
|
||||
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;
|
||||
_binding = gameObject.GetComponent<GameObjectBinding>();
|
||||
OnInit();
|
||||
}
|
||||
|
||||
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()
|
||||
|
@ -59,6 +54,7 @@ namespace ZC
|
|||
public virtual void OnDispose()
|
||||
{
|
||||
this._isDisposed = true;
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,43 @@
|
|||
using System.Collections.Generic;
|
||||
using Unity.Loader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
public static class GameObjectFactory
|
||||
{
|
||||
// public static T Create<T>(GameObject go = null) where T : GameObjectBase
|
||||
// {
|
||||
// var t = new T();
|
||||
// var id = t.GetHashCode();
|
||||
//
|
||||
// t.OnInit();
|
||||
// ZCGame.ObjectManager.Add(t);
|
||||
// return t;
|
||||
// }
|
||||
private static Transform parent;
|
||||
|
||||
public static T CreateGameObject<T>(string path) where T : GameObjectBase<T>
|
||||
{
|
||||
var go = ResourcesLocalComponent.Instance.LoadGameObjectSync(path);
|
||||
if (parent == null)
|
||||
parent = Global.ObjectPool;
|
||||
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,26 +13,31 @@ namespace ZC
|
|||
private static readonly long twepoch = 1288834974657L; // Twitter Snowflake算法中的自定义起始时间
|
||||
private static readonly long machineId = 1L; // 机器码,可以自定义
|
||||
|
||||
static object o = new object();
|
||||
|
||||
public static long Generate()
|
||||
{
|
||||
long timestamp = TimeGen();
|
||||
|
||||
if (lastTimestamp == timestamp)
|
||||
lock (o)
|
||||
{
|
||||
sequence = (sequence + 1) & 4095L;
|
||||
if (sequence == 0)
|
||||
long timestamp = TimeGen();
|
||||
|
||||
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)
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace ZC
|
|||
public interface ICreateBindingGo
|
||||
{
|
||||
GameObject go { get; }
|
||||
GameObjectBinding binding { get; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -13,12 +13,11 @@ namespace ZC
|
|||
{
|
||||
base.OnInit();
|
||||
|
||||
// string filePath = $"{Application.dataPath}/DemoGame/GameRes/Config/TaskListData.json";
|
||||
// var textAsset = ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(AssetConst.Assets_DemoGame_GameRes_UIPanel_UIBattle_prefab);
|
||||
// // var json = File.ReadAllText(textAsset.text);
|
||||
// var datas = JsonConvert.DeserializeObject<TaskListDatas>(textAsset.text);
|
||||
// _datas = datas;
|
||||
// _datas.Init();
|
||||
string filePath = $"{Application.dataPath}/DemoGame/GameRes/Config/TaskListData.json";
|
||||
var textAsset = ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(filePath);
|
||||
var datas = JsonConvert.DeserializeObject<TaskListDatas>(textAsset.text);
|
||||
_datas = datas;
|
||||
_datas.Init();
|
||||
}
|
||||
|
||||
public void SetState(string title, TaskListType type)
|
||||
|
|
|
@ -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
|
||||
|
@ -6,6 +7,8 @@ namespace ZC
|
|||
[Procedure(ProcedureType.LoadingGameSceneProcedure)]
|
||||
class LoadingGameSceneProcedure : ProcedureBase
|
||||
{
|
||||
private TestZhongLi _testZhongLi;
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
base.OnEnter();
|
||||
|
@ -13,14 +16,32 @@ namespace ZC
|
|||
UniTask.Create(async () =>
|
||||
{
|
||||
// await ResourcesLocalComponent.Instance.LoadSceneAsync(AssetConst.Assets_DemoGame_GameRes_Scene_Game_unity);
|
||||
var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetConst.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||
Debug.Log("加载的是:" + loadAssetAsync);
|
||||
// var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetConst.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||
// Debug.Log("加载的是:" + loadAssetAsync);
|
||||
_testZhongLi = GameObjectFactory.CreateGameObject<TestZhongLi>(AssetConst
|
||||
.Assets_DemoGame_GameRes_Entity_Cube_prefab);
|
||||
// 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();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
base.OnLeave();
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace ZC
|
|||
{
|
||||
private Dictionary<ProcedureType, IProcedure> _procedures = new Dictionary<ProcedureType, IProcedure>();
|
||||
private IProcedure currentProcedure;
|
||||
public ProcedureType CurrentProcedureType => currentProcedure.procedureType;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace ZC
|
|||
var procedureType = procedureAttribute.ProcedureType;
|
||||
_procedures.Add(procedureType, (IProcedure)Activator.CreateInstance(type, false));
|
||||
}
|
||||
|
||||
|
||||
foreach (var procedureBase in _procedures.Values)
|
||||
{
|
||||
procedureBase.Init();
|
||||
|
@ -94,6 +95,5 @@ namespace ZC
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Unity.Loader;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using YooAsset;
|
||||
|
@ -28,7 +29,8 @@ namespace ZC
|
|||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new ResourcesLocalComponent();
|
||||
throw new NullReferenceException();
|
||||
// instance = new ResourcesLocalComponent();
|
||||
}
|
||||
|
||||
return instance;
|
||||
|
@ -44,8 +46,10 @@ namespace ZC
|
|||
|
||||
public ResourcesLocalComponent()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
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");
|
||||
|
@ -131,7 +135,8 @@ namespace ZC
|
|||
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);
|
||||
while (!loadAssetAsync.IsDone)
|
||||
|
@ -145,7 +150,8 @@ namespace ZC
|
|||
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);
|
||||
while (!loadAssetAsync.IsDone)
|
||||
|
|
|
@ -12,19 +12,20 @@ namespace ZC
|
|||
|
||||
public void Update()
|
||||
{
|
||||
if (SystemInfo.supportsGyroscope)
|
||||
{
|
||||
var gyro = Input.gyro;
|
||||
gyro.enabled = true;
|
||||
Debug.Log($"{gyro.rotationRate} , {gyro.attitude}");
|
||||
// Camera.main.transform.Rotate(gyro.rotationRate);
|
||||
Camera.main.transform.rotation = gyro.attitude;
|
||||
Debug.Log($"raw: {Input.compass.rawVector}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug.Log("没找到?");
|
||||
}
|
||||
transform.Rotate(Vector3.up);
|
||||
// if (SystemInfo.supportsGyroscope)
|
||||
// {
|
||||
// var gyro = Input.gyro;
|
||||
// gyro.enabled = true;
|
||||
// Debug.Log($"{gyro.rotationRate} , {gyro.attitude}");
|
||||
// // Camera.main.transform.Rotate(gyro.rotationRate);
|
||||
// Camera.main.transform.rotation = gyro.attitude;
|
||||
// Debug.Log($"raw: {Input.compass.rawVector}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Debug.Log("没找到?");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,8 @@ namespace ZC
|
|||
public interface IUIManager
|
||||
{
|
||||
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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace ZC
|
|||
|
||||
public abstract class UIBase : MonoBehaviour, IUI
|
||||
{
|
||||
private bool _isPause;
|
||||
private bool _isActive;
|
||||
private bool _isPause = true;
|
||||
private bool _isActive = false;
|
||||
private CanvasGroup _group;
|
||||
|
||||
public bool isPause => _isPause;
|
||||
|
@ -31,15 +31,11 @@ namespace ZC
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
_isPause = true;
|
||||
_isActive = false;
|
||||
_uiGameObjectBinding = GetComponent<GameObjectBinding>();
|
||||
Init();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -86,6 +82,7 @@ namespace ZC
|
|||
{
|
||||
_isActive = false;
|
||||
_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);
|
||||
|
||||
// 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>();
|
||||
var uiBase = gameObject.AddComponent<T>();
|
||||
uiBase.Init();
|
||||
uiBase.Close();
|
||||
_uiDic.Add(uiType, uiBase);
|
||||
|
||||
//#if UNITY_EDITOR
|
||||
// view
|
||||
// var addComponent = gameObject.GetComponent<UIInfo>();
|
||||
// addComponent.SetStart(ui, this.font);
|
||||
//#endif
|
||||
|
||||
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)
|
||||
{
|
||||
if (_uiDic.TryGetValue(uiType, out var ui))
|
||||
|
|
|
@ -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>
|
||||
/// 事件管理器接口。
|
||||
|
|
|
@ -8,14 +8,13 @@ namespace Unity.Loader
|
|||
{
|
||||
public class Global : MonoBehaviour
|
||||
{
|
||||
private static Global _global;
|
||||
|
||||
private InitializePackage _initializePackage;
|
||||
|
||||
[SerializeField] EPlayMode playMode;
|
||||
[SerializeField] private string packageName = "DefaultPackage";
|
||||
|
||||
ZCGame zcGame;
|
||||
|
||||
private float time;
|
||||
private GlobalData _globalData;
|
||||
|
||||
public GlobalData Data => _globalData;
|
||||
|
@ -24,27 +23,34 @@ 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 bool _isInitFinish;
|
||||
private float gameTime;
|
||||
|
||||
public static Global _global;
|
||||
private ObjectManager _objectManager;
|
||||
|
||||
private UIManager _uiManager;
|
||||
private ProcedureManager _procedureManager;
|
||||
private ObjectManager _objectManager;
|
||||
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 IObjectManager ObjectManager => _global._objectManager;
|
||||
public static IResourcesLocalComponent ResourcesLocalComponent => _global._resourcesLocalComponent;
|
||||
|
||||
#region 可视化
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region mono
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -55,32 +61,57 @@ namespace Unity.Loader
|
|||
private void Start()
|
||||
{
|
||||
this._initializePackage = new InitializePackage(playMode, this.packageName, FinishCallback);
|
||||
|
||||
_globalData = new GlobalData();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
time += Time.fixedTime;
|
||||
if (!_isInitFinish || this.isPause) return;
|
||||
|
||||
this.gameTime += Time.fixedTime;
|
||||
updateTime?.Invoke(_globalData.runTimeStr);
|
||||
// Debug.Log($"{_globalData.runTimeStr}");
|
||||
|
||||
_procedureManager.OnUpdate(gameTime);
|
||||
// _uiManager.OnUpdate(gameTime);
|
||||
// _objectManager.OnUpdate(gameTime);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
isDisposed = true;
|
||||
_globalData.Dispose();
|
||||
_procedureManager.OnDispose();
|
||||
_uiManager.OnDispose();
|
||||
_objectManager.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._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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -3264,10 +3265,22 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: IngameDebugConsole
|
||||
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}
|
||||
propertyPath: m_BlockingMask.m_Bits
|
||||
value: 55
|
||||
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}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
|
@ -3276,6 +3289,10 @@ PrefabInstance:
|
|||
propertyPath: m_AnchorMax.y
|
||||
value: 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}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
|
|
Loading…
Reference in New Issue