提交 0dce8be3 编写于 作者: T tanghai

显示出登录界面

上级 937a2539
......@@ -11,14 +11,20 @@ namespace ET
//await BundleHelper.DownloadBundle("1111");
// 加载配置
Game.Scene.AddComponent<ResourcesComponent>().LoadBundle("config.unity3d");
Game.Scene.AddComponent<ResourcesComponent>();
ResourcesComponent.Instance.LoadBundle("config.unity3d");
Game.Scene.AddComponent<ConfigComponent>();
Game.Scene.GetComponent<ResourcesComponent>().UnloadBundle("config.unity3d");
ResourcesComponent.Instance.UnloadBundle("config.unity3d");
Game.Scene.AddComponent<OpcodeTypeComponent>();
Game.Scene.AddComponent<MessageDispatcherComponent>();
Game.Scene.AddComponent<UIEventComponent>();
Scene zoneScene = await SceneFactory.CreateZoneScene(1, 0, "Game");
await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
}
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ namespace ET
{
Scene zoneScene = args.ZoneScene;
zoneScene.AddComponent<ResourcesComponent>();
zoneScene.AddComponent<UIComponent>();
}
}
}
\ No newline at end of file
......@@ -9,8 +9,9 @@ namespace ET
zoneScene.AddComponent<NetOuterComponent>();
zoneScene.AddComponent<PlayerComponent>();
zoneScene.AddComponent<UnitComponent>();
await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene());
// UI层的初始化
await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene() {ZoneScene = zoneScene});
return zoneScene;
}
......
fileFormatVersion: 2
guid: 7cbe6b8dba0d1462e8ef45f7674b9794
guid: 6132d5efb1bae460db2ef73d954f24e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -2,9 +2,9 @@
namespace ET
{
public class AfterCreateZoneScene_RemoveLoginUI: AEvent<EventType.AfterCreateZoneScene>
public class AppStartInitFinish_RemoveLoginUI: AEvent<EventType.AppStartInitFinish>
{
public override async ETTask Run(EventType.AfterCreateZoneScene args)
public override async ETTask Run(EventType.AppStartInitFinish args)
{
await UIHelper.Create(args.ZoneScene, UIType.UILogin);
}
......
fileFormatVersion: 2
guid: f86b269e7cff94f3cb2a36780d7a9f27
guid: 8ca3bab3d15364846a895a2545184b52
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -10,7 +10,7 @@ namespace ET
{
public override void Awake(UILoginComponent self)
{
ReferenceCollector rc = self.GetParent<UI>().ViewGO.GetComponent<ReferenceCollector>();
ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
self.loginBtn = rc.Get<GameObject>("LoginBtn");
self.loginBtn.GetComponent<Button>().onClick.AddListener(self.OnLogin);
self.account = rc.Get<GameObject>("Account");
......
......@@ -16,6 +16,11 @@
public Scene LoginScene;
}
public struct AppStartInitFinish
{
public Scene ZoneScene;
}
public struct LoginFinish
{
public Scene ZoneScene;
......
......@@ -165,9 +165,19 @@ namespace ET
}
}
public class ResourcesComponentAwakeSystem: AwakeSystem<ResourcesComponent>
{
public override void Awake(ResourcesComponent self)
{
ResourcesComponent.Instance = self;
}
}
public class ResourcesComponent : Entity
{
public static ResourcesComponent Instance;
public static AssetBundleManifest AssetBundleManifestObject { get; set; }
private readonly Dictionary<string, Dictionary<string, UnityEngine.Object>> resourceCache = new Dictionary<string, Dictionary<string, UnityEngine.Object>>();
......
......@@ -43,7 +43,7 @@ namespace ET
/// </summary>
public void Turn2D(Vector3 dir, float turnTime = 0.1f)
{
Vector3 nexpos = this.GetParent<Unit>().ViewGO.transform.position + dir;
Vector3 nexpos = this.GetParent<Unit>().GameObject.transform.position + dir;
Turn(nexpos, turnTime);
}
......
using Quaternion = UnityEngine.Quaternion;
using UnityEngine;
using Quaternion = UnityEngine.Quaternion;
using Vector3 = UnityEngine.Vector3;
namespace ET
{
public sealed class Unit: Entity
{
// 先放这里,去掉ViewGO,后面挪到显示层
public GameObject GameObject;
public int ConfigId;
public UnitConfig Config
......
......@@ -21,11 +21,11 @@ namespace ET
public string Name { get; private set; }
public Dictionary<string, UI> children = new Dictionary<string, UI>();
public Dictionary<string, UI> nameChildren = new Dictionary<string, UI>();
public void Awake(string name, GameObject gameObject)
{
this.children.Clear();
this.nameChildren.Clear();
gameObject.AddComponent<ComponentView>().Component = this;
gameObject.layer = LayerMask.NameToLayer(LayerNames.UI);
this.Name = name;
......@@ -41,45 +41,45 @@ namespace ET
base.Dispose();
foreach (UI ui in this.children.Values)
foreach (UI ui in this.nameChildren.Values)
{
ui.Dispose();
}
UnityEngine.Object.Destroy(this.ViewGO);
children.Clear();
UnityEngine.Object.Destroy(this.GameObject);
this.nameChildren.Clear();
}
public void SetAsFirstSibling()
{
this.ViewGO.transform.SetAsFirstSibling();
this.GameObject.transform.SetAsFirstSibling();
}
public void Add(UI ui)
{
this.children.Add(ui.Name, ui);
this.nameChildren.Add(ui.Name, ui);
ui.Parent = this;
}
public void Remove(string name)
{
UI ui;
if (!this.children.TryGetValue(name, out ui))
if (!this.nameChildren.TryGetValue(name, out ui))
{
return;
}
this.children.Remove(name);
this.nameChildren.Remove(name);
ui.Dispose();
}
public UI Get(string name)
{
UI child;
if (this.children.TryGetValue(name, out child))
if (this.nameChildren.TryGetValue(name, out child))
{
return child;
}
GameObject childGameObject = this.ViewGO.transform.Find(name)?.gameObject;
GameObject childGameObject = this.GameObject.transform.Find(name)?.gameObject;
if (childGameObject == null)
{
return null;
......
......@@ -40,7 +40,7 @@ namespace ET
public void Awake()
{
Animator animator = this.GetParent<Unit>().ViewGO.GetComponent<Animator>();
Animator animator = this.GetParent<Unit>().GameObject.GetComponent<Animator>();
if (animator == null)
{
......
......@@ -65,7 +65,6 @@
<Compile Include="Assets\Hotfix\Move\M2C_PathfindingResultHandler.cs" />
<Compile Include="Assets\Hotfix\Scene\LoginHelper.cs" />
<Compile Include="Assets\Hotfix\Scene\MapHelper.cs" />
<Compile Include="Assets\Hotfix\Scene\SceneFactory.cs" />
<Compile Include="Assets\Hotfix\Unit\M2C_CreateUnitsHandler.cs" />
<Compile Include="Assets\Hotfix\Unit\PlayerFactory.cs" />
<Compile Include="Assets\Hotfix\Unit\UnitFactory.cs" />
......
......@@ -63,6 +63,7 @@
<Compile Include="Assets\HotfixView\Module\UI\UIComponentSystem.cs" />
<Compile Include="Assets\HotfixView\Module\UI\UIEventComponentSystem.cs" />
<Compile Include="Assets\HotfixView\Scene\AfterCreateZoneScene_AddComponent.cs" />
<Compile Include="Assets\HotfixView\Scene\SceneFactory.cs" />
<Compile Include="Assets\HotfixView\UI\UIHelper.cs" />
<Compile Include="Assets\HotfixView\UI\UILoading\LoadingBeginEvent_CreateLoadingUI.cs" />
<Compile Include="Assets\HotfixView\UI\UILoading\LoadingFinishEvent_RemoveLoadingUI.cs" />
......@@ -72,7 +73,7 @@
<Compile Include="Assets\HotfixView\UI\UILobby\LoginFinish_CreateLobbyUI.cs" />
<Compile Include="Assets\HotfixView\UI\UILobby\UILobbyComponentSystem.cs" />
<Compile Include="Assets\HotfixView\UI\UILobby\UILobbyEvent.cs" />
<Compile Include="Assets\HotfixView\UI\UILogin\AfterCreateZoneScene_CreateLoginUI.cs" />
<Compile Include="Assets\HotfixView\UI\UILogin\AppStartInitFinish_CreateLoginUI.cs" />
<Compile Include="Assets\HotfixView\UI\UILogin\LoginFinish_RemoveLoginUI.cs" />
<Compile Include="Assets\HotfixView\UI\UILogin\UILoginComponentSystem.cs" />
<Compile Include="Assets\HotfixView\UI\UILogin\UILoginEvent.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册