GMPanelView.cs 7.0 KB

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