public override void Load()
 {
     base.Load();
     m_remainingTime         = m_submissionDuration;
     m_countdownNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.Countdown, (int)m_remainingTime.TotalMilliseconds, null);
     MyHudNotification.AddNotification(m_countdownNotification, MyGuiScreenGamePlayType.GAME_STORY);
 }
        public override void Load()
        {
            base.Load();
            m_dummy = MyScriptWrapper.GetEntity(m_dummyId);
            MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnDialogueFinished;
            m_notificationWarningHurry          = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.HurryUp,
                                                                                     MyGuiManager.GetFontMinerWarsRed());
            m_notificationWarningSlowDown = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.SlowDown,
                                                                               MyGuiManager.GetFontMinerWarsRed());

            MyScriptWrapper.AddNotification(m_notificationWarningHurry);
            m_notificationWarningHurry.Disappear();
            MyScriptWrapper.AddNotification(m_notificationWarningSlowDown);
            m_notificationWarningSlowDown.Disappear();

            m_invalid = false;

            //We prevent mission fail by this when skipping with ctrl+del
            if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() < FailDistanceTooShort)
            {
                m_invalid = true;
            }
            //We prevent mission fail by this when skipping with ctrl+del
            if ((MySession.PlayerShip.GetPosition() - m_target.GetPosition()).Length() > FailDistanceTooFar)
            {
                m_invalid = true;
            }
        }
 void ClearCountdownNotification()
 {
     if (m_countdownNotification != null)
     {
         m_countdownNotification.Disappear();
         m_countdownNotification = null;
     }
 }
Exemplo n.º 4
0
        public override void Load()
        {
            base.Load();

            m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" });
            //MyHudNotification.AddNotification(m_countdownNotification);

            MyScriptWrapper.OnUseKeyPress += OnUseKeyPress;
        }
Exemplo n.º 5
0
 private void AddDroneNotification()
 {
     m_learnToUseDrone = MyScriptWrapper.CreateNotification(
         MyTextsWrapperEnum.HowToControlDrone,
         MyHudConstants.MISSION_FONT, 0,
         new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_DEPLOY), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_CONTROL) }
         );
     MyScriptWrapper.AddNotification(m_learnToUseDrone);
 }
 void OnCountdown(ref MyEventCountdown msg)
 {
     ClearCountdownNotification();
     if (msg.Timespan.Ticks > 0)
     {
         m_countdownNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.Countdown, MyGuiManager.GetFontMinerWarsBlue());
         m_countdownNotification.SetTextFormatArguments(new object[] { String.Format("{0:00}", msg.Timespan.Minutes) + ":" + String.Format("{0:00}", msg.Timespan.Seconds) });
         MyHudNotification.AddNotification(m_countdownNotification);
     }
 }
Exemplo n.º 7
0
        public void Start()
        {
            MyGuiManager.AddScreen(this);

            if (Background && BackgroundNotification.HasValue)
            {
                var notification = new MyHudNotification.MyNotification(BackgroundNotification.Value);
                MyHudNotification.AddNotification(notification);
                this.Closed += (screen) => notification.Disappear();
            }
        }
Exemplo n.º 8
0
        public override void Unload()
        {
            base.Unload();

            if (m_notification != null)
            {
                m_notification.Disappear();
                m_notification = null;
            }

            MyScriptWrapper.OnUseKeyPress -= OnUseKeyPress;
        }
Exemplo n.º 9
0
        public static void ShowObjectiveCompleted()
        {
            var notification = new MyHudNotification.MyNotification(
                MyTextsWrapperEnum.NotificationObjectiveComplete,
                MyHudNotification.GetCurrentScreen(),
                .85f,
                MyHudConstants.MISSION_FONT,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                15000); // TODO constant

            MyHudNotification.AddNotification(notification);
        }
Exemplo n.º 10
0
 public void Display(object[] parameters)
 {
     if (Text != null)
     {
         MyGuiFont font = GetFontDelegate();
         MyHudNotification.MyNotification notification = new MyHudNotification.MyNotification(Text.Value, font, 5000, null, parameters);
         MyHudNotification.AddNotification(notification);
     }
     if (SoundCue != null)
     {
         MyAudio.AddCue2D(SoundCue.Value);
     }
 }
