GMPanelView.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. using FairyGUI;
  2. using System.Text.RegularExpressions;
  3. using UI.RoleInfo;
  4. namespace GFGGame
  5. {
  6. public class GMPanelView : BaseWindow
  7. {
  8. private UI_GMPanelUI _ui;
  9. public override void Dispose()
  10. {
  11. if (_ui != null)
  12. {
  13. _ui.Dispose();
  14. }
  15. _ui = null;
  16. base.Dispose();
  17. }
  18. protected override void OnInit()
  19. {
  20. base.OnInit();
  21. packageName = UI_GMPanelUI.PACKAGE_NAME;
  22. _ui = UI_GMPanelUI.Create();
  23. this.viewCom = _ui.target;
  24. this.viewCom.Center();
  25. this.modal = true;
  26. _ui.m_ComBtn.m_btnGetAllDressUpItem.onClick.Add(OnClickBtnGetAllDressUpItem);
  27. _ui.m_ComBtn.m_btnGetAllCardItem.onClick.Add(OnClickBtnGetAllCardItem);
  28. _ui.m_ComBtn.m_btnSetLv.onClick.Add(OnClickBtnSetLv);
  29. _ui.m_ComBtn.m_btnSetChapter.onClick.Add(OnClickBtnSetChapter);
  30. _ui.m_ComBtn.m_btnAll.onClick.Add(OnClickBtnAll);
  31. _ui.m_btnAddItem.onClick.Add(OnClickBtnAddItem);
  32. _ui.m_btnGM.onClick.Add(OnClickBtnGM);
  33. }
  34. protected override void OnShown()
  35. {
  36. base.OnShown();
  37. _ui.m_ComBtn.m_c1.selectedIndex = LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL ? 0 : 1;
  38. }
  39. protected override void OnHide()
  40. {
  41. base.OnHide();
  42. }
  43. private void OnClickBtnGetAllDressUpItem()
  44. {
  45. GMController.GetAllDressUpItem().Coroutine();
  46. }
  47. private void OnClickBtnGetAllCardItem()
  48. {
  49. GMController.GetAllCardItem().Coroutine();
  50. }
  51. private void OnClickBtnAddItem(EventContext context)
  52. {
  53. string content = _ui.m_inputItem.text;
  54. string[] infos = Regex.Split(content, " ");
  55. if (infos.Length < 2)
  56. {
  57. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  58. return;
  59. }
  60. int itemId = int.Parse(infos[0]);
  61. int itemNum = int.Parse(infos[1]);
  62. if (itemId > 0 && itemNum > 0)
  63. {
  64. string messageSuc = "已获得物品" + itemId + "*" + itemNum;
  65. GMController.SendGMCommand("getItem " + content, messageSuc).Coroutine();
  66. }
  67. else
  68. {
  69. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  70. }
  71. }
  72. private void OnClickBtnSetLv()
  73. {
  74. int tmp;
  75. if (!int.TryParse(_ui.m_ComBtn.m_txtRoleLv.text, out tmp))
  76. {
  77. PromptController.Instance.ShowFloatTextPrompt("请输入数字");
  78. return;
  79. }
  80. string lv = _ui.m_ComBtn.m_txtRoleLv.text;
  81. string messageSuc = "等级提升至" + lv;
  82. GMController.SendGMCommand("lv " + lv, messageSuc).Coroutine();
  83. }
  84. private void OnClickBtnSetChapter()
  85. {
  86. int tmp;
  87. int tmp1;
  88. if (!int.TryParse(_ui.m_ComBtn.m_txtChapter.text, out tmp) || !int.TryParse(_ui.m_ComBtn.m_txtChapterLv.text, out tmp1))
  89. {
  90. PromptController.Instance.ShowFloatTextPrompt("请输入数字");
  91. return;
  92. }
  93. string content = _ui.m_ComBtn.m_txtChapter.text + " " + _ui.m_ComBtn.m_txtChapterLv.text;
  94. string messageSuc = string.Format("当前关卡第{0}章第{1}关", _ui.m_ComBtn.m_txtChapter.text, _ui.m_ComBtn.m_txtChapterLv.text);
  95. GMController.SendGMCommand("chapter " + content, messageSuc).Coroutine();
  96. }
  97. private async void OnClickBtnSkipCheckOpen()
  98. {
  99. int isSkip = GameGlobal.skipCheckOpen == false ? 1 : 0;
  100. bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.SKIP_CHECK_OPEN, isSkip);
  101. if (result)
  102. {
  103. GameGlobal.skipCheckOpen = !GameGlobal.skipCheckOpen;
  104. PromptController.Instance.ShowFloatTextPrompt("已开启跳过功能开启检测");
  105. }
  106. }
  107. private async void OnClickBtnAll()
  108. {
  109. bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 2);
  110. if (result)
  111. {
  112. GameGlobal.skipGuide = true;
  113. }
  114. OnClickBtnGetAllDressUpItem();
  115. OnClickBtnGetAllCardItem();
  116. _ui.m_ComBtn.m_txtRoleLv.text = "99";
  117. OnClickBtnSetLv();
  118. _ui.m_ComBtn.m_txtChapter.text = "5";
  119. _ui.m_ComBtn.m_txtChapterLv.text = "1";
  120. OnClickBtnSetChapter();
  121. OnClickBtnSkipCheckOpen();
  122. }
  123. private void OnClickBtnGM(EventContext context)
  124. {
  125. string content = _ui.m_inputGM.text;
  126. string[] infos = Regex.Split(content, " ");
  127. if (infos.Length < 2)
  128. {
  129. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  130. return;
  131. }
  132. switch (infos[0])
  133. {
  134. case "log":
  135. if (infos[1] == "1")//开启日志按钮
  136. {
  137. LogController.Instance.SetBtnLogVisable(true);
  138. }
  139. else if (infos[1] == "0")//关闭日志按钮
  140. {
  141. LogController.Instance.SetBtnLogVisable(false);
  142. }
  143. else
  144. {
  145. PromptController.Instance.ShowFloatTextPrompt(string.Format("log指令没有{0}这个状态", infos[1]));
  146. }
  147. break;
  148. case "cjstime":
  149. if (infos[1].Length != 10)
  150. {
  151. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  152. return;
  153. }
  154. LuckyBoxDataManager.Instance.startTime = int.Parse(infos[1]);
  155. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  156. break;
  157. case "cjetime":
  158. if (infos[1].Length != 10)
  159. {
  160. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  161. return;
  162. }
  163. LuckyBoxDataManager.Instance.endTime = int.Parse(infos[1]);
  164. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  165. break;
  166. default:
  167. GMController.SendGMCommand(content, "设置成功").Coroutine();
  168. break;
  169. }
  170. }
  171. }
  172. }