部分管理脱离Monobehaviour

This commit is contained in:
sin365 2023-01-17 14:11:22 +08:00
parent 683126e76a
commit 0efb1bba27
23 changed files with 552 additions and 150 deletions

View File

@ -72,18 +72,18 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 120382244} - {fileID: 120382244}
- {fileID: 1841654392651735884}
- {fileID: 658610398} - {fileID: 658610398}
- {fileID: 1657571477} - {fileID: 1657571477}
- {fileID: 6993509460263203211} - {fileID: 6993509460263203211}
- {fileID: 1300239977} - {fileID: 1300239977}
- {fileID: 1319979395} - {fileID: 1319979395}
- {fileID: 1091778791906574039}
- {fileID: 4252941443528595760} - {fileID: 4252941443528595760}
- {fileID: 1890265903537811374}
- {fileID: 1455161061579575423} - {fileID: 1455161061579575423}
- {fileID: 8799381804509301542} - {fileID: 8799381804509301542}
- {fileID: 1809405776} - {fileID: 1809405776}
- {fileID: 3666144938885549896} - {fileID: 3666144938885549896}
- {fileID: 279668259149659524}
- {fileID: 5844614599556982605} - {fileID: 5844614599556982605}
- {fileID: 6917580155287762257} - {fileID: 6917580155287762257}
m_Father: {fileID: 7219867924276195502} m_Father: {fileID: 7219867924276195502}
@ -183,7 +183,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 1 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &658610399 --- !u!114 &658610399
MonoBehaviour: MonoBehaviour:
@ -225,7 +225,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 4 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1319979394 --- !u!1 &1319979394
GameObject: GameObject:
@ -255,7 +255,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 5 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1657571476 --- !u!1 &1657571476
GameObject: GameObject:
@ -285,7 +285,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1692196357 --- !u!1 &1692196357
GameObject: GameObject:
@ -406,7 +406,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 11 m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2142655056 --- !u!1 &2142655056
GameObject: GameObject:
@ -531,7 +531,37 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 9 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1037504333823053521
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1841654392651735884}
m_Layer: 0
m_Name: NoMono
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1841654392651735884
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1037504333823053521}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 348142342}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1266064196098693916 --- !u!1 &1266064196098693916
GameObject: GameObject:
@ -591,7 +621,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 10 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &3066668558062058701 --- !u!1 &3066668558062058701
GameObject: GameObject:
@ -623,36 +653,6 @@ Transform:
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 7 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4047470345771744446
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1890265903537811374}
m_Layer: 0
m_Name: Luban
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1890265903537811374
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4047470345771744446}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 348142342}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5726855267738759965 --- !u!1 &5726855267738759965
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -683,7 +683,7 @@ Transform:
- {fileID: 2142655057} - {fileID: 2142655057}
- {fileID: 5437893104048697931} - {fileID: 5437893104048697931}
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6116728153081928790 --- !u!1 &6116728153081928790
GameObject: GameObject:
@ -953,6 +953,36 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f2d610724341cc443890ad10e4687938, type: 3} m_Script: {fileID: 11500000, guid: f2d610724341cc443890ad10e4687938, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1 &7315382533406682711
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 279668259149659524}
m_Layer: 0
m_Name: Bullet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &279668259149659524
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7315382533406682711}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 348142342}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7681822357474164521 --- !u!1 &7681822357474164521
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -981,37 +1011,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 348142342} m_Father: {fileID: 348142342}
m_RootOrder: 12 m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7900566146616611867
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1091778791906574039}
m_Layer: 0
m_Name: Input
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1091778791906574039
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7900566146616611867}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 348142342}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &7904639614614389035 --- !u!1001 &7904639614614389035
PrefabInstance: PrefabInstance:

View File

