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
        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 #3
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);
        }
        private void ValidateTeam(QuestParam quest, List <PartyEditData> teams, int maxTeamCount)
        {
            bool flag = false;

            if (teams.Count > maxTeamCount)
            {
                teams = teams.Take <PartyEditData>(maxTeamCount).ToList <PartyEditData>();
                flag  = true;
            }
            else if (teams.Count < maxTeamCount)
            {
                for (int count = teams.Count; count < maxTeamCount; ++count)
                {
                    PartyData party = new PartyData(PlayerPartyTypes.Ordeal);
                    teams.Add(new PartyEditData(PartyUtility.CreateOrdealPartyNameFromIndex(count), party));
                }
                flag = true;
            }
            if (!(flag | !PartyUtility.ResetToDefaultTeamIfNeededForOrdealQuest(quest, teams)))
            {
                return;
            }
            PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.Ordeal, 0, teams, false);
        }