Пример #1
0
 public void BeginFailReactionLocal(MyShootActionEnum action, MyGunStatusEnum status)
 {
     if (status == MyGunStatusEnum.Failed)
     {
         MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
     }
 }
        public override bool PasteGrid(MyInventory buildInventory = null, bool deactivate = true)
        {
            if ((CopiedGrids.Count > 0) && !IsActive)
            {
                Activate();
                return(true);
            }

            if (!m_canBePlaced)
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
                return(false);
            }

            if (PreviewGrids.Count == 0)
            {
                return(false);
            }

            bool result;

            bool placingOnDynamicGrid = RemoveBlock != null && !RemoveBlock.CubeGrid.IsStatic;

            if (MyCubeBuilder.Static.DynamicMode || placingOnDynamicGrid)
            {
                result = PasteGridsInDynamicMode(buildInventory, deactivate);
            }
            else
            {
                result = PasteGridsInStaticMode(buildInventory, deactivate);
            }

            return(result);
        }
Пример #3
0
        public void Unselect(bool unselectSound = true)
        {
            if (MyToolbarComponent.CurrentToolbar != this)
            {
                return;
            }
            if (SelectedItem != null && unselectSound)
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
            }

            if (unselectSound)
            {
                MySession.Static.GameFocusManager.Clear();
            }

            var controlledObject = MySession.Static.ControlledEntity;

            if (controlledObject != null)
            {
                controlledObject.SwitchToWeapon(null);
            }

            if (Unselected != null)
            {
                Unselected(this);
            }
        }
Пример #4
0
        void IMyUseObject.Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;

            if (!MarkedForClose)
            {
                MyFixedPoint amount = MyFixedPoint.Min(Item.Amount, user.GetInventory().ComputeAmountThatFits(Item.Content.GetId()));
                if (amount == 0)
                {
                    if (MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimePlayedSound > 2500)
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudVocInventoryFull);
                        m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
                    }

                    MyHud.Notifications.Add(MyNotificationSingletons.InventoryFull);
                    return;
                }

                if (amount > 0)
                {
                    if (MySession.ControlledEntity == user)
                    {
                        MyAudio.Static.PlaySound(TAKE_ITEM_SOUND.SoundId);
                    }
                    user.GetInventory().PickupItem(this, amount);
                }

                MyHud.Notifications.ReloadTexts();
            }
        }
        public static void OnMissingComponents(MyCubeBlockDefinition definition)
        {
            MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);

            (MyHud.Notifications.Get(MyNotificationSingletons.MissingComponent) as MyHudMissingComponentNotification).SetBlockDefinition(definition);
            MyHud.Notifications.Add(MyNotificationSingletons.MissingComponent);
        }
Пример #6
0
        void IMyUseObject.Use(UseActionEnum actionEnum, VRage.ModAPI.IMyEntity entity)
        {
            MyCharacter thisEntity = entity as MyCharacter;

            if (!base.MarkedForClose)
            {
                MyFixedPoint amount = MyFixedPoint.Min(this.Item.Amount, thisEntity.GetInventory(0).ComputeAmountThatFits(this.Item.Content.GetId(), 0f, 0f));
                if (amount == 0)
                {
                    if ((MySandboxGame.TotalGamePlayTimeInMilliseconds - this.m_lastTimePlayedSound) > 0x9c4)
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudVocInventoryFull);
                        this.m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
                    }
                    MyHud.Stats.GetStat <MyStatPlayerInventoryFull>().InventoryFull = true;
                }
                else
                {
                    if (amount > 0)
                    {
                        if (ReferenceEquals(MySession.Static.ControlledEntity, thisEntity) && ((this.lastTimeSound == DateTime.MinValue) || ((DateTime.UtcNow - this.lastTimeSound).TotalMilliseconds > 500.0)))
                        {
                            MyGuiAudio.PlaySound(MyGuiSounds.PlayTakeItem);
                            this.lastTimeSound = DateTime.UtcNow;
                        }
                        thisEntity.GetInventory(0).PickupItem(this, amount);
                    }
                    MyHud.Notifications.ReloadTexts();
                }
            }
        }