@ -116,7 +116,7 @@ namespace Axibug.Runtime
{ {
if (gameFrameworkComponent == null) if (gameFrameworkComponent == null)
{ {
Log.Error("Cao Cao component is invalid."); Log.Error("Axibug component is invalid.");
return; return;
} }
@ -127,7 +127,7 @@ namespace Axibug.Runtime
{ {
if (current.Value.GetType() == type) if (current.Value.GetType() == type)
{ {
Log.Error("Cao Cao component type '{0}' is already exist.", type.FullName); Log.Error("Axibug component type '{0}' is already exist.", type.FullName);
return; return;
} }

View File

@ -5,6 +5,12 @@ namespace Game
{ {
public static class GamePlayEntry public static class GamePlayEntry
{ {
public static NoMonoComponent NoMono
{
get;
private set;
}
public static ResourcesComponent Resources public static ResourcesComponent Resources
{ {
get; get;
@ -23,13 +29,13 @@ namespace Game
private set; private set;
} }
public static RoleMgrComponent RoleMgr public static RoleMgrNoMono RoleMgr
{ {
get; get;
private set; private set;
} }
public static LubanComponent Luban public static LubanNoMono Luban
{ {
get; get;
set; set;
@ -41,7 +47,7 @@ namespace Game
// set; // set;
//} //}
public static InputComponent Input public static InputNoMono Input
{ {
get; get;
set; set;
@ -65,13 +71,13 @@ namespace Game
// set; // set;
//} //}
public static EffectMgrComponent EffectMgr public static EffectNoMono EffectMgr
{ {
get; get;
set; set;
} }
public static BattleMgrComponent Battle public static BattleNoMono Battle
{ {
get; get;
private set; private set;
@ -89,6 +95,12 @@ namespace Game
private set; private set;
} }
public static BulletMgrNoMono BulletMgr
{
get;
private set;
}
//public static TaskComponent Task //public static TaskComponent Task
//{ //{
// get; // get;
@ -117,29 +129,42 @@ namespace Game
{ {
//Ëæ±ãÈ¡Ò»¸öAxibug/CustomsϵĽڵã //Ëæ±ãÈ¡Ò»¸öAxibug/CustomsϵĽڵã
Transform parent = AppEntry.HotUpdate.transform.parent; Transform parent = AppEntry.HotUpdate.transform.parent;
NoMono = parent.Find("NoMono").gameObject.AddComponent<NoMonoComponent>();
Transform LogicNode = parent.Find("Logic");
Resources = parent.Find("Resources").gameObject.AddComponent<ResourcesComponent>(); Resources = parent.Find("Resources").gameObject.AddComponent<ResourcesComponent>();
Input = parent.Find("Input").gameObject.AddComponent<InputComponent>();
Map = parent.Find("Map").gameObject.AddComponent<MapComponent>(); Map = parent.Find("Map").gameObject.AddComponent<MapComponent>();
MainPlayer = parent.Find("MainPlayer").gameObject.AddComponent<MainPlayerComponent>(); MainPlayer = parent.Find("MainPlayer").gameObject.AddComponent<MainPlayerComponent>();
Luban = parent.Find("Luban").gameObject.AddComponent<LubanComponent>(); //Luban = parent.Find("Luban").gameObject.AddComponent<LubanNoMono>();
RoleMgr = parent.Find("RoleMgr").gameObject.AddComponent<RoleMgrComponent>();
//Network = parent.Find("Network").gameObject.AddComponent<NetworkComponent>(); //Network = parent.Find("Network").gameObject.AddComponent<NetworkComponent>();
//DropMgr = parent.Find("DropMgr").gameObject.AddComponent<DropMgrComponent>(); //DropMgr = parent.Find("DropMgr").gameObject.AddComponent<DropMgrComponent>();
//ItemMgr = parent.Find("ItemMgr").gameObject.AddComponent<ItemMgrComponent>(); //ItemMgr = parent.Find("ItemMgr").gameObject.AddComponent<ItemMgrComponent>();
//ItemMgr.Init(); //ItemMgr.Init();
EffectMgr = parent.Find("EffectMgr").gameObject.AddComponent<EffectMgrComponent>(); //EffectMgr = parent.Find("EffectMgr").gameObject.AddComponent<EffectNoMono>();
Tips = parent.Find("Tips").gameObject.AddComponent<Tips>(); Tips = parent.Find("Tips").gameObject.AddComponent<Tips>();
//Task = parent.Find("Logic").gameObject.AddComponent<TaskComponent>(); //Task = parent.Find("Logic").gameObject.AddComponent<TaskComponent>();
//FindWay = parent.Find("Logic").gameObject.AddComponent<FindWayComponent>(); //FindWay = parent.Find("Logic").gameObject.AddComponent<FindWayComponent>();
Battle = parent.Find("Logic").gameObject.AddComponent<BattleMgrComponent>(); //Battle = parent.Find("Logic").gameObject.AddComponent<BattleNoMono>();
//Audio = parent.Find("Audio").gameObject.AddComponent<AudioComponent>(); //Audio = parent.Find("Audio").gameObject.AddComponent<AudioComponent>();
GameObject go = Resources.CloneBySync("Assets/GameAssets/Prefabs/UI/UIYYControl/UIMgr.prefab", parent); GameObject go = Resources.CloneBySync("Assets/GameAssets/Prefabs/UI/UIYYControl/UIMgr.prefab", parent);
if (go == null) if (go != null)
return; UI = go.GetComponent<UIMgr>();
#region ÎÞNoMonoBehaviour
Luban = new LubanNoMono(typeof(LubanNoMono).Name, LogicNode);
Input = new InputNoMono(typeof(InputNoMono).Name, LogicNode);
Battle = new BattleNoMono(typeof(BattleNoMono).Name, LogicNode);
RoleMgr = new RoleMgrNoMono(typeof(RoleMgrNoMono).Name, parent.Find("RoleMgr"));
EffectMgr = new EffectNoMono(typeof(EffectNoMono).Name, parent.Find("EffectMgr"));
BulletMgr = new BulletMgrNoMono(typeof(BulletMgrNoMono).Name, parent.Find("Bullet"));
//Input = parent.Find("Input").gameObject.AddComponent<InputComponent>();
//RoleMgr = parent.Find("RoleMgr").gameObject.AddComponent<RoleMgrComponent>();
//EffectMgr = parent.Find("EffectMgr").gameObject.AddComponent<EffectNoMono>();
//Battle = parent.Find("Logic").gameObject.AddComponent<BattleNoMono>();
#endregion
UI = go.GetComponent<UIMgr>();
} }
} }

View File

@ -1,20 +0,0 @@
using Axibug.Runtime;
using UnityEngine;
using UnityEditor;
using Axibug.Resources;
using System.Collections.Generic;
using System.Diagnostics.SymbolStore;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
namespace Game
{
public class EffectMgrComponent : GameComponent
{
public PrefabPool<RoleFastShadow> rolegastEftPool;
private void OnEnable()
{
rolegastEftPool = new PrefabPool<RoleFastShadow>(this.transform, E_PREFAB_TYPE.EFFECT);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0ee4cb4c220f29428b8df8531f84b3d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,28 +1,44 @@
using Axibug; using Axibug;
using Axibug.Event; using Axibug.Event;
using Axibug.Resources;
using Axibug.Runtime; using Axibug.Runtime;
using Codice.CM.WorkspaceServer.DataStore;
using Game.Config;
using System; using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine; using UnityEngine;
namespace Game namespace Game
{ {
public class BattleMgrComponent : GameComponent public class BattleNoMono : NoMono
{ {
public UnitPool<HPDamageShowUnit> _HpDamagePool; public UnitPool<HPDamageShowUnit> _HpDamagePool;
private void Start() #region ÉúÃüÖÜÆÚ
public BattleNoMono(string Name, Transform trans = null) : base(Name, trans)
{ {
//×¢²á»Øµ÷
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
AppEntry.Event.Subscribe(AttackHitEventArgs.EventId, OnAttackHitEventArgs); AppEntry.Event.Subscribe(AttackHitEventArgs.EventId, OnAttackHitEventArgs);
_HpDamagePool = new UnitPool<HPDamageShowUnit>(GamePlayEntry.UI.m_NodeScreen); _HpDamagePool = new UnitPool<HPDamageShowUnit>(GamePlayEntry.UI.m_NodeScreen);
} }
public override void Update()
{
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
private void OnAttackHitEventArgs(object sender, LogicEventArgs e) private void OnAttackHitEventArgs(object sender, LogicEventArgs e)
{ {
AttackHitEventArgs msg = (AttackHitEventArgs)e; AttackHitEventArgs msg = (AttackHitEventArgs)e;

View File

@ -8,22 +8,39 @@ using System.Runtime.Remoting.Metadata.W3cXsd2001;
namespace Game namespace Game
{ {
public class BulletMgrComponent : GameComponent public class BulletMgrNoMono : NoMono
{ {
public PrefabPoolForPath _BulletPool; public PrefabPoolForPath _BulletPool;
class BullteInfo #region ÉúÃüÖÜÆÚ
{ public BulletMgrNoMono(string Name, Transform trans = null) : base(Name, trans)
}
private void OnEnable()
{ {
_BulletPool = new PrefabPoolForPath(this.transform, E_PREFAB_TYPE.NONE, _BulletPool = new PrefabPoolForPath(this.transform, E_PREFAB_TYPE.NONE,
Common.GetBulletProfabPath("1")); Common.GetBulletProfabPath("1"));
//×¢²á»Øµ÷
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
} }
public override void Update()
{
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
void NewBullet() void NewBullet()
{ {
GameObject obj = _BulletPool.GetAnyHide(); GameObject obj = _BulletPool.GetAnyHide();

View File

@ -0,0 +1,44 @@
using Axibug.Runtime;
using UnityEngine;
using UnityEditor;
using Axibug.Resources;
using System.Collections.Generic;
using System.Diagnostics.SymbolStore;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
namespace Game
{
public class EffectNoMono : NoMono
{
public PrefabPool<RoleFastShadow> rolegastEftPool;
#region ÉúÃüÖÜÆÚ
public EffectNoMono(string Name, Transform trans = null) : base(Name, trans)
{
rolegastEftPool = new PrefabPool<RoleFastShadow>(this.transform, E_PREFAB_TYPE.EFFECT);
//×¢²á»Øµ÷
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
}
public override void Update()
{
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
}
}

View File

@ -0,0 +1,19 @@
using System;
using UnityEngine;
namespace Game
{
[Flags]
public enum E_LIFE_MONO_CYCLE
{
Update = 1,
FixUpdate,
ApplicationPause,
ApplicationQuit
}
interface INoMonoBehaviour
{
public void AddEvent(E_LIFE_MONO_CYCLE type);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0dfef096df0f3224aa370ee013d22c4c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,13 +3,14 @@ using Axibug.Event;
using Axibug.Resources; using Axibug.Resources;
using Axibug.Runtime; using Axibug.Runtime;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace Game namespace Game
{ {
public class InputComponent : GameComponent public class InputNoMono : NoMono
{ {
public Vector2 InputV2 { get { return _InputV2; } } public Vector2 InputV2 { get { return _InputV2; } }
public bool Attack { get { return _Attack; } } public bool Attack { get { return _Attack; } }
@ -20,6 +21,37 @@ namespace Game
public InputMotionData mInputMotionData = new InputMotionData(); public InputMotionData mInputMotionData = new InputMotionData();
#region
public InputNoMono(string Name, Transform trans = null) :base(Name, trans)
{
mInputMotionData.OnEnable();
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
}
public override void Update()
{
if (!GamePlayEntry.MainPlayer.InGame)
return;
Update_Touch();
Update_Input();
Update_InputKeyCode();
//更新行为列表逻辑
mInputMotionData.Update_Logic();
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
private void Start() private void Start()
{ {
//事件注册 //事件注册
@ -36,13 +68,12 @@ namespace Game
void OnEnable() void OnEnable()
{ {
mInputMotionData.OnEnable();
} }
void OnDisable() //void OnDisable()
{ //{
mInputMotionData.OnDestory(); // mInputMotionData.OnDestory();
} //}
/// <summary> /// <summary>
/// 检测是否点击UI /// 检测是否点击UI
@ -142,18 +173,6 @@ namespace Game
return false; return false;
} }
// Update is called once per frame
void Update()
{
if (!GamePlayEntry.MainPlayer.InGame)
return;
Update_Touch();
Update_Input();
Update_InputKeyCode();
//更新行为列表逻辑
mInputMotionData.Update_Logic();
}
/// <summary> /// <summary>
/// 点击 /// 点击
@ -270,6 +289,7 @@ namespace Game
return false; return false;
} }
} }
#endregion #endregion
} }
} }

View File

@ -9,15 +9,34 @@ using static Axibug.Utility;
namespace Game namespace Game
{ {
public class LubanComponent : GameComponent public class LubanNoMono : NoMono
{ {
public Tables tables = null; public Tables tables = null;
// Start is called before the first frame update #region ÉúÃüÖÜÆÚ
void Start() public LubanNoMono(string Name, Transform trans = null) : base(Name, trans)
{ {
tables = new Tables(LoadByteBuf); tables = new Tables(LoadByteBuf);
//×¢²á»Øµ÷
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
} }
public override void Update()
{
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
public static string GetConfigBytesPath(string fileName) public static string GetConfigBytesPath(string fileName)
{ {

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.EventSystems;
namespace Game
{
public abstract class NoMono : INoMonoBehaviour
{
public Transform transform;
public GameObject gameObject;
public E_LIFE_MONO_CYCLE mMonoCyle;
public NoMono(string Name, Transform trans = null)
{
transform = trans;
gameObject = trans.gameObject;
NoMonoSys.RegisterNoMono(Name,this);
}
public void AddEvent(E_LIFE_MONO_CYCLE type)
{
mMonoCyle = type;
if ((type & E_LIFE_MONO_CYCLE.Update) > 0)
NoMonoSys.AddUpdateEvent(Update);
if ((type & E_LIFE_MONO_CYCLE.FixUpdate) > 0)
NoMonoSys.AddUpdateEvent(FixedUpdate);
if ((type & E_LIFE_MONO_CYCLE.ApplicationPause) > 0)
NoMonoSys.AddUpdateEvent(OnApplicationPause);
if ((type & E_LIFE_MONO_CYCLE.ApplicationQuit) > 0)
NoMonoSys.AddUpdateEvent(OnApplicationQuit);
}
public abstract void Update();
public abstract void FixedUpdate();
public abstract void OnApplicationPause();
public abstract void OnApplicationQuit();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4498ca1042e147149b733349e641d256
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -11,7 +11,7 @@ using UnityEngine;
namespace Game namespace Game
{ {
public class RoleMgrComponent : GameComponent public class RoleMgrNoMono : NoMono
{ {
private Queue<RoleBase> temp_RemoveUser = new Queue<RoleBase>();//ÐèÒªÒƳýµÄÍæ¼ÒÁбí private Queue<RoleBase> temp_RemoveUser = new Queue<RoleBase>();//ÐèÒªÒƳýµÄÍæ¼ÒÁбí
private Dictionary<long, RoleBase> dictAllRole = new Dictionary<long, RoleBase>(); private Dictionary<long, RoleBase> dictAllRole = new Dictionary<long, RoleBase>();
@ -22,10 +22,11 @@ namespace Game
private float temp_CheckTime = 0; private float temp_CheckTime = 0;
private float temp_RequestTime = 0; private float temp_RequestTime = 0;
private int mRoleIdSeed = 0; private int mRoleIdSeed = 0;
private void Start()
#region ÉúÃüÖÜÆÚ
public RoleMgrNoMono(string Name, Transform trans = null) : base(Name, trans)
{ {
//AppEntry.Event.Subscribe(UserMoveEventArgs.EventId, OnUserMoveEvent); //AppEntry.Event.Subscribe(UserMoveEventArgs.EventId, OnUserMoveEvent);
//AppEntry.Event.Subscribe(UserPlayerSkillEventArgs.EventId, OnUserPlayerSkill); //AppEntry.Event.Subscribe(UserPlayerSkillEventArgs.EventId, OnUserPlayerSkill);
@ -34,6 +35,30 @@ namespace Game
//AppEntry.Event.Subscribe(RoleLevelupEventArgs.EventId, OnRoleLevelUp); //AppEntry.Event.Subscribe(RoleLevelupEventArgs.EventId, OnRoleLevelUp);
//AppEntry.Event.Subscribe(AddRoleBufferEvent.EventId, AddBuffer); //AppEntry.Event.Subscribe(AddRoleBufferEvent.EventId, AddBuffer);
//AppEntry.Event.Subscribe(RemoveRoleBufferEvent.EventId, RemoveBuffer); //AppEntry.Event.Subscribe(RemoveRoleBufferEvent.EventId, RemoveBuffer);
AddEvent(E_LIFE_MONO_CYCLE.Update | E_LIFE_MONO_CYCLE.FixUpdate);
}
public override void Update()
{
}
public override void FixedUpdate()
{
}
public override void OnApplicationPause()
{
}
public override void OnApplicationQuit()
{
}
#endregion
private void Start()
{
} }
int GetNewRoleId() int GetNewRoleId()
@ -197,7 +222,7 @@ namespace Game
{ {
role.enabled = false; role.enabled = false;
RemoveRole(role); RemoveRole(role);
Destroy(role.gameObject); GameObject.Destroy(role.gameObject);
} }
private GameObject CloneRole(string RoleName,Transform parent) private GameObject CloneRole(string RoleName,Transform parent)
@ -227,7 +252,7 @@ namespace Game
return null; return null;
} }
GameObject go = Instantiate(asset, parent) as GameObject; GameObject go = GameObject.Instantiate(asset, parent) as GameObject;
if (go == null) if (go == null)
{ {
Debug.LogError("LoadPrefabByEditor2. go == null. asset:" + asset); Debug.LogError("LoadPrefabByEditor2. go == null. asset:" + asset);
@ -262,7 +287,7 @@ namespace Game
return null; return null;
} }
GameObject go = Instantiate(asset, parent) as GameObject; GameObject go = GameObject.Instantiate(asset, parent) as GameObject;
if (go == null) if (go == null)
{ {
Debug.LogError("LoadPrefabByEditor2. go == null. asset:" + asset); Debug.LogError("LoadPrefabByEditor2. go == null. asset:" + asset);
@ -278,6 +303,7 @@ namespace Game
mRigidbody.constraints = RigidbodyConstraints.FreezeRotation; mRigidbody.constraints = RigidbodyConstraints.FreezeRotation;
} }
} }
} }

View File

@ -0,0 +1,153 @@
using Axibug;
using Axibug.Event;
using Axibug.Runtime;
using Codice.Client.Common.TreeGrouper;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Odbc;
using System.Xml.Serialization;
using UnityEngine;
using UnityEngine.SceneManagement;
using static Game.NoMonoComponent;
namespace Game
{
public class NoMonoComponent : GameComponent
{
public List<NoMonoInfo> NoMonoInfos = new List<NoMonoInfo>();
public event Action ApplicationPauseEvent;
public event Action ApplicationQuitEvent;
public event Action UpdateEvent;
public event Action FixedUpdateEvent;
public event Action<Scene, LoadSceneMode> SceneChangedEvent;
[Serializable]
public class NoMonoInfo
{
public string Name;
public GameObject Obj;
public NoMono noMono;
}
protected override void Awake()
{
base.Awake();
}
#region ÌṩÉúÃüÖÜÆÚ
void Update()
{
//for (int i = 0; i < Nodes.Count; i++)
// Nodes[i].Update();
UpdateEvent?.Invoke();
}
void FixedUpdate()
{
//for (int i = 0; i < Nodes.Count; i++)
// Nodes[i].FixedUpdate();
FixedUpdateEvent?.Invoke();
}
private void OnApplicationPause(bool pauseStatus)
{
if (pauseStatus)
{
ApplicationPauseEvent?.Invoke();
}
}
private void OnApplicationQuit()
{
ApplicationQuitEvent?.Invoke();
}
#endregion
}
public static class NoMonoSys
{
static private NoMonoComponent _monoController => GamePlayEntry.NoMono;
static public void RegisterNoMono(string Name, NoMono node)
{
_monoController.NoMonoInfos.Add(new NoMonoInfo() { Name = Name, Obj = node.gameObject, noMono = node });
}
static public Coroutine StartCoroutine(IEnumerator routine)
{
return _monoController.StartCoroutine(routine);
}
static public void StopCoroutine(IEnumerator routine)
{
if (_monoController != null)
{
_monoController.StopCoroutine(routine);
}
}
static public void AddApplicationQuitEvent(Action action)
{
_monoController.ApplicationQuitEvent += action;
}
static public void RemoveApplicationQuitEvent(Action action)
{
_monoController.ApplicationQuitEvent -= action;
}
static public void AddApplicationPauseEvent(Action action)
{
_monoController.ApplicationPauseEvent += action;
}
static public void RemoveApplicationPauseEvent(Action action)
{
_monoController.ApplicationPauseEvent -= action;
}
static public void AddUpdateEvent(Action action)
{
_monoController.UpdateEvent += action;
}
static public void RemoveUpdateEvent(Action action)
{
_monoController.UpdateEvent -= action;
}
static public void AddSceneChangedEvent(Action<Scene, LoadSceneMode> action)
{
_monoController.SceneChangedEvent += action;
}
static public void RemoveSceneChangedEvent(Action<Scene, LoadSceneMode> action)
{
_monoController.SceneChangedEvent -= action;
}
static public IEnumerator DelayCall(float delayTime, Action action, bool isRealTime = false)
{
var coroutine = DelayCallCoroutine();
StartCoroutine(coroutine);
return coroutine;
IEnumerator DelayCallCoroutine()
{
if (isRealTime)
{
yield return new WaitForSecondsRealtime(delayTime);
}
else
{
yield return new WaitForSeconds(delayTime);
}
action?.Invoke();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d628ef740e7b0d440b49aebf096af744
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: