public virtual void OnPlayClick(MyGuiControlButton sender)
        {
            int            key      = m_selectDialogueCombobox.GetSelectedKey();
            MyDialogueEnum dialogue = (MyDialogueEnum)key;

            MyDialogues.Play(dialogue);
        }
Esempio n. 2
0
 private void PlaySound()
 {
     if (m_playOverDialogues || !MyDialogues.IsPlaying())
     {
         if (m_soundCue == null || !m_soundCue.Value.IsPlaying)
         {
             m_soundCue = MyAudio.AddCue2D(Sound);
         }
     }
 }
Esempio n. 3
0
 public static void StartGameoverTimer()
 {
     if (m_gameOverTimer == null)
     {
         MyAudio.AddCue2D(MySoundCuesEnum.SfxClaxonAlert);
         MySmallShipBot.PlayFriendlyFireCue();
         MyDialogues.Stop();
         m_gameOverTimer = 10.0f; // 10s
     }
 }
Esempio n. 4
0
        public override void Update()
        {
            base.Update();

            if (!m_destinationReached && IsPlayerNearLocation())
            {
                DestinationReached();
            }

            if ((IsSuccess() || (SkipSubmission && (CanBeSkipped || MyFakes.TEST_MISSION_GAMEPLAY)))
                // complete submission only if player is in game play screen (In some missions there's possibility that mission will complete and player is in MainMenu,
                // progress dialog which follows will break gameplay)
                && MyGuiScreenGamePlay.Static != null && MyGuiScreenGamePlay.Static == MyGuiManager.GetScreenWithFocus())
            {
                if (SkipSubmission)
                {
                    MyDialogues.Stop();
                }
                SkipSubmission = false;
                Success();
            }
        }
Esempio n. 5
0
 public void SkipDialog()
 {
     MyDialogues.Stop();
     SkipDialogEnabled = true;
     Success();
 }
Esempio n. 6
0
        //  Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
        protected override void Update(GameTime gameTime)
        {
            if (m_debugFont == null)
            {
                return;
            }

            // Apply video mode changes.
            MyVideoModeManager.ApplyChanges();

            //  Update times in static member variables
            UpdateTimes(gameTime);

            //if (MyMinerGame.IsDeviceResetted)
            //  MyVideoModeManager.UpdateAfterDeviceReset();

            MyRender.GetRenderProfiler().StartProfilingBlock("Particles wait");
            MyParticlesManager.WaitUntilUpdateCompleted();
            MyRender.GetRenderProfiler().EndProfilingBlock();

            MyRender.GetRenderProfiler().StartProfilingBlock("Receive Multiplayer Messages");
            MyMultiplayerPeers.Static.Update();
            MyRender.GetRenderProfiler().EndProfilingBlock();

            int updateBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("Update", ref updateBlock);

            if (MyMwcFinalBuildConstants.EnableLoggingInDrawAndUpdateAndGuiLoops == true)
            {
                MyMwcLog.WriteLine("MyMinerGame.Update() - START");
                MyMwcLog.IncreaseIndent();
                MyMwcLog.WriteLine("Update - gameTime.ElapsedGameTime: " + gameTime.ElapsedGameTime.ToString());
                MyMwcLog.WriteLine("Update - gameTime.TotalGameTime: " + gameTime.TotalGameTime.ToString());

                MyMwcLog.WriteLine("Max Garbage Generation: " + GC.MaxGeneration.ToString());
                for (int i = 0; i <= GC.MaxGeneration; ++i)
                {
                    MyMwcLog.WriteLine("Generation " + i.ToString() + ": " + GC.CollectionCount(i).ToString() +
                                       " collections");
                }
                MyMwcLog.WriteLine("Total Memory: " + MyValueFormatter.GetFormatedLong(GC.GetTotalMemory(false)) +
                                   " bytes");
            }

            //  Inform us if there were some garbage collection
            if (MyMwcFinalBuildConstants.EnableLoggingGarbageCollectionCalls)
            {
                int newGc = MyGarbageCollectionManager.GetGarbageCollectionsCountFromLastCall();
                if (newGc > 0)
                {
                    MyMwcLog.WriteLine("####### Garbage collections from the last call: " + newGc + " #######");
                }
            }


            int updateManagersBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("UpdateManagers", ref updateManagersBlock);

            MyRender.GetRenderProfiler().EndProfilingBlock(updateManagersBlock);

            //  Now I think that it's better if HandleInput is called after Update, because then input methods
            //  such as Shot() have up-to-date values such as position, forward vector, etc
            int guiManagerBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("GuiManager", ref guiManagerBlock);
            MyGuiManager.Update();
            MyRender.GetRenderProfiler().EndProfilingBlock(guiManagerBlock);

            //After guimanager update because of object world matrices updates of objects
            MyParticlesManager.Update();

            int inputBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("Input", ref inputBlock);
            MyGuiManager.HandleInput();
            MyRender.GetRenderProfiler().EndProfilingBlock(inputBlock);

            int serverUpdateBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("MyClientServer.Update", ref serverUpdateBlock);
            //MyClientServer.Update();       ti
            MyRender.GetRenderProfiler().EndProfilingBlock(serverUpdateBlock);

            if (MyMwcFinalBuildConstants.SimulateSlowUpdate)
            {
                System.Threading.Thread.Sleep(7);
            }

            int audioUpdateBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("MyAudio.Update", ref audioUpdateBlock);
            MyAudio.Update();
            MyDialogues.Update();
            MyRender.GetRenderProfiler().EndProfilingBlock(audioUpdateBlock);

            int othersBlock = -1;

            MyRender.GetRenderProfiler().StartProfilingBlock("Others", ref othersBlock);

            if (MyMwcFinalBuildConstants.EnableLoggingInDrawAndUpdateAndGuiLoops == true)
            {
                if (MyMwcLog.IsIndentKeyIncreased())
                {
                    MyMwcLog.DecreaseIndent();
                }
                MyMwcLog.WriteLine("MyMinerGame.Update() - END");
            }

            ProcessInvoke();

            if (OnGameUpdate != null)
            {
                OnGameUpdate(gameTime);
            }

            base.Update(gameTime);

            MyRender.GetRenderProfiler().EndProfilingBlock(othersBlock);

            MyRender.GetRenderProfiler().EndProfilingBlock(updateBlock);
        }
        protected override void OnClosed()
        {
            base.OnClosed();

            MyDialogues.Stop();
        }