Esempio n. 1
0
        public void SelectUnit()
        {
            VersusDraftList.VersusDraftMessageData mess = new VersusDraftList.VersusDraftMessageData();
            mess.h = 1;
            int num = 0;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[0], (UnityEngine.Object)null))
            {
                mess.uidx0 = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[0]);
                ++num;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[1], (UnityEngine.Object)null))
            {
                mess.uidx1 = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[1]);
                ++num;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[2], (UnityEngine.Object)null))
            {
                mess.uidx2 = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[2]);
                ++num;
            }
            this.SendRoomMessage(mess, false);
            if (num < this.SelectableUnitCount)
            {
                return;
            }
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 102);
        }
Esempio n. 2
0
        private void SendRoomMessage(VersusDraftList.VersusDraftMessageData mess, bool immediate = false)
        {
            if (mess == null)
            {
                return;
            }
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer();
            int myPlayerIndex          = instance.MyPlayerIndex;
            int num = myPlayer != null ? myPlayer.playerID : 0;

            mess.pidx = myPlayerIndex;
            mess.pid  = num;
            byte[] msg = GameUtility.Object2Binary <VersusDraftList.VersusDraftMessageData>(mess);
            instance.SendRoomMessageBinary(true, msg, MyPhoton.SEND_TYPE.Normal, false);
            if (!immediate)
            {
                return;
            }
            instance.SendFlush();
        }
Esempio n. 3
0
 private void DecideUnit()
 {
     if (this.mRandomSelecting || !VersusDraftList.VersusDraftTurnOwn || this.mSelectingUnitIndex >= 6)
     {
         return;
     }
     VersusDraftList.VersusDraftMessageData mess = new VersusDraftList.VersusDraftMessageData();
     mess.h = 2;
     if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[0], (UnityEngine.Object)null))
     {
         VersusDraftUnit currentSelectCursor = VersusDraftUnit.CurrentSelectCursors[0];
         int             num = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[0]);
         currentSelectCursor.DecideUnit(true);
         mess.uidx0 = num;
         this.mVersusDraftSelectedUnit[this.mSelectingUnitIndex].Select(currentSelectCursor.UnitData);
         ++this.mSelectingUnitIndex;
     }
     if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[1], (UnityEngine.Object)null))
     {
         VersusDraftUnit currentSelectCursor = VersusDraftUnit.CurrentSelectCursors[1];
         int             num = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[1]);
         currentSelectCursor.DecideUnit(true);
         mess.uidx1 = num;
         this.mVersusDraftSelectedUnit[this.mSelectingUnitIndex].Select(currentSelectCursor.UnitData);
         ++this.mSelectingUnitIndex;
     }
     if (UnityEngine.Object.op_Inequality((UnityEngine.Object)VersusDraftUnit.CurrentSelectCursors[2], (UnityEngine.Object)null))
     {
         VersusDraftUnit currentSelectCursor = VersusDraftUnit.CurrentSelectCursors[2];
         int             num = this.mVersusDraftUnitList.IndexOf(VersusDraftUnit.CurrentSelectCursors[2]);
         currentSelectCursor.DecideUnit(true);
         mess.uidx2 = num;
         this.mVersusDraftSelectedUnit[this.mSelectingUnitIndex].Select(currentSelectCursor.UnitData);
         ++this.mSelectingUnitIndex;
     }
     this.SendRoomMessage(mess, false);
     this.FinishTurn();
 }
Esempio n. 4
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;
                        }
                    }
                }
            }
        }