using FL.Data; using FL.FGUI; using XGame.Framework.Nodes; namespace FL.Nodes.Summon { public class UIComponent : NodeComponent { public override void OnEnable(object intent) { Context.AddListener(EventDefine.SummonInto, OnSummonInto); Context.AddListener(EventDefine.SummonMwDraw, OnSummonMwDraw); Context.AddListener(EventDefine.SummonSbDraw, OnSummonSbDraw); Context.AddListener(EventDefine.AdSuccess, OnAdSuccess); } public override void OnDisable() { Context.RemoveListener(EventDefine.SummonInto, OnSummonInto); Context.RemoveListener(EventDefine.SummonMwDraw, OnSummonMwDraw); Context.RemoveListener(EventDefine.SummonSbDraw, OnSummonSbDraw); Context.RemoveListener(EventDefine.AdSuccess, OnAdSuccess); } private void OnAdSuccess(int eventId, object args) { var type = (EPayActionType)args; if (type == EPayActionType.SummonSbAd) { EventSingle.Instance.Notify(EventDefine.SummonSbAd); OnSummonSbDraw(eventId, args); } else if (type == EPayActionType.SummonMwAd) { EventSingle.Instance.Notify(EventDefine.SummonMwAd); OnSummonMwDraw(eventId, args); } } private void OnSummonMwDraw(int eventId, object args) { if (Context.UI.IsOpened(UIKeys.PartnerSummonMwResultPanel)) return; Context.UI.OpenAsync(UIKeys.PartnerSummonMwResultPanel); } private void OnSummonSbDraw(int eventId, object args) { if (Context.UI.IsOpened(UIKeys.PartnerSummonSbResultPanel)) return; Context.UI.OpenAsync(UIKeys.PartnerSummonSbResultPanel); } private void OnSummonInto(int eventId, object args) { Context.UI.OpenAsync(UIKeys.PartnerSummonMainPanel); } } }