void UpdateNotification()
        {
            MyVisualScriptLogicProvider.RemoveNotification(_notificationId);

            if (!_config.EnableNotification)
            {
                return;
            }

            var message = $"{_config.NotificationCurrentText}: {LagNormal * 100:0}%";

            if (Pin > TimeSpan.Zero)
            {
                message += $" (punishment left: {Pin.TotalSeconds:0} seconds or longer)";
            }

            _notificationId = MyVisualScriptLogicProvider.AddNotification(message, "Red", PlayerId);
        }
        void UpdateCommandNotification()
        {
            MyVisualScriptLogicProvider.RemoveNotification(_commandNotificationId);

            if (Quest >= Quest.Ended)
            {
                return;
            }

            if (_selfProfiled)
            {
                const string Msg = "Type in chat: !lag inspect";
                _commandNotificationId = MyVisualScriptLogicProvider.AddNotification(Msg, "Green", PlayerId);
            }
            else
            {
                const string Msg = "Type in chat: !lag profile";
                _commandNotificationId = MyVisualScriptLogicProvider.AddNotification(Msg, "Green", PlayerId);
            }
        }
示例#3
0
        private void CheckPlayerNotifications()
        {
            try
            {
                foreach (var item in new Dictionary <long, int>(TimeThrusterNoteWasSentToPlayer))
                {
                    if (item.Value != 0 && Timer > item.Value + 180)
                    {
                        MyAPIGateway.Utilities.InvokeOnGameThread(() =>
                        {
                            try
                            {
                                MyVisualScriptLogicProvider.RemoveNotification(LastThrusterHeatNoteSentToPlayer[item.Key], item.Key);
                                TimeThrusterNoteWasSentToPlayer[item.Key] = 0;
                            }
                            catch (Exception e)
                            { Debug.HandleException(e); }
                        });
                    }
                }

                foreach (var item in new Dictionary <long, int>(TimeWeaponNoteWasSentToPlayer))
                {
                    if (item.Value != 0 && Timer > item.Value + 180)
                    {
                        MyAPIGateway.Utilities.InvokeOnGameThread(() =>
                        {
                            try
                            {
                                MyVisualScriptLogicProvider.RemoveNotification(LastWeaponHeatNoteSentToPlayer[item.Key], item.Key);
                                TimeWeaponNoteWasSentToPlayer[item.Key] = 0;
                            }
                            catch (Exception e)
                            { Debug.HandleException(e); }
                        });
                    }
                }
            }
            catch (Exception e)
            { Debug.HandleException(e); }
        }
 public void Clear()
 {
     MyVisualScriptLogicProvider.RemoveNotification(_notificationId);
     MyVisualScriptLogicProvider.RemoveNotification(_commandNotificationId);
     MyVisualScriptLogicProvider.SetQuestlog(false, "", PlayerId);
 }