当前位置: 首页>>代码示例>>C#>>正文


C# Gui.MyHudNotification类代码示例

本文整理汇总了C#中Sandbox.Game.Gui.MyHudNotification的典型用法代码示例。如果您正苦于以下问题:C# MyHudNotification类的具体用法?C# MyHudNotification怎么用?C# MyHudNotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyHudNotification类属于Sandbox.Game.Gui命名空间,在下文中一共展示了MyHudNotification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

		public virtual void Init(MyObjectBuilder_Character characterBuilder)
		{
			if (characterBuilder == null)
				return;

			m_inertiaDampenersNotification = new MyHudNotification();
			m_jetpackToggleNotification = new MyHudNotification();

			CurrentAutoEnableDelay = characterBuilder.AutoenableJetpackDelay;

			if (ThrustComp != null)
				Character.Components.Remove<MyJetpackThrustComponent>();

		    var thrustProperties = Character.Definition.Jetpack.ThrustProperties;

		    FuelConverterDefinition = null;;
		    FuelConverterDefinition = !MyFakes.ENABLE_HYDROGEN_FUEL ? new MyFuelConverterInfo { Efficiency = 1.0f } : Character.Definition.Jetpack.ThrustProperties.FuelConverter;

		    MyDefinitionId fuelId = new MyDefinitionId();
		    if (!FuelConverterDefinition.FuelId.IsNull())
		        fuelId = thrustProperties.FuelConverter.FuelId;

		    MyGasProperties fuelDef = null;
            if (MyFakes.ENABLE_HYDROGEN_FUEL)
                MyDefinitionManager.Static.TryGetDefinition(fuelId, out fuelDef);

            FuelDefinition = fuelDef ?? new MyGasProperties // Use electricity by default
            {
                Id = MyResourceDistributorComponent.ElectricityId,
                EnergyDensity = 1f,
            };

            ForceMagnitude = thrustProperties.ForceMagnitude;
			MinPowerConsumption = thrustProperties.MinPowerConsumption;
			MaxPowerConsumption = thrustProperties.MaxPowerConsumption;
		    MinPlanetaryInfluence = thrustProperties.MinPlanetaryInfluence;
		    MaxPlanetaryInfluence = thrustProperties.MaxPlanetaryInfluence;
		    EffectivenessAtMinInfluence = thrustProperties.EffectivenessAtMinInfluence;
		    EffectivenessAtMaxInfluence = thrustProperties.EffectivenessAtMaxInfluence;
		    NeedsAtmosphereForInfluence = thrustProperties.NeedsAtmosphereForInfluence;
		    ConsumptionFactorPerG = thrustProperties.ConsumptionFactorPerG;

			MyEntityThrustComponent thrustComp = new MyJetpackThrustComponent();
			thrustComp.Init();
			Character.Components.Add(thrustComp);


			ThrustComp.DampenersEnabled = characterBuilder.DampenersEnabled;

			foreach (Vector3I direction in Base6Directions.IntDirections)
			{
				ThrustComp.Register(Character, direction);	// Preferably there should be a jetpack entity (equipment) that could hold the thrusts instead of the character
			}
		    thrustComp.ResourceSink(Character).TemporaryConnectedEntity = Character;
            Character.SuitRechargeDistributor.AddSink(thrustComp.ResourceSink(Character));
			TurnOnJetpack(characterBuilder.JetpackEnabled, true, true);
		}
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:57,代码来源:MyCharacterJetpackComponent.cs

示例2: MySessionComponentResearch

        public MySessionComponentResearch()
        {
            Static = this;

            m_unlockedResearch = new Dictionary<long, HashSet<MyDefinitionId>>();
            m_requiredResearch = new List<MyDefinitionId>();

            m_unlockedResearchNotification = new MyHudNotification(font: MyFontEnum.White, priority: 2, text: MyCommonTexts.NotificationResearchUnlocked);
            m_knownResearchNotification = new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MyCommonTexts.NotificationResearchKnown);

        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:11,代码来源:MySessionComponentResearch.cs

