public GDEPlayerData DeepClone() { GDEPlayerData newClone = ShallowClone(); newClone.achievementData = achievementData.DeepClone(); newClone.herosOwned = new List <GDEHeroData>(); if (herosOwned != null) { foreach (var val in herosOwned) { newClone.herosOwned.Add(val.DeepClone()); } } newClone.Set_herosOwned(); newClone.heroesTeam = new List <GDEunitTeamData>(); if (heroesTeam != null) { foreach (var val in heroesTeam) { newClone.heroesTeam.Add(val.DeepClone()); } } newClone.Set_heroesTeam(); newClone.consumables = new List <GDEItemData>(); if (consumables != null) { foreach (var val in consumables) { newClone.consumables.Add(val.DeepClone()); } } newClone.Set_consumables(); newClone.equipsOwned = new List <GDEEquipmentData>(); if (equipsOwned != null) { foreach (var val in equipsOwned) { newClone.equipsOwned.Add(val.DeepClone()); } } newClone.Set_equipsOwned(); newClone.propsTeam = new List <GDEItemData>(); if (propsTeam != null) { foreach (var val in propsTeam) { newClone.propsTeam.Add(val.DeepClone()); } } newClone.Set_propsTeam(); newClone.TimeTaskList = new List <GDEtimeTaskData>(); if (TimeTaskList != null) { foreach (var val in TimeTaskList) { newClone.TimeTaskList.Add(val.DeepClone()); } } newClone.Set_TimeTaskList(); newClone.goddessOwned = new List <GDEgoddessData>(); if (goddessOwned != null) { foreach (var val in goddessOwned) { newClone.goddessOwned.Add(val.DeepClone()); } } newClone.Set_goddessOwned(); newClone.buildingsOwned = new List <GDEtownBuildingData>(); if (buildingsOwned != null) { foreach (var val in buildingsOwned) { newClone.buildingsOwned.Add(val.DeepClone()); } } newClone.Set_buildingsOwned(); newClone.ItemsOwned = new List <GDEItemData>(); if (ItemsOwned != null) { foreach (var val in ItemsOwned) { newClone.ItemsOwned.Add(val.DeepClone()); } } newClone.Set_ItemsOwned(); newClone.NPCList = new List <GDENPCData>(); if (NPCList != null) { foreach (var val in NPCList) { newClone.NPCList.Add(val.DeepClone()); } } newClone.Set_NPCList(); newClone.RunesOwned = new List <GDERuneData>(); if (RunesOwned != null) { foreach (var val in RunesOwned) { newClone.RunesOwned.Add(val.DeepClone()); } } newClone.Set_RunesOwned(); newClone.AltarPoolList = new List <GDEHeroAltarPoolData>(); if (AltarPoolList != null) { foreach (var val in AltarPoolList) { newClone.AltarPoolList.Add(val.DeepClone()); } } newClone.Set_AltarPoolList(); newClone.finishSectionsList = new List <GDESectionData>(); if (finishSectionsList != null) { foreach (var val in finishSectionsList) { newClone.finishSectionsList.Add(val.DeepClone()); } } newClone.Set_finishSectionsList(); return(newClone); }
public GDEPlayerData ShallowClone() { string newKey = Guid.NewGuid().ToString(); GDEPlayerData newClone = new GDEPlayerData(newKey); newClone.maxPassSection = maxPassSection; newClone.lastPassSection = lastPassSection; newClone.maxDurgeonPassLevel = maxDurgeonPassLevel; newClone.coin = coin; newClone.addGoldPerc = addGoldPerc; newClone.allBufPerc = allBufPerc; newClone.newBestLevel = newBestLevel; newClone.dimension = dimension; newClone.damond = damond; newClone.sickBedNum = sickBedNum; newClone.honorPoint = honorPoint; newClone.JianCai = JianCai; newClone.achievementData = achievementData; newClone.temple_fighter = new List <int>(temple_fighter); newClone.Set_temple_fighter(); newClone.temple_ranger = new List <int>(temple_ranger); newClone.Set_temple_ranger(); newClone.temple_priest = new List <int>(temple_priest); newClone.Set_temple_priest(); newClone.temple_caster = new List <int>(temple_caster); newClone.Set_temple_caster(); newClone.bossKeys = new List <int>(bossKeys); newClone.Set_bossKeys(); newClone.bossKeyUsed = new List <int>(bossKeyUsed); newClone.Set_bossKeyUsed(); newClone.herosOwned = new List <GDEHeroData>(herosOwned); newClone.Set_herosOwned(); newClone.heroesTeam = new List <GDEunitTeamData>(heroesTeam); newClone.Set_heroesTeam(); newClone.consumables = new List <GDEItemData>(consumables); newClone.Set_consumables(); newClone.equipsOwned = new List <GDEEquipmentData>(equipsOwned); newClone.Set_equipsOwned(); newClone.propsTeam = new List <GDEItemData>(propsTeam); newClone.Set_propsTeam(); newClone.TimeTaskList = new List <GDEtimeTaskData>(TimeTaskList); newClone.Set_TimeTaskList(); newClone.goddessOwned = new List <GDEgoddessData>(goddessOwned); newClone.Set_goddessOwned(); newClone.buildingsOwned = new List <GDEtownBuildingData>(buildingsOwned); newClone.Set_buildingsOwned(); newClone.ItemsOwned = new List <GDEItemData>(ItemsOwned); newClone.Set_ItemsOwned(); newClone.NPCList = new List <GDENPCData>(NPCList); newClone.Set_NPCList(); newClone.RunesOwned = new List <GDERuneData>(RunesOwned); newClone.Set_RunesOwned(); newClone.AltarPoolList = new List <GDEHeroAltarPoolData>(AltarPoolList); newClone.Set_AltarPoolList(); newClone.finishSectionsList = new List <GDESectionData>(finishSectionsList); newClone.Set_finishSectionsList(); return(newClone); }