Пример #7
0
        void IMyUseObject.Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;

            if (!MarkedForClose)
            {
                System.Diagnostics.Debug.Assert((user.GetInventory() as MyInventory) != null, "Null or unexpected inventory type returned!");

                MyFixedPoint amount = MyFixedPoint.Min(Item.Amount, (user.GetInventory() as MyInventory).ComputeAmountThatFits(Item.Content.GetId()));
                if (amount == 0)
                {
                    if (MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimePlayedSound > 2500)
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudVocInventoryFull);
                        m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
                    }

                    MyHud.Notifications.Add(MyNotificationSingletons.InventoryFull);
                    return;
                }

                if (amount > 0)
                {
                    if (MySession.Static.ControlledEntity == user && (lastTimeSound == DateTime.MinValue || (DateTime.UtcNow - lastTimeSound).TotalMilliseconds > 500))
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.PlayTakeItem);
                        lastTimeSound = DateTime.UtcNow;
                    }
                    System.Diagnostics.Debug.Assert((user.GetInventory() as MyInventory) != null, "Null or unexpected inventory type returned");
                    (user.GetInventory() as MyInventory).PickupItem(this, amount);
                }

                MyHud.Notifications.ReloadTexts();
            }
        }
Пример #8
0
        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            if (!MarkedForClose)
            {
                if (!MySession.Static.CreativeMode)
                {
                    var amount = Item.Amount;
                    amount = MyFixedPoint.Min(amount, user.GetInventory().ComputeAmountThatFits(Item.Content.GetId()));
                    if (amount == 0)
                    {
                        if (MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimePlayedSound > 2500)
                        {
                            MyGuiAudio.PlaySound(MyGuiSounds.HudVocInventoryFull);
                            m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
                        }

                        MyHud.Notifications.Add(MyNotificationSingletons.InventoryFull);
                        return;
                    }
                }
                if (MySession.ControlledEntity == user)
                {
                    MyAudio.Static.PlaySound(TAKE_ITEM_SOUND.SoundId);
                }
                //user.StartSecondarySound(TAKE_ITEM_SOUND);
                user.GetInventory().TakeFloatingObject(this);
            }
        }
Пример #9
0
        public void ActivateItemAtSlot(int slot, bool checkIfWantsToBeActivated = false, bool playActivationSound = true)
        {
            if (!IsValidSlot(slot) && !IsHolsterSlot(slot))
            {
                return;
            }

            if (IsValidSlot(slot))
            {
                if (ActivateItemAtIndex(SlotToIndex(slot), checkIfWantsToBeActivated))
                {
                    if (playActivationSound)
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                    }
                    if (SlotActivated != null)
                    {
                        SlotActivated(this, new SlotArgs {
                            SlotNumber = slot
                        });
                    }
                }
            }
            else
            {
                Unselect();
            }
        }
Пример #10
0
        public override void HandleInput(bool receivedFocusInThisUpdate)
        {
            base.HandleInput(receivedFocusInThisUpdate);

            if (MyInput.Static.IsNewKeyPressed(MyKeys.Escape))
            {
                if (!MyInput.Static.IsAnyShiftKeyPressed())
                {
                    MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
                    MyGuiSandbox.AddScreen(new MyGuiScreenMainMenu());
                }
                else
                {
                    if (m_respawnsTable.SelectedRow.UserData == null || m_respawnsTable.SelectedRow.UserData as MyMedicalRoomInfo == null)
                    {
                        MySession.Static.SetCameraController(MyCameraControllerEnum.Spectator, null, new Vector3D(1000000)); //just somewhere out of the game area to see our beautiful skybox
                        return;
                    }

                    var medicalRoom = m_respawnsTable.SelectedRow.UserData as MyMedicalRoomInfo;

                    MySession.Static.SetCameraController(MyCameraControllerEnum.Spectator, null, medicalRoom.PrefferedCameraPosition);
                    MySpectatorCameraController.Static.SetTarget(medicalRoom.MedicalRoomPosition, medicalRoom.MedicalRoomUp);
                    MySpectatorCameraController.Static.Velocity = medicalRoom.MedicalRoomVelocity;

                    Close();
                }
            }

            if (MyInput.Static.IsNewKeyPressed(MyKeys.Enter))
            {
                onRespawnClick(m_respawnButton);
            }
        }
