public void Deserialize(Json_Artifact json) { if (json == null || string.IsNullOrEmpty(json.iname)) { this.Reset(); } else { GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); this.mArtifactParam = instanceDirect.MasterParam.GetArtifactParam(json.iname); this.mUniqueID = (OLong)json.iid; this.mRarity = (OInt)Math.Min(Math.Max(json.rare, this.mArtifactParam.rareini), this.mArtifactParam.raremax); this.mRarityParam = instanceDirect.GetRarityParam((int)this.mRarity); this.mExp = (OInt)json.exp; this.mLv = (OInt)this.GetLevelFromExp((int)this.mExp); this.mFavorite = json.fav != 0; this.UpdateEquipEffect(); this.UpdateLearningAbilities(false); } }
public Json_Unit GetJson_Unit() { GameManager instance = MonoSingleton <GameManager> .Instance; if (Object.op_Equality((Object)instance, (Object)null)) { return((Json_Unit)null); } if (instance.GetUnitParam(this.mUnitIName) == null) { return((Json_Unit)null); } Json_Unit jsonUnit = new Json_Unit(); jsonUnit.iid = this.mDraftUnitId; jsonUnit.iname = this.mUnitIName; jsonUnit.rare = this.mRare; jsonUnit.plus = this.mAwake; jsonUnit.exp = instance.MasterParam.GetUnitLevelExp(this.mLevel); jsonUnit.lv = this.mLevel; jsonUnit.fav = 0; jsonUnit.elem = 0; jsonUnit.select = new Json_UnitSelectable(); jsonUnit.jobs = new Json_Job[this.mVersusDraftUnitJobs.Count]; for (int index1 = 0; index1 < this.mVersusDraftUnitJobs.Count; ++index1) { JobParam jobParam = instance.GetJobParam(this.mVersusDraftUnitJobs[index1].mIName); if (jobParam != null && jobParam.ranks.Length > this.mVersusDraftUnitJobs[index1].mRank) { JobRankParam rank = jobParam.ranks[this.mVersusDraftUnitJobs[index1].mRank]; Json_Job jsonJob = new Json_Job(); jsonJob.iid = this.mDummyIID * 10L + (long)index1; jsonJob.iname = this.mVersusDraftUnitJobs[index1].mIName; jsonJob.rank = this.mVersusDraftUnitJobs[index1].mRank; jsonJob.equips = new Json_Equip[JobRankParam.MAX_RANKUP_EQUIPS]; if (this.mVersusDraftUnitJobs[index1].mEquip) { for (int index2 = 0; index2 < JobRankParam.MAX_RANKUP_EQUIPS; ++index2) { jsonJob.equips[index2] = new Json_Equip() { iid = jsonJob.iid * 10L + (long)index2, iname = rank.equips[index2] } } ; } jsonJob.select = new Json_JobSelectable(); jsonJob.select.abils = new long[5]; jsonJob.select.artifacts = new long[3]; List <Json_Ability> jsonAbilityList = new List <Json_Ability>(); List <string> stringList = new List <string>(); stringList.Add(jobParam.fixed_ability); for (int index2 = 1; index2 <= jsonJob.rank; ++index2) { if (jobParam.ranks.Length >= index2 && jobParam.ranks[index2] != null && jobParam.ranks[index2].learnings != null) { for (int index3 = 0; index3 < jobParam.ranks[index2].learnings.Length; ++index3) { stringList.Add((string)jobParam.ranks[index2].learnings[index3]); } } } for (int index2 = 0; index2 < stringList.Count; ++index2) { Json_Ability jsonAbility = new Json_Ability(); jsonAbility.iid = jsonJob.iid * 10L + (long)index2; jsonAbility.iname = stringList[index2]; jsonAbility.exp = 0; jsonAbilityList.Add(jsonAbility); if (this.mAbilities.ContainsKey(jsonAbility.iname)) { jsonAbility.exp = this.mAbilities[jsonAbility.iname].mLevel - 1; jsonAbility.iid = this.mAbilities[jsonAbility.iname].mIID; } } jsonJob.abils = jsonAbilityList.ToArray(); if (index1 == this.mSelectJobIndex) { jsonUnit.select.job = jsonJob.iid; jsonJob.artis = new Json_Artifact[3]; for (int index2 = 0; index2 < this.mVersusDraftUnitArtifacts.Count; ++index2) { Json_Artifact jsonArtifact = new Json_Artifact(); jsonArtifact.iid = jsonJob.iid * 100L + (long)index2; jsonArtifact.iname = this.mVersusDraftUnitArtifacts[index2].mIName; jsonArtifact.rare = this.mVersusDraftUnitArtifacts[index2].mRare; jsonArtifact.exp = ArtifactData.StaticCalcExpFromLevel(this.mVersusDraftUnitArtifacts[index2].mLevel); jsonJob.artis[index2] = jsonArtifact; jsonJob.select.artifacts[index2] = jsonArtifact.iid; } int index3 = 0; using (Dictionary <string, VersusDraftUnitAbility> .ValueCollection.Enumerator enumerator = this.mAbilities.Values.GetEnumerator()) { while (enumerator.MoveNext()) { VersusDraftUnitAbility current = enumerator.Current; jsonJob.select.abils[index3] = current.mIID; ++index3; } } jsonJob.cur_skin = this.mSkinIName; } jsonUnit.jobs[index1] = jsonJob; } } if (!string.IsNullOrEmpty(this.mMasterAbilityIName)) { jsonUnit.abil = new Json_MasterAbility(); jsonUnit.abil.iid = this.mDummyIID; jsonUnit.abil.iname = this.mMasterAbilityIName; jsonUnit.abil.exp = 0; } ConceptCardParam conceptCardParam = instance.MasterParam.GetConceptCardParam(this.mConceptCardIName); if (conceptCardParam != null) { RarityParam rarityParam = instance.GetRarityParam(conceptCardParam.rare); jsonUnit.concept_card = new JSON_ConceptCard(); jsonUnit.concept_card.iname = this.mConceptCardIName; jsonUnit.concept_card.iid = this.mDummyIID; jsonUnit.concept_card.plus = (int)rarityParam.ConceptCardAwakeCountMax; jsonUnit.concept_card.exp = instance.MasterParam.GetConceptCardLevelExp(conceptCardParam.rare, this.mConceptCardLevel); jsonUnit.concept_card.trust = 0; jsonUnit.concept_card.trust_bonus = 0; jsonUnit.concept_card.fav = 0; } jsonUnit.doors = new Json_Tobira[this.mVersusDraftUnitDoors.Count]; List <Json_Ability> jsonAbilityList1 = new List <Json_Ability>(); for (int index1 = 0; index1 < this.mVersusDraftUnitDoors.Count; ++index1) { Json_Tobira jsonTobira = new Json_Tobira(); jsonTobira.category = (int)this.mVersusDraftUnitDoors[index1].mCategory; jsonTobira.lv = this.mVersusDraftUnitDoors[index1].mLevel; jsonUnit.doors[index1] = jsonTobira; TobiraParam tobiraParam = instance.MasterParam.GetTobiraParam(this.mUnitIName, this.mVersusDraftUnitDoors[index1].mCategory); if (tobiraParam != null) { for (int index2 = 0; index2 < tobiraParam.LeanAbilityParam.Length; ++index2) { TobiraLearnAbilityParam learnAbilityParam = tobiraParam.LeanAbilityParam[index2]; if (learnAbilityParam.Level <= jsonTobira.lv) { switch (learnAbilityParam.AbilityAddType) { case TobiraLearnAbilityParam.AddType.JobOverwrite: for (int index3 = 0; index3 < jsonUnit.jobs.Length; ++index3) { for (int index4 = 0; index4 < jsonUnit.jobs[index3].abils.Length; ++index4) { if (jsonUnit.jobs[index3].abils[index4].iname == learnAbilityParam.AbilityOverwrite) { jsonUnit.jobs[index3].abils[index4].iname = learnAbilityParam.AbilityIname; if (this.mAbilities.ContainsKey(learnAbilityParam.AbilityIname)) { jsonUnit.jobs[index3].abils[index4].iid = this.mAbilities[learnAbilityParam.AbilityIname].mIID; jsonUnit.jobs[index3].abils[index4].exp = this.mAbilities[learnAbilityParam.AbilityIname].mLevel - 1; } } } } continue; case TobiraLearnAbilityParam.AddType.MasterAdd: jsonAbilityList1.Add(new Json_Ability() { iid = this.mDummyIID * 100L + (long)(index1 * 10) + (long)index2, iname = learnAbilityParam.AbilityIname, exp = 0 }); continue; default: continue; } } } } } jsonUnit.door_abils = jsonAbilityList1.ToArray(); return(jsonUnit); } }