GMPanelView.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using FairyGUI;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4. using UI.Main;
  5. namespace GFGGame
  6. {
  7. public class GMPanelView : BaseWindow
  8. {
  9. private UI_GMPanelUI _ui;
  10. public override void Dispose()
  11. {
  12. if(_ui != null)
  13. {
  14. _ui.Dispose();
  15. }
  16. _ui = null;
  17. base.Dispose();
  18. }
  19. protected override void OnInit()
  20. {
  21. base.OnInit();
  22. _ui = UI_GMPanelUI.Create();
  23. this.viewCom = _ui.target;
  24. this.viewCom.Center();
  25. this.modal = true;
  26. _ui.m_btnGetAllDressUpItem.onClick.Add(OnClickBtnGetAllDressUpItem);
  27. _ui.m_btnGetAllCardItem.onClick.Add(OnClickBtnGetAllCardItem);
  28. _ui.m_btnAddItem.onClick.Add(OnClickBtnAddItem);
  29. _ui.m_btnGM.onClick.Add(OnClickBtnGM);
  30. }
  31. protected override void OnShown()
  32. {
  33. base.OnShown();
  34. }
  35. protected override void OnHide()
  36. {
  37. base.OnHide();
  38. }
  39. private void OnClickBtnGetAllDressUpItem()
  40. {
  41. GMController.GetAllDressUpItem().Coroutine();
  42. }
  43. private void OnClickBtnGetAllCardItem()
  44. {
  45. GMController.GetAllCardItem().Coroutine();
  46. }
  47. private void OnClickBtnAddItem(EventContext context)
  48. {
  49. string content = _ui.m_inputItem.text;
  50. string[] infos = Regex.Split(content, " ");
  51. if(infos.Length < 2)
  52. {
  53. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  54. return;
  55. }
  56. int itemId = int.Parse(infos[0]);
  57. int itemNum = int.Parse(infos[1]);
  58. if(itemId > 0 && itemNum > 0)
  59. {
  60. string messageSuc = "已获得物品" + itemId + "*" + itemNum;
  61. GMController.SendGMCommand("getItem " + content, messageSuc).Coroutine();
  62. }
  63. else
  64. {
  65. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  66. }
  67. }
  68. private void OnClickBtnGM(EventContext context)
  69. {
  70. string content = _ui.m_inputGM.text;
  71. string[] infos = Regex.Split(content, " ");
  72. if (infos.Length < 2)
  73. {
  74. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  75. return;
  76. }
  77. switch (infos[0]) {
  78. case "log":
  79. if (infos[1] == "1")//开启日志按钮
  80. {
  81. LogController.Instance.SetBtnLogVisable(true);
  82. }
  83. else if (infos[1] == "0")//关闭日志按钮
  84. {
  85. LogController.Instance.SetBtnLogVisable(false);
  86. }
  87. else
  88. {
  89. PromptController.Instance.ShowFloatTextPrompt(string.Format("log指令没有{0}这个状态",infos[1]));
  90. }
  91. break;
  92. case "cjstime":
  93. if (infos[1].Length != 10)
  94. {
  95. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  96. return;
  97. }
  98. LuckyBoxDataManager.Instance.startTime = int .Parse(infos[1]);
  99. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  100. break;
  101. case "cjetime":
  102. if (infos[1].Length != 10)
  103. {
  104. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  105. return;
  106. }
  107. LuckyBoxDataManager.Instance.endTime = int.Parse(infos[1]);
  108. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  109. break;
  110. default:
  111. PromptController.Instance.ShowFloatTextPrompt(string.Format("没有{0}这个指令", infos[0]));
  112. break;
  113. }
  114. }
  115. }
  116. }