public static void Error(string msg, string printText) { Info("ERROR: " + msg); try { MyLog.Default.WriteLineAndConsole(modName + " error/exception: " + msg); if (MyAPIGateway.Session != null) { if (notify == null) { notify = MyAPIGateway.Utilities.CreateNotification(printText, 10000, MyFontEnum.Red); } else { notify.Text = printText; notify.ResetAliveTime(); } notify.Show(); } } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e); MyLog.Default.WriteLineAndConsole(modName + " error/exception: Could not send notification to local client: " + e); } }
public static void Error(string msg) { Info("ERROR: " + msg); try { string text = ModName + " error - open %AppData%/SpaceEngineers/Storage/..._" + ModName + "/" + LogFile + " for details"; MyLog.Default.WriteLineAndConsole(text); if (_notify == null) { _notify = MyAPIGateway.Utilities.CreateNotification(text, 10000, MyFontEnum.Red); } else { _notify.Text = text; _notify.ResetAliveTime(); } _notify.Show(); } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e.ToString()); } }
private static void PrintError(string msg) { Info("ERROR: " + msg); try { MyLog.Default.WriteLineAndConsole(ModName + " error: " + msg); if (MyAPIGateway.Session != null) { var text = ModName + " error - open %AppData%/SpaceEngineers/Storage/" + WorkshopId + ".sbm_" + ModName + "/" + LogFile + " for details"; if (_notify == null) { _notify = MyAPIGateway.Utilities.CreateNotification(text, 10000, MyFontEnum.Red); } else { _notify.Text = text; _notify.ResetAliveTime(); } _notify.Show(); } } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e); } }
public static void Error(string msg) { Info("ERROR: " + msg); try { MyLog.Default.WriteLineAndConsole(MOD_NAME + " error: " + msg); string text = MOD_NAME + " error - open %AppData%/SpaceEngineers/Storage/" + WORKSHOP_ID + "_" + MOD_NAME + "/" + LOG_FILE + " for details"; if (notify == null) { notify = MyAPIGateway.Utilities.CreateNotification(text, 10000, MyFontEnum.Red); } else { notify.Text = text; notify.ResetAliveTime(); } notify.Show(); } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e.ToString()); } }
/// <summary> /// Updates text colors and resets alive time for fallback hud. /// </summary> private void UpdateText() { int elements = Utilities.Clamp(visEnd - visStart, 0, Cfg.maxVisible), i, action; header.Show(); header.ResetAliveTime(); header.Text = $"{headerText} ({visStart + 1} - {visEnd} of {target.ScrollableCount})"; for (int notif = 0; notif < elements; notif++) { if (list[notif] == null) { list[notif] = MyAPIGateway.Utilities.CreateNotification(""); } i = notif + visStart; action = i - target.Properties.Count; // make sure its still being shown list[notif].Show(); list[notif].ResetAliveTime(); // get name if (i >= target.Properties.Count) { list[notif].Text = target.Actions[action].GetDisplay(); } else { list[notif].Text = target.Properties[i].GetDisplay(); } // get color if (i == selection) { list[notif].Font = MyFontEnum.Green; } else if (i == index) { list[notif].Font = MyFontEnum.Red; } else { list[notif].Font = MyFontEnum.White; } } // hide everything else for (int n = elements; n < list.Length; n++) { if (list[n] == null) { list[n] = MyAPIGateway.Utilities.CreateNotification(""); } list[n].Text = ""; list[n].Hide(); } }
private void ShowNotification(string text, MyFontEnum color) { if (mNotify == null) { mNotify = MyAPIGateway.Utilities.CreateNotification(text, 10000, MyFontEnum.Red); } else { mNotify.Text = text; mNotify.ResetAliveTime(); } mNotify.Show(); }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="displayms"></param> public void ShowOnHud(string text, int displayms = 10000) { if (_Notify == null) { _Notify = MyAPIGateway.Utilities.CreateNotification(text, displayms, MyFontEnum.Red); } else { _Notify.Text = text; _Notify.ResetAliveTime(); } _Notify.Show(); }
public override void UpdateBeforeSimulation() { base.UpdateBeforeSimulation(); Initialize(); if (_grid == null || _thrusters.Count == 0) { return; } var hasOverheat = false; foreach (var t in _thrusters) { ThrusterMode thrusterMode; ReadThrusterState(t, out thrusterMode); hasOverheat = hasOverheat || thrusterMode == ThrusterMode.Overheat; } var enableBoost = MyAPIGateway.Input.IsAnyShiftKeyPressed() && !hasOverheat; var heatLevel = 0f; hasOverheat = false; foreach (var t in _thrusters) { float thrusterHeat; ThrusterMode thrusterMode; UpdateThruster(t, enableBoost, out thrusterHeat, out thrusterMode); if (heatLevel < thrusterHeat) { heatLevel = thrusterHeat; } hasOverheat = hasOverheat || thrusterMode == ThrusterMode.Overheat; } if (enableBoost || heatLevel > 0f) { var progress = 100f * heatLevel / MAX_HEAT; _notification.Text = RenderMessage(progress, hasOverheat, enableBoost); _notification.ResetAliveTime(); _notification.Show(); } else { _notification.Hide(); } }
private void ShowHudMessage(ref IMyHudNotification notify, string message, string printText, int printTime, string font) { try { if (!sessionReady || printText == null || MyAPIGateway.Utilities == null || MyAPIGateway.Utilities.IsDedicated) { return; } if (printText == PRINT_GENERIC_ERROR) { printText = errorPrintText; } else if (printText == PRINT_MESSAGE) { if (font == MyFontEnum.Red) { printText = $"[{modName} ERROR: {message}]"; } else { printText = $"[{modName} WARNING: {message}]"; } } if (notify == null) { notify = MyAPIGateway.Utilities.CreateNotification(printText, printTime, font); } else { notify.Hide(); // required since SE v1.194 notify.Text = printText; notify.AliveTime = printTime; notify.ResetAliveTime(); } notify.Show(); } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e); MyLog.Default.WriteLineAndConsole($"{modName} :: LOGGER error/exception: Could not send notification to local client: {e}"); } }
public void DisplayMessage(int amount) { var time = MyAPIGateway.Session.GameDateTime - LastAliveTime; if (time.TotalSeconds > Notification.AliveTime) { CurrentValue = 0; } CurrentValue += amount; Notification.Hide(); Notification.Font = CurrentValue < 0 ? "Red" : "Green"; Notification.Text = string.Format("Reputation With {0} Changed By: {1}", ReputationFactionTarget, CurrentValue); Notification.ResetAliveTime(); Notification.Show(); LastAliveTime = MyAPIGateway.Session.GameDateTime; //Logger.MsgDebug(string.Format("Rep Message Displayed. Current Value {0} - ReceivedAmount: {1}", CurrentValue, amount), DebugTypeEnum.Owner); }
private void ShowHudMessage(ref IMyHudNotification notify, string message, string printText, int printTime, string font) { if (printText == null) { return; } try { if (MyAPIGateway.Utilities != null && !MyAPIGateway.Utilities.IsDedicated) { if (printText == PRINT_GENERIC_ERROR) { printText = errorPrintText; } else if (printText == PRINT_MESSAGE) { printText = $"[ {modName} ERROR: {message} ]"; } if (notify == null) { notify = MyAPIGateway.Utilities.CreateNotification(printText, printTime, font); } else { notify.Text = printText; notify.AliveTime = printTime; notify.ResetAliveTime(); } notify.Show(); } } catch (Exception e) { Info("ERROR: Could not send notification to local client: " + e); MyLog.Default.WriteLineAndConsole(modName + " logger error/exception: Could not send notification to local client: " + e); } }