Пример #11
0
 public void CutsceneSkip()
 {
     if (m_currentCutscene != null)
     {
         if (m_currentCutscene.CanBeSkipped)
         {
             if (m_currentCutscene.FireEventsDuringSkip && MyVisualScriptLogicProvider.CutsceneNodeEvent != null)
             {
                 if (m_currentNode != null && m_currentNode.EventDelay > 0 && m_eventDelay != float.MaxValue)
                 {
                     MyVisualScriptLogicProvider.CutsceneNodeEvent(m_currentNode.Event);
                 }
                 for (int i = m_currentNodeIndex + 1; i < m_currentCutscene.SequenceNodes.Length; i++)
                 {
                     if (!string.IsNullOrEmpty(m_currentCutscene.SequenceNodes[i].Event))
                     {
                         MyVisualScriptLogicProvider.CutsceneNodeEvent(m_currentCutscene.SequenceNodes[i].Event);
                     }
                 }
             }
             m_currentNodeIndex = m_currentCutscene.SequenceNodes.Length;
             MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
         }
         else
         {
             MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
         }
     }
 }
        private bool HandleBlueprintInput()
        {
            if (MyInput.Static.IsNewKeyPressed(MyKeys.B) && MyInput.Static.IsAnyCtrlKeyPressed() && !MyInput.Static.IsAnyMousePressed())
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);

                if (!m_clipboard.IsActive)
                {
                    MySessionComponentVoxelHand.Static.Enabled = false;
                    var copiedGrid = MyCubeGrid.GetTargetGrid();

                    if (!MyInput.Static.IsAnyShiftKeyPressed())
                    {
                        m_clipboard.CopyGroup(copiedGrid, MyInput.Static.IsAnyAltKeyPressed() ? GridLinkTypeEnum.Physical : GridLinkTypeEnum.Logical);
                    }
                    else
                    {
                        m_clipboard.CopyGrid(copiedGrid);
                    }

                    UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification);

                    var blueprintScreen = new MyGuiBlueprintScreen(m_clipboard, MySession.Static.CreativeMode || MySession.Static.CreativeToolsEnabled(Sync.MyId));
                    if (copiedGrid != null)
                    {
                        blueprintScreen.CreateFromClipboard(true);
                    }
                    m_clipboard.Deactivate();
                    MyGuiSandbox.AddScreen(blueprintScreen);
                }
                return(true);
            }

            return(false);
        }
        public override void HandleInput(bool receivedFocusInThisUpdate)
        {
            if (MyInput.Static.IsNewGameControlPressed(MyControlsSpace.LANDING_GEAR))
            {
                CloseScreenNow();
            }

            var humanPlayer = MySession.Static.LocalHumanPlayer;

            if (humanPlayer != null &&
                (MyInput.Static.IsNewLeftMousePressed() || MyControllerHelper.IsControl(Sandbox.Engine.Utils.MySpaceBindingCreator.CX_GUI, MyControlsGUI.ACCEPT, MyControlStateType.NEW_PRESSED)))
            {
                for (int i = 0; i < m_colorPaletteControlsList.Count; i++)
                {
                    if (m_colorPaletteControlsList[i].IsMouseOver)
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                        humanPlayer.SelectedBuildColorSlot = i;
                        m_highlightControlPanel.Position   = new Vector2(((x + defColCol) / 1600f) + (humanPlayer.SelectedBuildColorSlot % 7) * 0.03f, (y + defColLine) / 1200f + (humanPlayer.SelectedBuildColorSlot / 7) * 0.03f);
                        UpdateSliders(humanPlayer.SelectedBuildColor);
                    }
                }
            }
            base.HandleInput(receivedFocusInThisUpdate);
        }
