Browse Source

添加脚本

蓝色星空 1 year ago
parent
commit
7266ef4c70

+ 39 - 0
Assets/Game/Blue/0.F/BlueRoot.prefab

@@ -10,6 +10,9 @@ GameObject:
   m_Component:
   - component: {fileID: 3274897787036747888}
   - component: {fileID: 5869122083670888403}
+  - component: {fileID: 7409934566693514613}
+  - component: {fileID: 6195766569180850275}
+  - component: {fileID: 8415422319146954477}
   m_Layer: 0
   m_Name: BlueRoot
   m_TagString: Untagged
@@ -44,3 +47,39 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: efb17cf06ae01a9439af31afa921a9ae, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+--- !u!114 &7409934566693514613
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8253213312023144010}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: b0e7ee926e8752d44b518d4b36cbe970, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &6195766569180850275
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8253213312023144010}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 13f18050a8125144196cdf02b8eced3c, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &8415422319146954477
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8253213312023144010}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 1680d6e55f580a6409d98f775bd42500, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 

+ 22 - 0
Assets/Game/Blue/0.F/BlueSingleton.cs

@@ -0,0 +1,22 @@
+namespace Blue
+{
+    /// <summary>
+    /// 单例模式的基类
+    /// </summary>
+    public class BlueSingleton<T> where T : BlueSingleton<T>, new()
+    {
+        private static T instance;
+
+        public static T Instance
+        {
+            get
+            {
+                if (instance == null)
+                {
+                    instance = new T();
+                }
+                return instance;
+            }
+        }
+    }
+}

+ 11 - 0
Assets/Game/Blue/0.F/BlueSingleton.cs.meta

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

+ 34 - 0
Assets/Game/Blue/0.F/SceneIOCContainer.cs

@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using Blue;
+
+namespace GHZLangChao
+{
+    /// <summary>
+    /// 场景IOC容器,用于存储对象、物体
+    /// </summary>
+    public class SceneIOCContainer : BlueSingleton<SceneIOCContainer>
+    {
+        private Dictionary<string, object> objContainer = new Dictionary<string, object>();
+
+        public void Push(string objName, object obj)
+        {
+            if (objContainer.ContainsKey(objName))
+            {
+                objContainer[objName] = obj;
+            }
+            else
+            {
+                objContainer.Add(objName, obj);
+            }
+        }
+
+        public object Pull(string objName)
+        {
+            if (objContainer.ContainsKey(objName))
+            {
+                return objContainer[objName];
+            }
+            return null;
+        }
+    }
+}

+ 11 - 0
Assets/Game/Blue/0.F/SceneIOCContainer.cs.meta

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

+ 15 - 0
Assets/Game/Blue/System/CommandSystem.cs

@@ -0,0 +1,15 @@
+using Blue;
+
+namespace GHZLangChao
+{
+    public class CommandSystem : SingletonMonobehaviour<CommandSystem>
+    {
+        /// <summary>
+        /// 发送命令
+        /// </summary>
+        public void Send(ICommand command)
+        {
+            this.SendCommand(command);
+        }
+    }
+}

+ 11 - 0
Assets/Game/Blue/System/CommandSystem.cs.meta

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

+ 24 - 0
Assets/Game/Blue/System/GetObjectSystem.cs

@@ -0,0 +1,24 @@
+using Blue;
+using UnityEngine;
+
+namespace GHZLangChao
+{
+    public class GetObjectSystem : SingletonMonobehaviour<GetObjectSystem>
+    {
+        //[SerializeField] private GameObject mesh_test;
+        //[SerializeField] private GameObject ARSpaceForAll;
+        private void Awake()
+        {
+            GetObj();
+            PushIOC();
+        }
+
+        private void GetObj()
+        {
+        }
+
+        private void PushIOC()
+        {
+        }
+    }
+}

+ 11 - 0
Assets/Game/Blue/System/GetObjectSystem.cs.meta

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

+ 16 - 0
Assets/Game/Blue/System/InstantiateSystem.cs

@@ -0,0 +1,16 @@
+using Blue;
+using UnityEngine;
+
+namespace GHZLangChao
+{
+    public class InstantiateSystem : SingletonMonobehaviour<InstantiateSystem>
+    {
+        //[SerializeField] private BlueObject blueObject;
+        //public BlueObject BlueObject => blueObject;
+
+        public void InstantiatePrefab(GameObject prefab, GameObject parent = null)
+        {
+            Instantiate(prefab, parent.transform);
+        }
+    }
+}

+ 11 - 0
Assets/Game/Blue/System/InstantiateSystem.cs.meta

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