• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Gui.MyHudNotification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: RemoveNotification

 public void RemoveNotification(ref MyHudNotification notification)
 {
     if (notification != null)
     {
         MyHud.Notifications.Remove(notification);
         notification = null;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyCharacter.cs


示例17: RefreshControlNotifications

        private void RefreshControlNotifications()
        {
            RemoveControlNotifications();

            if (m_notificationReactorsOn == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TOGGLE_REACTORS).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationReactorsOn = new MyHudNotification(MySpaceTexts.NotificationHintTurnAllReactorsOn, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationReactorsOn.SetTextFormatArguments(controlName);
                else
                    m_notificationReactorsOn.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.TOGGLE_REACTORS));
                m_notificationReactorsOn.Level = MyNotificationLevel.Control;
            }

            if (m_notificationReactorsOff == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TOGGLE_REACTORS).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationReactorsOff = new MyHudNotification(MySpaceTexts.NotificationHintTurnAllReactorsOff, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationReactorsOff.SetTextFormatArguments(controlName);
                else
                    m_notificationReactorsOff.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.TOGGLE_REACTORS));
                m_notificationReactorsOff.Level = MyNotificationLevel.Control;
            }

            if (m_notificationLeave == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationLeave = new MyHudNotification(LeaveNotificationHintText, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationLeave.SetTextFormatArguments(controlName);
                else
                    m_notificationLeave.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.USE));
                m_notificationLeave.Level = MyNotificationLevel.Control;
            }

            if (m_notificationTerminal == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                if (!MyInput.Static.IsJoystickConnected())
                {
                    m_notificationTerminal = new MyHudNotification(MySpaceTexts.NotificationHintOpenShipControlPanel, 0);
                    m_notificationTerminal.SetTextFormatArguments(controlName);
                    m_notificationTerminal.Level = MyNotificationLevel.Control;
                }
                else
                {
                    m_notificationTerminal = null;
                }
            }

            if (m_notificationWeaponMode == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_COLOR_CHANGE).GetControlButtonName(MyGuiInputDeviceEnum.Mouse);
                if (!MyInput.Static.IsJoystickConnected())
                {
                    m_notificationWeaponMode = new MyHudNotification(MySpaceTexts.NotificationHintSwitchWeaponMode, 0);
                    m_notificationWeaponMode.SetTextFormatArguments(controlName);
                    m_notificationWeaponMode.Level = MyNotificationLevel.Control;
                }
                else
                {
                    m_notificationWeaponMode = null;
                }
            }

            MyHud.Notifications.Add(m_notificationLeave);
            if (m_notificationTerminal != null)
                MyHud.Notifications.Add(m_notificationTerminal);
            if (m_notificationWeaponMode != null)
                MyHud.Notifications.Add(m_notificationWeaponMode);
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:73,代码来源:MyShipController.cs


