예제 #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"));
        }
예제 #2
0
        private void UpdatePhotonMessage()
        {
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)instance, (UnityEngine.Object)null))
            {
                return;
            }
            List <MyPhoton.MyEvent> events = instance.GetEvents();

            if (events == null)
            {
                return;
            }
            while (events.Count > 0)
            {
                MyPhoton.MyEvent myEvent = events[0];
                events.RemoveAt(0);
                if (myEvent.code == MyPhoton.SEND_TYPE.Normal && myEvent.binary != null)
                {
                    VersusDraftReady.VersusReadyMessageData buffer = (VersusDraftReady.VersusReadyMessageData)null;
                    if (GameUtility.Binary2Object <VersusDraftReady.VersusReadyMessageData>(out buffer, myEvent.binary) && buffer != null)
                    {
                        this.mMessageDataList.Add(buffer);
                    }
                }
            }
        }
예제 #3
0
        private void UpdatePhotonMessage()
        {
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)instance, (UnityEngine.Object)null))
            {
                return;
            }
            List <MyPhoton.MyEvent> events = instance.GetEvents();

            if (events == null)
            {
                return;
            }
            while (events.Count > 0)
            {
                MyPhoton.MyEvent myEvent = events[0];
                events.RemoveAt(0);
                if (myEvent.code == MyPhoton.SEND_TYPE.Normal && myEvent.binary != null)
                {
                    VersusDraftList.VersusDraftMessageData buffer = (VersusDraftList.VersusDraftMessageData)null;
                    if (GameUtility.Binary2Object <VersusDraftList.VersusDraftMessageData>(out buffer, myEvent.binary) && buffer != null)
                    {
                        switch (buffer.h)
                        {
                        case 1:
                            VersusDraftUnit.ResetSelectUnit();
                            if (buffer.uidx0 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx0)
                            {
                                this.mVersusDraftUnitList[buffer.uidx0].SelectUnit(false);
                            }
                            if (buffer.uidx1 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx1)
                            {
                                this.mVersusDraftUnitList[buffer.uidx1].SelectUnit(false);
                            }
                            if (buffer.uidx2 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx2)
                            {
                                this.mVersusDraftUnitList[buffer.uidx2].SelectUnit(false);
                                continue;
                            }
                            continue;

                        case 2:
                            if (buffer.uidx0 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx0)
                            {
                                this.mVersusDraftUnitList[buffer.uidx0].DecideUnit(false);
                                ++this.mEnemyUnitIndex;
                            }
                            if (buffer.uidx1 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx1)
                            {
                                this.mVersusDraftUnitList[buffer.uidx1].DecideUnit(false);
                                ++this.mEnemyUnitIndex;
                            }
                            if (buffer.uidx2 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx2)
                            {
                                this.mVersusDraftUnitList[buffer.uidx2].DecideUnit(false);
                                ++this.mEnemyUnitIndex;
                                continue;
                            }
                            continue;

                        case 3:
                            if (!this.ChangeTurn(true))
                            {
                                for (int index = 0; index < this.SELECTABLE_UNIT_COUNT_OF_TURN[this.mTurn]; ++index)
                                {
                                    this.mVersusDraftSelectedUnit[this.mSelectingUnitIndex + index].Selecting();
                                }
                                continue;
                            }
                            continue;

                        default:
                            continue;
                        }
                    }
                }
            }
        }