Exemplo n.º 1
0
        private void RefreshDefenseParty()
        {
            PlayerData player      = MonoSingleton <GameManager> .Instance.Player;
            PartyData  partyOfType = player.FindPartyOfType(PlayerPartyTypes.ArenaDef);

            for (int index = 0; index < this.PartyUnitSlots.Length; ++index)
            {
                long     unitUniqueId = partyOfType.GetUnitUniqueID(index);
                UnitData unitData1    = player.FindUnitDataByUniqueID(unitUniqueId);
                if (unitData1 != null && unitData1.GetJobFor(PlayerPartyTypes.ArenaDef) != unitData1.CurrentJob)
                {
                    UnitData unitData2 = new UnitData();
                    unitData2.TempFlags |= UnitData.TemporaryFlags.TemporaryUnitData;
                    unitData2.Setup(unitData1);
                    unitData2.SetJob(PlayerPartyTypes.ArenaDef);
                    unitData1 = unitData2;
                }
                if (index == 0)
                {
                    DataSource.Bind <UnitData>(this.DefenseUnitLeader, unitData1);
                    GameParameter.UpdateAll(this.DefenseUnitLeader);
                }
                DataSource.Bind <UnitData>(this.DefenseUnitSlots[index], unitData1);
                GameParameter.UpdateAll(this.DefenseUnitSlots[index]);
            }
            if (!Object.op_Inequality((Object)this.DefensePartyInfo, (Object)null))
            {
                return;
            }
            DataSource.Bind <PartyData>(this.DefensePartyInfo, partyOfType);
            GameParameter.UpdateAll(this.DefensePartyInfo);
        }
Exemplo n.º 2
0
        public void SetUnitToActivePartySlot()
        {
            PartyUnitSlot active       = PartyUnitSlot.Active;
            UnitData      dataOfClass1 = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);

            if (!Object.op_Inequality((Object)active, (Object)null))
            {
                return;
            }
            PartyData dataOfClass2 = DataSource.FindDataOfClass <PartyData>(((Component)active).get_gameObject(), (PartyData)null);

            if (dataOfClass1 != null)
            {
                for (int index = 0; index < dataOfClass2.MAX_UNIT; ++index)
                {
                    if (dataOfClass2.GetUnitUniqueID(index) == dataOfClass1.UniqueID)
                    {
                        dataOfClass2.SetUnitUniqueID(index, 0L);
                    }
                }
                dataOfClass2.SetUnitUniqueID(active.Index, dataOfClass1.UniqueID);
            }
            else
            {
                dataOfClass2.SetUnitUniqueID(active.Index, 0L);
            }
            FlowNodeEvent <FlowNode_OnPartyChange> .Invoke();
        }
Exemplo n.º 3
0
        private bool IsChooseRoom(MultiPlayAPIRoom room)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;
            PlayerData  player   = instance.Player;
            PartyData   party    = player.Partys[2];
            QuestParam  quest    = instance.FindQuest(room.quest.iname);
            bool        flag     = false;

            if (room.limit == 0)
            {
                return(true);
            }
            if (party != null)
            {
                flag = true;
                for (int index = 0; index < (int)quest.unitNum; ++index)
                {
                    long unitUniqueId = party.GetUnitUniqueID(index);
                    if (unitUniqueId <= 0L)
                    {
                        flag = false;
                        break;
                    }
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    if (unitDataByUniqueId == null)
                    {
                        flag = false;
                        break;
                    }
                    flag &= unitDataByUniqueId.CalcLevel() >= room.unitlv;
                }
            }
            return(flag);
        }