Пример #14
0
        public void Unselect(bool unselectSound = true)
        {
            if (MyToolbarComponent.CurrentToolbar != this)
            {
                return;
            }
            if (SelectedItem != null && unselectSound)
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
            }

            var controlledObject = MySession.Static.ControlledEntity as IMyControllableEntity;

            if (controlledObject != null)
            {
                controlledObject.SwitchToWeapon(null);
            }

            if (MyCubeBuilder.Static.IsActivated)
            {
                MyCubeBuilder.Static.Deactivate();
            }

            if (Unselected != null)
            {
                Unselected(this);
            }
        }
Пример #15
0
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            if (MySandboxGame.IsDedicated)
            {
                m_hudWarnings.Clear();
                m_soundQueue.Clear();
                return;
            }

            m_updateCounter++;
            if (m_updateCounter % FRAMES_BETWEEN_UPDATE == 0)
            {
                foreach (var warningGroup in m_hudWarnings)
                {
                    warningGroup.Update();
                }
                if (m_soundQueue.Count > 0 && MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastSoundPlayed > 5000)
                {
                    m_lastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
                    m_sound           = MyGuiAudio.PlaySound(m_soundQueue[0]);
                    m_soundQueue.RemoveAt(0);
                }
            }
        }
Пример #16
0
        public override void HandleInput()
        {
            ProfilerShort.Begin("MyToolbarComponent.HandleInput");
            try
            {
                var context       = MySession.ControlledEntity != null ? MySession.ControlledEntity.ControlContext : MyStringId.NullOrEmpty;
                var focusedScreen = MyScreenManager.GetScreenWithFocus();
                if ((focusedScreen == MyGuiScreenGamePlay.Static ||
                     focusedScreen is MyGuiScreenCubeBuilder ||
                     focusedScreen is MyGuiScreenToolbarConfigBase) &&
                    CurrentToolbar != null)
                {
                    // if (!(focusedScreen is MyGuiScreenCubeBuilder) || !(focusedScreen.FocusedControl is MyGuiControlTextbox))
                    {
                        for (int i = 0; i < m_slotControls.Length; i++)
                        {
                            if (MyControllerHelper.IsControl(context, m_slotControls[i], MyControlStateType.NEW_PRESSED))
                            {
                                if (!MyInput.Static.IsAnyShiftKeyPressed())
                                {
                                    CurrentToolbar.ActivateItemAtSlot(i);
                                }
                                else if (i < CurrentToolbar.PageCount)
                                {
                                    MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                                    CurrentToolbar.SwitchToPage(i);
                                }
                            }
                        }
                    }

                    if (MyControllerHelper.IsControl(context, MyControlsSpace.TOOLBAR_UP, MyControlStateType.NEW_PRESSED))
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                        CurrentToolbar.PageUp();
                    }
                    if (MyControllerHelper.IsControl(context, MyControlsSpace.TOOLBAR_DOWN, MyControlStateType.NEW_PRESSED))
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                        CurrentToolbar.PageDown();
                    }

                    if (MyControllerHelper.IsControl(context, MyControlsSpace.TOOLBAR_NEXT_ITEM, MyControlStateType.NEW_PRESSED))
                    {
                        CurrentToolbar.SelectNextSlot();
                    }
                    else if (MyControllerHelper.IsControl(context, MyControlsSpace.TOOLBAR_PREV_ITEM, MyControlStateType.NEW_PRESSED))
                    {
                        CurrentToolbar.SelectPreviousSlot();
                    }
                }
            }
            finally
            {
                ProfilerShort.End();
            }

            base.HandleInput();
        }
