public T Load <T>(Ikadn.IkadnBaseObject data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } return(Load <T>(data.To <IkonBaseObject>())); }
private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session) { var saveData = rawData.To <IkonArray>(); var result = (ICollection <T>) this.constructor(); foreach (var elementData in saveData) { result.Add(session.Load <T>(elementData)); } return(result); }
private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session) { var saveData = rawData.To <IkonArray>(); var result = (T[])this.lengthConstructor(saveData.Count); for (int i = 0; i < saveData.Count; i++) { result[i] = session.Load <T>(saveData[i]); } return(result); }
public static AMission Load(Ikadn.IkadnBaseObject rawData, ObjectDeindexer deindexer) { var dataStruct = rawData as IkonComposite; var destination = deindexer.Get <StarData>(dataStruct[DestinationKey].To <int>()); Wormhole usedWormhole = null; if (dataStruct.Keys.Contains(WormholeKey)) { usedWormhole = deindexer.Get <Wormhole>(dataStruct[WormholeKey].To <int>()); } return(new MoveMission(destination, usedWormhole)); }
public static IReport Load(Ikadn.IkadnBaseObject reportData, LoadSession session) { if (reportData.Tag.Equals(DevelopmentReport.SaveTag)) { return(session.Load <DevelopmentReport>(reportData)); } else if (reportData.Tag.Equals(ResearchReport.SaveTag)) { return(session.Load <ResearchReport>(reportData)); } //TODO(later) add error handling throw new NotImplementedException(); }
private object deserializeChildren <K, V>(Ikadn.IkadnBaseObject rawData, LoadSession session) { var saveData = rawData.To <IkonArray>(); var result = (IDictionary <K, V>) this.constructor(); for (int i = 0; i < saveData.Count; i += 2) { result.Add( session.Load <K>(saveData[i]), session.Load <V>(saveData[i + 1]) ); } return(result); }
private static IStarTrait LoadTrait(Ikadn.IkadnBaseObject loadData, LoadSession session) { var tag = loadData.Tag as string; if (loadData.Tag.Equals(EffectAfflictPlanets.SaveTag)) { return(session.Load <EffectAfflictPlanets>(loadData)); } else if (loadData.Tag.Equals(EffectTemporary.SaveTag)) { return(session.Load <EffectTemporary>(loadData)); } else { throw new KeyNotFoundException("Unknown order type: " + loadData.Tag); } }
private static IOffscreenPlayer loadControl(Ikadn.IkadnBaseObject rawData, LoadSession session) { var tag = rawData.Tag as string; if (tag.Equals(PlayerType.NoControllerTag)) { return(null); } else if (tag.Equals(PlayerType.OrganelleControllerTag)) { return(new OrganellePlayerFactory().Load(rawData.To <IkonComposite>(), session)); } else if (PlayerAssets.AIDefinitions.ContainsKey(tag)) { return(PlayerAssets.AIDefinitions[tag].Load(rawData.To <IkonComposite>(), session)); } throw new KeyNotFoundException("Can't load player controller for " + tag); }
private static IOffscreenPlayer loadControl(Ikadn.IkadnBaseObject rawData, LoadSession session) { var tag = rawData.Tag as string; switch (tag) { case PlayerType.NoControllerTag: return(null); case PlayerType.OrganelleControllerTag: return(new OrganellePlayerFactory().Load(rawData.To <IkonComposite>(), session)); default: if (PlayerAssets.AIDefinitions.TryGetValue(tag, out var factory)) { return(factory.Load(rawData.To <IkonComposite>(), session)); } else { throw new KeyNotFoundException("Can't load player controller for " + tag); } } }
public BodyTrait Load(StarData location, Ikadn.IkadnBaseObject loadData) { return(new BodyTrait(this, location, loadData.To <IkonComposite>())); }
public T Load <T>(Ikadn.IkadnBaseObject data) { return(Load <T>(data.To <IkonBaseObject>())); }