Exemplo n.º 11
0
 public override void Load()
 {
     base.Load();
     if (m_isOn)
     {
         m_countdownNotification             = new MyHudNotification.MyNotification(NotificationText, MyGuiManager.GetFontMinerWarsBlue(), (int)RemainingTime.TotalMilliseconds, null);
         m_countdownNotification.IsImportant = true;
         if (DisplayCounter)
         {
             MyHudNotification.AddNotification(m_countdownNotification);
         }
     }
 }
Exemplo n.º 12
0
 public void Suspend(bool isOn)
 {
     if (isOn && !m_isOn)
     {
         m_countdownNotification             = new MyHudNotification.MyNotification(NotificationText, (int)RemainingTime.TotalMilliseconds);
         m_countdownNotification.IsImportant = true;
         if (DisplayCounter)
         {
             MyHudNotification.AddNotification(m_countdownNotification);
         }
     }
     m_isOn = isOn;
 }
Exemplo n.º 13
0
 void AddPanelPercentNotification()
 {
     if (m_hudSolarPanelsCounter != null)
     {
         m_hudSolarPanelsCounter.Disappear();
     }
     m_hudSolarPanelsCounter = MyScriptWrapper.CreateNotification(
         MyTextsWrapperEnum.SolarPanelsLeft,
         MyHudConstants.MISSION_FONT,
         0,
         new object[] { (int)((1 - (float)m_panelsLeft / m_totalPanelCount) * 100) });
     MyScriptWrapper.AddNotification(m_hudSolarPanelsCounter);
 }
Exemplo n.º 14
0
            public MyTimerAction(int startTime, MyTimerActionDelegate action, string notification, bool showTimeFromStart)
            {
                StartTime         = startTime;
                Launched          = false;
                Action            = action;
                Notification      = notification;
                ShowTimeFromStart = showTimeFromStart;

                if (Notification != null)
                {
                    m_hudNotification     = new MyHudNotification.MyNotification(Notification + "{0}", MyGuiManager.GetFontMinerWarsBlue(), MyHudNotification.DONT_DISAPEAR, null);
                    m_hudNotificationArgs = new object[1];
                }
            }
Exemplo n.º 15
0
        public static void UpdateMaxVolume(bool forward)
        {
            float increment = forward ? 10f : -10f;

            m_maxVolume = MathHelper.Clamp(m_maxVolume + increment, 0f, 100f);
            if (m_nearestInfluenceSphere != null)
            {
                m_nearestInfluenceSphere.ChangeSound(m_nearestInfluenceSphereStrength);
            }
            if (m_notification != null)
            {
                m_notification.Disappear();
                m_notification = null;
            }
        }
Exemplo n.º 16
0
        public MyServerAction SaveLastCheckpoint(bool createChapter = false)
        {
            if (MyMultiplayerGameplay.IsRunning && !MyMultiplayerGameplay.Static.IsHost)
            {
                return(null);
            }

            var lastChapterTime = MyLocalCache.GetLastChapterTimestamp();
            var nextChapterTime = lastChapterTime + TimeSpan.FromHours(3);

            if (MyMissions.ActiveMission == null && DateTime.Now > nextChapterTime)
            {
                createChapter = true;
            }

            MyMwcSectorIdentifier sectorId = MyGuiScreenGamePlay.Static.GetSectorIdentifier();

            if (CanBeSaved(false, sectorId, false))
            {
                var notification = new MyHudNotification.MyNotification(Localization.MyTextsWrapperEnum.SavingSectorToServer, 2500);
                MyHudNotification.AddNotification(notification);

                var checkpoint = GetCheckpointBuilder(true);
                checkpoint.CurrentSector.UserId = MyClientServer.LoggedPlayer.GetUserId(); // Saving players checkpoint

                if (MySession.PlayerShip != null && checkpoint.PlayerObjectBuilder.ShipObjectBuilder != null)
                {
                    float refilRatio = 0.5f;

                    var ship = checkpoint.PlayerObjectBuilder.ShipObjectBuilder;
                    ship.ArmorHealth     = MathHelper.Clamp(ship.ArmorHealth, refilRatio * MySession.PlayerShip.MaxArmorHealth, MySession.PlayerShip.MaxArmorHealth);
                    ship.ShipHealthRatio = MathHelper.Clamp(ship.ShipHealthRatio, refilRatio, 1.0f);
                    ship.Fuel            = MathHelper.Clamp(ship.Fuel, refilRatio * MySession.PlayerShip.MaxFuel, MySession.PlayerShip.MaxFuel);
                    ship.Oxygen          = MathHelper.Clamp(ship.Oxygen, refilRatio * MySession.PlayerShip.MaxOxygen, MySession.PlayerShip.MaxOxygen);
                    checkpoint.PlayerObjectBuilder.Health = MathHelper.Clamp(checkpoint.PlayerObjectBuilder.Health, refilRatio * 100, 100);
                }

                // Need to store actual checkpoint...because when we travel, we receive only sector, not checkpoint
                MyGuiScreenGamePlay.Static.AddEnterSectorResponse(checkpoint, null);

                Debug.Assert(checkpoint.CurrentSector.UserId != null, "Saving last checkpoint as story");
                UpdatePlayerStartDummy(checkpoint);

                MyLocalCache.SaveCheckpoint(checkpoint, createChapter);
                checkpoint.SectorObjectBuilder = null; // Don't save sector
            }
            return(null);
        }
