| using System;  | 
| using System.Collections.Generic;  | 
| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| public class GMInputWin : UIBase  | 
| {  | 
|     [SerializeField]  | 
|     private ScrollerController _cmdCtrl;  | 
|   | 
|     [SerializeField]  | 
|     private InputField _inputCmd;  | 
|   | 
|     [SerializeField]  | 
|     private Button _closeBtn;  | 
|   | 
|     [SerializeField]  | 
|     private Button _lookBtn;  | 
|   | 
|     [SerializeField]  | 
|     private Button _sendBtn;  | 
|   | 
|   | 
|     [SerializeField]  | 
|     private Button _gmInfoBtn;  | 
|   | 
|     [SerializeField]  | 
|     private Button _clearBtn;  | 
|   | 
|     [SerializeField]  | 
|     private Button achieveJumpTestBtn;  | 
|   | 
|     [SerializeField]  | 
|     private GameObject _cmdContent;  | 
|   | 
|     private List<string> recordCmdlist;  | 
|   | 
|     GMCmdManager cmdModel { get { return GMCmdManager.Instance; } }  | 
|   | 
|     protected override void InitComponent()  | 
|     {  | 
|         _closeBtn.onClick.AddListener(OnClickCloseBtn);  | 
|         _lookBtn.onClick.AddListener(OnClickLookBtn);  | 
|         _sendBtn.onClick.AddListener(() => { OnClickSendBtn(); });  | 
|         _gmInfoBtn.onClick.AddListener(OnClickGMInfoBtn);  | 
|         _clearBtn.onClick.AddListener(OnClickClearBtn);  | 
|         achieveJumpTestBtn.AddListener(ClickAchieveJumpBtn);  | 
|     }         | 
|   | 
|   | 
|     protected override void OnPreOpen()  | 
|     {  | 
|         base.OnPreOpen();  | 
|         _cmdCtrl.OnRefreshCell += RefreshCmdCell;  | 
|   | 
|         _cmdContent.SetActive(false);  | 
|     }  | 
|   | 
|     protected override void OnOpen()  | 
|     {  | 
|         this.transform.SetAsLastSibling();  | 
|     }  | 
|     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.StartsWith("GuildID"))  | 
|         {  | 
|             var id = GuildManager.Instance.DecryptGuildID(_inputCmd.text.Substring(8));  | 
|             ServerTipDetails.ReceivePackage("公会ID:" + id);  | 
|             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)  | 
|         // {  | 
|         // }  | 
|     }  | 
|   | 
| }  |