|  |  |  | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using UnityEngine.UI; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | namespace vnxbqy.UI | 
|---|
|  |  |  | public class GMInputWin : UIBase | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public class GMInputWin : UIBase | 
|---|
|  |  |  | { | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private ScrollerController _cmdCtrl; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private ScrollerController _cmdCtrl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private InputField _inputCmd; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private InputField _inputCmd; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _closeBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _closeBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _lookBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _lookBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _sendBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _sendBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _gmInfoBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _gmInfoBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _clearBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button _clearBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button achieveJumpTestBtn; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private Button achieveJumpTestBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private GameObject _cmdContent; | 
|---|
|  |  |  | [SerializeField] | 
|---|
|  |  |  | private GameObject _cmdContent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private List<string> recordCmdlist; | 
|---|
|  |  |  | private List<string> recordCmdlist; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GMCmdManager cmdModel { get { return GMCmdManager.Instance; } } | 
|---|
|  |  |  | GMCmdManager cmdModel { get { return GMCmdManager.Instance; } } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.OnPreOpen(); | 
|---|
|  |  |  | _cmdCtrl.OnRefreshCell += RefreshCmdCell; | 
|---|
|  |  |  | _closeBtn.onClick.AddListener(OnClickCloseBtn); | 
|---|
|  |  |  | _lookBtn.onClick.AddListener(OnClickLookBtn); | 
|---|
|  |  |  | _sendBtn.onClick.AddListener(() => { OnClickSendBtn(); }); | 
|---|
|  |  |  | _gmInfoBtn.onClick.AddListener(OnClickGMInfoBtn); | 
|---|
|  |  |  | _clearBtn.onClick.AddListener(OnClickClearBtn); | 
|---|
|  |  |  | achieveJumpTestBtn.AddListener(ClickAchieveJumpBtn); | 
|---|
|  |  |  | _cmdContent.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.HandleOpen(); | 
|---|
|  |  |  | this.transform.SetAsLastSibling(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | protected void LateUpdate() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.OnPreOpen(); | 
|---|
|  |  |  | _cmdCtrl.OnRefreshCell += RefreshCmdCell; | 
|---|
|  |  |  | _closeBtn.onClick.AddListener(OnClickCloseBtn); | 
|---|
|  |  |  | _lookBtn.onClick.AddListener(OnClickLookBtn); | 
|---|
|  |  |  | _sendBtn.onClick.AddListener(() => { OnClickSendBtn(); }); | 
|---|
|  |  |  | _gmInfoBtn.onClick.AddListener(OnClickGMInfoBtn); | 
|---|
|  |  |  | _clearBtn.onClick.AddListener(OnClickClearBtn); | 
|---|
|  |  |  | achieveJumpTestBtn.AddListener(ClickAchieveJumpBtn); | 
|---|
|  |  |  | OnClickSendBtn(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void CreateCmdCell() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdCtrl.Refresh(); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | for (i = recordCmdlist.Count - 1; i > -1; i--) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdCtrl.AddCell(ScrollerDataType.Header, i); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | _cmdCtrl.Restart(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void RefreshCmdCell(ScrollerDataType type, CellView cell) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Button cellBtn = cell.GetComponent<Button>(); | 
|---|
|  |  |  | Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); | 
|---|
|  |  |  | string cmdStr = recordCmdlist[cell.index]; | 
|---|
|  |  |  | cmdText.text = cmdStr; | 
|---|
|  |  |  | cellBtn.onClick.RemoveAllListeners(); | 
|---|
|  |  |  | cellBtn.onClick.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnClickCmdCell(cmdStr); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickCmdCell(string paramSet) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _inputCmd.text = paramSet; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickGMInfoBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ServerTipDetails.OpenGMPanel(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickLookBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (_cmdContent.gameObject.activeInHierarchy) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdContent.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnOpen() | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.HandleOpen(); | 
|---|
|  |  |  | this.transform.SetAsLastSibling(); | 
|---|
|  |  |  | _cmdContent.SetActive(true); | 
|---|
|  |  |  | recordCmdlist = cmdModel.GetRecordCmdlist(); | 
|---|
|  |  |  | CreateCmdCell(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | protected void LateUpdate() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnClickSendBtn(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void CreateCmdCell() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdCtrl.Refresh(); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | for (i = recordCmdlist.Count - 1; i > -1; i--) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdCtrl.AddCell(ScrollerDataType.Header, i); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | _cmdCtrl.Restart(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void RefreshCmdCell(ScrollerDataType type, CellView cell) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Button cellBtn = cell.GetComponent<Button>(); | 
|---|
|  |  |  | Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); | 
|---|
|  |  |  | string cmdStr = recordCmdlist[cell.index]; | 
|---|
|  |  |  | cmdText.text = cmdStr; | 
|---|
|  |  |  | cellBtn.onClick.RemoveAllListeners(); | 
|---|
|  |  |  | cellBtn.onClick.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnClickCmdCell(cmdStr); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickCmdCell(string paramSet) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _inputCmd.text = paramSet; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickGMInfoBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ServerTipDetails.OpenGMPanel(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickLookBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (_cmdContent.gameObject.activeInHierarchy) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdContent.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cmdContent.SetActive(true); | 
|---|
|  |  |  | recordCmdlist = cmdModel.GetRecordCmdlist(); | 
|---|
|  |  |  | CreateCmdCell(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickSendBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (_inputCmd.text == null || _inputCmd.text == "" || _inputCmd.text == string.Empty) | 
|---|
|  |  |  | return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // if (_inputCmd.text == "HappyXB") | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     WindowCenter.Instance.Open<HappyXBWin>(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // else if (_inputCmd.text == "TreasureFindHost") | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     WindowCenter.Instance.Open<TreasureFindHostWin>(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (_inputCmd.text.Equals("EnterFB 31250")) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     cmdModel.OnSendGMQuest("SetFBStar 31250"); | 
|---|
|  |  |  | //     ClientGuardDungeon.RequestEnter(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cmdModel.OnSendGMQuest(_inputCmd.text.Trim()); | 
|---|
|  |  |  | cmdModel.SetRecordCmdlist(_inputCmd.text); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickClearBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cmdModel.ClearRecordCmdlist(); | 
|---|
|  |  |  | OnClickLookBtn(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickCloseBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | CloseWindow(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void ClickAchieveJumpBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // try | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     int achieveId = int.Parse(_inputCmd.text); | 
|---|
|  |  |  | //     ModelCenter.Instance.GetModel<AchievementModel>().GotoCompleteAchievement(achieveId); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // catch (Exception ex) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickSendBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (_inputCmd.text == null || _inputCmd.text == "" || _inputCmd.text == string.Empty) | 
|---|
|  |  |  | return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // if (_inputCmd.text == "HappyXB") | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     WindowCenter.Instance.Open<HappyXBWin>(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // else if (_inputCmd.text == "TreasureFindHost") | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     WindowCenter.Instance.Open<TreasureFindHostWin>(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (_inputCmd.text.Equals("EnterFB 31250")) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     cmdModel.OnSendGMQuest("SetFBStar 31250"); | 
|---|
|  |  |  | //     ClientGuardDungeon.RequestEnter(); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cmdModel.OnSendGMQuest(_inputCmd.text.Trim()); | 
|---|
|  |  |  | cmdModel.SetRecordCmdlist(_inputCmd.text); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickClearBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cmdModel.ClearRecordCmdlist(); | 
|---|
|  |  |  | OnClickLookBtn(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnClickCloseBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | CloseWindow(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void ClickAchieveJumpBtn() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // try | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     int achieveId = int.Parse(_inputCmd.text); | 
|---|
|  |  |  | //     ModelCenter.Instance.GetModel<AchievementModel>().GotoCompleteAchievement(achieveId); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // catch (Exception ex) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|