public override void Load() { base.Load(); m_remainingTime = m_submissionDuration; m_countdownNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.Countdown, (int)m_remainingTime.TotalMilliseconds, null); MyHudNotification.AddNotification(m_countdownNotification,MyGuiScreenGamePlayType.GAME_STORY); }
public override void Load() { base.Load(); m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" }); //MyHudNotification.AddNotification(m_countdownNotification); MyScriptWrapper.OnUseKeyPress += OnUseKeyPress; }
public override void Load() { base.Load(); if (m_isOn) { m_countdownNotification = new MyHudNotification.MyNotification(NotificationText, MyGuiManager.GetFontMinerWarsBlue(), (int)RemainingTime.TotalMilliseconds, null); m_countdownNotification.IsImportant = true; if (DisplayCounter) MyHudNotification.AddNotification(m_countdownNotification); } }
public void Start() { MyGuiManager.AddScreen(this); if (Background && BackgroundNotification.HasValue) { var notification = new MyHudNotification.MyNotification(BackgroundNotification.Value); MyHudNotification.AddNotification(notification); this.Closed += (screen) => notification.Disappear(); } }
public override void Unload() { base.Unload(); if (m_notification != null) { m_notification.Disappear(); m_notification = null; } MyScriptWrapper.OnUseKeyPress -= OnUseKeyPress; }
public void Display(object[] parameters) { if (Text != null) { MyGuiFont font = GetFontDelegate(); MyHudNotification.MyNotification notification = new MyHudNotification.MyNotification(Text.Value, font, 5000, null, parameters); MyHudNotification.AddNotification(notification); } if (SoundCue != null) { MyAudio.AddCue2D(SoundCue.Value); } }
public MyTimerAction(int startTime, MyTimerActionDelegate action, string notification, bool showTimeFromStart) { StartTime = startTime; Launched = false; Action = action; Notification = notification; ShowTimeFromStart = showTimeFromStart; if (Notification != null) { m_hudNotification = new MyHudNotification.MyNotification(Notification + "{0}", MyGuiManager.GetFontMinerWarsBlue(), MyHudNotification.DONT_DISAPEAR, null); m_hudNotificationArgs = new object[1]; } }
public override void Load() { base.Load(); MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished; m_notification = MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.DoNotGoThere, MyGuiManager.GetFontMinerWarsRed()); m_target = MyScriptWrapper.GetEntity(m_targetId); MyScriptWrapper.MarkEntity(m_target, NameTemp.ToString(), MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_TEXT, MyGuitargetMode.Objective); MyScriptWrapper.AddNotification(m_notification); m_notification.Disappear(); }
public void Suspend(bool isOn) { if (isOn && !m_isOn) { m_countdownNotification = new MyHudNotification.MyNotification(NotificationText, (int)RemainingTime.TotalMilliseconds); m_countdownNotification.IsImportant = true; if (DisplayCounter) MyHudNotification.AddNotification(m_countdownNotification); } m_isOn = isOn; }
static void Multiplayer_OnNotification(MyNotificationType notificationType, MyTextsWrapperEnum arg1, object[] arg2) { if (notificationType == MyNotificationType.Text) { MyHudNotification.MyNotification notification = new MyHudNotification.MyNotification(arg1, 3000, null, arg2); MyHudNotification.AddNotification(notification); } else if (notificationType == MyNotificationType.WaitStart) { MyGuiManager.CloseIngameScreens(); MyGuiManager.AddModalScreen(new MyGuiScreenWaitingOnHost(arg1), null); MyMultiplayerGameplay.IsWaiting = true; if (!MyMinerGame.IsPaused()) MyMinerGame.SwitchPause(); } else if (notificationType == MyNotificationType.WaitEnd) { MyMultiplayerGameplay.IsWaiting = false; if (!MyMinerGame.IsPaused()) MyMinerGame.SwitchPause(); CloseWaitingScreen(); } }
public MyGuiScreenGamePlay(MyGuiScreenGamePlayType type, MyGuiScreenGamePlayType? previousType, MyMwcSectorIdentifier sectorIdentifier, int sectorVersion, MyMwcStartSessionRequestTypeEnum? sessionType) : base(Vector2.Zero, null, null) { MySystemTimer.SetByType(type); m_sessionType = sessionType; m_sectorIdentifier = sectorIdentifier; SectorVersion = sectorVersion; m_directionToSunNormalized = -MyMwcUtils.Normalize(GetPositionInMillionsOfKm()); DrawMouseCursor = false; m_closeOnEsc = false; m_type = type; m_previousType = previousType; m_firstUpdateCall = true; m_firstDrawCall = FIRST_TOTAL_DELAY; m_drawEvenWithoutFocus = true; m_enableBackgroundFade = true; m_canShareInput = false; m_screenCanHide = false; m_isPreparedTextureForSectorLoadingScreen = false; m_prepareTextureForSectorLoadingScreen = false; MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ClearEvents(); MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ShutdownNotification += new MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ShutdownHandler(MySectorServerCallback_ShutdownNotification); m_secondarySetup = new MyRender.MyRenderSetup(); m_secondarySetup.EnabledModules = new HashSet<MyRenderModuleEnum>(); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Cockpit); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.CockpitGlass); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunGlareAndLensFlare); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.UpdateOcclusions); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.AnimatedParticlesPrepare); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TransparentGeometry); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.ParticlesDustField); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.VoxelHand); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DistantImpostors); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Decals); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.CockpitWeapons); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunGlow); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SectorBorder); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DrawSectorBBox); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DrawCoordSystem); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Explosions); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.BackgroundCube); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.GPS); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TestField); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.AnimatedParticles); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Lights); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TransparentGeometryForward); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Projectiles); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DebrisField); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.ThirdPerson); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Editor); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SolarObjects); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SolarMapGrid); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PrunningStructure); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunWind); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.IceStormWind); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PrefabContainerManager); m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PhysicsPrunningStructure); m_showGPSNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.GPSReminder, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, null); m_showGPSNotification.SetTextFormatArguments(new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.GPS) }); }
private void ShowOrHideNotification(bool show, ref MyHudNotification.MyNotification notification, MyTextsWrapperEnum text, MyGameControlEnums? gameControl) { if (show) { if (notification == null) { notification = new MyHudNotification.MyNotification(text, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, null); if (gameControl.HasValue) { notification.SetTextFormatArguments(new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(gameControl.Value) }); } notification.Disappear(); } if (notification.IsDisappeared()) { notification.Appear(); MyHudNotification.AddNotification(notification); } } else { if (notification != null && !notification.IsDisappeared()) notification.Disappear(); } }
private void Update_PlayerShip() { if (IsDead() || IsPilotDead()) { return; } UpdateSecondaryCamera(); UpdateFriendlyFireDamage(); int updatePlBlock = -1; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("SmallShip_Update_PlayerShip", ref updatePlBlock); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("SmallShip_Update_PlayerShip trade test"); UpdateSubObjectsState(IsCameraInsideMinerShip()); bool cameraAttachedToPlayer = MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip || MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonDynamic || MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonFollowing || MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonStatic; bool canBeDetectorsActive = MyGuiScreenGamePlay.Static.IsGameActive() && (MyFakes.ENABLE_DETECTORS_IN_EDITOR_GAME || ( MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_MMO && MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_STORY && MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_SANDBOX)); // Trade detector if (cameraAttachedToPlayer) { if (TradeDetector.TrySetStatus(true)) TradeDetector.ActivateSensor(); } else { TradeDetector.TrySetStatus(false); } // other detectors if (cameraAttachedToPlayer && canBeDetectorsActive) { if (MyFakes.ENABLE_BUILDER_MODE) { if (BuildDetector.TrySetStatus(true)) BuildDetector.ActivateSensor(); } if (MotherShipDetector.TrySetStatus(true)) MotherShipDetector.ActivateSensor(); if (UseableEntityDetector.TrySetStatus(true)) UseableEntityDetector.ActivateSensor(); } else { BuildDetector.TrySetStatus(false); MotherShipDetector.TrySetStatus(false); UseableEntityDetector.TrySetStatus(false); } //// Detecting nearest friend or neutral ship to trade //if (MyGuiScreenGamePlay.Static.IsGameActive() && // (MyFakes.ENABLE_DETECTORS_IN_EDITOR_GAME || ( // MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_MMO && // MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_STORY && // MyGuiScreenGamePlay.Static.GetPreviousGameType() != MyGuiScreenGamePlayType.EDITOR_SANDBOX)) && // (MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip || // MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonDynamic || // MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonFollowing || // MyGuiScreenGamePlay.Static.CameraAttachedTo == MyCameraAttachedToEnum.PlayerMinerShip_ThirdPersonStatic)) //{ // if (TradeDetector.TrySetStatus(true)) // TradeDetector.ActivateSensor(); // if (BuildDetector.TrySetStatus(true)) // BuildDetector.ActivateSensor(); // if (MotherShipDetector.TrySetStatus(true)) // MotherShipDetector.ActivateSensor(); // if (UseableEntityDetector.TrySetStatus(true)) // UseableEntityDetector.ActivateSensor(); //} //else //{ //} if (m_travelNotification == null && m_nearMotherShipContainer != null && MyGuiScreenGamePlay.Static.CanTravel) { m_travelNotification = DisplayDetectedEntityActionNotification(m_nearMotherShipContainer, MySmallShipInteractionActionEnum.Travel); } else if (m_travelNotification != null && (m_nearMotherShipContainer == null || !MyGuiScreenGamePlay.Static.CanTravel)) { m_travelNotification.Disappear(); m_travelNotification = null; } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("SmallShip_Update_PlayerShip radar"); //if (MyHudConstants.RADAR_DATA_SHARING_WITH_FRIENDLY_RADARS || this == MySession.PlayerShip) //{ // ShipRadar.UdpdateTime(MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS); //} MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("SmallShip_Update_PlayerShip mission or neutral"); if (ToolKits != null) { ToolKits.Update(); } // Detecting nearest mission or neutral ship to trade if (MyMissions.ActiveMission == null) { m_lastMissionProximityCheck += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS; if (m_lastMissionProximityCheck >= MySmallShipConstants.DETECT_INTERVAL) { MyMissions.CheckMissionProximity(); m_lastMissionProximityCheck = 0f; } } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("SmallShip_Update_PlayerShip regen"); // Regen gameplay properties if near friendly Mother Ship if (MyFakes.ENABLE_REFILL_PLAYER_IN_MOTHERSHIP && GetNearMotherShipContainer() != null && MyFactions.GetFactionsRelation(GetNearMotherShipContainer(), this) == MyFactionRelationEnum.Friend) { float regenRate = 1.0f / 5.0f * MyConstants.PHYSICS_STEP_SIZE_IN_SECONDS; Health += MaxHealth * regenRate; ArmorHealth += MaxArmorHealth * regenRate; Oxygen += MaxOxygen * regenRate; Fuel += MaxFuel * regenRate; Health = MathHelper.Clamp(Health, 0, MaxHealth); ArmorHealth = MathHelper.Clamp(ArmorHealth, 0, MaxArmorHealth); Oxygen = MathHelper.Clamp(Oxygen, 0, MaxOxygen); Fuel = MathHelper.Clamp(Fuel, 0, MaxFuel); MySession.Static.Player.AddHealth(MySession.Static.Player.MaxHealth * regenRate, null); } // handle medikit { var medikit = MySession.Static.Player.Medicines[(int)MyMedicineType.MEDIKIT]; // medikit has an effect over time: handle it here if (medikit.WasActiveSinceLastTriggered()) { MySession.Static.Player.AddHealth(medikit.ActiveTimeSinceLastTriggered() * 0.001f * MyMedicineConstants.MEDIKIT_HEALTH_RESTORED_PER_SECOND, null); medikit.Trigger(); } // player low on health: started medikit automatically if (!medikit.IsActive() && MySession.Static.Player.Health <= MyMedicineConstants.MEDIKIT_HEALTH_TO_ACTIVATE) { medikit.ActivateIfInInventory(Inventory); } } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("SmallShip_Update_PlayerShip enemy sounds"); int enemiesDetectedCount = MyHud.GetHudEnemiesCount(MySmallShipConstants.WARNING_ENEMY_ALERT_MAX_DISTANCE_SQR); if (m_enemiesCountDetectedLastUpdate == 0 && enemiesDetectedCount > 0) { MyAudio.AddCue2D(MySoundCuesEnum.HudEnemyAlertWarning); } m_enemiesCountDetectedLastUpdate = enemiesDetectedCount; //if (Fuel <= 0 || !Config.Engine.On) //{ // Config.ReflectorLight.SetValue(false); //} UpdateAfterburner(); if (enemiesDetectedCount > 0) { m_lastEnemyDetection = MyMinerGame.TotalGamePlayTimeInMilliseconds; } if (MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastEnemyDetection < 5000) { MyAudio.ApplyTransition(MyMusicTransitionEnum.LightFight, 2); } else { MyAudio.StopTransition(2); } PlayLowHealthAlertSound(); GlassDirtLevel = MAX_GLASS_DIRT_LEVEL - (MaxHealth > 0f ? ((MAX_GLASS_DIRT_LEVEL - MIN_GLASS_DIRT_LEVEL) * HealthRatio) : 0f); UpdateSectorBoundariesWarning(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(updatePlBlock); }
public static void ShowObjectiveCompleted() { var notification = new MyHudNotification.MyNotification( MyTextsWrapperEnum.NotificationObjectiveComplete, MyHudNotification.GetCurrentScreen(), .85f, MyHudConstants.MISSION_FONT, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 15000); // TODO constant MyHudNotification.AddNotification(notification); }
void BuildDefenses_Loaded(MyMissionBase sender) { m_buildingStopped = false; m_turretsBuilt = 0; m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_1).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_2).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_3).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_4).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_5).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_6).EntityId.Value.NumericValue); m_buildDefenses.MissionEntityIDs.Add(GetTurretFromContainer((uint)EntityID.TURRET_CONTAINER_ID_7).EntityId.Value.NumericValue); foreach (var detectorTurretContainerPair in m_detectorToTurretContainerMapping) { MyScriptWrapper.Highlight(detectorTurretContainerPair.Value, true, this); MyScriptWrapper.EnablePhysics(detectorTurretContainerPair.Value, false); MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity(detectorTurretContainerPair.Value)); ShowContainer(MyScriptWrapper.GetEntity(detectorTurretContainerPair.Value) as MyPrefabContainer); var turret = GetTurretFromContainer(detectorTurretContainerPair.Value); Debug.Assert(turret != null); if (turret != null) { turret.Enabled = false; MyScriptWrapper.MarkEntity(turret, MyTexts.BuildTurret, MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER, MyGuitargetMode.Objective); } } foreach (var dummyId in m_detectorToTurretContainerMapping) { var detector = MyScriptWrapper.GetEntity(dummyId.Key) as MyEntityDetector; //MyScriptWrapper.GetEntity(dummyId.Key); Debug.Assert(detector != null); if (detector != null) { // register for player ship enter detector.OnEntityEnter += TurretDummyEnter; detector.OnEntityLeave += TurretDummyLeave; detector.On(); } } m_canBuildNotification = MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.PressToBuildTurret, MyGuiManager.GetFontMinerWarsBlue()); m_canBuildNotification.SetTextFormatArguments(m_actionKeyString); m_remainingTurretsNotification = MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.RemainingTurrets, MyGuiManager.GetFontMinerWarsBlue()); m_remainingTurretsNotification.IsImportant = true; //m_canSkipNotification = MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.PressToSkipTimer, MyGuiManager.GetFontMinerWarsBlue()); //m_canSkipNotification.SetTextFormatArguments(m_actionKeyString); //m_canSkipNotification.Disappear(); MyScriptWrapper.AddNotification(m_remainingTurretsNotification); MyScriptWrapper.OnUseKeyPress += Build_UseKeyPress; }
private void LearnDronesOnOnMissionLoaded(MyMissionBase sender) { m_learnToUseDrone = MyScriptWrapper.CreateNotification( MyTextsWrapperEnum.HowToControlDrone, MyHudConstants.MISSION_FONT, 0, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_DEPLOY), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_CONTROL) } ); MyScriptWrapper.AddNotification(m_learnToUseDrone); }
public override void LoadData() { MyMwcLog.WriteLine("MyGuiScreenGamePlay.LoadData - START"); MyMwcLog.IncreaseIndent(); m_multipleLoadsCount++; int loadDataBlock = -1; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyGuiScreenGamePlay.LoadData", ref loadDataBlock); MyPerformanceTimer.GuiScreenGamePlay_LoadData.Start(); Static = this; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MySunGlare.UpdateSectorInfo"); MySunGlare.UpdateSectorInfo(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.InitSounds"); InitSounds(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyHudSectorBorder block"); MyHudSectorBorder.LoadData(); MyDistantImpostors.LoadData(); MyLights.LoadData(); MyExplosions.LoadData(); MyProjectiles.LoadData(); MyCockpitGlassDecals.LoadData(); MyModels.LoadData(); if (IsEditorActive()) { MyGuiManager.LoadPrefabPreviews(); } MyTransparentGeometry.LoadData(); MyParticlesDustField.LoadData(); MyHud.LoadData(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyVoxelMaterials block"); MyVoxelMaterials.LoadData(); MyVoxelGenerator.LoadData(); MyDebrisField.LoadData(); MyVoxelContentCellContents.LoadData(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyVoxelCacheData block"); MyVoxelCacheData.LoadData(); MyVoxelCacheCellRenderHelper.LoadData(); MyVoxelCacheRender.LoadData(); MyVoxelPrecalc.LoadData(); MyVoxelMaps.LoadData(); MyWayPointGraph.LoadData(); MyPhysics physics = new MyPhysics(); physics.InitializePhysics(); MyConstants.InitializeCollisionLayers(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyAmmoConstants block"); MyAmmoConstants.LoadData(); MyEntities.LoadData(); MyMissiles.LoadData(); MyHologramShips.LoadData(); MyCannonShots.LoadData(); MyUniversalLauncherShells.LoadData(true); MyExplosionDebrisVoxel.LoadData(); MyExplosionDebrisModel.LoadData(); MyEditor.Static.LoadData(); MyFriendlyFire.Load(); if (MyFakes.ENABLE_SHOUT) { MyShouts.LoadData(); } // load editor controls also when game active, because we can enter editor during gameplay if (IsEditorActive() || IsGameActive()) { EditorControls.LoadData(); //FoundationFactoryControls.LoadData(); } m_invokeGameEditorSwitch = false; m_lastTimeSwitchedDroneControl = MyConstants.FAREST_TIME_IN_PAST; MyPerformanceTimer.GuiScreenGamePlay_LoadData.End(); PartialDustColor = new List<Vector4>(); m_notificationYouHaveToBeNearMothership = new MyHudNotification.MyNotification(MyTextsWrapperEnum.NotificationYouHaveToBeNearMothership, MyGuiManager.GetFontMinerWarsRed(), (int)TimeSpan.FromSeconds(5).TotalMilliseconds); m_notificationUnableToLeaveSectorMission = new MyHudNotification.MyNotification(MyTextsWrapperEnum.UnableToLeaveSectorMission, MyGuiManager.GetFontMinerWarsRed(), (int)TimeSpan.FromSeconds(5).TotalMilliseconds); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(loadDataBlock); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyGuiScreenGamePlay.LoadData - END"); }
void ClearCountdownNotification() { if (m_countdownNotification != null) { m_countdownNotification.Disappear(); m_countdownNotification = null; } }
void OnCountdown(ref MyEventCountdown msg) { ClearCountdownNotification(); if (msg.Timespan.Ticks > 0) { m_countdownNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.Countdown, MyGuiManager.GetFontMinerWarsBlue()); m_countdownNotification.SetTextFormatArguments(new object[] { String.Format("{0:00}", msg.Timespan.Minutes) + ":" + String.Format("{0:00}", msg.Timespan.Seconds) }); MyHudNotification.AddNotification(m_countdownNotification); } }
public MyServerAction SaveLastCheckpoint(bool createChapter = false) { if (MyMultiplayerGameplay.IsRunning && !MyMultiplayerGameplay.Static.IsHost) return null; var lastChapterTime = MyLocalCache.GetLastChapterTimestamp(); var nextChapterTime = lastChapterTime + TimeSpan.FromHours(3); if (MyMissions.ActiveMission == null && DateTime.Now > nextChapterTime) { createChapter = true; } MyMwcSectorIdentifier sectorId = MyGuiScreenGamePlay.Static.GetSectorIdentifier(); if (CanBeSaved(false, sectorId, false)) { var notification = new MyHudNotification.MyNotification(Localization.MyTextsWrapperEnum.SavingSectorToServer, 2500); MyHudNotification.AddNotification(notification); var checkpoint = GetCheckpointBuilder(true); checkpoint.CurrentSector.UserId = MyClientServer.LoggedPlayer.GetUserId(); // Saving players checkpoint if (MySession.PlayerShip != null && checkpoint.PlayerObjectBuilder.ShipObjectBuilder != null) { float refilRatio = 0.5f; var ship = checkpoint.PlayerObjectBuilder.ShipObjectBuilder; ship.ArmorHealth = MathHelper.Clamp(ship.ArmorHealth, refilRatio * MySession.PlayerShip.MaxArmorHealth, MySession.PlayerShip.MaxArmorHealth); ship.ShipHealthRatio = MathHelper.Clamp(ship.ShipHealthRatio, refilRatio, 1.0f); ship.Fuel = MathHelper.Clamp(ship.Fuel, refilRatio * MySession.PlayerShip.MaxFuel, MySession.PlayerShip.MaxFuel); ship.Oxygen = MathHelper.Clamp(ship.Oxygen, refilRatio * MySession.PlayerShip.MaxOxygen, MySession.PlayerShip.MaxOxygen); checkpoint.PlayerObjectBuilder.Health = MathHelper.Clamp(checkpoint.PlayerObjectBuilder.Health, refilRatio * 100, 100); } // Need to store actual checkpoint...because when we travel, we receive only sector, not checkpoint MyGuiScreenGamePlay.Static.AddEnterSectorResponse(checkpoint, null); Debug.Assert(checkpoint.CurrentSector.UserId != null, "Saving last checkpoint as story"); UpdatePlayerStartDummy(checkpoint); MyLocalCache.SaveCheckpoint(checkpoint, createChapter); checkpoint.SectorObjectBuilder = null; // Don't save sector } return null; }
private MyGuiScreenEditorSaveProgress Save(bool saveSector, string checkpointName, bool asTemplate, bool visibleSave, bool pause) { MyMwcSectorIdentifier sectorId = MyGuiScreenGamePlay.Static.GetSectorIdentifier(); bool isEditor = MyGuiScreenGamePlay.Static.IsEditorActive(); if (CanBeSaved(asTemplate, sectorId, isEditor)) { MyMwcObjectBuilder_Checkpoint checkpoint = GetCheckpointBuilder(saveSector); checkpoint.CheckpointName = checkpointName; // Need to store actual checkpoint...because when we travel, we receive only sector, not checkpoint MyGuiScreenGamePlay.Static.AddEnterSectorResponse(checkpoint, null); bool savePlayerShip = MyGuiScreenGamePlay.Static.GetGameType() == MyGuiScreenGamePlayType.EDITOR_STORY ? MyEditor.SavePlayerShip : true; if (savePlayerShip && saveSector) { UpdatePlayerStartDummy(checkpoint); } MyHudNotification.MyNotification notification = null; if (!visibleSave) { notification = new MyHudNotification.MyNotification(Localization.MyTextsWrapperEnum.SavingSectorToServer, 2500); MyHudNotification.AddNotification(notification); } StringBuilder errors = null; if (isEditor) { errors = CheckMissingObject(checkpoint); } MyGuiScreenEditorSaveProgress screen = new MyGuiScreenEditorSaveProgress(sectorId, checkpoint, savePlayerShip, visibleSave, pause); //screen.Closed += new MyGuiScreenBase.ScreenHandler((s) => { if (notification != null) notification.Disappear(); }); CheckErrors(errors, screen); return screen; } return null; }
public override void Load() { MyScriptWrapper.OnBotReachedWaypoint += BotReachedWaypoint; MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned; MyScriptWrapper.EntityDeath += OnEntityDeath; m_actionKeyString[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE); m_canBuildNotification = MyScriptWrapper.CreateNotification( Localization.MyTextsWrapperEnum.PressToBuildTurret, MyGuiManager.GetFontMinerWarsBlue()); m_canBuildNotification.SetTextFormatArguments(m_actionKeyString); m_remainingTurretsNotification = MyScriptWrapper.CreateNotification( Localization.MyTextsWrapperEnum.RemainingTurrets, MyGuiManager.GetFontMinerWarsBlue()); //m_canSkipNotification = MyScriptWrapper.CreateNotification( // Localization.MyTextsWrapperEnum.PressToSkipTimer, // MyGuiManager.GetFontMinerWarsBlue()); //m_canSkipNotification.SetTextFormatArguments(m_actionKeyString); //m_canSkipNotification.Disappear(); m_generatorUnderAttackNotification = MyScriptWrapper.CreateNotification( Localization.MyTextsWrapperEnum.GeneratorUnderAttack, MyGuiManager.GetFontMinerWarsRed(), 3000); m_generatorUnderAttackNotification.Disappear(); m_useProgress = new MyGuiScreenUseProgressBar(MyTextsWrapperEnum.Turrets, MyTextsWrapperEnum.BuildingInProgress,0f, MySoundCuesEnum.SfxProgressBuild, MySoundCuesEnum.SfxCancelBuild, MyGameControlEnums.USE, 0, 3000, 0); m_useProgress.OnCanceled += OnCanceledHandler; m_useProgress.OnSuccess += OnSuccessHandler; SetupMotherships(); SetUpTurrets(); base.Load(); }
private void ProtectBarth_Loaded(MyMissionBase sender) { m_canRepairNotification = MyScriptWrapper.CreateNotification( Localization.MyTextsWrapperEnum.PressToRepairTurret, MyGuiManager.GetFontMinerWarsBlue()); m_canRepairNotification.SetTextFormatArguments(m_actionKeyString); m_repairing = false; ShowContainer(EntityID._05PirateBigShip); ShowContainer(EntityID._05PirateShip); MyScriptWrapper.SetEntityDestructible(MyScriptWrapper.GetEntity("MadelynsBridge"), true); MyScriptWrapper.PrepareMotherShipForMove(m_05PirateShip); MyScriptWrapper.PrepareMotherShipForMove(m_05PirateBigShip); MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity("FrontTurretM"), true); MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity("BackTurretM"), true); MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity("BottomTurretM"), true); ActivateSpawnpoints(m_05SpawnPoints); }
void AddLargeWeaponDetachingNotification() { if (m_detachNotification != null && !m_detachNotification.IsDisappeared()) { return; } object[] args = { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE), "" }; m_detachNotification = new MyHudNotification.MyNotification( MyTextsWrapperEnum.NotificationExitControlled, MyHudNotification.GetCurrentScreen(), 1f, MyHudConstants.NEUTRAL_FONT, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, MyHudNotification.DONT_DISAPEAR, null, false, args); if (!DetachingForbidden) { MyHudNotification.AddNotification(m_detachNotification); } }
public override void Load() { base.Load(); m_entitiesToUse = new List<uint>(); m_entitiesToUse.AddRange(MissionEntityIDs); InitSounds(m_objectiveType); m_totalCount = MissionEntityIDs.Count; m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR,null, new object[] { "" }); m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler); m_startingGeneratorProgressScreen_OnSuccessHandler = new EventHandler(OnSuccessHandler); m_useProgress = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0); m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler; m_useProgress.OnSuccess += m_startingGeneratorProgressScreen_OnSuccessHandler; foreach(var id in MissionEntityIDs) { SetLocationVisibility(true,MyScriptWrapper.GetEntity(id),MyGuitargetMode.Objective); } ReloadAdditionalHubInfo(); }
/// <summary> /// Called automaticaly from CameraAttachedTo setter /// </summary> public void ReleaseControlOfLargeWeapon() { if (ControlledLargeWeapon != null) { if (MyMultiplayerGameplay.IsRunning) { MyMultiplayerGameplay.Static.Lock(ControlledLargeWeapon, false); } if (m_switchControlNotification != null) { m_switchControlNotification.Disappear(); m_switchControlNotification = null; } if (m_detachNotification != null) { m_detachNotification.Disappear(); m_detachNotification = null; } OnControlReleased(ControlledLargeWeapon); CameraAttachedTo = MyCameraAttachedToEnum.PlayerMinerShip; ControlledShip = MySession.PlayerShip; MyAudio.AddCue2D(MySoundCuesEnum.SfxAcquireWeaponOff); MyGuiManager.RemoveRemoteViewWeaponTextures(); } }
public void ReleaseControlOfCamera() { if (ControlledCamera != null && CameraAttachedTo != MyCameraAttachedToEnum.PlayerMinerShip) { if (m_switchControlNotification != null) { m_switchControlNotification.Disappear(); m_switchControlNotification = null; } m_detachNotification.Disappear(); m_detachNotification = null; ControlledCamera.Visible = true; OnControlReleased(ControlledCamera); CameraAttachedTo = MyCameraAttachedToEnum.PlayerMinerShip; MySecondaryCamera.Instance.SetEntityCamera(ControlledCamera); ControlledShip = MySession.PlayerShip; MyAudio.AddCue2D(MySoundCuesEnum.SfxAcquireCameraOff); MyGuiManager.RemoveRemoteViewCameraTextures(); if (m_idleVehicleCue.HasValue && m_idleVehicleCue.Value.IsPlaying) { m_idleVehicleCue.Value.Stop(SharpDX.XACT3.StopFlags.Release); } } }
/// <summary> /// Displays notification /// </summary> /// <param name="entity">Entity</param> /// <param name="action">Action</param> private MyHudNotification.MyNotification DisplayDetectedEntityActionNotification(MyEntity entity, MySmallShipInteractionActionEnum action) { string entityName = entity.DisplayName; //// if we trade throught hangar, we want display prefab container's name, not hangar's name //if (entity is MyPrefabHangar) //{ // entityName = (entity as MyPrefabHangar).GetOwner().DisplayName; //} //else //{ // entityName = entity.DisplayName; //} //get localized entity name entityName = entity.GetCorrectDisplayName(); if (String.IsNullOrWhiteSpace(entityName)) { entityName = MyTextsWrapper.Get(MyTextsWrapperEnum.ThisObject).ToString(); } bool isMissionNotification = MyMissions.IsMissionEntityNotification(entity, action); object[] args = new object[3]; MyTextsWrapperEnum notificationText; MyGuiFont notificationFont; switch (action) { case MySmallShipInteractionActionEnum.TradeForFree: notificationFont = MyHudConstants.FRIEND_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanTradeWith; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY); args[1] = entityName; break; case MySmallShipInteractionActionEnum.TradeForMoney: notificationFont = MyHudConstants.NEUTRAL_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanTradeWith; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY); args[1] = entityName; break; case MySmallShipInteractionActionEnum.Loot: notificationFont = MyHudConstants.ENEMY_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanLoot; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY); args[1] = entityName; break; case MySmallShipInteractionActionEnum.Examine: notificationFont = MyHudConstants.NEUTRAL_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanExamine; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY); args[1] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE); args[2] = entityName; break; case MySmallShipInteractionActionEnum.ExamineEmpty: notificationFont = MyHudConstants.NEUTRAL_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanExamineEmpty; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY); args[1] = entityName; break; case MySmallShipInteractionActionEnum.Blocked: notificationFont = MyHudConstants.ENEMY_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCantExamine; args[0] = entityName; break; case MySmallShipInteractionActionEnum.Build: notificationFont = MyHudConstants.NEUTRAL_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanBuild; break; case MySmallShipInteractionActionEnum.Travel: notificationFont = MyHudConstants.FRIEND_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanTravel; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.TRAVEL); args[1] = entityName; break; case MySmallShipInteractionActionEnum.Use: IMyUseableEntity useableEntity = entity as IMyUseableEntity; Debug.Assert(useableEntity != null); notificationFont = MyHudConstants.FRIEND_FONT; if (useableEntity.UseProperties.UseText != null) { notificationText = useableEntity.UseProperties.UseText.Value; } else { notificationText = MyTextsWrapperEnum.NotificationYouCanUse; } args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE); args[1] = entityName; break; case MySmallShipInteractionActionEnum.Hack: notificationFont = MyHudConstants.NEUTRAL_FONT; notificationText = MyTextsWrapperEnum.NotificationYouCanHack; args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE); args[1] = entityName; break; default: throw new Exception(); } MyHudNotification.MyNotification notification = new MyHudNotification.MyNotification( notificationText, MyHudNotification.GetCurrentScreen(), 1f, isMissionNotification ? MyHudConstants.MISSION_FONT : notificationFont, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyHudNotification.DONT_DISAPEAR, null, false, args); MyHudNotification.AddNotification(notification); return notification; }
public override void Load() { base.Load(); if (m_realMissionEntityId.HasValue) m_realMissionEntity = MyScriptWrapper.TryGetEntity(m_realMissionEntityId.Value); m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" }); m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler); m_startingGeneratorProgressScreen_OnSuccessHandler = new EventHandler(OnSuccessHandler); m_useProgress = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0); m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler; m_useProgress.OnSuccess += m_startingGeneratorProgressScreen_OnSuccessHandler; }
void AddSwitchingNotification() { if (ActiveSecurityHubScreen == null || ActiveSecurityHubScreen.GetNumberOfControllableEntities() < 2) { return; } if (m_switchControlNotification != null) { if (m_switchControlNotification.IsDisappeared()) { m_switchControlNotification.Appear(); } } else { object[] args = { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT) }; m_switchControlNotification = new MyHudNotification.MyNotification( (ControlledEntity == null || ControlledEntity is MyPrefabCamera) ? MyTextsWrapperEnum.SwitchInHUBCameras : MyTextsWrapperEnum.SwitchInHUBTurrets, MyHudNotification.GetCurrentScreen(), 1f, MyHudConstants.FRIEND_FONT, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, MyHudNotification.DONT_DISAPEAR, null, false, args); MyHudNotification.AddNotification(m_switchControlNotification); } }