| using System.Collections.Generic; | 
|   | 
| using System.Text; | 
| using System; | 
| using UnityEngine; | 
|   | 
|   | 
| public class GMCmdManager : GameSystemManager<GMCmdManager> | 
| { | 
|     public const string Record_CmdKey = "Record_CmdKey"; | 
|     private List<string> recordCmdlist = new List<string>(); | 
|     private string[] recordCmdArray; | 
|   | 
|     public override void Init() | 
|     { | 
|         base.Init(); | 
|         GetCmdArray(); | 
|         LaunchInHot.Instance.OnApplicationOut += OnApplicationOut; | 
|     } | 
|   | 
|     public override void Release() | 
|     { | 
|         LaunchInHot.Instance.OnApplicationOut -= OnApplicationOut; | 
|     } | 
|   | 
|   | 
|     /// <summary> | 
|     /// 发送请求 | 
|     /// </summary> | 
|     /// <param name="sendQuest"></param> | 
|     public void OnSendGMQuest(string sendQuest) | 
|     { | 
|         Debug.Log("sendQuest: " + sendQuest); | 
|         C320C_tagCGMCMD gmCmd = new C320C_tagCGMCMD(); | 
|         gmCmd.Cmd = sendQuest; | 
|         gmCmd.CmdLen = (byte)(sendQuest.Length); | 
|         GameNetSystem.Instance.SendInfo(gmCmd); | 
|     } | 
|   | 
|   | 
|   | 
|     public void GetCmdArray() | 
|     { | 
|         recordCmdArray = LocalSave.GeStringArray(Record_CmdKey); | 
|         recordCmdlist.Clear(); | 
|         if (recordCmdArray == null) | 
|             return; | 
|   | 
|         int i = 0; | 
|         for (i = 0; i < recordCmdArray.Length; i++) | 
|         { | 
|             if (recordCmdArray[i] != "" && recordCmdArray[i] != string.Empty) | 
|                 recordCmdlist.Add(recordCmdArray[i]); | 
|   | 
|         } | 
|     } | 
|   | 
|     public void SetRecordCmdlist(string cmdStr) | 
|     { | 
|         if (!recordCmdlist.Contains(cmdStr)) | 
|         { | 
|             recordCmdlist.Add(cmdStr); | 
|         } | 
|         else | 
|         { | 
|             recordCmdlist.Remove(cmdStr); | 
|             recordCmdlist.Insert(recordCmdlist.Count, cmdStr); | 
|         } | 
|     } | 
|   | 
|     public void SetCmdArray() | 
|     { | 
|         recordCmdArray = new string[recordCmdlist.Count]; | 
|         int i = 0; | 
|         for (i = 0; i < recordCmdlist.Count; i++) | 
|         { | 
|             recordCmdArray[i] = recordCmdlist[i]; | 
|         } | 
|         LocalSave.SetStringArray(Record_CmdKey, recordCmdArray); | 
|     } | 
|   | 
|     public List<string> GetRecordCmdlist() | 
|     { | 
|         return recordCmdlist; | 
|     } | 
|   | 
|     public void ClearRecordCmdlist() | 
|     { | 
|         recordCmdlist.Clear(); | 
|         LocalSave.DeleteKey(Record_CmdKey); | 
|     } | 
|   | 
|     void OnApplicationOut() | 
|     { | 
|         SetCmdArray(); | 
|     } | 
| } |