public override void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyScriptManager.LoadData"); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - START"); MySandboxGame.Log.IncreaseIndent(); base.LoadData(); Static = this; Scripts.Clear(); if (Sync.IsServer) { LoadScripts(MyFileSystem.ContentPath); } LoadScripts(MySession.Static.CurrentPath); ReadScripts(MySession.Static.CurrentPath); foreach (var mod in MySession.Static.Mods) { LoadScripts(Path.Combine(MyFileSystem.ModsPath, mod.Name), mod.Name); } foreach (var ass in Scripts.Values) { MySession.Static.RegisterComponentsFromAssembly(ass); MySandboxGame.Log.WriteLine(string.Format("Script loaded: {0}", ass.FullName)); } MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - END"); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public override void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyScriptManager.LoadData"); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - START"); MySandboxGame.Log.IncreaseIndent(); base.LoadData(); Static = this; Scripts.Clear(); EntityScripts.Clear(); SubEntityScripts.Clear(); if(Sync.IsServer) LoadScripts(MyFileSystem.ContentPath); LoadScripts(MySession.Static.CurrentPath); ReadScripts(MySession.Static.CurrentPath); foreach (var mod in MySession.Static.Mods) LoadScripts(Path.Combine(MyFileSystem.ModsPath, mod.Name), mod.Name); foreach (var ass in Scripts.Values) { MySession.Static.RegisterComponentsFromAssembly(ass); MySandboxGame.Log.WriteLine(string.Format("Script loaded: {0}", ass.FullName)); } MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - END"); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyScriptManager.LoadData"); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - START"); MySandboxGame.Log.IncreaseIndent(); Static = this; Scripts.Clear(); EntityScripts.Clear(); SubEntityScripts.Clear(); if (Sync.IsServer) { LoadScripts(MyFileSystem.ContentPath, MyModContext.BaseGame); } if (MySession.Static.CurrentPath != null) { LoadScripts(MySession.Static.CurrentPath, MyModContext.BaseGame); } if (MySession.Static.Mods != null) { foreach (var mod in MySession.Static.Mods) { var mc = new MyModContext(); mc.Init(mod); LoadScripts(Path.Combine(MyFileSystem.ModsPath, mod.Name), mc); } } foreach (var ass in Scripts.Values) { #if XB1 // XB1_ALLINONEASSEMBLY System.Diagnostics.Debug.Assert(false, "XB1 TODO?"); #else // !XB1 if (MyFakes.ENABLE_TYPES_FROM_MODS) // Highly experimental! { MyGlobalTypeMetadata.Static.RegisterAssembly(ass); } MySandboxGame.Log.WriteLine(string.Format("Script loaded: {0}", ass.FullName)); #endif // !XB1 } MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - END"); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyScriptManager.LoadData"); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - START"); MySandboxGame.Log.IncreaseIndent(); Static = this; Scripts.Clear(); EntityScripts.Clear(); SubEntityScripts.Clear(); if (Sync.IsServer) { LoadScripts(MyFileSystem.ContentPath, MyModContext.BaseGame); } if (MySession.Static.CurrentPath != null) { LoadScripts(MySession.Static.CurrentPath, MyModContext.BaseGame); } if (MySession.Static.Mods != null) { foreach (var mod in MySession.Static.Mods) { var mc = new MyModContext(); mc.Init(mod); LoadScripts(Path.Combine(MyFileSystem.ModsPath, mod.Name), mc); } } foreach (var ass in Scripts.Values) { #if XB1 // XB1_ALLINONEASSEMBLY System.Diagnostics.Debug.Assert(false, "XB1 TODO?"); #else // !XB1 if (MyFakes.ENABLE_TYPES_FROM_MODS) // Highly experimental! { MyGlobalTypeMetadata.Static.RegisterAssembly(ass); } MySandboxGame.Log.WriteLine(string.Format("Script loaded: {0}", ass.FullName)); #endif // !XB1 } MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - END"); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public void LoadData() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyScriptManager.LoadData"); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - START"); MySandboxGame.Log.IncreaseIndent(); Static = this; Scripts.Clear(); EntityScripts.Clear(); SubEntityScripts.Clear(); if (Sync.IsServer) { LoadScripts(MyFileSystem.ContentPath, MyModContext.BaseGame); } if (MySession.Static.CurrentPath != null) { LoadScripts(MySession.Static.CurrentPath, MyModContext.BaseGame); } if (MySession.Static.Mods != null) { foreach (var mod in MySession.Static.Mods) { var mc = new MyModContext(); mc.Init(mod); LoadScripts(Path.Combine(MyFileSystem.ModsPath, mod.Name), mc); } } foreach (var ass in Scripts.Values) { if (MyFakes.ENABLE_TYPES_FROM_MODS) // Highly experimental! { MyObjectFactories.RegisterFromAssembly(ass); } MySandboxGame.Log.WriteLine(string.Format("Script loaded: {0}", ass.FullName)); } MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("MyScriptManager.LoadData() - END"); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
/// <summary> /// Initializes a new instance of the <see cref="MySession"/> class. /// </summary> private MySession(MySyncLayer syncLayer, bool registerComponents = true) { Debug.Assert(syncLayer != null); if (syncLayer == null) MyLog.Default.WriteLine("MySession.Static.MySession() - sync layer is null"); SyncLayer = syncLayer; ElapsedGameTime = new TimeSpan(); // To reset spectator positions Spectator.Reset(); m_timeOfSave = MyTimeSpan.Zero; ElapsedGameTime = new TimeSpan(); Ready = false; MultiplayerLastMsg = 0; MultiplayerAlive = true; MultiplayerDirect = true; AppVersionFromSave = MyFinalBuildConstants.APP_VERSION; Factions.FactionStateChanged += OnFactionsStateChanged; ScriptManager = new MyScriptManager(); GC.Collect(2, GCCollectionMode.Forced); MySandboxGame.Log.WriteLine(String.Format("GC Memory: {0} B", GC.GetTotalMemory(false).ToString("##,#"))); MySandboxGame.Log.WriteLine(String.Format("Process Memory: {0} B", Process.GetCurrentProcess().PrivateMemorySize64.ToString("##,#"))); this.GameFocusManager = new MyGameFocusManager(); }