1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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);
- }
- }
- }
|