Пример #17
0
 public static void RemoveSound(MyGuiSounds cueEnum)
 {
     if (m_sound != null && m_sound.CueEnum == MyGuiAudio.GetCue(cueEnum))
     {
         m_sound.Stop();
     }
     m_soundQueue.RemoveAll(new System.Predicate <MyGuiSounds>((cue) => { return(cue == cueEnum); }));
 }
Пример #18
0
 public override void HandleInput(bool receivedFocusInThisUpdate)
 {
     base.HandleInput(receivedFocusInThisUpdate);
     if (MyInput.Static.IsNewKeyPressed(MyKeys.F3))
     {
         MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
         CloseScreen();
     }
 }
Пример #19
0
 private static void CreateRotorGridFailed(long builtBy, out MyCubeGrid rotorGrid, out MyMotorRotor rotorBlock)
 {
     if (builtBy == MySession.LocalPlayerId)
     {
         MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
     }
     rotorGrid  = null;
     rotorBlock = null;
 }
Пример #20
0
        public override void HandleInput(bool receivedFocusInThisUpdate)
        {
            base.HandleInput(receivedFocusInThisUpdate);

            if (MyInput.Static.IsNewKeyPressed(MyKeys.Escape))
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
                MyGuiScreenMainMenu.AddMainMenu();
            }
        }