Exemplo n.º 17
0
        public override void Load()
        {
            base.Load();
            if (m_realMissionEntityId.HasValue)
            {
                m_realMissionEntity = MyScriptWrapper.TryGetEntity(m_realMissionEntityId.Value);
            }

            m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" });
            m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler);
            m_startingGeneratorProgressScreen_OnSuccessHandler  = new EventHandler(OnSuccessHandler);

            m_useProgress             = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0);
            m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler;
            m_useProgress.OnSuccess  += m_startingGeneratorProgressScreen_OnSuccessHandler;
        }
        public override void Load()
        {
            base.Load();
            MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished;
            m_notification = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.DoNotGoThere,
                                                                MyGuiManager.GetFontMinerWarsRed());

            m_target = MyScriptWrapper.GetEntity(m_targetId);
            MyScriptWrapper.MarkEntity(m_target, NameTemp.ToString(),
                                       MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER |
                                       MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS |
                                       MyHudIndicatorFlagsEnum.SHOW_DISTANCE |
                                       MyHudIndicatorFlagsEnum.SHOW_TEXT, MyGuitargetMode.Objective);
            MyScriptWrapper.AddNotification(m_notification);
            m_notification.Disappear();
        }
Exemplo n.º 19
0
        private MyGuiScreenEditorSaveProgress Save(bool saveSector, string checkpointName, bool asTemplate, bool visibleSave, bool pause)
        {
            MyMwcSectorIdentifier sectorId = MyGuiScreenGamePlay.Static.GetSectorIdentifier();
            bool isEditor = MyGuiScreenGamePlay.Static.IsEditorActive();

            if (CanBeSaved(asTemplate, sectorId, isEditor))
            {
                MyMwcObjectBuilder_Checkpoint checkpoint = GetCheckpointBuilder(saveSector);
                checkpoint.CheckpointName = checkpointName;

                // Need to store actual checkpoint...because when we travel, we receive only sector, not checkpoint
                MyGuiScreenGamePlay.Static.AddEnterSectorResponse(checkpoint, null);

                bool savePlayerShip = MyGuiScreenGamePlay.Static.GetGameType() == MyGuiScreenGamePlayType.EDITOR_STORY ? MyEditor.SavePlayerShip : true;

                if (savePlayerShip && saveSector)
                {
                    UpdatePlayerStartDummy(checkpoint);
                }

                MyHudNotification.MyNotification notification = null;
                if (!visibleSave)
                {
                    notification = new MyHudNotification.MyNotification(Localization.MyTextsWrapperEnum.SavingSectorToServer, 2500);
                    MyHudNotification.AddNotification(notification);
                }

                StringBuilder errors = null;
                if (isEditor)
                {
                    errors = CheckMissingObject(checkpoint);
                }

                MyGuiScreenEditorSaveProgress screen = new MyGuiScreenEditorSaveProgress(sectorId, checkpoint, savePlayerShip, visibleSave, pause);
                //screen.Closed += new MyGuiScreenBase.ScreenHandler((s) => { if (notification != null) notification.Disappear(); });

                CheckErrors(errors, screen);
                return(screen);
            }

            return(null);
        }
