using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using UnityEngine.UI; using static System.Net.Mime.MediaTypeNames; namespace ET.Client { [FriendOf(typeof(UIInvateComponent))] public static class UIInvateComponentSystem { [ObjectSystem] public class UIInvateComponentAwakeSystem : AwakeSystem<UIInvateComponent> { protected override void Awake(UIInvateComponent self, params object[] param) { ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>(); self.InvateObj = rc.Get<GameObject>("InvateObj"); self.UnInvateObj = rc.Get<GameObject>("UnInvateObj"); self.yourInvate = rc.Get<GameObject>("yourInvate"); self.invateInput = rc.Get<GameObject>("invateInput"); self.sureBtn = rc.Get<GameObject>("sureBtn"); self.sureBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnSureBtn(); }); self.Init(); } } private static void Init(this UIInvateComponent self) { self.UnInvateObj.SetActive(false); self.InvateObj.SetActive(true); } public static async void OnSureBtn(this UIInvateComponent self) { await SoundManager.Instance.PlaySound("clickbtnsound"); self.OnCloseAsync(); } public static async void OnCloseAsync(this UIInvateComponent self) { await UIHelper.Remove(self.ClientScene(),UIType.UIInvate); } } }