예제 #1
0
        private bool ChangeTurn(bool isPlayer = true)
        {
            ++this.mTurn;
            if (this.SELECTABLE_UNIT_COUNT_OF_TURN.Length <= this.mTurn)
            {
                this.StartCoroutine(this.DownloadUnitImage());
                return(true);
            }
            VersusDraftList.VersusDraftTurnOwn = isPlayer;
            this.mTimerGO.SetActive(isPlayer);
            ((Component)this.mPlayerText).get_gameObject().SetActive(isPlayer);
            ((Component)this.mEnemyText).get_gameObject().SetActive(!isPlayer);
            VersusDraftUnit.ResetSelectUnit();
            string str1;
            string str2;

            if (isPlayer)
            {
                this.mPlayerTimer = 0.0f;
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 110);
                str1 = LocalizedText.Get("sys.DRAFT_TURN_PLAYER");
                str2 = (this.mSelectingUnitIndex + 1).ToString();
                for (int index = 1; index < this.SelectableUnitCount; ++index)
                {
                    str2 = str2 + "," + (this.mSelectingUnitIndex + 1 + index).ToString();
                }
                this.mTimerText.set_text(((int)this.mDraftSec).ToString());
                this.mPlayerText.set_text(str1 + string.Format(LocalizedText.Get("sys.DRAFT_UNIT_SELECT_MESSAGE_PLAYER"), (object)str2));
            }
            else
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 111);
                str1 = LocalizedText.Get("sys.DRAFT_TURN_ENEMY");
                str2 = (this.mEnemyUnitIndex + 1).ToString();
                for (int index = 1; index < this.SelectableUnitCount; ++index)
                {
                    str2 = str2 + "," + (this.mEnemyUnitIndex + 1 + index).ToString();
                }
                this.mEnemyText.set_text(str1 + string.Format(LocalizedText.Get("sys.DRAFT_UNIT_SELECT_MESSAGE_ENEMY"), (object)str2));
            }
            this.mTurnChangeUserText.set_text(str1);
            this.mTurnChangeMessage.set_text(string.Format(LocalizedText.Get("sys.DRAFT_CHANGE_TURN_MESSAGE"), (object)str2));
            return(false);
        }
예제 #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)
                {
                    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;
                        }
                    }
                }
            }
        }