Browse Source

客户端bug修复 (#195)

* 修复ReferenceCollector组件字段不能赋值的bug

* 修复UILobbyComponentAwakeSystem获取ReferenceCollector组件报错的bug

* 修复Unit预制体为空的bug

* 调通客户端进map场景流程
m969 5 years ago
parent
commit
d714de87d5

+ 8 - 2
Server/Hotfix/Demo/UnitPathComponentSystem.cs

@@ -34,6 +34,14 @@ namespace ET
             self.Target = target;
 
             Unit unit = self.GetParent<Unit>();
+            unit.Position = target;
+
+            M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult();
+            m2CPathfindingResult.X = unit.Position.x;
+            m2CPathfindingResult.Y = unit.Position.y;
+            m2CPathfindingResult.Z = unit.Position.z;
+            m2CPathfindingResult.Id = unit.Id;
+            MessageHelper.Broadcast(unit, m2CPathfindingResult);
         }
 
         // 从index找接下来3个点,广播
@@ -46,8 +54,6 @@ namespace ET
             m2CPathfindingResult.Y = unitPos.y;
             m2CPathfindingResult.Z = unitPos.z;
             m2CPathfindingResult.Id = unit.Id;
-            
-            
             MessageHelper.Broadcast(unit, m2CPathfindingResult);
         }
     }

+ 1 - 1
Unity/Assets/Editor/ReferenceCollectorEditor/ReferenceCollectorEditor.cs

@@ -104,7 +104,7 @@ public class ReferenceCollectorEditor: Editor
             property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("key");
             EditorGUILayout.TextField(property.stringValue, GUILayout.Width(150));
             property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("gameObject");
-            EditorGUILayout.ObjectField(property.objectReferenceValue, typeof(Object), true);
+            property.objectReferenceValue = EditorGUILayout.ObjectField(property.objectReferenceValue, typeof(Object), true);
 			if (GUILayout.Button("X"))
 			{
                 //将元素添加进删除list

+ 1 - 2
Unity/Assets/Hotfix/Move/M2C_PathfindingResultHandler.cs

@@ -6,8 +6,7 @@
 		protected override async ETTask Run(Session session, M2C_PathfindingResult message)
 		{
 			Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id);
-			
-			
+			unit.GameObject.transform.position = unit.Position = new UnityEngine.Vector3(message.X, message.Y, message.Z);
 			await ETTask.CompletedTask;
 		}
 	}

+ 1 - 17
Unity/Assets/Hotfix/Scene/MapHelper.cs

@@ -9,24 +9,8 @@ namespace ET
         {
             try
             {
-                /*
-                // 加载Unit资源
-                ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
-                await resourcesComponent.LoadBundleAsync($"unit.unity3d");
-
-                // 加载场景资源
-                await Game.Scene.GetComponent<ResourcesComponent>().LoadBundleAsync("map.unity3d");
-                // 切换到map场景
-                using (SceneChangeComponent sceneChangeComponent = Game.Scene.AddComponent<SceneChangeComponent>())
-                {
-                    await sceneChangeComponent.ChangeSceneAsync(sceneName);
-                }
-				*/
                 G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
-				
-                //Game.Scene.AddComponent<OperaComponent>();
-				
-                Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene});
+                Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene}).Coroutine();
             }
             catch (Exception e)
             {

+ 1 - 1
Unity/Assets/Hotfix/Unit/M2C_CreateUnitsHandler.cs

@@ -8,7 +8,7 @@ namespace ET
 	{
 		protected override async ETTask Run(Session session, M2C_CreateUnits message)
 		{	
-			UnitComponent unitComponent = Game.Scene.GetComponent<UnitComponent>();
+			UnitComponent unitComponent = Game.Scene.Get(0).GetComponent<UnitComponent>();
 			
 			foreach (UnitInfo unitInfo in message.Units)
 			{

+ 1 - 1
Unity/Assets/Hotfix/Unit/UnitFactory.cs

@@ -12,7 +12,7 @@ namespace ET
 
 	        Game.EventSystem.Publish(new EventType.AfterUnitCreate() {Unit = unit});
 	        
-	        UnitComponent unitComponent = Game.Scene.GetComponent<UnitComponent>();
+	        UnitComponent unitComponent = Game.Scene.Get(0).GetComponent<UnitComponent>();
             unitComponent.Add(unit);
             return unit;
         }

+ 2 - 1
Unity/Assets/HotfixView/AppStart_Init.cs

@@ -21,8 +21,9 @@ namespace ET
             Game.Scene.AddComponent<MessageDispatcherComponent>();
             Game.Scene.AddComponent<UIEventComponent>();
 
+            ResourcesComponent.Instance.LoadBundle("unit.unity3d");
 
-            Scene zoneScene = await SceneFactory.CreateZoneScene(1, 0, "Game");
+            Scene zoneScene = await SceneFactory.CreateZoneScene(0, 0, "Game");
 
             await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
         }

+ 9 - 1
Unity/Assets/HotfixView/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs

@@ -4,7 +4,15 @@
 	{
 		public override async ETTask Run(EventType.EnterMapFinish args)
 		{
-			await UIHelper.Remove(args.ZoneScene, UIType.UILobby);
+			// 加载场景资源
+			await Game.Scene.GetComponent<ResourcesComponent>().LoadBundleAsync("map.unity3d");
+			// 切换到map场景
+			using (SceneChangeComponent sceneChangeComponent = Game.Scene.AddComponent<SceneChangeComponent>())
+			{
+				await sceneChangeComponent.ChangeSceneAsync("Map");
+			}
+            Game.Scene.Get(0).AddComponent<OperaComponent>();
+            await UIHelper.Remove(args.ZoneScene, UIType.UILobby);
 		}
 	}
 }

+ 2 - 2
Unity/Assets/HotfixView/UI/UILobby/UILobbyComponentSystem.cs

@@ -7,7 +7,7 @@ namespace ET
     {
         public override void Awake(UILobbyComponent self)
         {
-            ReferenceCollector rc = self.GetParent<UI>().ViewGO.GetComponent<ReferenceCollector>();
+            ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
 			
             self.enterMap = rc.Get<GameObject>("EnterMap");
             self.enterMap.GetComponent<Button>().onClick.AddListener(self.EnterMap);
@@ -22,4 +22,4 @@ namespace ET
             MapHelper.EnterMapAsync(self.ZoneScene(), "Map").Coroutine();
         }
     }
-}
+}

