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); }
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); }
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; }
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); }
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); }
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()); } }
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); }
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); } }
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); } }
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; }
private void ShowDebugNotification(string notificationText) { var debugNotification = new MyHudNotification(MySpaceTexts.CustomText, 5000, level: MyNotificationLevel.Important); debugNotification.SetTextFormatArguments("DEBUG: " + notificationText); MyHud.Notifications.Add(debugNotification); }
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); }
private void EquipWeapon(IMyHandheldGunObject<MyDeviceBase> newWeapon, bool showNotification = false) { // Debug.Assert(newWeapon != null); if (newWeapon == null) return; MyEntity gunEntity = (MyEntity)newWeapon; gunEntity.Render.CastShadows = true; gunEntity.Render.NeedsResolveCastShadow = false; gunEntity.Save = false; gunEntity.OnClose += gunEntity_OnClose; MyEntities.Add(gunEntity); m_handItemDefinition = null; m_currentWeapon = newWeapon; m_currentWeapon.OnControlAcquired(this); UseAnimationForWeapon |= m_currentWeapon.ForceAnimationInsteadOfIK; if (WeaponEquiped != null) WeaponEquiped(m_currentWeapon); 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); }
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(); } } }
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; } }
private void RemovePasteNotification() { if (m_pasteNotification != null) { MyHud.Notifications.Remove(m_pasteNotification); m_pasteNotification = null; } }
public void RemoveNotification(ref MyHudNotification notification) { if (notification != null) { MyHud.Notifications.Remove(notification); notification = null; } }
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); }
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; }
protected virtual void OnControlReleased(MyEntityController controller) { // Release control of the ship if (Sync.Players.GetEntityController(this) == controller && GridThrustSystem != null) GridThrustSystem.Enabled = true; if (MySession.LocalHumanPlayer == controller.Player) { OnControlReleased_UpdateCamera(); ForceFirstPersonCamera = false; if (MyGuiScreenGamePlay.Static != null) { Static_CameraAttachedToChanged(null, null); //MySession.Static.CameraAttachedToChanged -= Static_CameraAttachedToChanged; } MyHud.Notifications.Remove(MyNotificationSingletons.RespawnShipWarning); RemoveControlNotifications(); if (GridThrustSystem != null) { ClearMovementControl(); } MyHud.ShipInfo.Hide(); MyHud.GravityIndicator.Hide(); MyHud.Crosshair.Hide(); MyHud.LargeTurretTargets.Visible = false; MyHud.Notifications.Remove(m_noControlNotification); m_noControlNotification = null; } else { if (!MyFakes.ENABLE_RADIO_HUD) { MyHud.LocationMarkers.UnregisterMarker(this); } #warning TODO: Add player name changing support //controller.Player.OnDisplayNameChanged -= UpdateHudMarker; } if (SyncObject.IsShooting()) { EndShootAll(); } if (m_enableShipControl && (IsMainCockpit == true || CubeGrid.HasMainCockpit() == false)) { if (GridSelectionSystem != null) { GridSelectionSystem.OnControlReleased(); } //if (Sync.IsServer) /*{ var group = ControlGroup.GetGroup(CubeGrid); Debug.Assert(group != null, "Grid should be in group when player lefts cockpit?"); if (group != null) { foreach (var node in group.Nodes) Sync.Controllers.RemoveControlledEntity(node.NodeData); } }*/ var group = ControlGroup.GetGroup(CubeGrid); if (group != null) { group.GroupData.ControlSystem.RemoveControllerBlock(this); } } }
public override void Init(MyObjectBuilder_EntityBase objectBuilder) { SyncFlag = true; /// Wee need to get the character subtype, before passing init to base classes so the components can be properly initialized.. MyObjectBuilder_Character characterOb = (MyObjectBuilder_Character)objectBuilder; Render.ColorMaskHsv = characterOb.ColorMaskHSV; Vector3 colorMask = Render.ColorMaskHsv; /// This will retrieve definition and set the subtype for the character GetModelAndDefinition(characterOb, out m_characterModel, out m_characterDefinition, ref colorMask); base.UseNewAnimationSystem = m_characterDefinition.UseNewAnimationSystem; if (UseNewAnimationSystem) { //// Create default layer. //AnimationController.Controller.DeleteAllLayers(); //var animationLayer = AnimationController.Controller.CreateLayer("Body"); //// Build an animation node for each animation subtype. //// VRAGE TODO: this is just temporary for testing the new animation system //foreach (var animationNameSubType in m_characterDefinition.AnimationNameToSubtypeName) //{ // string animSubType = animationNameSubType.Value; // MyAnimationDefinition animationDefinition = null; // if (animationLayer.FindNode(animSubType) == null && TryGetAnimationDefinition(animSubType, out animationDefinition)) // { // MyModel modelAnimation = VRage.Game.Models.MyModels.GetModelOnlyAnimationData(animationDefinition.AnimationModel); // if (modelAnimation != null && animationDefinition.ClipIndex < modelAnimation.Animations.Clips.Count) // { // VRage.Animations.MyAnimationClip clip = modelAnimation.Animations.Clips[animationDefinition.ClipIndex]; // var animationState = new VRage.Animations.MyAnimationStateMachineNode(animSubType, clip); // animationLayer.AddNode(animationState); // } // } //} AnimationController.Clear(); MyStringHash animSubtypeNameHash = MyStringHash.GetOrCompute(m_characterDefinition.AnimationController); MyAnimationControllerDefinition animControllerDef = MyDefinitionManager.Static.GetDefinition<MyAnimationControllerDefinition>(animSubtypeNameHash); if (animControllerDef != null) { AnimationController.InitFromDefinition(animControllerDef); } } if (Render.ColorMaskHsv != colorMask) // color mask is set by definition of model Render.ColorMaskHsv = colorMask; /// Set the subtype from the definition characterOb.SubtypeName = m_characterDefinition.Id.SubtypeName; base.Init(objectBuilder); SyncObject.MarkPhysicsDirty(); m_currentAnimationChangeDelay = 0; SoundComp = new MyCharacterSoundComponent(); RadioBroadcaster.WantsToBeEnabled = characterOb.EnableBroadcasting && Definition.VisibleOnHud; Init(new StringBuilder(characterOb.DisplayName), m_characterDefinition.Model, null, null); NeedsUpdate = MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.EACH_10TH_FRAME | MyEntityUpdateEnum.EACH_100TH_FRAME; PositionComp.LocalAABB = new BoundingBox(-new Vector3(0.3f, 0.0f, 0.3f), new Vector3(0.3f, 1.8f, 0.3f)); m_currentLootingCounter = characterOb.LootingCounter; if (m_currentLootingCounter <= 0) UpdateCharacterPhysics(!characterOb.AIMode); m_currentMovementState = characterOb.MovementState; if (Physics != null && Physics.CharacterProxy != null) { switch (m_currentMovementState) { case MyCharacterMovementEnum.Falling: case MyCharacterMovementEnum.Flying: Physics.CharacterProxy.SetState(HkCharacterStateType.HK_CHARACTER_IN_AIR); break; case MyCharacterMovementEnum.Jump: Physics.CharacterProxy.SetState(HkCharacterStateType.HK_CHARACTER_JUMPING); break; case MyCharacterMovementEnum.Ladder: case MyCharacterMovementEnum.LadderDown: case MyCharacterMovementEnum.LadderUp: Physics.CharacterProxy.SetState(HkCharacterStateType.HK_CHARACTER_CLIMBING); break; default: Physics.CharacterProxy.SetState(HkCharacterStateType.HK_CHARACTER_ON_GROUND); break; } } InitAnimations(); ValidateBonesProperties(); CalculateTransforms(0); if (m_currentLootingCounter > 0) { InitDeadBodyPhysics(); if (m_currentMovementState != MyCharacterMovementEnum.Died) SetCurrentMovementState(MyCharacterMovementEnum.Died); SwitchAnimation(MyCharacterMovementEnum.Died, false); } 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); } bool hasGases = Definition.SuitResourceStorage.Count > 0; var sinkData = new List<MyResourceSinkInfo>(); var sourceData = new List<MyResourceSourceInfo>(); if (hasGases) { OxygenComponent = new MyCharacterOxygenComponent(); Components.Add(OxygenComponent); OxygenComponent.Init(characterOb); OxygenComponent.AppendSinkData(sinkData); OxygenComponent.AppendSourceData(sourceData); } m_suitBattery = new MyBattery(this); m_suitBattery.Init(characterOb.Battery, sinkData, sourceData); if (hasGases) { OxygenComponent.CharacterGasSink = m_suitBattery.ResourceSink; OxygenComponent.CharacterGasSource = m_suitBattery.ResourceSource; } sinkData.Clear(); sinkData.Add( new MyResourceSinkInfo { ResourceTypeId = MyResourceDistributorComponent.ElectricityId, MaxRequiredInput = MyEnergyConstants.REQUIRED_INPUT_LIFE_SUPPORT + MyEnergyConstants.REQUIRED_INPUT_CHARACTER_LIGHT, RequiredInputFunc = ComputeRequiredPower }); if (hasGases) { sinkData.Add(new MyResourceSinkInfo { ResourceTypeId = MyCharacterOxygenComponent.OxygenId, MaxRequiredInput = (OxygenComponent.OxygenCapacity + (!OxygenComponent.NeedsOxygenFromSuit ? Definition.OxygenConsumption : 0f)) * Definition.OxygenConsumptionMultiplier * VRage.Game.MyEngineConstants.UPDATE_STEPS_PER_SECOND / 100f, RequiredInputFunc = () => (OxygenComponent.HelmetEnabled ? Definition.OxygenConsumption : 0f) * Definition.OxygenConsumptionMultiplier * VRage.Game.MyEngineConstants.UPDATE_STEPS_PER_SECOND / 100f }); } SinkComp.Init( MyStringHash.GetOrCompute("Utility"), sinkData); SinkComp.CurrentInputChanged += delegate { SetPowerInput(SinkComp.CurrentInputByType(MyResourceDistributorComponent.ElectricityId)); }; SinkComp.TemporaryConnectedEntity = this; SuitRechargeDistributor = new MyResourceDistributorComponent(); SuitRechargeDistributor.AddSource(m_suitBattery.ResourceSource); SuitRechargeDistributor.AddSink(SinkComp); SinkComp.Update(); bool isJetpackAvailable = !MySession.Static.Battle; isJetpackAvailable = isJetpackAvailable && (m_characterDefinition.Jetpack != null); if (isJetpackAvailable) { JetpackComp = new MyCharacterJetpackComponent(); JetpackComp.Init(characterOb); } WeaponPosition = new MyCharacterWeaponPositionComponent(); Components.Add(WeaponPosition); WeaponPosition.Init(characterOb); InitWeapon(characterOb.HandWeapon); if (Definition.RagdollBonesMappings.Count > 0) CreateBodyCapsulesForHits(Definition.RagdollBonesMappings); else m_bodyCapsuleInfo.Clear(); PlayCharacterAnimation(Definition.InitialAnimation, MyBlendOption.Immediate, MyFrameOption.JustFirstFrame, 0.0f); m_savedHealth = characterOb.Health; m_savedPlayer = new Sandbox.Game.World.MyPlayer.PlayerId(characterOb.PlayerSteamId, characterOb.PlayerSerialId); NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; // TODO: Get rid of after after the character will be initialized properly from objectBuilder IsPromoted = characterOb.IsPromoted; m_previousLinearVelocity = characterOb.LinearVelocity; if (ControllerInfo.IsLocallyControlled()) { m_localHeadTransform.Value = new MyTransform(Vector3.Zero); m_localHeadTransformTool.Value = new MyTransform(Vector3.Zero); } CheckExistingStatComponent(); }
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); }
static void OnShowNotification(ref ShowNotificationMsg msg, MyNetworkClient sender) { var notification = new MyHudNotification(msg.Text, msg.Time, level: MyNotificationLevel.Important); MyHud.Notifications.Add(notification); }
private void RemoveSymmetryNotification() { if (m_symmetryNotification != null) { MyHud.Notifications.Remove(m_symmetryNotification); m_symmetryNotification = null; } }
private void ShowNotification(MyStringId textToDisplay) { var debugNotification = new MyHudNotification(textToDisplay, 5000, level: MyNotificationLevel.Important); MyHud.Notifications.Add(debugNotification); }
/// <summary> /// Notification visible when looking at grid whose size is nto supported current block. /// </summary> private void ShowNotificationBlockNotAvailable(String blockDisplayName, MyStringId gridTypeText) { if (!MyFakes.ENABLE_NOTIFICATION_BLOCK_NOT_AVAILABLE) return; if (m_blockNotAvailableNotification == null) m_blockNotAvailableNotification = new MyHudNotification(MySpaceTexts.NotificationBlockNotAvailableFor, 0, font: MyFontEnum.Red, priority: 1); m_blockNotAvailableNotification.SetTextFormatArguments(blockDisplayName, MyTexts.Get(gridTypeText)); MyHud.Notifications.Add(m_blockNotAvailableNotification); }
private void AbortJump() { m_soundEmitter.StopSound(true, true); if (IsLocalCharacterAffectedByJump()) { var notification = new MyHudNotification(MySpaceTexts.NotificationJumpAborted, 1500, Common.MyFontEnum.Red, level: MyNotificationLevel.Important); MyHud.Notifications.Add(notification); } CleanupAfterJump(); }
private void InitializeNotifications() { // keyboard mouse notifications { var next = MyInput.Static.GetGameControl(MyControlsSpace.SWITCH_LEFT); var prev = MyInput.Static.GetGameControl(MyControlsSpace.SWITCH_RIGHT); var compoundToggle = MyInput.Static.GetGameControl(MyControlsSpace.SWITCH_COMPOUND); var buildingModeToggle = MyInput.Static.GetGameControl(MyControlsSpace.SWITCH_BUILDING_MODE); var build = MyInput.Static.GetGameControl(MyControlsSpace.PRIMARY_TOOL_ACTION); var rotxp = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE); var rotxn = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE); var rotyp = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE); var rotyn = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE); var rotzp = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE); var rotzn = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE); // This will combine controls which has name var controlHelper = new MyHudNotifications.ControlsHelper(rotxp, rotxn, rotzp, rotzn, rotyp, rotyn); BlockRotationHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationRotationFormatCombined, controlHelper); ColorHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationColorFormat, next, prev, "MMB", "CTRL", "SHIFT"); BuildingHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationBuildingFormat, build); UnlimitedBuildingHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationUnlimitedBuildingFormat, "LMB", "RMB", "CTRL"); if (MyFakes.ENABLE_COMPOUND_BLOCKS) CompoundModeHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationCompoundBuildingFormat, compoundToggle, "ALT"); if (MyFakes.ENABLE_CUBE_BUILDER_DYNAMIC_MODE) DynamicModeHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationSwitchBuildingModeFormat, buildingModeToggle); m_buildModeHint = null; } // joystick notifications { var cx_char = MySpaceBindingCreator.CX_CHARACTER; var cx_build = MySpaceBindingCreator.CX_BUILD_MODE; var primaryActionCode = MyControllerHelper.GetCodeForControl(cx_char, MyControlsSpace.PRIMARY_TOOL_ACTION); var secondaryActionCode = MyControllerHelper.GetCodeForControl(cx_char, MyControlsSpace.SECONDARY_TOOL_ACTION); var rotateBlockCode1 = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE); var rotateBlockCode2 = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE); var rotateBlockCode3 = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE); var rotateBlockCode4 = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE); var rotateBlockRollCode = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE); var rotateBlockRollCode2 = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE); var dynamicModeCode = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.SWITCH_BUILDING_MODE); var compoundCode = MyControllerHelper.GetCodeForControl(cx_build, MyControlsSpace.SWITCH_COMPOUND); var buildModeCode = MyControllerHelper.GetCodeForControl(cx_char, MyControlsSpace.BUILD_MODE); StringBuilder sb = new StringBuilder(); var rotation = new HashSet<char>() { rotateBlockCode1, rotateBlockCode2, rotateBlockCode3, rotateBlockCode4, rotateBlockRollCode, rotateBlockRollCode2 }; foreach (var c in rotation) sb.Append(c); JoystickRotationHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationRotationFormatCombined, sb.ToString().Trim()); JoystickBuildingHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationBuildingFormat, primaryActionCode); JoystickUnlimitedBuildingHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationJoystickUnlimitedBuildingFormat, primaryActionCode, secondaryActionCode); if (MyFakes.ENABLE_COMPOUND_BLOCKS) JoystickCompoundModeHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationJoystickCompoundBuildingFormat, compoundCode); if (MyFakes.ENABLE_CUBE_BUILDER_DYNAMIC_MODE) JoystickDynamicModeHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationSwitchBuildingModeFormat, dynamicModeCode); m_buildModeHint = MyHudNotifications.CreateControlNotification(MySpaceTexts.NotificationHintPressToOpenBuildMode, buildModeCode); } }
void Matchmaking_LobbyChatUpdate(Lobby lobby, ulong changedUser, ulong makingChangeUser, ChatMemberStateChangeEnum stateChange) { //System.Diagnostics.Debug.Assert(MySession.Static != null); if (lobby.LobbyId == Lobby.LobbyId) { if (stateChange == ChatMemberStateChangeEnum.Entered) { MySandboxGame.Log.WriteLineAndConsole("Player entered: " + MySteam.API.Friends.GetPersonaName(changedUser) + " (" + changedUser + ")"); MyTrace.Send(TraceWindow.Multiplayer, "Player entered"); Peer2Peer.AcceptSession(changedUser); // When some clients connect at the same time then some of them can have already added clients // (see function MySyncLayer.RegisterClientEvents which registers all Members in Lobby). if (Sync.Clients == null || !Sync.Clients.HasClient(changedUser)) { RaiseClientJoined(changedUser); // Battles - send all clients, identities, players, factions as first message to client if ((Battle || Scenario) && changedUser != Sync.MyId) { SendAllMembersDataToClient(changedUser); } } if (MySandboxGame.IsGameReady && changedUser != ServerId) { // Player is able to connect to the battle which already started - player is then kicked and we do not want to show connected message in HUD. bool showMsg = true; if (MyFakes.ENABLE_BATTLE_SYSTEM && MySession.Static != null && MySession.Static.Battle && !BattleCanBeJoined) showMsg = false; if (showMsg) { var playerJoined = new MyHudNotification(MyCommonTexts.NotificationClientConnected, 5000, level: MyNotificationLevel.Important); playerJoined.SetTextFormatArguments(MySteam.API.Friends.GetPersonaName(changedUser)); MyHud.Notifications.Add(playerJoined); } } } else { // Kicked client can be already removed from Clients if (Sync.Clients == null || Sync.Clients.HasClient(changedUser)) RaiseClientLeft(changedUser, stateChange); if (changedUser == ServerId) { MyTrace.Send(TraceWindow.Multiplayer, "Host left: " + stateChange.ToString()); RaiseHostLeft(); MyGuiScreenMainMenu.UnloadAndExitToMenu(); MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MyCommonTexts.MultiplayerErrorServerHasLeft))); // Set new server //ServerId = Lobby.GetOwner(); //if (ServerId == Sync.MyId) //{ // Lobby.SetLobbyData(HostNameTag, Sync.MyName); //} } else if (MySandboxGame.IsGameReady) { var playerLeft = new MyHudNotification(MyCommonTexts.NotificationClientDisconnected, 5000, level: MyNotificationLevel.Important); playerLeft.SetTextFormatArguments(MySteam.API.Friends.GetPersonaName(changedUser)); MyHud.Notifications.Add(playerLeft); } } } }
private void UpdatePasteNotification(MyStringId myTextsWrapperEnum) { RemovePasteNotification(); if (m_clipboard.IsActive) { m_pasteNotification = new MyHudNotification(myTextsWrapperEnum, 0, level: MyNotificationLevel.Control); MyHud.Notifications.Add(m_pasteNotification); } }