public override void UpdateAfterSimulation() { if (!isDedicated) { isServer = MyAPIGateway.Session.OnlineMode == MyOnlineModeEnum.OFFLINE || MyAPIGateway.Multiplayer.IsServer; isDedicated = (MyAPIGateway.Utilities.IsDedicated && isServer); } if (!crashed && !isDedicated) { try { if (BuildVision == null) { BvMain.Init(); } if (BuildVision != null) { BuildVision.Update(); } } catch (Exception e) { crashed = true; BvMain.Log?.TryWriteToLog("Build Vision has crashed!\n" + e.ToString()); MyAPIGateway.Utilities.ShowMissionScreen("Build Vision 2", "Debug", "", "Build Vision has crashed! Press the X in the upper right hand corner if you don't want " + "" + "it to reload.\n" + e.ToString(), AllowReload, "Reload"); TryUnload(); } } }
public static void Init() { if (Instance == null) { Instance = new BvMain(); Instance.InitStart(); } }
public override void BeforeClose() { if (ExceptionHandler.IsClient) { BvConfig.Save(); QuickActionHudSpace.Close(); BvConfig.OnConfigLoad -= UpdateBindPageVisibility; } if (ExceptionHandler.Unloading) { TerminalUtilities.Close(); Instance = null; } }
public BvMain() : base(true, true) { if (Instance == null) { Instance = this; } else { throw new Exception("Only one instance of BvMain can exist at any given time."); } LogIO.FileName = "bvLog.txt"; BvConfig.FileName = "BuildVision2Config.xml"; ExceptionHandler.ModName = "Build Vision"; ExceptionHandler.PromptForReload = true; ExceptionHandler.RecoveryLimit = 3; }