using FairyGUI; using System.Text; using System.Text.RegularExpressions; using UI.Main; namespace GFGGame { public class GMPanelView : BaseWindow { private UI_GMPanelUI _ui; public override void Dispose() { if (_ui != null) { _ui.Dispose(); } _ui = null; base.Dispose(); } protected override void OnInit() { base.OnInit(); _ui = UI_GMPanelUI.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; _ui.m_ComBtn.m_btnGetAllDressUpItem.onClick.Add(OnClickBtnGetAllDressUpItem); _ui.m_ComBtn.m_btnGetAllCardItem.onClick.Add(OnClickBtnGetAllCardItem); _ui.m_ComBtn.m_btnSetLv.onClick.Add(OnClickBtnSetLv); _ui.m_ComBtn.m_btnSetChapter.onClick.Add(OnClickBtnSetChapter); _ui.m_ComBtn.m_btnAll.onClick.Add(OnClickBtnAll); _ui.m_btnAddItem.onClick.Add(OnClickBtnAddItem); _ui.m_btnGM.onClick.Add(OnClickBtnGM); _ui.m_ComBtn.m_btnSkipCheckOpen.onClick.Add(OnClickBtnSkipCheckOpen); } protected override void OnShown() { base.OnShown(); } protected override void OnHide() { base.OnHide(); } private void OnClickBtnGetAllDressUpItem() { GMController.GetAllDressUpItem().Coroutine(); } private void OnClickBtnGetAllCardItem() { GMController.GetAllCardItem().Coroutine(); } private void OnClickBtnAddItem(EventContext context) { string content = _ui.m_inputItem.text; string[] infos = Regex.Split(content, " "); if (infos.Length < 2) { PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR); return; } int itemId = int.Parse(infos[0]); int itemNum = int.Parse(infos[1]); if (itemId > 0 && itemNum > 0) { string messageSuc = "已获得物品" + itemId + "*" + itemNum; GMController.SendGMCommand("getItem " + content, messageSuc).Coroutine(); } else { PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR); } } private void OnClickBtnSetLv() { int tmp; if (!int.TryParse(_ui.m_ComBtn.m_txtRoleLv.text, out tmp)) { PromptController.Instance.ShowFloatTextPrompt("请输入数字"); return; } string lv = _ui.m_ComBtn.m_txtRoleLv.text; string messageSuc = "等级提升至" + lv; GMController.SendGMCommand("lv " + lv, messageSuc).Coroutine(); } private void OnClickBtnSetChapter() { int tmp; int tmp1; if (!int.TryParse(_ui.m_ComBtn.m_txtChapter.text, out tmp) || !int.TryParse(_ui.m_ComBtn.m_txtChapterLv.text, out tmp1)) { PromptController.Instance.ShowFloatTextPrompt("请输入数字"); return; } string content = _ui.m_ComBtn.m_txtChapter.text + " " + _ui.m_ComBtn.m_txtChapterLv.text; string messageSuc = string.Format("当前关卡第{0}章第{1}关", _ui.m_ComBtn.m_txtChapter.text, _ui.m_ComBtn.m_txtChapterLv.text); GMController.SendGMCommand("chapter " + content, messageSuc).Coroutine(); } private async void OnClickBtnSkipCheckOpen() { int isSkip = GameGlobal.skipCheckOpen == false ? 1 : 0; bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.SKIP_CHECK_OPEN, isSkip); if (result) { GameGlobal.skipCheckOpen = !GameGlobal.skipCheckOpen; PromptController.Instance.ShowFloatTextPrompt("已开启跳过功能开启检测"); } } private void OnClickBtnAll() { OnClickBtnGetAllDressUpItem(); OnClickBtnGetAllCardItem(); _ui.m_ComBtn.m_txtRoleLv.text = "99"; OnClickBtnSetLv(); _ui.m_ComBtn.m_txtChapter.text = "5"; _ui.m_ComBtn.m_txtChapterLv.text = "1"; OnClickBtnSetChapter(); OnClickBtnSkipCheckOpen(); } private void OnClickBtnGM(EventContext context) { string content = _ui.m_inputGM.text; string[] infos = Regex.Split(content, " "); if (infos.Length < 2) { PromptController.Instance.ShowFloatTextPrompt("请按照指定格式输入物品信息", MessageType.ERR); return; } switch (infos[0]) { case "log": if (infos[1] == "1")//开启日志按钮 { LogController.Instance.SetBtnLogVisable(true); } else if (infos[1] == "0")//关闭日志按钮 { LogController.Instance.SetBtnLogVisable(false); } else { PromptController.Instance.ShowFloatTextPrompt(string.Format("log指令没有{0}这个状态", infos[1])); } break; case "cjstime": if (infos[1].Length != 10) { PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳"); return; } LuckyBoxDataManager.Instance.startTime = int.Parse(infos[1]); PromptController.Instance.ShowFloatTextPrompt("设置成功"); break; case "cjetime": if (infos[1].Length != 10) { PromptController.Instance.ShowFloatTextPrompt("请输入以秒为单位的正确的时间戳"); return; } LuckyBoxDataManager.Instance.endTime = int.Parse(infos[1]); PromptController.Instance.ShowFloatTextPrompt("设置成功"); break; default: PromptController.Instance.ShowFloatTextPrompt(string.Format("没有{0}这个指令", infos[0])); break; } } } }