Пример #21
0
        bool IMyCameraController.HandleUse()
        {
            MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
            CubeGrid.GridSystems.CameraSystem.ResetCamera();

            if (MySession.ControlledEntity is MyRemoteControl)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #22
0
        public virtual void PickUp()
        {
            MyCharacterDetectorComponent component = base.Character.Components.Get <MyCharacterDetectorComponent>();

            if (((component != null) && (component.UseObject != null)) && component.UseObject.IsActionSupported(UseActionEnum.PickUp))
            {
                if (component.UseObject.PlayIndicatorSound)
                {
                    MyGuiAudio.PlaySound(MyGuiSounds.HudUse);
                    base.Character.SoundComp.StopStateSound(true);
                }
                component.UseObject.Use(UseActionEnum.PickUp, base.Character);
            }
        }
        private bool HandleCopyInput()
        {
            if (MyInput.Static.IsNewKeyPressed(MyKeys.C) && MyInput.Static.IsAnyCtrlKeyPressed() && !MyInput.Static.IsAnyMousePressed())
            {
                if (MySession.Static.CameraController is MyCharacter || MySession.Static.GetCameraControllerEnum() == MyCameraControllerEnum.Spectator)
                {
                    bool handled = false;
                    MyGuiAudio.PlaySound(MyGuiSounds.HudClick);

                    var entity = MyCubeGrid.GetTargetEntity();
                    if (m_clipboard.IsActive == false && entity is MyCubeGrid)
                    {
                        MyCubeGrid grid = entity as MyCubeGrid;
                        MySessionComponentVoxelHand.Static.Enabled = false;
                        DeactivateCopyPasteFloatingObject(true);

                        if (!MyInput.Static.IsAnyShiftKeyPressed())
                        {
                            m_clipboard.CopyGroup(grid, MyInput.Static.IsAnyAltKeyPressed() ? GridLinkTypeEnum.Physical : GridLinkTypeEnum.Logical);
                            m_clipboard.Activate();
                        }
                        else
                        {
                            m_clipboard.CopyGrid(grid);
                            m_clipboard.Activate();
                        }
                        UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification);
                        handled = true;
                    }
                    else if (!m_floatingObjectClipboard.IsActive && entity is MyFloatingObject)
                    {
                        MySessionComponentVoxelHand.Static.Enabled = false;
                        DeactivateCopyPaste(true);

                        m_floatingObjectClipboard.CopyfloatingObject(entity as MyFloatingObject);
                        UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification);
                        handled = true;
                    }

                    if (handled)
                    {
                        this.Activate();
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #24
0
 public static void EnqueueSound(MyGuiSounds sound)
 {
     if (!MyGuiAudio.HudWarnings)
     {
         return;
     }
     if ((m_sound == null || !m_sound.IsPlaying) && MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastSoundPlayed > 5000)
     {
         m_sound           = MyGuiAudio.PlaySound(sound);
         m_lastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     }
     else
     {
         m_soundQueue.Add(sound);
     }
 }
Пример #25
0
        public override void Shoot(MyShootActionEnum action, Vector3 direction, Vector3D?overrideWeaponPos, string gunAction)
        {
            MyAnalyticsHelper.ReportActivityStartIf(!m_activated, this.Owner, "Welding", "Character", "HandTools", "Welder", true);

            base.Shoot(action, direction, overrideWeaponPos, gunAction);

            if (action == MyShootActionEnum.PrimaryAction /* && IsPreheated*/)
            {
                var block = GetTargetBlock();
                if (block != null && m_activated)
                {
                    if (Sync.IsServer && CanWeld(block))
                    {
                        Weld();
                    }
                }
                else if (Owner == MySession.Static.LocalCharacter)
                {
                    var info = FindProjectedBlock();
                    if (info.raycastResult == BuildCheckResult.OK)
                    {
                        if (IsWithinWorldLimits(info.cubeProjector.CubeGrid, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, info.hitCube.BlockDefinition.BlockPairName))
                        {
                            if (MySession.Static.CreativeMode || MyBlockBuilderBase.SpectatorIsBuilding || Owner.CanStartConstruction(info.hitCube.BlockDefinition) || MySession.Static.IsAdminModeEnabled(Sync.MyId))
                            {
                                info.cubeProjector.Build(info.hitCube, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, Owner.EntityId, builtBy: Owner.ControllerInfo.Controller.Player.Identity.IdentityId);
                            }
                            else
                            {
                                MyBlockPlacerBase.OnMissingComponents(info.hitCube.BlockDefinition);
                            }
                        }
                        else
                        {
                            MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
                            MyHud.Notifications.Add(MyNotificationSingletons.ShipOverLimits);
                        }
                    }
                }
            }
            else if (action == MyShootActionEnum.SecondaryAction && Sync.IsServer)
            {
                FillStockpile();
            }
            return;
        }
Пример #26
0
 public static void EnqueueSound(MyGuiSounds sound)
 {
     if (!MyGuiAudio.HudWarnings)
     {
         return;
     }
     if ((_mSound == null || !_mSound.IsPlaying) &&
         MySandboxGame.TotalGamePlayTimeInMilliseconds - _mLastSoundPlayed > 5000)
     {
         _mSound           = MyGuiAudio.PlaySound(sound);
         _mLastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     }
     else
     {
         M_SOUND_QUEUE.Add(sound);
     }
 }
        public void UpdateBeforeSimulation()
        {
            if (!MyFakes.ENABLE_CAMERA_BLOCK)
            {
                return;
            }

            if (m_currentCamera == null)
            {
                return;
            }

            if (MySession.Static.CameraController != m_currentCamera)
            {
                if (!(MySession.Static.CameraController is MyCameraBlock))
                {
                    DisableCameraEffects();
                }
                ResetCurrentCamera();
                return;
            }

            //Guard to make sure that when current camera moves from one system to another (through antennas), the input is not processed twice
            if (m_ignoreNextInput)
            {
                m_ignoreNextInput = false;
                return;
            }

            if (MyInput.Static.IsNewGameControlPressed(MyControlsSpace.SWITCH_LEFT))
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                SetPrev();
            }
            if (MyInput.Static.IsNewGameControlPressed(MyControlsSpace.SWITCH_RIGHT))
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);
                SetNext();
            }

            if (MyInput.Static.DeltaMouseScrollWheelValue() != 0 && MyGuiScreenCubeBuilder.Static == null && !MyGuiScreenTerminal.IsOpen)
            {
                m_currentCamera.ChangeZoom(MyInput.Static.DeltaMouseScrollWheelValue());
            }
        }
        public override bool PasteGrid(MyInventoryBase buildInventory = null, bool deactivate = true)
        {
            if ((CopiedGrids.Count > 0) && !IsActive)
            {
                Activate();
                return(true);
            }

            if (!m_canBePlaced)
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
                return(false);
            }

            if (PreviewGrids.Count == 0)
            {
                return(false);
            }

            bool result;
            bool placingOnDynamicGrid = (m_hitEntity is MyCubeGrid) && !((MyCubeGrid)m_hitEntity).IsStatic && !MyCubeBuilder.Static.DynamicMode;

            if (MyCubeBuilder.Static.DynamicMode)
            {
                result = PasteGridsInDynamicMode(buildInventory, deactivate);
            }
            else if (placingOnDynamicGrid)
            {
                result = PasteGridInternal(buildInventory: buildInventory, deactivate: deactivate);
            }
            else
            {
                if (MyFakes.ENABLE_VR_BUILDING)
                {
                    result = PasteGridInternal(buildInventory: buildInventory, deactivate: deactivate);
                }
                else
                {
                    result = PasteGridsInStaticMode(buildInventory, deactivate);
                }
            }

            return(result);
        }
            private void HandleKey()
            {
                ReadPressedKeys();

                foreach (var key in m_newPressedKeys)
                {
                    if (m_oldPressedKeys.Contains(key))
                    {
                        continue;
                    }

                    if (!MyInput.Static.IsKeyValid((MyKeys)key))
                    {
                        ShowControlIsNotValidMessageBox();
                        break;
                    }

                    MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
                    MyControl ctrl = MyInput.Static.GetControl((MyKeys)key);
                    if (ctrl != null)
                    {
                        if (ctrl.Equals(m_controlBeingSet))
                        {
                            OverwriteAssignment(ctrl, key);
                            CloseScreen();
                        }
                        else
                        {
                            StringBuilder controlText = null;
                            MyControl.AppendName(ref controlText, (MyKeys)key);
                            ShowControlIsAlreadyAssigned(ctrl, controlText, () => OverwriteAssignment(ctrl, key));
                        }
                    }
                    else
                    {
                        m_controlBeingSet.SetControl(m_deviceType, (MyKeys)key);
                        CloseScreen();
                    }
                    break;
                }

                m_oldPressedKeys.Clear();
                MyUtils.Swap(ref m_oldPressedKeys, ref m_newPressedKeys);
            }
            private void HandleMouseButton()
            {
                MyInput.Static.GetListOfPressedMouseButtons(m_newPressedMouseButtons);

                //  don't assign buttons that were pressed when we arrived in the menu
                foreach (var button in m_newPressedMouseButtons)
                {
                    if (!m_oldPressedMouseButtons.Contains(button))
                    {
                        MyGuiAudio.PlaySound(MyGuiSounds.HudMouseClick);
                        if (!MyInput.Static.IsMouseButtonValid(button))
                        {
                            ShowControlIsNotValidMessageBox();
                            break;
                        }

                        MyControl ctrl = MyInput.Static.GetControl(button);
                        if (ctrl != null)
                        {
                            if (ctrl.Equals(m_controlBeingSet))
                            {
                                OverwriteAssignment(ctrl, button);
                                CloseScreen();
                            }
                            else
                            {
                                StringBuilder controlText = null;
                                MyControl.AppendName(ref controlText, button);
                                ShowControlIsAlreadyAssigned(ctrl, controlText, () => OverwriteAssignment(ctrl, button));
                            }
                        }
                        else
                        {
                            m_controlBeingSet.SetControl(button);
                            CloseScreen();
                        }
                        break;
                    }
                }

                m_oldPressedMouseButtons.Clear();
                MyUtils.Swap(ref m_oldPressedMouseButtons, ref m_newPressedMouseButtons);
            }