Exemplo n.º 20
0
 public static void SwitchToNextSound(bool forward)
 {
     if (m_nearestInfluenceSphere != null)
     {
         if (m_sounds == null)
         {
             LoadSounds();
         }
         int currentIndex = m_sounds.IndexOf(m_nearestInfluenceSphere.m_cueEnum);
         if (forward)
         {
             currentIndex++;
             if (currentIndex >= m_sounds.Count)
             {
                 currentIndex = 0;
             }
         }
         else
         {
             currentIndex--;
             if (currentIndex < 0)
             {
                 currentIndex = m_sounds.Count - 1;
             }
         }
         m_nearestInfluenceSphere.m_cueEnum = m_sounds[currentIndex];
         if (m_nearestInfluenceSphere.m_cue.HasValue)
         {
             m_nearestInfluenceSphere.m_cue.Value.Stop(SharpDX.XACT3.StopFlags.Immediate);
         }
         m_nearestInfluenceSphere.ChangeSound(m_nearestInfluenceSphereStrength);
         if (m_notification != null)
         {
             m_notification.Disappear();
             m_notification = null;
         }
     }
 }
        public override void Load()
        {
            base.Load();
            m_entitiesToUse = new List <uint>();
            m_entitiesToUse.AddRange(MissionEntityIDs);
            InitSounds(m_objectiveType);
            m_totalCount   = MissionEntityIDs.Count;
            m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" });
            m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler);
            m_startingGeneratorProgressScreen_OnSuccessHandler  = new EventHandler(OnSuccessHandler);

            m_useProgress             = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0);
            m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler;
            m_useProgress.OnSuccess  += m_startingGeneratorProgressScreen_OnSuccessHandler;


            foreach (var id in MissionEntityIDs)
            {
                SetLocationVisibility(true, MyScriptWrapper.GetEntity(id), MyGuitargetMode.Objective);
            }

            ReloadAdditionalHubInfo();
        }
Exemplo n.º 22
0
        public override void UpdateBeforeSimulation()
        {
            base.UpdateBeforeSimulation();

            if (IsDust || IsSound)
            {
                float influence = CalculateInfluenceStrength(MyCamera.Position);
                if (m_influenceStrengthCamera != influence)
                {
                    if (IsDust)
                    {
                        ChangeDustColor(influence);
                    }
                    if (IsSound)
                    {
                        ChangeSound(influence);
                    }
                    m_influenceStrengthCamera = influence;
                }

                #region DEBUGING
                if (MyFakes.ENABLE_DEBUG_INFLUENCE_SPHERES_SOUNDS && IsSound)
                {
                    if (influence > 0f)
                    {
                        if (influence > m_nearestInfluenceSphereStrength)
                        {
                            m_nearestInfluenceSphere = this;
                            if (m_notification == null)
                            {
                                m_notification = new MyHudNotification.MyNotification(m_nearestInfluenceSphere.m_cueEnum.ToString() + ":" + (int)m_maxVolume, MyGuiManager.GetFontMinerWarsBlue());
                                MyHudNotification.AddNotification(m_notification);
                            }
                        }
                    }
                    else
                    {
                        if (m_nearestInfluenceSphere == this)
                        {
                            m_nearestInfluenceSphere         = null;
                            m_nearestInfluenceSphereStrength = 0f;
                            if (m_notification != null)
                            {
                                m_notification.Disappear();
                                m_notification = null;
                            }
                        }
                    }
                }
                #endregion
            }

            if (IsRadioactivity)
            {
                float influence = CalculateInfluenceStrength(MySession.PlayerShip.GetPosition());
                if (m_influenceStrengthShip != influence)
                {
                    ChangeRadioactivity(influence);
                    m_influenceStrengthShip = influence;
                }
            }
        }