Пример #1
0
        /// <summary>
        /// Will show the reload notification for the specified duration.
        /// </summary>
        /// <param name="duration">The time in MS it should show reloading.</param>
        private void ShowReloadNotification(int duration)
        {
            int desiredEndTime = MySandboxGame.TotalGamePlayTimeInMilliseconds + duration;

            if (m_reloadNotification == null)
            {
                // Removing 250ms to remove overlap in notification display.
                duration = System.Math.Max(0, duration - 250);
                if (duration == 0)
                {
                    // No notification
                    return;
                }

                m_reloadNotification = new MyHudNotification(MySpaceTexts.LargeMissileTurretReloadingNotification, duration, level: MyNotificationLevel.Important);
                MyHud.Notifications.Add(m_reloadNotification);

                m_nextNotificationTime = desiredEndTime;
            }
            else
            {
                // Append with extra time
                int extraTime = desiredEndTime - m_nextNotificationTime;
                m_reloadNotification.AddAliveTime(extraTime);

                m_nextNotificationTime = desiredEndTime;
            }
        }