未验证 提交 d714de87 编写于 作者: M m969 提交者: GitHub

客户端bug修复 (#195)

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

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

* 修复Unit预制体为空的bug

* 调通客户端进map场景流程
上级 6ab47a24
...@@ -34,6 +34,14 @@ namespace ET ...@@ -34,6 +34,14 @@ namespace ET
self.Target = target; self.Target = target;
Unit unit = self.GetParent<Unit>(); 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个点,广播 // 从index找接下来3个点,广播
...@@ -46,8 +54,6 @@ namespace ET ...@@ -46,8 +54,6 @@ namespace ET
m2CPathfindingResult.Y = unitPos.y; m2CPathfindingResult.Y = unitPos.y;
m2CPathfindingResult.Z = unitPos.z; m2CPathfindingResult.Z = unitPos.z;
m2CPathfindingResult.Id = unit.Id; m2CPathfindingResult.Id = unit.Id;
MessageHelper.Broadcast(unit, m2CPathfindingResult); MessageHelper.Broadcast(unit, m2CPathfindingResult);
} }
} }
......
...@@ -104,7 +104,7 @@ public class ReferenceCollectorEditor: Editor ...@@ -104,7 +104,7 @@ public class ReferenceCollectorEditor: Editor
property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("key"); property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("key");
EditorGUILayout.TextField(property.stringValue, GUILayout.Width(150)); EditorGUILayout.TextField(property.stringValue, GUILayout.Width(150));
property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("gameObject"); 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")) if (GUILayout.Button("X"))
{ {
//将元素添加进删除list //将元素添加进删除list
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
protected override async ETTask Run(Session session, M2C_PathfindingResult message) protected override async ETTask Run(Session session, M2C_PathfindingResult message)
{ {
Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id); 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; await ETTask.CompletedTask;
} }
} }
......
...@@ -9,24 +9,8 @@ namespace ET ...@@ -9,24 +9,8 @@ namespace ET
{ {
try 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; G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene}).Coroutine();
//Game.Scene.AddComponent<OperaComponent>();
Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene});
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -8,7 +8,7 @@ namespace ET ...@@ -8,7 +8,7 @@ namespace ET
{ {
protected override async ETTask Run(Session session, M2C_CreateUnits message) 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) foreach (UnitInfo unitInfo in message.Units)
{ {
......
...@@ -12,7 +12,7 @@ namespace ET ...@@ -12,7 +12,7 @@ namespace ET
Game.EventSystem.Publish(new EventType.AfterUnitCreate() {Unit = unit}); 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); unitComponent.Add(unit);
return unit; return unit;
} }
......
...@@ -21,8 +21,9 @@ namespace ET ...@@ -21,8 +21,9 @@ namespace ET
Game.Scene.AddComponent<MessageDispatcherComponent>(); Game.Scene.AddComponent<MessageDispatcherComponent>();
Game.Scene.AddComponent<UIEventComponent>(); 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 }); await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
} }
......
...@@ -4,7 +4,15 @@ ...@@ -4,7 +4,15 @@
{ {
public override async ETTask Run(EventType.EnterMapFinish args) 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);
} }
} }
} }
...@@ -7,7 +7,7 @@ namespace ET ...@@ -7,7 +7,7 @@ namespace ET
{ {
public override void Awake(UILobbyComponent self) 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 = rc.Get<GameObject>("EnterMap");
self.enterMap.GetComponent<Button>().onClick.AddListener(self.EnterMap); self.enterMap.GetComponent<Button>().onClick.AddListener(self.EnterMap);
...@@ -22,4 +22,4 @@ namespace ET ...@@ -22,4 +22,4 @@ namespace ET
MapHelper.EnterMapAsync(self.ZoneScene(), "Map").Coroutine(); MapHelper.EnterMapAsync(self.ZoneScene(), "Map").Coroutine();
} }
} }
} }
\ No newline at end of file
...@@ -12,7 +12,8 @@ namespace ET ...@@ -12,7 +12,8 @@ namespace ET
GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton"); GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
GameObject go = UnityEngine.Object.Instantiate(prefab); GameObject go = UnityEngine.Object.Instantiate(prefab);
GameObject.DontDestroyOnLoad(go);
args.Unit.GameObject = go;
args.Unit.AddComponent<AnimatorComponent>(); args.Unit.AddComponent<AnimatorComponent>();
} }
} }
......
fileFormatVersion: 2
guid: 22d6f792265e14b95ae06ccb3a11601d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -442,7 +442,8 @@ MonoBehaviour: ...@@ -442,7 +442,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
data: data:
- key: Unit - key: Unit
gameObject: {fileID: 0} gameObject: {fileID: 1610378981859644, guid: cfaf4529ce2243c4c85126e9d008897b,
type: 3}
--- !u!1 &872594939 --- !u!1 &872594939
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
此差异已折叠。
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.analytics": { "com.unity.analytics": {
"version": "3.3.5", "version": "3.3.5",
...@@ -28,44 +28,44 @@ ...@@ -28,44 +28,44 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.assetbundlebrowser": { "com.unity.assetbundlebrowser": {
"version": "1.7.0", "version": "1.7.0",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.collab-proxy": { "com.unity.collab-proxy": {
"version": "1.2.16", "version": "1.2.16",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.0", "version": "1.0.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.rider": { "com.unity.ide.rider": {
"version": "1.1.4", "version": "1.1.4",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "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": { "com.unity.ide.vscode": {
"version": "1.2.1", "version": "1.2.1",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.multiplayer-hlapi": { "com.unity.multiplayer-hlapi": {
"version": "1.0.6", "version": "1.0.6",
...@@ -74,16 +74,14 @@ ...@@ -74,16 +74,14 @@
"dependencies": { "dependencies": {
"nuget.mono-cecil": "0.1.6-preview" "nuget.mono-cecil": "0.1.6-preview"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.purchasing": { "com.unity.purchasing": {
"version": "2.1.0", "version": "2.1.0",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {},
"com.unity.ugui": "1.0.0" "url": "https://packages.unity.com"
},
"url": "https://packages.unity.cn"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.16", "version": "1.1.16",
...@@ -94,7 +92,7 @@ ...@@ -94,7 +92,7 @@
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.textmeshpro": { "com.unity.textmeshpro": {
"version": "2.0.1", "version": "2.0.1",
...@@ -103,14 +101,14 @@ ...@@ -103,14 +101,14 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.2.10", "version": "1.2.10",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
...@@ -126,14 +124,14 @@ ...@@ -126,14 +124,14 @@
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"nuget.mono-cecil": { "nuget.mono-cecil": {
"version": "0.1.6-preview", "version": "0.1.6-preview",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010 # Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{E15BADD2-3A26-309A-AB0F-DC5B08044350}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{E15BADD2-3A26-309A-AB0F-DC5B08044350}"
EndProject 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.csproj", "{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ModelView", "Unity.ModelView.csproj", "{2F8409C1-DA01-D464-DBF2-00C6449E459E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ModelView", "Unity.ModelView.csproj", "{2F8409C1-DA01-D464-DBF2-00C6449E459E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}"
EndProject 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{CD311104-1830-B119-81B6-5DBEE2467FFB}"
EndProject EndProject
Global Global
...@@ -23,6 +23,10 @@ Global ...@@ -23,6 +23,10 @@ Global
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}.Debug|Any CPU.Build.0 = 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 {B4BF9894-F5D9-41C4-13E3-3F26F7700E29}.Release|Any CPU.ActiveCfg = Release|Any CPU
...@@ -35,10 +39,6 @@ Global ...@@ -35,10 +39,6 @@ Global
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.Build.0 = 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 {CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册