UIComponent.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using FL.FGUI;
  2. using XGame.Framework.Nodes;
  3. namespace FL.Nodes.Summon
  4. {
  5. public class UIComponent : NodeComponent
  6. {
  7. public override void OnEnable(object intent)
  8. {
  9. Context.AddListener(EventDefine.SummonInto, OnSummonInto);
  10. Context.AddListener(EventDefine.SummonMwDraw, OnSummonMwDraw);
  11. Context.AddListener(EventDefine.SummonSbDraw, OnSummonSbDraw);
  12. Context.AddListener(EventDefine.AdSuccess, OnAdSuccess);
  13. }
  14. public override void OnDisable()
  15. {
  16. Context.RemoveListener(EventDefine.SummonInto, OnSummonInto);
  17. Context.RemoveListener(EventDefine.SummonMwDraw, OnSummonMwDraw);
  18. Context.RemoveListener(EventDefine.SummonSbDraw, OnSummonSbDraw);
  19. Context.RemoveListener(EventDefine.AdSuccess, OnAdSuccess);
  20. }
  21. private void OnAdSuccess(int eventId, object args)
  22. {
  23. //if () return;
  24. //if ()
  25. //{
  26. // EventSingle.Instance.Notify(EventDefine.SummonSbAd);
  27. // OnSummonSbDraw(eventId,args);
  28. //}
  29. //else
  30. //{
  31. // EventSingle.Instance.Notify(EventDefine.SummonMwAd);
  32. // OnSummonMwDraw(eventId,args);
  33. //}
  34. }
  35. private void OnSummonMwDraw(int eventId, object args)
  36. {
  37. if (Context.UI.IsOpened(UIKeys.PartnerSummonMwResultPanel)) return;
  38. Context.UI.OpenAsync(UIKeys.PartnerSummonMwResultPanel);
  39. }
  40. private void OnSummonSbDraw(int eventId, object args)
  41. {
  42. if (Context.UI.IsOpened(UIKeys.PartnerSummonSbResultPanel)) return;
  43. Context.UI.OpenAsync(UIKeys.PartnerSummonSbResultPanel);
  44. }
  45. private void OnSummonInto(int eventId, object args)
  46. {
  47. Context.UI.OpenAsync(UIKeys.PartnerSummonMainPanel);
  48. }
  49. }
  50. }