123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- 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_btnGetAllDressUpItem.onClick.Add(OnClickBtnGetAllDressUpItem);
- _ui.m_btnGetAllCardItem.onClick.Add(OnClickBtnGetAllCardItem);
- _ui.m_btnAddItem.onClick.Add(OnClickBtnAddItem);
- _ui.m_btnGM.onClick.Add(OnClickBtnGM);
- }
- 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 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;
- }
- }
- }
- }
|