TH1/Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs
2025-07-17 18:26:28 +08:00

26 lines
853 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace ET.Client
{
[EntitySystemOf(typeof(UILobbyComponent))]
[FriendOf(typeof(UILobbyComponent))]
public static partial class UILobbyComponentSystem
{
[EntitySystem]
private static void Awake(this UILobbyComponent self)
{
ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
self.enterMap = rc.Get<GameObject>("EnterMap");
self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap().Coroutine(); });
}
public static async ETTask EnterMap(this UILobbyComponent self)
{
Scene root = self.Root();
await EnterMapHelper.EnterMapAsync(root);
await UIHelper.Remove(root, UIType.UILobby);
}
}
}