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(UIMessageComponent))] public static class UIMessageComponentSystem { [ObjectSystem] public class UIMessageComponentAwakeSystem : AwakeSystem<UIMessageComponent> { protected override void Awake(UIMessageComponent self, params object[] param) { ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>(); self.sureBtn = rc.Get<GameObject>("sureBtn"); self.sureBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnCloseBtn(); }); self.Init(); } } private static void Init(this UIMessageComponent self) { } public static async void OnCloseBtn(this UIMessageComponent self) { await SoundManager.Instance.PlaySound("clickbtnsound"); self.OnCloseAsync(); } public static async void OnCloseAsync(this UIMessageComponent self) { await UIHelper.Remove(self.ClientScene(),UIType.UIMessage); } } }