public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.NoUnitParty:
                case Network.EErrCode.IllegalParty:
                    this.OnFailed();
                    break;

                default:
                    FlowNode_Network.Retry();
                    break;
                }
            }
            WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
            GameManager instance = MonoSingleton <GameManager> .Instance;

            try
            {
                if (jsonObject.body == null)
                {
                    throw new InvalidJSONException();
                }
                instance.Deserialize(jsonObject.body.player);
                instance.Deserialize(jsonObject.body.parties);
            }
            catch (Exception ex)
            {
                FlowNode_Network.Retry();
                return;
            }
            Json_Party[] parties = jsonObject.body.parties;
            if (parties != null && parties.Length > 0)
            {
                Json_Party json = parties[0];
                for (int index1 = 0; index1 < 11; ++index1)
                {
                    int num = index1;
                    if (index1 != 9)
                    {
                        PartyData party = new PartyData((PlayerPartyTypes)num);
                        party.Deserialize(json);
                        PartyWindow2.EditPartyTypes editPartyType = ((PlayerPartyTypes)num).ToEditPartyType();
                        List <PartyEditData>        teams         = new List <PartyEditData>();
                        int maxTeamCount = editPartyType.GetMaxTeamCount();
                        for (int index2 = 0; index2 < maxTeamCount; ++index2)
                        {
                            PartyEditData partyEditData = new PartyEditData(PartyUtility.CreateDefaultPartyNameFromIndex(index2), party);
                            teams.Add(partyEditData);
                        }
                        PartyUtility.SaveTeamPresets(editPartyType, 0, teams, false);
                    }
                }
            }
            Network.RemoveAPI();
            ((Behaviour)this).set_enabled(false);
            this.ActivateOutputLinks(10);
        }
Exemple #2
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);
        }
Exemple #3
0
        public ReqOrdealPartyUpdate(Network.ResponseCallback response, List <PartyEditData> parties)
        {
            PartyData party = MonoSingleton <GameManager> .Instance.Player.Partys[9];

            this.name = "party2/ordeal/update";
            StringBuilder stringBuilder = WebAPI.GetStringBuilder();

            stringBuilder.Append("\"parties\":[");
            int num = 0;

            stringBuilder.Append("{\"units\":[");
            using (List <PartyEditData> .Enumerator enumerator = parties.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    PartyEditData current = enumerator.Current;
                    if (num > 0)
                    {
                        stringBuilder.Append(',');
                    }
                    stringBuilder.Append('[');
                    for (int index = 0; index < party.MAX_UNIT && index < current.Units.Length && current.Units[index] != null; ++index)
                    {
                        if (index > 0)
                        {
                            stringBuilder.Append(',');
                        }
                        stringBuilder.Append(current.Units[index].UniqueID);
                    }
                    stringBuilder.Append(']');
                    ++num;
                }
            }
            stringBuilder.Append(']');
            string stringFromPartyType = PartyData.GetStringFromPartyType(PlayerPartyTypes.Ordeal);

            stringBuilder.Append(",\"ptype\":\"");
            stringBuilder.Append(stringFromPartyType);
            stringBuilder.Append('"');
            stringBuilder.Append('}');
            stringBuilder.Append(']');
            this.body     = WebAPI.GetRequestString(stringBuilder.ToString());
            this.callback = response;
        }
Exemple #4
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);
        }
Exemple #5
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);
        }