示例18: StartRespawn

        private void StartRespawn(float respawnTime)
        {
            if (ControllerInfo.Controller != null && ControllerInfo.Controller.Player != null)
            {
                MySessionComponentMissionTriggers.PlayerDied(this.ControllerInfo.Controller.Player);
                if (!MySessionComponentMissionTriggers.CanRespawn(this.ControllerInfo.Controller.Player.Id))
                {
                    m_currentRespawnCounter = -1;
                    return;
                }
            }

            if (this == MySession.Static.ControlledEntity)
            {
                MyGuiScreenTerminal.Hide();

                m_respawnNotification = new MyHudNotification(MyCommonTexts.NotificationRespawn, (int)(RESPAWN_TIME * 1000), priority: 5);
                m_respawnNotification.Level = MyNotificationLevel.Important;
                m_respawnNotification.SetTextFormatArguments((int)m_currentRespawnCounter);
                MyHud.Notifications.Add(m_respawnNotification);
            }

            m_currentRespawnCounter = respawnTime;

            NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:26,代码来源:MyCharacter.cs


示例19: Init


//.........这里部分代码省略.........
            InitInventory(characterOb);

            Physics.Enabled = true;

            SetHeadLocalXAngle(characterOb.HeadAngle.X);
            SetHeadLocalYAngle(characterOb.HeadAngle.Y);

            Render.InitLight(m_characterDefinition);
            Render.InitJetpackThrusts(m_characterDefinition);

            m_useAnimationForWeapon = MyPerGameSettings.CheckUseAnimationInsteadOfIK();

            m_lightEnabled = characterOb.LightEnabled;

            Physics.LinearVelocity = characterOb.LinearVelocity;

            if (Physics.CharacterProxy != null)
            {
                Physics.CharacterProxy.ContactPointCallbackEnabled = true;
                Physics.CharacterProxy.ContactPointCallback += RigidBody_ContactPointCallback;
            }

            Render.UpdateLightProperties(m_currentLightPower);

            // Setup first person view for local player from previous state before die.
            IsInFirstPersonView = MySession.Static.Settings.Enable3rdPersonView == false
                || (m_localCharacterWasInThirdPerson != null
                ? characterOb.IsInFirstPersonView && !m_localCharacterWasInThirdPerson.Value : characterOb.IsInFirstPersonView);

            m_breath = new MyCharacterBreath(this);

            Debug.Assert(m_currentLootingCounter <= 0 || m_currentLootingCounter > 0);

            m_broadcastingNotification = new MyHudNotification();

            m_notEnoughStatNotification = new MyHudNotification(MyCommonTexts.NotificationStatNotEnough, disappearTimeMs: 1000, font: MyFontEnum.Red, level: MyNotificationLevel.Important);

            if (InventoryAggregate != null) InventoryAggregate.Init();

            UseDamageSystem = true;

            if (characterOb.EnabledComponents == null)
            {
                characterOb.EnabledComponents = new List<string>();
            }

            foreach (var componentName in m_characterDefinition.EnabledComponents)
            {
                if (characterOb.EnabledComponents.All(x => x != componentName))
                    characterOb.EnabledComponents.Add(componentName);
            }

            foreach (var componentName in characterOb.EnabledComponents)
            {
                Tuple<Type, Type> componentType;
                if (MyCharacterComponentTypes.CharacterComponents.TryGetValue(MyStringId.GetOrCompute(componentName), out componentType))
                {
                    MyEntityComponentBase component = Activator.CreateInstance(componentType.Item1) as MyEntityComponentBase;
                    Components.Add(componentType.Item2, component);
                }
            }

            if (m_characterDefinition.UsesAtmosphereDetector)
            {
                AtmosphereDetectorComp = new MyAtmosphereDetectorComponent();
                AtmosphereDetectorComp.InitComponent(true, this);
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:67,代码来源:MyCharacter.cs


示例20: UpdateSymmetryNotification

        private void UpdateSymmetryNotification(MyStringId myTextsWrapperEnum)
        {
            RemoveSymmetryNotification();

            m_symmetryNotification = new MyHudNotification(myTextsWrapperEnum, 0, level: MyNotificationLevel.Control);
            if (!MyInput.Static.IsJoystickConnected())
            {
                m_symmetryNotification.SetTextFormatArguments(
                    MyInput.Static.GetGameControl(MyControlsSpace.PRIMARY_TOOL_ACTION),
                    MyInput.Static.GetGameControl(MyControlsSpace.SECONDARY_TOOL_ACTION));
            }
            else
            {
                m_symmetryNotification.SetTextFormatArguments(
                    MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.PRIMARY_TOOL_ACTION),
                    MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.SECONDARY_BUILD_ACTION));
            }

            MyHud.Notifications.Add(m_symmetryNotification);
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:20,代码来源:MyCubeBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Multiplayer.MySyncGrid类代码示例发布时间:2022-05-26
下一篇:
C# EntityComponents.MyResourceSourceComponent类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap