internal ProcessSet(SerializationInfo info, StreamingContext context) { Game game = (Game)context.Context; Dictionary <string, List <Guid> > instanceProcessors = (Dictionary <string, List <Guid> >)info.GetValue(nameof(InstanceProcessors), typeof(Dictionary <string, List <Guid> >)); ProcessorManager processManager = StaticRefLib.ProcessorManager; foreach (var kvpItem in instanceProcessors) { string typeName = kvpItem.Key; //IInstanceProcessor processor = processManager.GetInstanceProcessor(typeName); if (!InstanceProcessors.ContainsKey(typeName)) { InstanceProcessors.Add(typeName, new List <Entity>()); } foreach (var entityGuid in kvpItem.Value) { if (game.GlobalManager.FindEntityByGuid(entityGuid, out Entity entity)) //might be a better way to do this, can we get the manager from here and just search localy? { InstanceProcessors[typeName].Add(entity); } else { // Entity has not been deserialized. throw new Exception("Unfound Entity Exception, possibly this entity hasn't been deseralised yet?"); //I *think* we'll have the entitys all deseralised for this manager at this point... } } } }
internal ManagerSubPulse(EntityManager entityMan, ProcessorManager procMan) { _systemLocalDateTime = StaticRefLib.CurrentDateTime; _entityManager = entityMan; _processManager = procMan; InitHotloopProcessors(); }
internal Game() { SyncContext = SynchronizationContext.Current; GameLoop = new TimeLoop(this); EventLog = new EventLog(this); ProcessorManager = new ProcessorManager(this); GlobalManager = new EntityManager(this, true); OrderHandler = new StandAloneOrderHandler(this); }
public static void Setup(Game game) { Game = game; StaticData = game.StaticData; ProcessorManager = new ProcessorManager(game); GameLoop = new TimeLoop(game); EventLog = new EventLog(game); SyncContext = SynchronizationContext.Current; }
public static void Setup(Game game) { Game = game; StaticData = game.StaticData; ProcessorManager = new ProcessorManager(game); GamePulse = new MasterTimePulse(game); EventLog = new EventLog(game); SyncContext = SynchronizationContext.Current; OrderHandler = game.OrderHandler; }
internal void PostLoadInit(StreamingContext context, EntityManager entityManager) //this one is used after loading a game. { _entityManager = entityManager; _processManager = StaticRefLib.ProcessorManager; InitHotloopProcessors(); }