Exemplo n.º 4
0
        private List <Unit> LoadRankMatchParty()
        {
            PlayerData  player   = MonoSingleton <GameManager> .Instance.Player;
            PartyData   party    = player.Partys[10];
            List <Unit> unitList = new List <Unit>();

            for (int index1 = 0; index1 < party.MAX_UNIT; ++index1)
            {
                long unitUniqueId = party.GetUnitUniqueID(index1);
                if (unitUniqueId != 0L)
                {
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    DownloadUtility.DownloadUnit(unitDataByUniqueId.UnitParam, (JobData[])null);
                    Unit unit   = new Unit();
                    int  index2 = player.GetVersusPlacement(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index1);
                    if (index2 < 0 || index2 >= this.CurrentMap.PartyUnitSettings.Count)
                    {
                        index2 = 0;
                    }
                    unit.Setup(unitDataByUniqueId, this.CurrentMap.PartyUnitSettings[index2], (Unit.DropItem)null, (Unit.DropItem)null);
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
Exemplo n.º 5
0
        private SkillParam GetLeaderSkill(PartyData party)
        {
            long        unitUniqueId       = party.GetUnitUniqueID(party.LeaderIndex);
            GameManager instance           = MonoSingleton <GameManager> .Instance;
            UnitData    unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId);

            if (unitDataByUniqueId != null && !string.IsNullOrEmpty((string)unitDataByUniqueId.UnitParam.skill))
            {
                return(instance.GetSkillParam((string)unitDataByUniqueId.UnitParam.skill));
            }
            return((SkillParam)null);
        }
Exemplo n.º 6
0
 public void SetParty(PartyData org)
 {
     if (org == null)
     {
         return;
     }
     this.Reset();
     for (int index = 0; index < this.MAX_UNIT; ++index)
     {
         this.mUniqueIDs[index] = org.GetUnitUniqueID(index);
     }
 }
Exemplo n.º 7
0
        private void Refresh()
        {
            this.ClearItems();
            if (Object.op_Equality((Object)this.ListItem_Normal, (Object)null))
            {
                return;
            }
            Transform   transform = ((Component)this).get_transform();
            GameManager instance  = MonoSingleton <GameManager> .Instance;

            ArenaPlayer[] arenaRanking = instance.GetArenaRanking(this.RankingType);
            PlayerData    player       = MonoSingleton <GameManager> .Instance.Player;

            this.arenaPlayerOwner             = new ArenaPlayer();
            this.arenaPlayerOwner.PlayerName  = player.Name;
            this.arenaPlayerOwner.PlayerLevel = player.Lv;
            this.arenaPlayerOwner.ArenaRank   = player.ArenaRank;
            this.arenaPlayerOwner.battle_at   = player.ArenaLastAt;
            this.arenaPlayerOwner.SelectAward = player.SelectedAward;
            PartyData partyOfType = player.FindPartyOfType(PlayerPartyTypes.Arena);

            for (int index = 0; index < 3; ++index)
            {
                long unitUniqueId = partyOfType.GetUnitUniqueID(index);
                this.arenaPlayerOwner.Unit[index] = player.FindUnitDataByUniqueID(unitUniqueId);
            }
            DataSource.Bind <ArenaPlayer>(this.OwnRankingInfo.get_gameObject(), this.arenaPlayerOwner);
            this.OwnRankingInfo.get_gameObject().SetActive(false);
            this.OwnRankingInfo.get_gameObject().SetActive(true);
            for (int index = 0; index < arenaRanking.Length; ++index)
            {
                ListItemEvents listItemEvents1 = (ListItemEvents)null;
                if (arenaRanking[index].FUID == instance.Player.FUID)
                {
                    listItemEvents1 = this.ListItem_Self;
                }
                if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    listItemEvents1 = this.ListItem_Normal;
                }
                ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                DataSource.Bind <ArenaPlayer>(((Component)listItemEvents2).get_gameObject(), arenaRanking[index]);
                listItemEvents2.OnSelect     = new ListItemEvents.ListItemEvent(this.OnItemSelect);
                listItemEvents2.OnOpenDetail = new ListItemEvents.ListItemEvent(this.OnItemDetail);
                this.AddItem(listItemEvents2);
                ((Component)listItemEvents2).get_transform().SetParent(transform, false);
                ((Component)listItemEvents2).get_gameObject().SetActive(true);
            }
        }
Exemplo n.º 8
0
 public override void OnActivate(int pinID)
 {
     if (pinID != 0 || ((Behaviour)this).get_enabled())
     {
         return;
     }
     if (Network.Mode == Network.EConnectMode.Offline)
     {
         this.Success();
     }
     else
     {
         GameManager      instance         = MonoSingleton <GameManager> .Instance;
         VersusStatusData versusStatusData = new VersusStatusData();
         int       num   = 0;
         PartyData party = instance.Player.Partys[7];
         if (party != null)
         {
             for (int index = 0; index < party.MAX_UNIT; ++index)
             {
                 long unitUniqueId = party.GetUnitUniqueID(index);
                 if (party.GetUnitUniqueID(index) != 0L)
                 {
                     UnitData unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                     if (unitDataByUniqueId != null)
                     {
                         versusStatusData.Add(unitDataByUniqueId.Status.param, unitDataByUniqueId.GetCombination());
                         ++num;
                     }
                 }
             }
         }
         this.ExecRequest((WebAPI) new ReqVersusCpuList(versusStatusData, num, GlobalVars.SelectedQuestID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
         ((Behaviour)this).set_enabled(true);
     }
 }
Exemplo n.º 9
0
        public void Refresh()
        {
            TowerResuponse towerResuponse     = MonoSingleton <GameManager> .Instance.TowerResuponse;
            PlayerData     player             = MonoSingleton <GameManager> .Instance.Player;
            PartyData      partyOfType        = player.FindPartyOfType(PlayerPartyTypes.Tower);
            UnitData       unitDataByUniqueId = player.FindUnitDataByUniqueID(partyOfType.GetUnitUniqueID(partyOfType.LeaderIndex));

            if (unitDataByUniqueId != null)
            {
                DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unitDataByUniqueId);
            }
            if (towerResuponse.arrived_num > 0)
            {
                if (this.TowerFloorParam != null)
                {
                    this.TowerName.set_text(LocalizedText.Get("sys.TOWER_CLEAR_DESC", (object)this.TowerFloorParam.title, (object)this.TowerFloorParam.floor));
                }
                string str = this.TowerResuponse.arrived_num.ToString();
                if (this.TowerResuponse.arrived_num > 99)
                {
                    if (Object.op_Inequality((Object)this.ArrivedNum, (Object)null))
                    {
                        ((Component)this.ArrivedNum).get_gameObject().SetActive(true);
                        this.ArrivedNum.set_text(str);
                    }
                }
                else if (Object.op_Inequality((Object)this.BigArrivedNum, (Object)null) && Object.op_Inequality((Object)this.BigArrivedNumEff, (Object)null))
                {
                    ((Component)this.BigArrivedNum).get_gameObject().SetActive(true);
                    ((Component)this.BigArrivedNumEff).get_gameObject().SetActive(true);
                    this.BigArrivedNum.set_text(str);
                    this.BigArrivedNumEff.set_text(str);
                }
                if (Object.op_Inequality((Object)this.ResultInfo, (Object)null))
                {
                    this.ResultInfo.get_gameObject().SetActive(false);
                }
                if (Object.op_Inequality((Object)this.BackButton, (Object)null))
                {
                    ((Component)this.BackButton).get_gameObject().SetActive(false);
                }
                this.Nowflow = TowerClear.CLEAR_FLOW.RANK_IN;
            }
            else
            {
                this.RefleshResult();
            }
        }
Exemplo n.º 10
0
        public static JSON_MyPhotonPlayerParam Create(int playerID = 0, int playerIndex = 0)
        {
            JSON_MyPhotonPlayerParam photonPlayerParam = new JSON_MyPhotonPlayerParam();

            if (photonPlayerParam == null)
            {
                return((JSON_MyPhotonPlayerParam)null);
            }
            if (Object.op_Equality((Object)PunMonoSingleton <MyPhoton> .Instance, (Object)null))
            {
                return((JSON_MyPhotonPlayerParam)null);
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            photonPlayerParam.playerID    = playerID;
            photonPlayerParam.playerIndex = playerIndex;
            photonPlayerParam.playerName  = player.Name;
            photonPlayerParam.playerLevel = player.Lv;
            photonPlayerParam.FUID        = player.FUID;
            photonPlayerParam.UID         = MonoSingleton <GameManager> .Instance.DeviceId;
            photonPlayerParam.award       = player.SelectedAward;
            PartyData partyData = GlobalVars.SelectedMultiPlayRoomType != JSON_MyPhotonRoomParam.EType.VERSUS ? player.Partys[2] : player.Partys[7];
            int       num       = 0;

            photonPlayerParam.leaderID = partyData.LeaderIndex;
            List <JSON_MyPhotonPlayerParam.UnitDataElem> unitDataElemList = new List <JSON_MyPhotonPlayerParam.UnitDataElem>();

            for (int index = 0; index < partyData.MAX_UNIT; ++index)
            {
                long     unitUniqueId       = partyData.GetUnitUniqueID(index);
                UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                if (unitDataByUniqueId != null)
                {
                    unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem()
                    {
                        slotID = index,
                        place  = player.GetVersusPlacement(PlayerData.VERSUS_ID_KEY + (object)index),
                        unit   = unitDataByUniqueId
                    });
                    num = num + (int)unitDataByUniqueId.Status.param.atk + (int)unitDataByUniqueId.Status.param.mag;
                }
            }
            photonPlayerParam.units     = unitDataElemList.ToArray();
            photonPlayerParam.totalAtk  = num;
            photonPlayerParam.rankpoint = player.VERSUS_POINT;
            return(photonPlayerParam);
        }
Exemplo n.º 11
0
        private void LoadParty()
        {
            this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

            this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest);
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest);
            if (type == PartyWindow2.EditPartyTypes.Auto)
            {
                type = PartyWindow2.EditPartyTypes.Normal;
            }
            PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType());

            this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT];
            string str = this.mCurrentQuest.units.Get(0);

            if (this.mIsUserOwnUnits)
            {
                for (int index = 0; index < partyOfType.MAX_UNIT; ++index)
                {
                    long unitUniqueId = partyOfType.GetUnitUniqueID(index);
                    if (unitUniqueId > 0L)
                    {
                        this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId);
                    }
                }
            }
            else
            {
                for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index)
                {
                    if (this.mUserSelectionParty[index] == null)
                    {
                        this.mCurrentParty[index] = (UnitData)null;
                    }
                    if (this.mUserSelectionParty[index] == null || !(this.mUserSelectionParty[index].UnitParam.iname == str))
                    {
                        this.mCurrentParty[index] = this.mUserSelectionParty[index];
                    }
                }
            }
        }
