public void Show(int line, string text, string font = MyFontEnum.Debug, int aliveTime = DEFAULT_TIMEOUT_MS) { if (line < 0 || line >= notifications.Length) { throw new ArgumentException($"Notification line ({line.ToString()}) is either negative or above max of {(notifications.Length - 1).ToString()}."); } IMyHudNotification notify = notifications[line]; if (text == null) { if (notify != null) { notify.Hide(); } return; } if (notify == null) { notify = notifications[line] = MyAPIGateway.Utilities.CreateNotification(string.Empty); } notify.Hide(); // required since SE v1.194 notify.Font = font; notify.Text = text; notify.AliveTime = aliveTime; notify.Show(); }
public override void Close() { try { if (SessionCore.Settings.Debug) { DebugNote.Hide(); DebugNote.AliveTime = 0; DebugNote = null; } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close().DebugClose", Scrap); } try { HUDModule.Close(); PersistenceModule.Close(); TermModule.Close(); GridInventoryModule.RemoveWatcher(Tool); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close()", Scrap); } }
public override void Close() { try { if (SessionCore.Debug) { DebugNote.Hide(); DebugNote.AliveTime = 0; DebugNote = null; } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close().DebugClose", Scrap); } try { SessionCore.SaveUnregister(Save); SyncBeamLength.Close(); SyncDistanceMode.Close(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close()", Scrap); } }
public override void Close() { try { if (SessionCore.Settings.Debug) { DebugNote.Hide(); DebugNote.AliveTime = 0; DebugNote = null; } } catch (Exception Scrap) { SessionCore.LogError($"{Drill?.CustomName}.Close().DebugClose", Scrap); } try { SessionCore.SaveUnregister(Save); SyncHarvestEfficiency.GotValueFromServer -= Drill.UpdateVisual; SyncHarvestEfficiency.Close(); } catch (Exception Scrap) { SessionCore.LogError($"{Drill?.CustomName}.Close()", Scrap); } }
public static void refresh_local_player_HUD() { if (!_UI_handlers_registered) { return; } bool player_in_cockpit = local_controller is MyShipController; foreach (var message_entry in _HUD_messages) { HUD_notification cur_message = message_entry.Value; bool show_message = player_in_cockpit && _HUD_messages[message_entry.Key].toggled_on && cur_message.set_to_visible; IMyHudNotification contents = cur_message.contents; /* * if (cur_message.currently_visible != show_message) * { * if (show_message) * contents.Show(); * else * contents.Hide(); * cur_message.currently_visible = show_message; * } */ contents.Hide(); if (show_message) { contents.Show(); } } }
public override void Close() { try { if (SessionCore.Debug) { DebugNote.Hide(); DebugNote.AliveTime = 0; DebugNote = null; } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close().DebugClose", Scrap); } try { SessionCore.SaveUnregister(Save); SyncBeamLength.GotValueFromServer -= Tool.UpdateVisual; SyncDistanceMode.GotValueFromServer -= Tool.UpdateVisual; SyncSpeedMultiplier.GotValueFromServer -= Tool.UpdateVisual; SyncBeamLength.Close(); SyncDistanceMode.Close(); SyncSpeedMultiplier.Close(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close()", Scrap); } }
void SetPadStatus(string text, string font, int aliveTime = 200) { try { if (!SeeWeldPadInfo()) { return; } if (Notification == null) { Notification = MyAPIGateway.Utilities.CreateNotification(text, aliveTime, font); } else { Notification.Hide(); // required since SE v1.194 Notification.Font = font; Notification.Text = text; Notification.AliveTime = aliveTime; } Notification.Show(); } catch (Exception e) { Log.Error(e); } }
public void HideNotification() { if (m_notification != null) { m_notification.Hide(); m_notification = null; } }
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(); } }
/// <summary> /// Hides notificatins /// </summary> public override void Hide() { header.Hide(); foreach (IMyHudNotification prop in list) { if (prop != null) { prop.Hide(); } } base.Hide(); }
public void Print(Channel channel, string text, string font = MyFontEnum.Debug, int aliveTime = 200) { IMyHudNotification notification = Channels[(int)channel]; if (notification == null) { notification = MyAPIGateway.Utilities.CreateNotification(string.Empty); Channels[(int)channel] = notification; } notification.Hide(); // required since SE v1.194 notification.Font = font; notification.Text = text; notification.AliveTime = aliveTime; notification.Show(); }
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); }