GMPanelView.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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_ComBtn.m_btnArenaGrade.onClick.Add(OnClickBtnArenaGrade);
  32. _ui.m_btnAddItem.onClick.Add(OnClickBtnAddItem);
  33. _ui.m_btnGM.onClick.Add(OnClickBtnGM);
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _ui.m_ComBtn.m_c1.selectedIndex = LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL ? 0 : 1;
  39. _ui.m_ComBtn.m_txtArenaGrade.text = "";
  40. _ui.m_ComBtn.m_txtArenaRank.text = "";
  41. }
  42. protected override void OnHide()
  43. {
  44. base.OnHide();
  45. }
  46. private void OnClickBtnGetAllDressUpItem()
  47. {
  48. GMController.GetAllDressUpItem().Coroutine();
  49. }
  50. private void OnClickBtnGetAllCardItem()
  51. {
  52. GMController.GetAllCardItem().Coroutine();
  53. }
  54. private void OnClickBtnAddItem(EventContext context)
  55. {
  56. string content = _ui.m_inputItem.text;
  57. string[] infos = Regex.Split(content, " ");
  58. if (infos.Length < 2)
  59. {
  60. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  61. return;
  62. }
  63. int itemId = int.Parse(infos[0]);
  64. int itemNum = int.Parse(infos[1]);
  65. if (itemId > 0)
  66. {
  67. string messageSuc;
  68. if (itemNum > 0)
  69. {
  70. messageSuc = "已获得物品" + itemId + "*" + itemNum;
  71. GMController.SendGMCommand("getItem " + content, messageSuc).Coroutine();
  72. }
  73. else if (itemNum < 0)
  74. {
  75. messageSuc = "已扣除物品" + itemId + "*" + itemNum;
  76. GMController.SendGMCommand("getItem " + content, messageSuc).Coroutine();
  77. }
  78. }
  79. else
  80. {
  81. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  82. }
  83. }
  84. private void OnClickBtnSetLv()
  85. {
  86. int tmp;
  87. if (!int.TryParse(_ui.m_ComBtn.m_txtRoleLv.text, out tmp))
  88. {
  89. PromptController.Instance.ShowFloatTextPrompt("请输入数字");
  90. return;
  91. }
  92. string lv = _ui.m_ComBtn.m_txtRoleLv.text;
  93. string messageSuc = "等级提升至" + lv;
  94. GMController.SendGMCommand("lv " + lv, messageSuc).Coroutine();
  95. }
  96. private void OnClickBtnSetChapter()
  97. {
  98. int tmp;
  99. int tmp1;
  100. if (!int.TryParse(_ui.m_ComBtn.m_txtChapter.text, out tmp) || !int.TryParse(_ui.m_ComBtn.m_txtChapterLv.text, out tmp1))
  101. {
  102. PromptController.Instance.ShowFloatTextPrompt("请输入数字");
  103. return;
  104. }
  105. string content = _ui.m_ComBtn.m_txtChapter.text + " " + _ui.m_ComBtn.m_txtChapterLv.text;
  106. string messageSuc = string.Format("当前关卡第{0}章第{1}关", _ui.m_ComBtn.m_txtChapter.text, _ui.m_ComBtn.m_txtChapterLv.text);
  107. GMController.SendGMCommand("chapter " + content, messageSuc).Coroutine();
  108. }
  109. private async void OnClickBtnSkipCheckOpen()
  110. {
  111. int isSkip = GameGlobal.skipCheckOpen == false ? 1 : 0;
  112. bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.SKIP_CHECK_OPEN, isSkip);
  113. if (result)
  114. {
  115. GameGlobal.skipCheckOpen = !GameGlobal.skipCheckOpen;
  116. PromptController.Instance.ShowFloatTextPrompt("已开启跳过功能开启检测");
  117. }
  118. }
  119. private async void OnClickBtnArenaGrade()
  120. {
  121. string gm = string.Format("SetArenaRank|{0}|{1}", _ui.m_ComBtn.m_txtArenaGrade.text, _ui.m_ComBtn.m_txtArenaRank.text);
  122. await GMController.SendGMCommand(gm, "修改成功");
  123. }
  124. private async void OnClickBtnAll()
  125. {
  126. bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 2);
  127. if (result)
  128. {
  129. GameGlobal.skipGuide = true;
  130. }
  131. OnClickBtnGetAllDressUpItem();
  132. OnClickBtnGetAllCardItem();
  133. _ui.m_ComBtn.m_txtRoleLv.text = "99";
  134. OnClickBtnSetLv();
  135. _ui.m_ComBtn.m_txtChapter.text = "5";
  136. _ui.m_ComBtn.m_txtChapterLv.text = "1";
  137. OnClickBtnSetChapter();
  138. OnClickBtnSkipCheckOpen();
  139. }
  140. private void OnClickBtnGM(EventContext context)
  141. {
  142. string content = _ui.m_inputGM.text;
  143. string[] infos = Regex.Split(content, " ");
  144. if (infos.Length < 2)
  145. {
  146. PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR);
  147. return;
  148. }
  149. switch (infos[0])
  150. {
  151. case "log":
  152. if (infos[1] == "1")//开启日志按钮
  153. {
  154. LogController.Instance.SetBtnLogVisable(true);
  155. }
  156. else if (infos[1] == "0")//关闭日志按钮
  157. {
  158. LogController.Instance.SetBtnLogVisable(false);
  159. }
  160. else
  161. {
  162. PromptController.Instance.ShowFloatTextPrompt(string.Format("log指令没有{0}这个状态", infos[1]));
  163. }
  164. break;
  165. case "cjstime":
  166. if (infos[1].Length != 10)
  167. {
  168. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  169. return;
  170. }
  171. LuckyBoxDataManager.Instance.startTime = int.Parse(infos[1]);
  172. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  173. break;
  174. case "cjetime":
  175. if (infos[1].Length != 10)
  176. {
  177. PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳");
  178. return;
  179. }
  180. LuckyBoxDataManager.Instance.endTime = int.Parse(infos[1]);
  181. PromptController.Instance.ShowFloatTextPrompt("设置成功");
  182. break;
  183. default:
  184. GMController.SendGMCommand(content, "设置成功").Coroutine();
  185. break;
  186. }
  187. }
  188. }
  189. }