+ 2 - 1
Unity/Assets/HotfixView/Unit/AfterUnitCreate_CreateUnitView.cs

@@ -12,7 +12,8 @@ namespace ET
             GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
 	        
             GameObject go = UnityEngine.Object.Instantiate(prefab);
-            
+            GameObject.DontDestroyOnLoad(go);
+            args.Unit.GameObject = go;
             args.Unit.AddComponent<AnimatorComponent>();
         }
     }

+ 0 - 8
Unity/Assets/Model/Move.meta

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

+ 2 - 1
Unity/Assets/Scenes/Init.unity

@@ -442,7 +442,8 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   data:
   - key: Unit
-    gameObject: {fileID: 0}
+    gameObject: {fileID: 1610378981859644, guid: cfaf4529ce2243c4c85126e9d008897b,
+      type: 3}
 --- !u!1 &872594939
 GameObject:
   m_ObjectHideFlags: 0

File diff suppressed because it is too large
+ 149 - 49
Unity/Assets/Scenes/Map.unity


+ 16 - 18
Unity/Packages/packages-lock.json

@@ -19,7 +19,7 @@
       "dependencies": {
         "com.unity.ugui": "1.0.0"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.analytics": {
       "version": "3.3.5",
@@ -28,44 +28,44 @@
       "dependencies": {
         "com.unity.ugui": "1.0.0"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.assetbundlebrowser": {
       "version": "1.7.0",
       "depth": 0,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.collab-proxy": {
       "version": "1.2.16",
       "depth": 0,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.ext.nunit": {
       "version": "1.0.0",
       "depth": 1,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.ide.rider": {
       "version": "1.1.4",
       "depth": 0,
       "source": "registry",
       "dependencies": {
-        "com.unity.test-framework": "1.1.3"
+        "com.unity.test-framework": "1.1.1"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.ide.vscode": {
       "version": "1.2.1",
       "depth": 0,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.multiplayer-hlapi": {
       "version": "1.0.6",
@@ -74,16 +74,14 @@
       "dependencies": {
         "nuget.mono-cecil": "0.1.6-preview"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.purchasing": {
       "version": "2.1.0",
       "depth": 0,
       "source": "registry",
-      "dependencies": {
-        "com.unity.ugui": "1.0.0"
-      },
-      "url": "https://packages.unity.cn"
+      "dependencies": {},
+      "url": "https://packages.unity.com"
     },
     "com.unity.test-framework": {
       "version": "1.1.16",
@@ -94,7 +92,7 @@
         "com.unity.modules.imgui": "1.0.0",
         "com.unity.modules.jsonserialize": "1.0.0"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.textmeshpro": {
       "version": "2.0.1",
@@ -103,14 +101,14 @@
       "dependencies": {
         "com.unity.ugui": "1.0.0"
       },
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.timeline": {
       "version": "1.2.10",
       "depth": 0,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.ugui": {
       "version": "1.0.0",
@@ -126,14 +124,14 @@
       "depth": 0,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "nuget.mono-cecil": {
       "version": "0.1.6-preview",
       "depth": 1,
       "source": "registry",
       "dependencies": {},
-      "url": "https://packages.unity.cn"
+      "url": "https://packages.unity.com"
     },
     "com.unity.modules.ai": {
       "version": "1.0.0",

File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.Editor.csproj


File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.Hotfix.csproj


File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.HotfixView.csproj


File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.Model.csproj


File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.ModelView.csproj


File diff suppressed because it is too large
+ 1 - 5
Unity/Unity.ThirdParty.csproj


+ 8 - 8
Unity/Unity.sln

@@ -1,16 +1,16 @@
 
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{E15BADD2-3A26-309A-AB0F-DC5B08044350}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.HotfixView", "Unity.HotfixView.csproj", "{D31345DE-9B88-525C-8E9C-744C99AE7509}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.csproj", "{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ModelView", "Unity.ModelView.csproj", "{2F8409C1-DA01-D464-DBF2-00C6449E459E}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.HotfixView", "Unity.HotfixView.csproj", "{D31345DE-9B88-525C-8E9C-744C99AE7509}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{CD311104-1830-B119-81B6-5DBEE2467FFB}"
 EndProject
 Global
@@ -23,6 +23,10 @@ Global
 		{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Release|Any CPU.Build.0 = Release|Any CPU
 		{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -35,10 +39,6 @@ Global
 		{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{D31345DE-9B88-525C-8E9C-744C99AE7509}.Release|Any CPU.Build.0 = Release|Any CPU
 		{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU

Some files were not shown because too many files changed in this diff