Exemplo n.º 12
0
        private List <Unit> LoadVersusParty()
        {
            PlayerData  player   = MonoSingleton <GameManager> .Instance.Player;
            PartyData   party    = player.Partys[7];
            List <Unit> unitList = new List <Unit>();

            for (int index = 0; index < party.MAX_UNIT; ++index)
            {
                long unitUniqueId = party.GetUnitUniqueID(index);
                if (unitUniqueId != 0L)
                {
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    DownloadUtility.DownloadUnit(unitDataByUniqueId.UnitParam, (JobData[])null);
                    Unit unit            = new Unit();
                    int  versusPlacement = player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index);
                    unit.Setup(unitDataByUniqueId, this.CurrentMap.PartyUnitSettings[versusPlacement], (Unit.DropItem)null, (Unit.DropItem)null);
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
Exemplo n.º 13
0
        private void RefreshData()
        {
            GameManager          instance1          = MonoSingleton <GameManager> .Instance;
            PlayerData           player             = instance1.Player;
            PartyData            partyOfType        = player.FindPartyOfType(PlayerPartyTypes.Versus);
            VsTowerMatchEndParam towerMatchEndParam = instance1.GetVsTowerMatchEndParam();

            if (towerMatchEndParam == null)
            {
                return;
            }
            if (partyOfType != null)
            {
                UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(partyOfType.GetUnitUniqueID(partyOfType.LeaderIndex));
                if (unitDataByUniqueId != null)
                {
                    DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unitDataByUniqueId);
                }
            }
            int versusTowerFloor = player.VersusTowerFloor;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floortxt, (UnityEngine.Object)null))
            {
                this.floortxt.set_text(versusTowerFloor.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floorEfftxt, (UnityEngine.Object)null))
            {
                this.floorEfftxt.set_text(versusTowerFloor.ToString());
            }
            int versusTowerKey = player.VersusTowerKey;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.key, (UnityEngine.Object)null))
            {
                VersusTowerParam versusTowerParam = instance1.GetCurrentVersusTowerParam(-1);
                if (versusTowerParam != null)
                {
                    int num1 = 0;
                    while (num1 < (int)versusTowerParam.RankupNum)
                    {
                        GameObject go = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.key);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)go, (UnityEngine.Object)null))
                        {
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.parent, (UnityEngine.Object)null))
                            {
                                go.get_transform().SetParent(this.parent.get_transform(), false);
                            }
                            if (versusTowerKey > 0)
                            {
                                GameUtility.SetAnimatorTrigger(go, this.keyDefAnim);
                            }
                            this.mCreateKey.Add(go);
                        }
                        ++num1;
                        --versusTowerKey;
                    }
                    this.key.SetActive(false);
                    SceneBattle instance2 = SceneBattle.Instance;
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance2, (UnityEngine.Object)null))
                    {
                        BattleCore battle = instance2.Battle;
                        if (battle != null)
                        {
                            BattleCore.Record questRecord = battle.GetQuestRecord();
                            if (questRecord.result == BattleCore.QuestResult.Win)
                            {
                                int num2 = !towerMatchEndParam.rankup ? towerMatchEndParam.key : (int)versusTowerParam.RankupNum;
                                this.mAnimKeyIndex = player.VersusTowerKey;
                                this.mMaxKeyCount  = Mathf.Min(num2, (int)versusTowerParam.RankupNum);
                                this.mUpdateFloor  = towerMatchEndParam.rankup;
                                this.mBattleRes    = VersusTowerKey.RESULT.WIN;
                                if (this.mUpdateFloor)
                                {
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalEffNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalEffNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                }
                            }
                            else if (questRecord.result == BattleCore.QuestResult.Lose && (int)versusTowerParam.LoseNum > 0)
                            {
                                this.mAnimKeyIndex = player.VersusTowerKey - 1;
                                this.mMaxKeyCount  = Math.Max(towerMatchEndParam.key, 0);
                                this.mUpdateFloor  = this.mAnimKeyIndex < 0 && (int)versusTowerParam.DownFloor > 0;
                                this.mBattleRes    = VersusTowerKey.RESULT.LOSE;
                                if (this.mUpdateFloor && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                {
                                    this.arrivalNumText.set_text(Math.Max(towerMatchEndParam.floor, 1).ToString());
                                }
                            }
                            else
                            {
                                this.mBattleRes = VersusTowerKey.RESULT.DRAW;
                            }
                        }
                    }
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.infoText, (UnityEngine.Object)null))
                    {
                        this.infoText.SetActive(this.mBattleRes == VersusTowerKey.RESULT.WIN && (int)versusTowerParam.RankupNum > 0);
                    }
                }
            }
            if (!this.mUpdateFloor)
            {
                return;
            }
            this.SetButtonText(true);
        }
