Ejemplo n.º 1
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 120)
            {
                return;
            }
            int           lastSelectionIndex;
            PartyEditData loadTeamPreset = PartyUtility.LoadTeamPresets(PlayerPartyTypes.RankMatch, out lastSelectionIndex, false)[lastSelectionIndex];

            for (int index = 0; index < loadTeamPreset.PartyData.VSWAITMEMBER_START; ++index)
            {
                if (index + 1 > loadTeamPreset.Units.Length || loadTeamPreset.Units[index] == null)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
            }
            List <int> intList = new List <int>();

            for (int index = 0; index < loadTeamPreset.PartyData.VSWAITMEMBER_START; ++index)
            {
                int num = PlayerPrefsUtility.GetInt(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index, -1);
                if (num >= 0)
                {
                    if (intList.Contains(num))
                    {
                        this.ActivateOutputLinks(202);
                        return;
                    }
                    intList.Add(num);
                }
            }
            this.ActivateOutputLinks(200);
        }
Ejemplo n.º 2
0
        private List <PartyEditData> LoadTeamFromPlayerPrefs()
        {
            int maxTeamCount = PartyWindow2.EditPartyTypes.Ordeal.GetMaxTeamCount();
            int lastSelectionIndex;
            List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PartyWindow2.EditPartyTypes.Ordeal, out lastSelectionIndex, false) ?? new List <PartyEditData>();

            this.ValidateTeam(this.mCurrentQuest, teams, maxTeamCount);
            return(teams);
        }
Ejemplo n.º 3
0
        private void Start()
        {
            int lastSelectionIndex;
            List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PlayerPartyTypes.Versus, out lastSelectionIndex, false);

            if (teams == null || teams.Count <= lastSelectionIndex)
            {
                return;
            }
            PartyEditData partyEditData = teams[lastSelectionIndex];

            UnitData[] src = new UnitData[partyEditData.PartyData.MAX_UNIT];
            for (int index = 0; index < partyEditData.Units.Length && index < partyEditData.PartyData.VSWAITMEMBER_START; ++index)
            {
                src[index] = partyEditData.Units[index];
            }
            partyEditData.SetUnits(src);
            PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.Versus, lastSelectionIndex, teams, false);
        }
