10 protected static const ResourceName CORE_CONFIG_PATH =
"{A9ACCDC72AD70995}Configs/Core/Cores.conf";
13 protected ref array<ref SCR_GameCoreBase> m_aCores;
15 protected ref array<SCR_GameCoreBase> m_CoresSorted =
new array<SCR_GameCoreBase>;
16 protected static ref map<typename, SCR_GameCoreBase> m_CoresMap =
new map<typename, SCR_GameCoreBase>;
20 foreach (SCR_GameCoreBase core: m_CoresSorted)
28 foreach (SCR_GameCoreBase core: m_CoresSorted)
34 void OnWorldPostProcess(World world)
36 foreach (SCR_GameCoreBase core: m_CoresSorted)
39 core.OnWorldPostProcess(world);
42 void OnUpdate(
float timeSlice)
44 foreach (SCR_GameCoreBase core: m_CoresSorted)
47 core.OnUpdate(timeSlice);
52 foreach (SCR_GameCoreBase core: m_CoresSorted)
64 static SCR_GameCoreBase GetCore(
typename type)
66 return m_CoresMap.Get(
type);
74 Resource container = BaseContainerTools.LoadContainer(CORE_CONFIG_PATH);
75 if (!container || !container.IsValid())
77 Print(
string.Format(
"Core config '%1' not found!", CORE_CONFIG_PATH), LogLevel.ERROR);
81 Managed instance = BaseContainerTools.CreateInstanceFromContainer(container.GetResource().ToBaseContainer());
85 Print(
string.Format(
"SCR_GameCoresManager class not found in '%1'!", CORE_CONFIG_PATH), LogLevel.ERROR);
94 m_CoresMap =
new map<typename, SCR_GameCoreBase>;
95 foreach (SCR_GameCoreBase core: m_aCores)
97 if (!core.IsEnabled() || !core.CanCreate())
100 if (!m_CoresMap.Contains(core.Type()))
103 int priority = core.GetPriority();
105 for (
int c = 0, count = m_CoresSorted.Count(); c < count; c++)
111 m_CoresSorted.InsertAt(core,
index);
112 m_CoresMap.Insert(core.Type(), core);
116 Print(
string.Format(
"Duplicate definition of core '%1'!", core.Type()), LogLevel.ERROR);