protected override void InitCommon(IModSystemRegistry modSystemRegistry) { string sInit = "Initialising Wico Research. Version: " + CurrentModVersion; MyAPIGateway.Utilities.ShowNotification(sInit, 5000, MyFontEnum.DarkBlue); ModLog.Info(sInit); if (MyAPIGateway.Session.IsServer) { MyVisualScriptLogicProvider.SendChatMessage(sInit, "Wicorel", 0, MyFontEnum.DarkBlue); } bool bResearch = Session.SessionSettings.EnableResearch; // This works to change the setting. Session.SessionSettings.EnableResearch = true; if (!bResearch) { ModLog.Info("Research was not turned on"); } TextAPI = new HudAPIv2(); researchControl = new ResearchControl(audioSystem); researchControl.InitResearchRestrictions(); researchHacking = new ResearchHacking(researchControl, TextAPI, networkComms); networkComms.Init(audioSystem, researchControl, researchHacking); modSystemRegistry.AddCloseableModSystem(networkComms); modSystemRegistry.AddUpatableModSystem(audioSystem); MyAPIGateway.Utilities.MessageEntered += MessageEntered; }
public override void LoadData() { Instance = this; isCreativeGame = (MyAPIGateway.Session.SessionSettings.GameMode == MyGameModeEnum.Creative); isServer = (MyAPIGateway.Session.OnlineMode == MyOnlineModeEnum.OFFLINE || MyAPIGateway.Multiplayer.IsServer); isDedicated = (MyAPIGateway.Utilities.IsDedicated && isServer); MyLog.Default.WriteLineAndConsole($"isCreativeGame: {isCreativeGame}; isServer: {isServer}; isDedicated: {isDedicated}"); if (!isDedicated) { HudApi = new HudAPIv2(); HUD = new Hud(HudApi); } if (isServer) { updateCounter = 0; PlayerList = new List <IMyPlayer>(); Config = StorageFile.Load <Config>("config.xml"); PlayerStatsDict = StorageFile.Load <PlayerStatsStorage>("stats.xml").ToDict(); MovementCosts.SetFromConfig(Config); } }
internal ResearchHacking(ResearchControl researchControl, HudAPIv2 hudTextApi, NetworkComms networkComms) { this.researchControl = researchControl; TextAPI = hudTextApi; this.networkComms = networkComms; }
/// <summary> /// Closes the hud api object. /// </summary> public void Close() { if (_hudApi != null) { IsRegistered = false; _hudApi.Close(); _hudApi = null; } }
private HudUtilities() { textHudApi = new HudAPIv2(); fov = MyAPIGateway.Session.Camera.FovWithZoom; fovScale = 0.1 * Math.Tan(fov / 2d); hudElementsDraw = new List <Action>(); menuElementsInit = new Queue <Action>(); }
public Hud(HudAPIv2 api) { HudApi = api; stamina = 0; refreshNeeded = false; noColor = new Color(new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); colorString = ""; }
private void Init() { _textAPI = new HudAPIv2(); if (Utils.isDev()) { MyAPIGateway.Utilities.ShowMessage("CLIENT", "INIT"); } MyAPIGateway.Utilities.MessageEntered += OnMessageEntered; MyAPIGateway.Multiplayer.RegisterMessageHandler(1337, FoodUpdateMsgHandler); }
public ToolGroups() { welder = new WelderTool(MyKeys.None, 0, 0); ToolEdited(welder, false); grinder = new GrinderTool(MyKeys.None, 1, 0); ToolEdited(grinder, false); drill = new DrillTool(MyKeys.None, 2, 0); ToolEdited(drill, false); pistol = new PistolTool(MyKeys.None, 3, 0); ToolEdited(pistol, false); launcher = new LauncherTool(MyKeys.None, 3, 0); ToolEdited(launcher, false); rifle = new RifleTool(MyKeys.None, 3, 0); ToolEdited(rifle, false); foreach (MyHandItemDefinition def in MyDefinitionManager.Static.GetHandItemDefinitions()) { if (!def.Context.IsBaseGame) { string modName = def.Context.ModName; if (string.IsNullOrWhiteSpace(modName)) { if (string.IsNullOrWhiteSpace(def.Context.ModId)) { modName = null; } else { modName = def.Context.ModId.Trim(); } } else { modName = modName.Trim(); } if (modName != null && modName.Length > 30) { modName = modName.Substring(0, 30); } ModTool modTool = new ModTool(MyKeys.None, 0, 0, def.PhysicalItemId, modName); modTools.Add(modTool); ToolEdited(modTool, false); } } serializableTools = modTools.ToArray(); hud = new HudAPIv2(OnHudReady); }
internal ResearchHacking(ResearchControl researchControl, HudAPIv2 hudTextApi, NetworkComms networkComms) { this.researchControl = researchControl; /* * // V1 * hackBar.options |= HUDTextAPI.Options.HideHud; * hackInterrupted.options |= HUDTextAPI.Options.HideHud; * this.hudTextApi = hudTextApi; */ //V2 TextAPI = hudTextApi; this.networkComms = networkComms; }
public void Init() { if (init) { return; //script already initialized, abort. } instance = this; init = true; running = true; isServer = MyAPIGateway.Session.OnlineMode == MyOnlineModeEnum.OFFLINE || MyAPIGateway.Multiplayer.IsServer; isDedicated = (MyAPIGateway.Utilities.IsDedicated && isServer); if (isDedicated) { return; } TextAPI = new HudAPIv2(); }
public override void Init(MyObjectBuilder_SessionComponent sessionComponent) { if (init) { return; } base.Init(sessionComponent); Instance = this; HudAPI = new HudAPIv2(); init = true; running = true; isServer = (MyAPIGateway.Multiplayer.IsServer && MyAPIGateway.Utilities.IsDedicated); if (!isServer) { SetUpdateOrder(MyUpdateOrder.AfterSimulation); } }
internal ResearchHacking(ResearchControl researchControl, HudAPIv2 hudTextApi, NetworkComms networkComms) { this.researchControl = researchControl; /* * // V1 * hackBar.options |= HUDTextAPI.Options.HideHud; * hackInterrupted.options |= HUDTextAPI.Options.HideHud; * this.hudTextApi = hudTextApi; */ //V2 TextAPI = hudTextApi; this.networkComms = networkComms; ConnectionLostID = MyStringId.TryGet("ConnectionLost"); HackInProgressID = MyStringId.TryGet("HackInProgress"); // string sInit = VRage.MyTexts.Get(stringIdInit).ToString() + " " + CurrentModVersion; }
public void Start(HudAPIv2 api) { debugText = new HUDMessage(); debugText.InitialColor = Color.Yellow; debugText.Message = DebugString; debugText.Font = "monospace"; var boxdef = HudAPIv2.APIinfo.GetBoxUIDefinition(MyStringId.GetOrCompute("Default")); debugUI = new BoxUIText(); debugUI.SetDefinition(boxdef); debugUI.Origin = new Vector2I(-340, 0); debugUI.Width = 340; debugUI.SetTextContent(debugText); debugUI.Visible = true; debugUI.Height = 9 * 13 + boxdef.Min.X; debugUI.BackgroundColor = Color.White * 0.2f; debugText.Scale = 10; //10pt debugText.Blend = BlendTypeEnum.PostPP; }
public override void UpdateAfterSimulation() { debugMonitor.Update(); if (!init) { HudAPI = new HudAPIv2(RegisterHudAPI); init = true; offline = MyAPIGateway.Session.OnlineMode == VRage.Game.MyOnlineModeEnum.OFFLINE; if (!offline) { MyAPIGateway.Multiplayer.RegisterMessageHandler(COMID, UpdateChannelRecieve); } isServer = offline || MyAPIGateway.Multiplayer.IsServer; isDedicated = isServer && MyAPIGateway.Utilities.IsDedicated; time.Start(); } foreach (var controller in controllers) { controller.Value.SendUpdate(time.ElapsedTicks); } }
public void Init() { api_handle_ = new HudAPIv2(OnHudInit); }
private void Init() { hudApIv2 = new HudAPIv2(); MyAPIGateway.Utilities.MessageEntered += ChatCommands; _logging.WriteLine("Cross hair mod initialized"); }
public override void Start() { base.Start(); _textApi = new HudAPIv2(OnRegisteredCallback); }
protected override void InitCommon(IModSystemRegistry modSystemRegistry) { var stringIdInit = MyStringId.TryGet("Init"); string sInit = VRage.MyTexts.Get(stringIdInit).ToString() + " " + CurrentModVersion; var TranslationByID = MyStringId.TryGet("TranslationBy"); string sTranslationBy = VRage.MyTexts.Get(TranslationByID).ToString(); if (!string.IsNullOrWhiteSpace(sTranslationBy)) { sInit += "\n " + sTranslationBy; } var AudioByID = MyStringId.TryGet("AudioBy"); string sAudioBy = VRage.MyTexts.Get(AudioByID).ToString(); if (!string.IsNullOrWhiteSpace(sAudioBy)) { sInit += "\n " + sAudioBy; } // string sInit = "Initialising Escape From Mars build " + CurrentModVersion; MyAPIGateway.Utilities.ShowNotification(sInit, 5000, MyFontEnum.DarkBlue); ModLog.Info(sInit); MyLog.Default.Info("EFM Init" + sInit); // var gamelanguage = MySpaceTexts.ToolTipOptionsGame_Language; var gamelanguage = MyAPIGateway.Session.Config.Language; ModLog.Info("Game Language=" + gamelanguage.ToString()); /* * var idString1=MyStringId.TryGet("String1"); * var String1=VRage.MyTexts.Get(idString1); * ModLog.Info("idString1=" + idString1); * ModLog.Info("String1=" + String1); */ if (MyAPIGateway.Session.IsServer) { MyVisualScriptLogicProvider.SendChatMessage(sInit, "Wicorel", 0, MyFontEnum.DarkBlue); } gameVersion = MyAPIGateway.Session.Version; ModLog.Info("SE Version=" + gameVersion.ToString()); /* * ModLog.Info(" Major=" + gameVersion.Major.ToString()); * ModLog.Info(" MajorRevision=" + gameVersion.MajorRevision.ToString()); * ModLog.Info(" Minor=" + gameVersion.Minor.ToString()); * ModLog.Info(" MinorRevision=" + gameVersion.MinorRevision.ToString()); * ModLog.Info(" Build=" + gameVersion.Build.ToString()); */ /* * // TESTING: (they seem to be the same) * if (MyAPIGateway.Session.IsServer) * ModLog.Info("MyAPIGateway.Session.IsServer.IsServer"); * else * ModLog.Info("MyAPIGateway.Session.NOT Server"); * if (MyAPIGateway.Multiplayer.IsServer) * ModLog.Info("MyAPIGateway.Multiplayer.IsServer"); * else * ModLog.Info("MyAPIGateway.Multiplayer.NOT Server"); */ bool bResearch = Session.SessionSettings.EnableResearch; // This works to change the setting. Session.SessionSettings.EnableResearch = true; Session.SessionSettings.EnableBountyContracts = false; // SE V1.192 if ((gameVersion.Major == 1 && gameVersion.Minor >= 192) || gameVersion.Major > 1) { ModLog.Info("Economy items enabled"); CargoType.AllowEconomyItems(); } if ((gameVersion.Major == 1 && gameVersion.Minor >= 198) || gameVersion.Major > 1) { ModLog.Info("Warefare1 items enabled"); CargoType.AllowWarefare1Items(); } if ((gameVersion.Major == 1 && gameVersion.Minor >= 200) || gameVersion.Major > 1) { ModLog.Info("Warefare2 items enabled"); CargoType.AllowWarefare2Items(); } if (!bResearch) { // MyAPIGateway.Utilities.ShowNotification("Save, then Exit. Edit world /Advanced settings and Enable progression", 50000, MyFontEnum.Red); ModLog.Info("Research was not turned on"); } TextAPI = new HudAPIv2(); // if (modBuildWhenGameStarted > 4) V37 { DuckUtils.PutPlayerIntoFaction("CRASH"); } researchControl = new ResearchControl(audioSystem); researchControl.InitResearchRestrictions(); researchHacking = new ResearchHacking(researchControl, TextAPI, networkComms); networkComms.Init(audioSystem, researchControl, researchHacking); modSystemRegistry.AddCloseableModSystem(networkComms); modSystemRegistry.AddUpatableModSystem(audioSystem); MyAPIGateway.Utilities.MessageEntered += MessageEntered; }
protected override void RegisterComponent() { api = new HudAPIv2(TextAPIDetected); }
/// <summary> /// Clean up references when exiting game. /// </summary> public void Unload() { // we didn't initialise this, so don't unload it either HudApi = null; }
public GuiHandler() { _hudApi = new HudAPIv2(OnHudApiRegistered); }
void InitializableModule.Init() { HudAPI = new HudAPIv2(); CheckForHudAPIInModlist(); }
protected override void UnregisterComponent() { api?.Close(); api = null; }
public SettingsHud() { hud = new HudAPIv2(OnHudReady); config = IPSession.Instance.MapSettings; }
protected override void InitCommon(IModSystemRegistry modSystemRegistry) { string sInit = "Initialising Escape From Mars build " + CurrentModVersion; MyAPIGateway.Utilities.ShowNotification(sInit, 5000, MyFontEnum.DarkBlue); ModLog.Info(sInit); if (MyAPIGateway.Session.IsServer) { MyVisualScriptLogicProvider.SendChatMessage(sInit, "Wicorel", 0, MyFontEnum.DarkBlue); } gameVersion = MyAPIGateway.Session.Version; ModLog.Info("SE Version=" + gameVersion.ToString()); /* * ModLog.Info(" Major=" + gameVersion.Major.ToString()); * ModLog.Info(" MajorRevision=" + gameVersion.MajorRevision.ToString()); * ModLog.Info(" Minor=" + gameVersion.Minor.ToString()); * ModLog.Info(" MinorRevision=" + gameVersion.MinorRevision.ToString()); * ModLog.Info(" Build=" + gameVersion.Build.ToString()); */ /* * // TESTING: (they seem to be the same) * if (MyAPIGateway.Session.IsServer) * ModLog.Info("MyAPIGateway.Session.IsServer.IsServer"); * else * ModLog.Info("MyAPIGateway.Session.NOT Server"); * if (MyAPIGateway.Multiplayer.IsServer) * ModLog.Info("MyAPIGateway.Multiplayer.IsServer"); * else * ModLog.Info("MyAPIGateway.Multiplayer.NOT Server"); */ bool bResearch = Session.SessionSettings.EnableResearch; // This works to change the setting. Session.SessionSettings.EnableResearch = true; Session.SessionSettings.EnableBountyContracts = false; // SE V1.192 if ((gameVersion.Major == 1 && gameVersion.Minor >= 192) || gameVersion.Major > 1) { ModLog.Info("Economy items enabled"); CargoType.AllowEconomyItems(); } if (!bResearch) { // MyAPIGateway.Utilities.ShowNotification("Save, then Exit. Edit world /Advanced settings and Enable progression", 50000, MyFontEnum.Red); ModLog.Info("Research was not turned on"); } TextAPI = new HudAPIv2(); if (modBuildWhenGameStarted > 4) { DuckUtils.PutPlayerIntoFaction("CRASH"); } researchControl = new ResearchControl(audioSystem); researchControl.InitResearchRestrictions(); researchHacking = new ResearchHacking(researchControl, TextAPI, networkComms); networkComms.Init(audioSystem, researchControl, researchHacking); modSystemRegistry.AddCloseableModSystem(networkComms); modSystemRegistry.AddUpatableModSystem(audioSystem); MyAPIGateway.Utilities.MessageEntered += MessageEntered; }