示例3: MyAngleGrinder

        public MyAngleGrinder()
            : base(250)
        {
            SecondaryLightIntensityLower = 0.4f;
            SecondaryLightIntensityUpper = 0.4f;
            EffectId = MyParticleEffectsIDEnum.AngleGrinder;
            EffectScale = 0.6f;

            HasCubeHighlight = true;
            HighlightColor = Color.Red * 0.3f;
			HighlightMaterial = "GizmoDrawLineRed";

            m_grindingNotification = new MyHudNotification(MySpaceTexts.AngleGrinderPrimaryAction, MyHudNotification.INFINITE, level: MyNotificationLevel.Control);

            m_rotationSpeed = 0.0f;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:16,代码来源:MyAngleGrinder.cs

示例4: MyCameraBlock

        static MyCameraBlock()
        {
            var viewBtn = new MyTerminalControlButton<MyCameraBlock>("View", MySpaceTexts.BlockActionTitle_View, MySpaceTexts.Blank, (b) => b.RequestSetView());
            viewBtn.Enabled = (b) => b.CanUse();
            viewBtn.SupportsMultipleBlocks = false;
            var action = viewBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
            if (action != null)
            {
                action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
                action.ValidForGroups = false;
            }
            MyTerminalControlFactory.AddControl(viewBtn);

            var controlName = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
            m_hudNotification = new MyHudNotification(MySpaceTexts.NotificationHintPressToExitCamera);
            m_hudNotification.SetTextFormatArguments(controlName);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyCameraBlock.cs

示例5: MyAngleGrinder

        public MyAngleGrinder()
            : base(MyDefinitionManager.Static.TryGetHandItemForPhysicalItem(m_physicalItemId), 0.5f, 250)
        {
            SecondaryLightIntensityLower = 0.4f;
            SecondaryLightIntensityUpper = 0.4f;
            EffectId = MyParticleEffectsIDEnum.AngleGrinder;

            HasCubeHighlight = true;
            HighlightColor = Color.Red * 0.3f;

            m_grindingNotification = new MyHudNotification(MySpaceTexts.AngleGrinderPrimaryAction, MyHudNotification.INFINITE, level: MyNotificationLevel.Control);
            m_grindingNotification.SetTextFormatArguments(MyInput.Static.GetGameControl(MyControlsSpace.PRIMARY_TOOL_ACTION));

            m_rotationSpeed = 0.0f;

            PhysicalObject = (MyObjectBuilder_PhysicalGunObject)MyObjectBuilderSerializer.CreateNewObject(m_physicalItemId);
        }
开发者ID:martejj,项目名称:SpaceEngineers,代码行数:17,代码来源:MyAngleGrinder.cs

示例6: MyGuiControlStat

            public MyGuiControlStat(MyEntityStat stat, Vector2 position, Vector2 size, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
				: base(position: position, size: size, originAlign: originAlign)
            {
				Debug.Assert(stat != null);
				m_stat = stat;
                var vecColor = m_stat.StatDefinition.GuiDef.CriticalColorFrom;
                m_criticalValueColorFrom = new Color(vecColor.X, vecColor.Y, vecColor.Z);
                vecColor = m_stat.StatDefinition.GuiDef.CriticalColorTo;
                m_criticalValueColorTo = new Color(vecColor.X, vecColor.Y, vecColor.Z);
				if(m_stat != null)
				{
					m_stat.OnStatChanged += UpdateStatControl;
                    m_stat.OnStatChanged += DisplayStatNotification;
                    m_outOfStatNotification = new MyHudNotification(MyCommonTexts.NotificationStatZero, disappearTimeMs: 1000, font: MyFontEnum.Red, level: MyNotificationLevel.Important);
                    m_outOfStatNotification.SetTextFormatArguments(m_stat.StatId.ToString());
				}
            }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiControlStats.cs

示例7: MyAngleGrinder

        public MyAngleGrinder()
            : base(MyDefinitionManager.Static.TryGetHandItemForPhysicalItem(m_physicalItemId), 0.5f, 250)
        {
            SecondaryLightIntensityLower = 0.4f;
            SecondaryLightIntensityUpper = 0.4f;
            EffectId = MyParticleEffectsIDEnum.AngleGrinder;

            HasCubeHighlight = true;
            HighlightColor = Color.Red * 0.3f;
			HighlightMaterial = "GizmoDrawLineRed";

            m_grindingNotification = new MyHudNotification(MySpaceTexts.AngleGrinderPrimaryAction, MyHudNotification.INFINITE, level: MyNotificationLevel.Control);

            m_rotationSpeed = 0.0f;

            PhysicalObject = (MyObjectBuilder_PhysicalGunObject)MyObjectBuilderSerializer.CreateNewObject(m_physicalItemId);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyAngleGrinder.cs

示例8: Update

        public override void Update()
        {
            m_disableFading = VRage.Input.MyInput.Static.IsGameControlPressed(MyControlsSpace.LOOKAROUND);

            //for now make extra check for control key. Maybe trigger from HandleInput?
            if (VRage.Input.MyInput.Static.IsNewGameControlPressed(MyControlsSpace.TOGGLE_SIGNALS) && !VRage.Input.MyInput.Static.IsAnyCtrlKeyPressed() && Sandbox.Graphics.GUI.MyScreenManager.FocusedControl == null)
            {
                SignalDisplayMode += 1;
                if (SignalDisplayMode >= SignalMode.MaxSignalModes)
                    SignalDisplayMode = SignalMode.DefaultMode;

                if (m_signalModeNotification != null)
                {
                    MyHud.Notifications.Remove(m_signalModeNotification);
                    m_signalModeNotification = null;
                }

                switch (SignalDisplayMode)
                {
                    case SignalMode.DefaultMode:
                        m_signalModeNotification = new MyHudNotification(MyCommonTexts.SignalMode_Switch_DefaultMode, 1000);
                        break;
                    case SignalMode.FullDisplay:
                        m_signalModeNotification = new MyHudNotification(MyCommonTexts.SignalMode_Switch_FullDisplay, 1000);
                        break;
                    case SignalMode.NoNames:
                        m_signalModeNotification = new MyHudNotification(MyCommonTexts.SignalMode_Switch_NoNames, 1000);
                        break;
                    case SignalMode.Off:
                        m_signalModeNotification = new MyHudNotification(MyCommonTexts.SignalMode_Switch_Off, 1000);
                        break;
                }

                if (m_signalModeNotification != null)
                    MyHud.Notifications.Add(m_signalModeNotification);
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:37,代码来源:MyHudMarkerRender.cs

示例9: RequestJump

        private void RequestJump()
        {
            if (CanJump)
            {
                if (MySession.Static.LocalCharacter != null)
                {
                    var shipController = MySession.Static.LocalCharacter.Parent as MyShipController;
                    if (shipController == null && MySession.Static.ControlledEntity != null)
                    {
                        shipController = MySession.Static.ControlledEntity.Entity as MyShipController;
                    }


                    if (shipController != null && (shipController.IsMainCockpit || !CubeGrid.HasMainCockpit()))
                    {
                        if (m_jumpTarget != null)
                        {
                            CubeGrid.GridSystems.JumpSystem.RequestJump(m_jumpTarget.Name, m_jumpTarget.Coords, shipController.OwnerId);
                        }
                        else
                        {
                            Vector3 localForward = Base6Directions.GetVector(shipController.Orientation.Forward);
                            Vector3D forward = Vector3D.Transform(localForward, shipController.CubeGrid.WorldMatrix.GetOrientation());

                            forward.Normalize();

                            Vector3D jumpCoords = CubeGrid.WorldMatrix.Translation + forward * ComputeMaxDistance();
                            CubeGrid.GridSystems.JumpSystem.RequestJump("Blind Jump", jumpCoords, shipController.OwnerId);
                        }
                    }
                }
            }
            else if (!IsJumping && !IsFull)
            {
                var notification = new MyHudNotification(MySpaceTexts.NotificationJumpDriveNotFullyCharged, 1500);
                notification.SetTextFormatArguments((m_storedPower / BlockDefinition.PowerNeededForJump).ToString("P"));
                MyHud.Notifications.Add(notification);
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:39,代码来源:MyJumpDrive.cs

示例10: UpdateJumpDriveSystem

        private void UpdateJumpDriveSystem()
        {
            // Using this instead of game time because it cannot be affected by sim speed
            float jumpTime = (float)(TimeUtil.LocalTime - m_jumpStartTime).TotalMilliseconds;

            float warmupTime = 10000f;
            float startJumpTime = 1500f;
            float endJumpTime = 500f;

            if (m_isJumping)
            {
                if (jumpTime < warmupTime)
                {
                    int prevTimeInt = (int)(m_prevJumpTime / 1000);
                    int timeInt = (int)(jumpTime / 1000);
                    if (prevTimeInt != timeInt)
                    {
                        if (IsLocalCharacterAffectedByJump())
                        {
                            var notification = new MyHudNotification(MySpaceTexts.NotificationJumpWarmupTime, 500);
                            int secondsRemaining = (int)(Math.Round((warmupTime - jumpTime) / 1000));
                            notification.SetTextFormatArguments(secondsRemaining);
                            MyHud.Notifications.Add(notification);
                        }
                    }
                } 
                else if (jumpTime < startJumpTime + warmupTime)
                {
                    if (m_soundEmitter.SoundId != m_jumpOutSound.SoundId)
                    {
                        m_soundEmitter.PlaySound(m_jumpOutSound);
                    }
                    UpdateJumpEffect(MathHelper.SmoothStep(1f, 0f, (jumpTime - warmupTime) / startJumpTime));
                }
                else if (!m_jumped)
                {
                    if (Sync.IsServer)
                    {
                        Vector3? suitableLocation = FindSuitableJumpLocation(m_shipInfo[m_grid]);
                        if (suitableLocation.HasValue)
                        {
                            SyncObject.SendPerformJump(suitableLocation.Value);
                            PerformJump(suitableLocation.Value);
                        }
                        else
                        {
                            SyncObject.SendAbortJump();
                            AbortJump();
                        }
                    }
                }
                else if (jumpTime < startJumpTime + endJumpTime + warmupTime)
                {
                    if (m_soundEmitter.SoundId != m_jumpInSound.SoundId)
                    {
                        m_soundEmitter.PlaySound(m_jumpInSound);
                    }
                    UpdateJumpEffect(MathHelper.SmoothStep(0f, 1f, (jumpTime - startJumpTime - warmupTime) / (endJumpTime)));
                }
                else
                {
                    CleanupAfterJump();
                }
            }
            m_prevJumpTime = jumpTime;
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:66,代码来源:MyGridJumpDriveSystem.cs

示例11: ShowDebugNotification

 private void ShowDebugNotification(string notificationText)
 {
     var debugNotification = new MyHudNotification(MySpaceTexts.CustomText, 5000, level: MyNotificationLevel.Important);
     debugNotification.SetTextFormatArguments("DEBUG: " + notificationText);
     MyHud.Notifications.Add(debugNotification);
 }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:6,代码来源:MyProjector.cs

示例12: ShowOutOfAmmoNotification

        public void ShowOutOfAmmoNotification()
        {
            if (OutOfAmmoNotification == null)
            {
                OutOfAmmoNotification = new MyHudNotification(MyCommonTexts.OutOfAmmo, 2000, font: MyFontEnum.Red);
            }

            if (m_currentWeapon is MyEntity)
                OutOfAmmoNotification.SetTextFormatArguments((m_currentWeapon as MyEntity).DisplayName);
            MyHud.Notifications.Add(OutOfAmmoNotification);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:11,代码来源:MyCharacter.cs

示例13: EquipWeapon


//.........这里部分代码省略.........

            MyAnalyticsHelper.ReportActivityStart(this, "item_equip", "character", "toolbar_item_usage", m_currentWeapon.GetType().Name);

            // CH:TODO: The hand item definitions should be changed to handheld gun object definitions and should be taken according to m_currentWeapon typeId
            if (m_currentWeapon.PhysicalObject != null)
            {
                var handItemId = m_currentWeapon.PhysicalObject.GetId();

                m_handItemDefinition = MyDefinitionManager.Static.TryGetHandItemForPhysicalItem(handItemId);
                System.Diagnostics.Debug.Assert(m_handItemDefinition != null, "Create definition for this hand item!");
            }
            else if (m_currentWeapon.DefinitionId.TypeId == typeof(MyObjectBuilder_CubePlacer))
            {
                var gunID = new MyDefinitionId(typeof(MyObjectBuilder_CubePlacer));

                m_handItemDefinition = MyDefinitionManager.Static.TryGetHandItemDefinition(ref gunID);
                System.Diagnostics.Debug.Assert(m_handItemDefinition != null, "Create definition for this hand item!");
            }

            //Setup correct worldmatrix to weapon
            //CalculateDependentMatrices();

            if (m_handItemDefinition != null && !string.IsNullOrEmpty(m_handItemDefinition.FingersAnimation))
            {
                string animationSubtype;
                if (!m_characterDefinition.AnimationNameToSubtypeName.TryGetValue(m_handItemDefinition.FingersAnimation, out animationSubtype))
                {
                    animationSubtype = m_handItemDefinition.FingersAnimation;
                }
                var def = MyDefinitionManager.Static.TryGetAnimationDefinition(animationSubtype);
                if (!def.LeftHandItem.TypeId.IsNull)
                {
                    m_currentWeapon.OnControlReleased();
                    (m_currentWeapon as MyEntity).Close(); //no dual wielding now
                    m_currentWeapon = null;
                }

                PlayCharacterAnimation(m_handItemDefinition.FingersAnimation, MyBlendOption.Immediate, def.Loop ? MyFrameOption.Loop : MyFrameOption.PlayOnce, 1.0f, 1, false, null);
                if (UseNewAnimationSystem)
                {
                    TriggerCharacterAnimationEvent("equip_left_tool", true);
                    TriggerCharacterAnimationEvent("equip_right_tool", true);
                    TriggerCharacterAnimationEvent(m_handItemDefinition.Id.SubtypeName.ToLower(), true);
                    TriggerCharacterAnimationEvent(m_handItemDefinition.FingersAnimation.ToLower(), true);
                }

                if (!def.LeftHandItem.TypeId.IsNull)
                {
                    if (m_leftHandItem != null)
                    {
                        (m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased();
                        m_leftHandItem.Close();
                    }

                    // CH: TODO: The entity id is not synced, but it never was in this place. It should be fixed later
                    long handItemId = MyEntityIdentifier.AllocateId();
                    uint? inventoryItemId = null;
                    var builder = GetObjectBuilderForWeapon(def.LeftHandItem, ref inventoryItemId, handItemId);
                    var leftHandItem = CreateGun(builder, inventoryItemId);

                    if (leftHandItem != null)
                    {
                        m_leftHandItem = leftHandItem as MyEntity;
                        leftHandItem.OnControlAcquired(this);
                        UpdateLeftHandItemPosition();

                        MyEntities.Add(m_leftHandItem);
                    }
                }
            }
            else if (m_handItemDefinition != null)
            {
                if (UseNewAnimationSystem)
                {
                    TriggerCharacterAnimationEvent("equip_left_tool", true);
                    TriggerCharacterAnimationEvent("equip_right_tool", true);
                    TriggerCharacterAnimationEvent(m_handItemDefinition.Id.SubtypeName.ToLower(), true);
                }
            }
            else
            {
                StopFingersAnimation(0);
            }

            var consumer = gunEntity.Components.Get<MyResourceSinkComponent>();
            if (consumer != null && SuitRechargeDistributor != null)
                SuitRechargeDistributor.AddSink(consumer);

            if (showNotification)
            {
                var notificationUse = new MyHudNotification(MySpaceTexts.NotificationUsingWeaponType, 2000);
                notificationUse.SetTextFormatArguments(MyDeviceBase.GetGunNotificationName(newWeapon.DefinitionId));
                MyHud.Notifications.Add(notificationUse);
            }

            Static_CameraAttachedToChanged(null, null);
            if (!(IsUsing is MyCockpit))
                MyHud.Crosshair.ResetToDefault(clear: false);

        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:101,代码来源:MyCharacter.cs

示例14: UpdateAfterSimulation

        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            UpdateShipInfo();

            //Debug.Assert(GridGyroSystem != null && GridThrustSystem != null && Parent.Physics != null && m_cameraSpring != null && m_cameraShake != null, "CALL PROGRAMMER, this cant happen");

            // Vector3.One is max power, larger values will be clamped
            //if (GridThrustSystem != null && GridGyroSystem != null && ControllerInfo.Controller.IsLocalPlayer())
            //{
            //    if (
            //        (GridThrustSystem.ControlThrust != Vector3.Zero) ||
            //        (GridGyroSystem.ControlTorque != Vector3.Zero)
            //        )
            //    {
            //        CubeGrid.SyncObject.RequestControlThrustAndTorque(Vector3.Zero, Vector3.Zero);
            //        GridThrustSystem.ControlThrust = Vector3.Zero;
            //        GridGyroSystem.ControlTorque = Vector3.Zero;
            //    }
            //}

            if (ControllerInfo.Controller != null && MySession.LocalHumanPlayer != null && ControllerInfo.Controller == MySession.LocalHumanPlayer.Controller)
            {
                var shipController = CubeGrid.GridSystems.ControlSystem.GetController();
                if (shipController == ControllerInfo.Controller)
                {
                    if (m_noControlNotification != null)
                    {
                        MyHud.Notifications.Remove(m_noControlNotification);
                        m_noControlNotification = null;
                    }
                }
                else
                {
                    if (m_noControlNotification == null && EnableShipControl)
                    {
                        if (shipController == null && CubeGrid.GridSystems.ControlSystem.GetShipController() != null)
                        {
                            m_noControlNotification = new MyHudNotification(MySpaceTexts.Notification_NoControlAutoPilot, 0);
                        }
                        else
                        {
                            if (CubeGrid.IsStatic)
                            {
                                m_noControlNotification = new MyHudNotification(MySpaceTexts.Notification_NoControlStation, 0);
                            }
                            else
                            {
                                m_noControlNotification = new MyHudNotification(MySpaceTexts.Notification_NoControl, 0);
                            }
                        }
                        MyHud.Notifications.Add(m_noControlNotification);
                    }
                }
            }

            foreach (MyShootActionEnum action in MyEnum<MyShootActionEnum>.Values)
            {
                if (SyncObject.IsShooting(action))
                {
                    Shoot(action);
                }
            }

            if (CanBeMainCockpit())
            {
                if (CubeGrid.HasMainCockpit() && CubeGrid.IsMainCockpit(this) == false)
                {
                    DetailedInfo.Clear();
                    DetailedInfo.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertiesText_MainCockpit));
                    DetailedInfo.Append(": " + CubeGrid.MainCockpit.CustomName);
                }
                else
                {
                    DetailedInfo.Clear();
                }
            }
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:79,代码来源:MyShipController.cs

示例15: ShowShootNotification

        private void ShowShootNotification(MyGunStatusEnum status, IMyGunObject<MyDeviceBase> weapon)
        {
            if (!ControllerInfo.IsLocallyHumanControlled())
                return;

            switch (status)
            {
                case MyGunStatusEnum.NotSelected:
                    if (m_noWeaponNotification == null)
                    {
                        m_noWeaponNotification = new MyHudNotification(MySpaceTexts.NotificationNoWeaponSelected, 2000, font: MyFontEnum.Red);
                        MyHud.Notifications.Add(m_noWeaponNotification);
                    }

                    MyHud.Notifications.Add(m_noWeaponNotification);
                    break;
                case MyGunStatusEnum.OutOfAmmo:
                    if (m_outOfAmmoNotification == null)
                    {
                        m_outOfAmmoNotification = new MyHudNotification(MySpaceTexts.OutOfAmmo, 2000, font: MyFontEnum.Red);
                    }

                    if (weapon is MyCubeBlock)
                        m_outOfAmmoNotification.SetTextFormatArguments((weapon as MyCubeBlock).DisplayNameText);

                    MyHud.Notifications.Add(m_outOfAmmoNotification);
                    break;
                case MyGunStatusEnum.NotFunctional:
                case MyGunStatusEnum.OutOfPower:
                    if (m_weaponNotWorkingNotification == null)
                    {
                        m_weaponNotWorkingNotification = new MyHudNotification(MySpaceTexts.NotificationWeaponNotWorking, 2000, font: MyFontEnum.Red);
                    }

                    if (weapon is MyCubeBlock)
                        m_weaponNotWorkingNotification.SetTextFormatArguments((weapon as MyCubeBlock).DisplayNameText);

                    MyHud.Notifications.Add(m_weaponNotWorkingNotification);
                    break;
                default:
                    break;
            }
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:43,代码来源:MyShipController.cs


注:本文中的Sandbox.Game.Gui.MyHudNotification类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。