Ejemplo n.º 4
0
        private void PostJobChange()
        {
            this.mRequestSent = false;
            if (this.mTargetUnit != null)
            {
                MonoSingleton <GameManager> .Instance.Player.OnJobChange(this.mTargetUnit.UnitID);

                this.mOriginalJobID = this.mTargetUnit.CurrentJob.JobID;
                if (this.UpdateValue != null)
                {
                    this.UpdateValue();
                }
                if (DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max) == PlayerPartyTypes.MultiTower)
                {
                    int lastSelectionIndex     = 0;
                    List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PartyWindow2.EditPartyTypes.MultiTower, out lastSelectionIndex, false);
                    if (teams != null && lastSelectionIndex >= 0)
                    {
                        for (int index1 = 0; index1 < teams.Count; ++index1)
                        {
                            if (teams[index1] != null)
                            {
                                for (int index2 = 0; index2 < teams[index1].Units.Length; ++index2)
                                {
                                    if (teams[index1].Units[index2] != null && teams[index1].Units[index2].UnitParam.iname == this.mTargetUnit.UnitParam.iname)
                                    {
                                        teams[index1].Units[index2] = this.mTargetUnit;
                                        break;
                                    }
                                }
                            }
                        }
                        PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.MultiTower, lastSelectionIndex, teams, false);
                        GlobalEvent.Invoke("SELECT_PARTY_END", (object)null);
                    }
                }
            }
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 11);
        }
        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 (UnityEngine.Object.op_Equality((UnityEngine.Object)PunMonoSingleton <MyPhoton> .Instance, (UnityEngine.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;
            PlayerPartyTypes partyType = PlayerPartyTypes.Multiplay;

            switch (GlobalVars.SelectedMultiPlayRoomType)
            {
            case JSON_MyPhotonRoomParam.EType.RAID:
                partyType = PlayerPartyTypes.Multiplay;
                break;

            case JSON_MyPhotonRoomParam.EType.VERSUS:
                partyType = PlayerPartyTypes.Versus;
                break;

            case JSON_MyPhotonRoomParam.EType.TOWER:
                partyType = PlayerPartyTypes.MultiTower;
                break;
            }
            QuestParam           quest = (QuestParam)null;
            PartyData            party;
            int                  length;
            List <PartyEditData> teams;

            if (partyType == PlayerPartyTypes.Versus || partyType == PlayerPartyTypes.MultiTower)
            {
                party  = player.Partys[(int)partyType];
                length = party.MAX_UNIT;
                int lastSelectionIndex;
                teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex);
            }
            else
            {
                party  = player.Partys[(int)partyType];
                length = party.MAX_UNIT;
                if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID))
                {
                    quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                    if (quest != null)
                    {
                        length = (int)quest.unitNum;
                    }
                }
                int lastSelectionIndex;
                teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex);
            }
            UnitData[] unitDataArray = new UnitData[length];
            if (teams != null && teams.Count > 0)
            {
                PartyUtility.ResetToDefaultTeamIfNeeded(partyType, quest, teams);
                UnitData[] units = teams[0].Units;
                for (int index = 0; index < unitDataArray.Length && index < units.Length; ++index)
                {
                    unitDataArray[index] = units[index];
                }
            }
            else
            {
                for (int index = 0; index < unitDataArray.Length; ++index)
                {
                    long unitUniqueId = party.GetUnitUniqueID(index);
                    unitDataArray[index] = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                }
            }
            int  num1 = 0;
            int  num2 = 0;
            bool flag = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER;

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

            for (int index = 0; index < unitDataArray.Length; ++index)
            {
                UnitData unitData = unitDataArray[index];
                if (unitData != null)
                {
                    unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem()
                    {
                        slotID = num1++,
                        place  = !flag ? player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index) : -1,
                        sub    = index < party.MAX_MAINMEMBER || party.MAX_SUBMEMBER <= 0 ? 0 : 1,
                        unit   = unitData
                    });
                    num2 = num2 + (int)unitData.Status.param.atk + (int)unitData.Status.param.mag;
                }
            }
            photonPlayerParam.units            = unitDataElemList.ToArray();
            photonPlayerParam.totalAtk         = num2;
            photonPlayerParam.rankpoint        = player.VERSUS_POINT;
            photonPlayerParam.mtChallengeFloor = MonoSingleton <GameManager> .Instance.GetMTChallengeFloor();

            photonPlayerParam.mtClearedFloor = MonoSingleton <GameManager> .Instance.GetMTClearedMaxFloor();

            return(photonPlayerParam);
        }