Exemplo n.º 14
0
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;
            MyPhoton    pt       = PunMonoSingleton <MyPhoton> .Instance;

            instance.AudienceMode  = false;
            this.mReqID            = pinID;
            pt.IsMultiPlay         = false;
            pt.IsMultiVersus       = false;
            instance.IsVSCpuBattle = false;
            pt.IsRankMatch         = false;
            if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 250) || (pinID == 500 || pinID == 700 || pinID == 1000))
            {
                pt.IsMultiPlay         = pinID == 100 || pinID == 200 || pinID == 250 || pinID == 500;
                pt.IsMultiVersus       = pinID == 200 || pinID == 250;
                instance.IsVSCpuBattle = pinID == 700;
                pt.IsRankMatch         = pinID == 250;
                pinID = 0;
            }
            if (pinID == 10)
            {
                this.mResume = true;
                pinID        = 0;
            }
            if (pinID == 0)
            {
                if (((Behaviour)this).get_enabled())
                {
                    return;
                }
                ((Behaviour)this).set_enabled(true);
                CriticalSection.Enter(CriticalSections.SceneChange);
                if (this.mResume)
                {
                    long btlId = (long)GlobalVars.BtlID;
                    GlobalVars.BtlID.Set(0L);
                    this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                }
                else
                {
                    this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID);
                    PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type);
                    if (!string.IsNullOrEmpty(this.QuestID))
                    {
                        GlobalVars.SelectedQuestID  = this.QuestID;
                        GlobalVars.SelectedFriendID = string.Empty;
                    }
                    if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online)
                    {
                        if (this.mStartingQuest.type == QuestTypes.Arena)
                        {
                            this.ActivateOutputLinks(5);
                            this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                        }
                        else if (this.mStartingQuest.type == QuestTypes.Ordeal)
                        {
                            this.ExecRequest((WebAPI) new ReqBtlOrdealReq(this.mStartingQuest.iname, GlobalVars.OrdealSupports, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        else
                        {
                            PartyData        partyOfType      = instance.Player.FindPartyOfType(partyIndex1);
                            int              partyIndex2      = instance.Player.Partys.IndexOf(partyOfType);
                            bool             multi            = false;
                            bool             isHost           = false;
                            int              seat             = -1;
                            int              plid             = -1;
                            string           uid              = string.Empty;
                            List <string>    stringList       = new List <string>();
                            VersusStatusData versusStatusData = (VersusStatusData)null;
                            int              num1             = 0;
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null))
                            {
                                multi  = pt.IsMultiPlay;
                                isHost = pt.IsOldestPlayer();
                                seat   = pt.MyPlayerIndex;
                                MyPhoton.MyPlayer myPlayer = pt.GetMyPlayer();
                                if (myPlayer != null)
                                {
                                    plid = myPlayer.playerID;
                                }
                                if (pt.IsMultiVersus)
                                {
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted();
                                    MyPhoton.MyRoom          currentRoom             = pt.GetCurrentRoom();
                                    int                      num2 = currentRoom == null ? 1 : currentRoom.playerCount;
                                    JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerIndex != pt.MyPlayerIndex));
                                    if (photonPlayerParam != null)
                                    {
                                        uid = photonPlayerParam.UID;
                                    }
                                    if (!GlobalVars.IsVersusDraftMode)
                                    {
                                        if (string.IsNullOrEmpty(uid) || num2 == 1)
                                        {
                                            this.OnVersusNoPlayer();
                                            return;
                                        }
                                        PlayerPartyTypes playerPartyTypes = PlayerPartyTypes.Versus;
                                        if (pt.IsRankMatch)
                                        {
                                            playerPartyTypes = PlayerPartyTypes.RankMatch;
                                        }
                                        PartyData party = instance.Player.Partys[(int)playerPartyTypes];
                                        if (party != null)
                                        {
                                            versusStatusData = new VersusStatusData();
                                            for (int index = 0; index < party.MAX_UNIT; ++index)
                                            {
                                                long unitUniqueId = party.GetUnitUniqueID(index);
                                                if (party.GetUnitUniqueID(index) != 0L)
                                                {
                                                    UnitData unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                                                    if (unitDataByUniqueId != null)
                                                    {
                                                        versusStatusData.Add(unitDataByUniqueId.Status.param, unitDataByUniqueId.GetCombination());
                                                        ++num1;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        versusStatusData = new VersusStatusData();
                                        for (int index = 0; index < VersusDraftList.VersusDraftPartyUnits.Count; ++index)
                                        {
                                            UnitData versusDraftPartyUnit = VersusDraftList.VersusDraftPartyUnits[index];
                                            if (versusDraftPartyUnit != null)
                                            {
                                                versusStatusData.Add(versusDraftPartyUnit.Status.param, versusDraftPartyUnit.GetCombination());
                                                ++num1;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted();
                                    for (int index = 0; index < myPlayersStarted.Count; ++index)
                                    {
                                        if (myPlayersStarted[index].playerIndex != pt.MyPlayerIndex)
                                        {
                                            stringList.Add(myPlayersStarted[index].UID);
                                        }
                                    }
                                }
                            }
                            if (this.mReqID == 200)
                            {
                                if (GlobalVars.IsVersusDraftMode)
                                {
                                    int enemy_draft_id       = 0;
                                    MyPhoton.MyPlayer player = PunMonoSingleton <MyPhoton> .Instance.GetMyPlayer();

                                    JSON_MyPhotonPlayerParam photonPlayerParam = pt.GetMyPlayersStarted().Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID != player.playerID));
                                    if (photonPlayerParam != null)
                                    {
                                        enemy_draft_id = photonPlayerParam.draft_id;
                                    }
                                    this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, VersusDraftList.DraftID, enemy_draft_id));
                                }
                                else
                                {
                                    this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, 0, 0));
                                }
                            }
                            else if (this.mReqID == 250)
                            {
                                this.ExecRequest((WebAPI) new ReqRankMatch(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else if (this.mReqID == 500)
                            {
                                this.ExecRequest((WebAPI) new ReqBtlMultiTwReq(this.mStartingQuest.iname, partyIndex2, plid, seat, stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else if (this.mReqID == 700)
                            {
                                this.ExecRequest((WebAPI) new ReqVersusCpu(this.mStartingQuest.iname, GlobalVars.VersusCpu == null ? 1 : GlobalVars.VersusCpu.Get().Deck, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else
                            {
                                this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, GlobalVars.SelectedSupport.Get(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat, GlobalVars.Location, GlobalVars.SelectedRankingQuestParam));
                            }
                        }
                    }
                    else
                    {
                        this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                    }
                }
            }
            else if (pinID == 20)
            {
                if (instance.AudienceRoom == null)
                {
                    return;
                }
                this.StartCoroutine(this.StartAudience());
            }
            else
            {
                if (pinID != 30)
                {
                    return;
                }
                if (Network.IsError)
                {
                    this.ActivateOutputLinks(300);
                    Network.ResetError();
                }
                else if (!Network.IsStreamConnecting)
                {
                    Network.ResetError();
                    this.ActivateOutputLinks(300);
                }
                else
                {
                    VersusAudienceManager audienceManager = instance.AudienceManager;
                    audienceManager.AddStartQuest();
                    if (audienceManager.GetStartedParam() != null)
                    {
                        if (audienceManager.GetStartedParam().btlinfo != null)
                        {
                            BattleCore.Json_Battle json = new BattleCore.Json_Battle();
                            json.btlinfo = audienceManager.GetStartedParam().btlinfo;
                            CriticalSection.Enter(CriticalSections.SceneChange);
                            instance.AudienceMode = true;
                            this.StartCoroutine(this.StartScene(json));
                        }
                        else if (audienceManager.IsRetryError)
                        {
                            DebugUtility.LogError("Not Exist btlInfo");
                            Network.Abort();
                            this.ActivateOutputLinks(300);
                        }
                        else
                        {
                            this.ActivateOutputLinks(9);
                        }
                    }
                    else if (audienceManager.IsRetryError)
                    {
                        DebugUtility.LogError("Not Exist StartParam");
                        Network.Abort();
                        this.ActivateOutputLinks(300);
                    }
                    else
                    {
                        this.ActivateOutputLinks(9);
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void LoadParty()
        {
            this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

            this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest);
            if (this.StoryNormalObjects != null)
            {
                for (int index = 0; index < this.StoryNormalObjects.Length; ++index)
                {
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StoryNormalObjects[index], (UnityEngine.Object)null))
                    {
                        this.StoryNormalObjects[index].SetActive(!this.mIsHeloOnly);
                    }
                }
            }
            if (this.HeloOnlyObjects != null)
            {
                for (int index = 0; index < this.HeloOnlyObjects.Length; ++index)
                {
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HeloOnlyObjects[index], (UnityEngine.Object)null))
                    {
                        this.HeloOnlyObjects[index].SetActive(this.mIsHeloOnly);
                    }
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.GuestUnitSlot, (UnityEngine.Object)null))
            {
                if (this.mIsHeloOnly)
                {
                    ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(0);
                }
                else
                {
                    ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(4);
                }
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest);
            if (type == PartyWindow2.EditPartyTypes.Auto)
            {
                type = PartyWindow2.EditPartyTypes.Normal;
            }
            PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType());

            this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT];
            UnitData data  = (UnitData)null;
            string   iname = this.mCurrentQuest.units.Get(0);

            if (this.mIsUserOwnUnits)
            {
                data = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUnitID(iname);

                for (int index = 0; index < partyOfType.MAX_UNIT; ++index)
                {
                    long unitUniqueId = partyOfType.GetUnitUniqueID(index);
                    if (unitUniqueId > 0L)
                    {
                        this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId);
                    }
                }
            }
            else
            {
                for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index)
                {
                    if (this.mUserSelectionParty[index] == null)
                    {
                        this.mCurrentParty[index] = (UnitData)null;
                    }
                    if (this.mUserSelectionParty[index] != null && this.mUserSelectionParty[index].UnitParam.iname == iname)
                    {
                        data = this.mUserSelectionParty[index];
                    }
                    else
                    {
                        this.mCurrentParty[index] = this.mUserSelectionParty[index];
                    }
                }
            }
            int count = this.mCurrentParty.Length - 2;

            UnitData[] array1 = ((IEnumerable <UnitData>) this.mCurrentParty).Skip <UnitData>(count).Take <UnitData>(2).ToArray <UnitData>();
            UnitData[] array2 = ((IEnumerable <UnitData>) this.mCurrentParty).Take <UnitData>(count).ToArray <UnitData>();
            for (int index = 0; index < this.SubUnitSlots.Length && index < array1.Length; ++index)
            {
                this.SubUnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest);
                this.SubUnitSlots[index].SetSlotData <UnitData>(array1[index]);
            }
            for (int index = 0; index < this.UnitSlots.Length && index < array2.Length; ++index)
            {
                this.UnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest);
                this.UnitSlots[index].SetSlotData <UnitData>(array2[index]);
            }
            if (data != null)
            {
                this.mGuestUnit = data;
                this.GuestUnitSlot.SetSlotData <QuestParam>(this.mCurrentQuest);
                this.GuestUnitSlot.SetSlotData <UnitData>(data);
                ((Component)this.GuestUnitSlot).get_gameObject().SetActive(true);
            }
            else
            {
                ((Component)this.GuestUnitSlot).get_gameObject().SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendSlot, (UnityEngine.Object)null))
            {
                if (this.mCurrentQuest.type == QuestTypes.Tower)
                {
                    ((Component)this.FriendSlot).get_gameObject().SetActive(false);
                }
                else
                {
                    ((Component)this.FriendSlot).get_gameObject().SetActive(true);
                    if (this.mIsUserOwnUnits)
                    {
                        this.mCurrentSupport = (SupportData)GlobalVars.SelectedSupport;
                        this.FriendSlot.SetSlotData <UnitData>(this.mCurrentSupport != null ? this.mCurrentSupport.Unit : (UnitData)null);
                    }
                    else if (this.mSupportData != null)
                    {
                        this.FriendSlot.SetSlotData <UnitData>(this.mSupportData.Unit);
                    }
                }
            }
            int num;

            switch (type)
            {
            case PartyWindow2.EditPartyTypes.Normal:
            case PartyWindow2.EditPartyTypes.Arena:
            case PartyWindow2.EditPartyTypes.ArenaDef:
            case PartyWindow2.EditPartyTypes.Character:
                num = 3;
                break;

            case PartyWindow2.EditPartyTypes.Tower:
                num = 5;
                break;

            default:
                if ((this.mCurrentQuest == null ? 0 : (this.mCurrentQuest.UseFixEditor ? 1 : 0)) == 0)
                {
                    num = 4;
                    break;
                }
                goto case PartyWindow2.EditPartyTypes.Normal;
            }
            for (int index = 0; index < this.UnitSlots.Length; ++index)
            {
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitSlots[index], (UnityEngine.Object)null))
                {
                    ((Component)this.UnitSlots[index]).get_gameObject().SetActive(index < num);
                }
            }
        }
Exemplo n.º 16
0
 private SkillParam GetLeaderSkill(PartyData party)
 {
     return(MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(party.GetUnitUniqueID(party.LeaderIndex))?.LeaderSkill.SkillParam);
 }