Esempio n. 1
0
        private void OnEventHandler(byte eventCode, object content, int senderID)
        {
            Hashtable hashtable = (Hashtable)content;
            int       num       = (int)hashtable.get_Item((object)"s");
            string    str;

            if (num == 0)
            {
                str = (string)hashtable.get_Item((object)"m");
            }
            else
            {
                byte[] data = (byte[])hashtable.get_Item((object)"m");
                str = MyEncrypt.Decrypt(num + this.GetCryptKey(), data, true);
            }
            MyPhoton.MyEvent myEvent = new MyPhoton.MyEvent();
            myEvent.code     = (MyPhoton.SEND_TYPE)eventCode;
            myEvent.playerID = senderID;
            myEvent.json     = str;
            if (((Dictionary <object, object>)hashtable).ContainsKey((object)"sq"))
            {
                myEvent.sendID = (int)hashtable.get_Item((object)"sq");
            }
            this.mEvents.Add(myEvent);
            if (this.SortRoomMessage)
            {
                this.mEvents.Sort((Comparison <MyPhoton.MyEvent>)((a, b) => a.sendID - b.sendID));
            }
            this.Log("OnEventHandler: " + (object)senderID + (string)hashtable.get_Item((object)"msg"));
        }
Esempio n. 2
0
 private static BattleSuspend.Data loadSaveData(string file_name)
 {
     if (string.IsNullOrEmpty(file_name))
     {
         return((BattleSuspend.Data)null);
     }
     try
     {
         byte[] data = File.ReadAllBytes(file_name);
         if (data != null)
         {
             string str = MyEncrypt.Decrypt(0, data, false);
             if (!string.IsNullOrEmpty(str))
             {
                 return((BattleSuspend.Data)JsonUtility.FromJson <BattleSuspend.Data>(str));
             }
         }
     }
     catch
     {
     }
     return((BattleSuspend.Data)null);
 }
        public void Analyze(string log)
        {
            string json = string.Empty;
            string src  = string.Empty;

            if (!string.IsNullOrEmpty(this.mNonAnalyzeLog))
            {
                log = this.mNonAnalyzeLog + log;
                this.mNonAnalyzeLog = string.Empty;
            }
            if (log.IndexOf("creatorName") != -1)
            {
                json = log;
            }
            else if (log.IndexOf("players") != -1)
            {
                src = log;
            }
            else if (log.IndexOf("bm") != -1)
            {
                try
                {
                    byte[] data = MyEncrypt.Decrypt(((AudienceLog)JsonUtility.FromJson <AudienceLog>(log)).bm);
                    SceneBattle.MultiPlayRecvData buffer;
                    if (GameUtility.Binary2Object <SceneBattle.MultiPlayRecvData>(out buffer, data))
                    {
                        if (!this.mTurnLog.ContainsKey(buffer.b))
                        {
                            this.mTurnLog[buffer.b] = new List <SceneBattle.MultiPlayRecvData>();
                        }
                        this.mTurnLog[buffer.b].Add(buffer);
                    }
                }
                catch
                {
                    this.mNonAnalyzeLog = log;
                }
            }
            else if (log.IndexOf("bin") != -1)
            {
                try
                {
                    SceneBattle.MultiPlayRecvBinData multiPlayRecvBinData = (SceneBattle.MultiPlayRecvBinData)JsonUtility.FromJson <SceneBattle.MultiPlayRecvBinData>(log);
                    string buffer;
                    GameUtility.Binary2Object <string>(out buffer, multiPlayRecvBinData.bin);
                    this.Analyze(buffer);
                    return;
                }
                catch
                {
                    this.mNonAnalyzeLog = log;
                }
            }
            else
            {
                this.mNonAnalyzeLog = log;
            }
            if (!string.IsNullOrEmpty(json))
            {
                try
                {
                    this.mRoomParam = JSON_MyPhotonRoomParam.Parse(json);
                }
                catch
                {
                    Debug.LogWarning((object)json);
                    this.mNonAnalyzeLog = json;
                }
            }
            if (string.IsNullOrEmpty(src))
            {
                return;
            }
            try
            {
                this.mStartedParam = JSONParser.parseJSONObject <AudienceStartParam>(src);
            }
            catch
            {
                Debug.LogWarning((object)src);
                this.mNonAnalyzeLog = src;
            }
        }