Ejemplo n.º 6
0
        private void RefreshParty()
        {
            int             lastSelectionIndex;
            PartyEditData   loadTeamPreset  = PartyUtility.LoadTeamPresets(PlayerPartyTypes.RankMatch, out lastSelectionIndex, false)[lastSelectionIndex];
            VersusRankParam versusRankParam = MonoSingleton <GameManager> .Instance.GetVersusRankParam(MonoSingleton <GameManager> .Instance.RankMatchScheduleId);

            if (versusRankParam == null)
            {
                return;
            }
            for (int index = 0; index < this.PartyUnitSlots.Length && index < loadTeamPreset.PartyData.VSWAITMEMBER_START; ++index)
            {
                if (index + 1 <= loadTeamPreset.Units.Length && loadTeamPreset.Units[index] != null)
                {
                    UnitData unitData1 = loadTeamPreset.Units[index];
                    if (unitData1.GetJobFor(PlayerPartyTypes.RankMatch) != unitData1.CurrentJob)
                    {
                        UnitData unitData2 = new UnitData();
                        unitData2.TempFlags |= UnitData.TemporaryFlags.TemporaryUnitData;
                        unitData2.Setup(unitData1);
                        unitData2.SetJob(PlayerPartyTypes.RankMatch);
                        unitData1 = unitData2;
                    }
                    unitData1.TempFlags |= UnitData.TemporaryFlags.AllowJobChange;
                    if (index == 0)
                    {
                        DataSource.Bind <UnitData>(this.PartyUnitLeader, unitData1);
                        GameParameter.UpdateAll(this.PartyUnitLeader);
                    }
                    DataSource.Bind <UnitData>(this.PartyUnitSlots[index], unitData1);
                    GameParameter.UpdateAll(this.PartyUnitSlots[index]);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.PartyInfo, (UnityEngine.Object)null))
            {
                DataSource.Bind <PartyData>(this.PartyInfo, loadTeamPreset.PartyData);
                GameParameter.UpdateAll(this.PartyInfo);
            }
            DataSource.Bind <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.RankMatch);
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AwardItem, (UnityEngine.Object)null))
            {
                DataSource.Bind <PlayerData>(this.AwardItem, player);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StreakWin, (UnityEngine.Object)null))
            {
                if (player.RankMatchStreakWin > 1)
                {
                    this.StreakWin.set_text(player.RankMatchStreakWin.ToString());
                }
                else
                {
                    ((Component)((Component)this.StreakWin).get_transform().get_parent()).get_gameObject().SetActive(false);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.NextOpenDate, (UnityEngine.Object)null))
            {
                if (MonoSingleton <GameManager> .Instance.RankMatchNextTime == 0L)
                {
                    ((Component)this.NextOpenDate).get_gameObject().SetActive(false);
                }
                else
                {
                    DateTime dateTime = TimeManager.FromUnixTime(MonoSingleton <GameManager> .Instance.RankMatchNextTime);
                    ((Component)this.NextOpenDate).get_gameObject().SetActive(true);
                    this.NextOpenDate.set_text(dateTime.ToString("MM/dd"));
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.NextOpenTime, (UnityEngine.Object)null))
            {
                if (MonoSingleton <GameManager> .Instance.RankMatchNextTime == 0L)
                {
                    this.NextOpenTime.set_text("--");
                }
                else
                {
                    this.NextOpenTime.set_text(TimeManager.FromUnixTime(MonoSingleton <GameManager> .Instance.RankMatchNextTime).ToString("HH:mm"));
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SeasonDateText, (UnityEngine.Object)null))
            {
                this.SeasonDateText.set_text(versusRankParam.EndAt.ToString("MM/dd"));
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SeasonTimeText, (UnityEngine.Object)null))
            {
                this.SeasonTimeText.set_text(versusRankParam.EndAt.ToString("HH:mm"));
            }
            MultiPlayVersusEdit component = (MultiPlayVersusEdit)((Component)this).GetComponent <MultiPlayVersusEdit>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            component.Set();
        }
        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 (UnityEngine.Object.op_Equality((UnityEngine.Object)PunMonoSingleton <MyPhoton> .Instance, (UnityEngine.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;
            PlayerPartyTypes partyType = PlayerPartyTypes.Multiplay;

            switch (GlobalVars.SelectedMultiPlayRoomType)
            {
            case JSON_MyPhotonRoomParam.EType.RAID:
                partyType = PlayerPartyTypes.Multiplay;
                break;

            case JSON_MyPhotonRoomParam.EType.VERSUS:
                partyType = PlayerPartyTypes.Versus;
                break;

            case JSON_MyPhotonRoomParam.EType.TOWER:
                partyType = PlayerPartyTypes.MultiTower;
                break;

            case JSON_MyPhotonRoomParam.EType.RANKMATCH:
                partyType = PlayerPartyTypes.RankMatch;
                break;
            }
            QuestParam           quest = (QuestParam)null;
            PartyData            party;
            int                  length;
            List <PartyEditData> teams;

            switch (partyType)
            {
            case PlayerPartyTypes.Versus:
                party  = player.Partys[(int)partyType];
                length = party.MAX_MAINMEMBER;
                int lastSelectionIndex1;
                teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex1, false);
                if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID))
                {
                    quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                    break;
                }
                break;

            case PlayerPartyTypes.MultiTower:
                party  = player.Partys[(int)partyType];
                length = party.MAX_UNIT;
                int lastSelectionIndex2;
                teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex2, false);
                break;

            case PlayerPartyTypes.RankMatch:
                party  = player.Partys[(int)partyType];
                length = party.MAX_MAINMEMBER;
                int lastSelectionIndex3;
                teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex3, false);
                if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID))
                {
                    quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                    break;
                }
                break;

            default:
                party  = player.Partys[(int)partyType];
                length = party.MAX_UNIT;
                if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID))
                {
                    quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                    if (quest != null)
                    {
                        length = (int)quest.unitNum;
                    }
                }
                PartyEditData partyEditData = new PartyEditData(string.Empty, party);
                teams = new List <PartyEditData>();
                teams.Add(partyEditData);
                break;
            }
            UnitData[] unitDataArray = new UnitData[length];
            if (teams != null && teams.Count > 0)
            {
                PartyUtility.ResetToDefaultTeamIfNeeded(partyType, quest, teams);
                UnitData[] units = teams[0].Units;
                for (int index = 0; index < unitDataArray.Length && index < units.Length; ++index)
                {
                    unitDataArray[index] = units[index];
                }
            }
            else
            {
                for (int index = 0; index < unitDataArray.Length; ++index)
                {
                    long unitUniqueId = party.GetUnitUniqueID(index);
                    unitDataArray[index] = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                }
            }
            int  num1 = 0;
            int  num2 = 0;
            int  num3 = 0;
            bool flag = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER;

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

            for (int index = 0; index < unitDataArray.Length; ++index)
            {
                UnitData unitData = unitDataArray[index];
                if (unitData != null)
                {
                    unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem()
                    {
                        slotID = num1++,
                        place  = !flag ? (partyType != PlayerPartyTypes.RankMatch ? player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index) : player.GetVersusPlacement(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index)) : -1,
                        sub    = index < party.MAX_MAINMEMBER || party.MAX_SUBMEMBER <= 0 ? 0 : 1,
                        unit   = unitData
                    });
                    num2 = num2 + (int)unitData.Status.param.atk + (int)unitData.Status.param.mag;
                    num3 = num3 + (int)((double)(int)unitData.Status.param.hp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.HP) + (int)((double)(int)unitData.Status.param.atk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Attack) + (int)((double)(int)unitData.Status.param.def * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Defense) + (int)((double)(int)unitData.Status.param.mag * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagAttack) + (int)((double)(int)unitData.Status.param.mnd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagDefense) + (int)((double)(int)unitData.Status.param.dex * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Dex) + (int)((double)(int)unitData.Status.param.spd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Speed) + (int)((double)(int)unitData.Status.param.cri * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Critical) + (int)((double)(int)unitData.Status.param.luk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Luck) + (int)((double)unitData.GetCombination() * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Combo) + (int)((double)(int)unitData.Status.param.mov * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Move) + (int)((double)(int)unitData.Status.param.jmp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Jump);
                }
            }
            photonPlayerParam.units            = unitDataElemList.ToArray();
            photonPlayerParam.totalAtk         = num2;
            photonPlayerParam.totalStatus      = Mathf.FloorToInt((float)(num3 / unitDataElemList.Count));
            photonPlayerParam.rankpoint        = player.VERSUS_POINT;
            photonPlayerParam.mtChallengeFloor = MonoSingleton <GameManager> .Instance.GetMTChallengeFloor();

            photonPlayerParam.mtClearedFloor = MonoSingleton <GameManager> .Instance.GetMTClearedMaxFloor();

            photonPlayerParam.rankmatch_score = MonoSingleton <GameManager> .Instance.Player.RankMatchScore;
            UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedSupportUnitUniqueID);

            photonPlayerParam.support_unit = unitDataByUniqueId.Serialize();
            photonPlayerParam.draft_id     = VersusDraftList.DraftID;
            return(photonPlayerParam);
        }