private void AddStatRowToListbox(MyStatsRow statsRow) { StringBuilder pingText = GetStringBuilderLong(); StringBuilder killsText = GetStringBuilderShort(); StringBuilder deathsText = GetStringBuilderShort(); pingText.Append(statsRow.Ping.HasValue ? statsRow.Ping.Value.ToString() + "ms" : ""); killsText.Append(statsRow.Kills.ToString()); deathsText.Append(statsRow.Deaths.ToString()); Vector4?rowColor = null; if (statsRow.IsFaction) { if (MySession.Static.Player.Faction == statsRow.Faction) { rowColor = new Vector4(0, 1f, 0, 0.07f); } else { rowColor = new Vector4(1f, 0, 0, 0.07f); } } else if (statsRow.Id == (byte)MyClientServer.LoggedPlayer.GetUserId()) { rowColor = new Vector4(1f, 1f, 1f, 0.02f); } int rowIndex = m_statsListbox.AddRow(rowColor); var textColor = Color.White; MyGuiFont textFont; if (MyFactions.GetFactionsRelation(MySession.Static.Player.Faction, statsRow.Faction) == MyFactionRelationEnum.Friend || statsRow.Id == m_playerId) { textFont = MyGuiManager.GetFontMinerWarsGreen(); } else { textFont = MyGuiManager.GetFontMinerWarsRed(); } m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 0, new MyColoredText(statsRow.Name, textColor, textFont, GetRowScale(statsRow)), null, new MyToolTips(statsRow.Name)), rowIndex, 0); m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 1, new MyColoredText(killsText, textColor, textFont, GetRowScale(statsRow)), null, new MyToolTips(killsText)), rowIndex, 1); m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 2, new MyColoredText(deathsText, textColor, textFont, GetRowScale(statsRow)), null, new MyToolTips(deathsText)), rowIndex, 2); m_statsListbox.AddItem(new MyGuiControlListboxItem(rowIndex * 4 + 3, new MyColoredText(pingText, textColor, textFont, GetRowScale(statsRow)), null, new MyToolTips(pingText)), rowIndex, 3); }
private void DestroyGenerator_Loaded(MyMissionBase sender) { MyScriptWrapper.ActivateSpawnPoints(m_wavesApolloSpawns); MyScriptWrapper.ActivateSpawnPoints(m_wavesMarcusSpawns); m_marcus.StopFollow(); m_ravenGuy.StopFollow(); m_marcus.SetWaypointPath("MarcusLeaved"); m_marcus.PatrolMode = MyPatrolMode.ONE_WAY; m_marcus.SeeDistance = 250f; m_marcus.Patrol(); m_ravenGuy.SetWaypointPath("VitolinoLeaved"); m_ravenGuy.SeeDistance = 250f; m_ravenGuy.PatrolMode = MyPatrolMode.ONE_WAY; m_ravenGuy.Patrol(); m_generatorPosition = MyScriptWrapper.GetEntity((uint)EntityID.DestroyGenerator).GetPosition(); MyScriptWrapper.ActivateSpawnPoints(m_barricadeLoomers); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.MarcusAndValentinoLeavingParty, MyGuiManager.GetFontMinerWarsGreen(), 10000)); EveryoneAttackMadelyn(); }
private void MyScriptWrapperOnFadedOut() { MyScriptWrapper.FadedOut -= MyScriptWrapperOnFadedOut; MyScriptWrapper.FadeIn(); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT) } )); MyScriptWrapper.TakeControlOfLargeWeapon(m_madelynTurrets[m_activeTurret]); MyScriptWrapper.ForbideDetaching(); MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious; MyScriptWrapper.SwitchTowerNext += MyScriptWrapper_SwitchTowerNext; }
public override void Load() { if (!IsMainSector) { return; } RemoveFriends(); MyScriptWrapper.DisableAllGlobalEvents(); m_attackerBots.Clear(); m_detectorFirst = MyScriptWrapper.GetDetector((uint)EntityID.DetectorFirst); m_detectorSecond = MyScriptWrapper.GetDetector((uint)EntityID.DetectorSecond); m_detectorThird = MyScriptWrapper.GetDetector((uint)EntityID.DetectorThird); m_detectorFirst.SetSensorDetectRigidBodyTypes(null); m_detectorSecond.SetSensorDetectRigidBodyTypes(null); m_detectorThird.SetSensorDetectRigidBodyTypes(null); m_madelyn = MyScriptWrapper.GetEntity("Madelyn"); //Because she was hidden in previous mission MyScriptWrapper.UnhideEntity(m_madelyn); m_transporter = MyScriptWrapper.GetEntity((uint)EntityID.Transporter); m_transporter.OnContactEvent += new Action <MyEntity>(m_transporter_OnContactEvent); m_reassignBotTargets = false; m_motherShipSpeed = MOTHERSHIP_FULLSPEED; MyScriptWrapper.PrepareMotherShipForMove(m_transporter); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000, new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT) } )); foreach (var item in m_spawnCompanions) { MyScriptWrapper.ActivateSpawnPoint(item); } var pos = MySession.PlayerShip.WorldMatrix.Translation; MySession.PlayerShip.WorldMatrix = m_transporter.WorldMatrix; Vector3 playerPos = m_transporter.WorldMatrix.Translation - 400 * m_transporter.WorldMatrix.Forward; MyScriptWrapper.Move(MySession.PlayerShip, playerPos); //MyScriptWrapper.EnablePhysics(MySession.PlayerShip.EntityId.Value.NumericValue, false); MyScriptWrapper.HideEntity(MySession.PlayerShip); m_towers[0] = MyScriptWrapper.GetEntity((uint)EntityID.Tower1); m_towers[1] = MyScriptWrapper.GetEntity((uint)EntityID.Tower2); m_towers[2] = MyScriptWrapper.GetEntity((uint)EntityID.Tower3); MyScriptWrapper.SetEntityPriority(m_towers[0], -1); MyScriptWrapper.SetEntityPriority(m_towers[1], -1); MyScriptWrapper.SetEntityPriority(m_towers[2], -1); MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.TowerDown), -1); MyScriptWrapper.TakeControlOfLargeWeapon(m_towers[m_activeTower]); MyScriptWrapper.ForbideDetaching(); MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Mystery); MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious; MyScriptWrapper.SwitchTowerNext += MyScriptWrapper_SwitchTowerNext; MyScriptWrapper.EntityDeath += MyScriptWrapper_OnEntityDeath; MyScriptWrapper.OnSpawnpointBotSpawned += BotSpawned; m_objective01_flyTowardsMadelyn.OnMissionLoaded += O01FlyTowardsMadelynLoaded; m_objective01_flyTowardsMadelyn.OnMissionSuccess += O01FlyTowardsMadelynSuccess; m_madelynDestinationReached = false; m_transporterDestinationReached = false; m_moveMadelynFlag = false; m_towersCount = 3; m_activeTower = 0; m_switchCounter = 0; MyScriptWrapper.DrawHealthOfCustomPrefabInLargeWeapon(MyScriptWrapper.GetEntity((uint)EntityID.TransporterShip)); MyScriptWrapper.DisableShipBackCamera(); m_detectorFirst.OnEntityEnter += DetectorActionFirst; m_detectorFirst.On(); MyScriptWrapper.OnDialogueFinished += MyScriptWrapper_OnDialogueFinished; base.Load(); }
void O10FindBombDealerLoaded(MyMissionBase sender) { m_manjeet.LookTarget = null; MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Special, 1, "MM01"); MyScriptWrapper.SetSleepDistance(m_marcus, 5000); MyScriptWrapper.StopFollow(m_marcus); m_marcus.SetWaypointPath("MarcusOut"); m_marcus.SpeedModifier = 2.0f; MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.MarcusIsLeavingForTarja, MyGuiManager.GetFontMinerWarsGreen(), 5000)); m_marcus.PatrolMode = MyPatrolMode.ONE_WAY; m_marcus.Patrol(); m_valentin = (MySmallShipBot)MyScriptWrapper.GetEntity("RavenGuy"); m_valentin.LeaderLostEnabled = true; MyScriptWrapper.MarkEntity(m_valentin, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.VALENTIN)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend); MyScriptWrapper.StopFollow(m_valentin); MyEntity valentinPosition = MyScriptWrapper.GetEntity((uint)EntityID.ValentinBRPosition); m_valentin.SetWorldMatrix(valentinPosition.WorldMatrix); m_tarja.LeaderLostEnabled = true; MyScriptWrapper.StopFollow(m_tarja); MyScriptWrapper.MarkEntity(m_tarja, MyTextsWrapper.Get(MyActorConstants.GetActorDisplayName(MyActorEnum.TARJA)).ToString(), HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS, HUD.MyGuitargetMode.Friend); MyEntity tarjaPosition = MyScriptWrapper.GetEntity((uint)EntityID.TarjaBRPosition); m_tarja.SetWorldMatrix(tarjaPosition.WorldMatrix); MyScriptWrapper.SetEntityDisplayName(m_tarja, MyTextsWrapper.Get(MyTextsWrapperEnum.Actor_Tarja).ToString()); MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.BombDealer)); }
public void UseFromHackingTool(MySmallShip useBy, int hackingLevelDifference) { float cashMoveToPlayer = Cash * (0.5f + hackingLevelDifference * 0.1f); MySession.Static.Player.Money += cashMoveToPlayer; Cash -= cashMoveToPlayer; MyHudNotification.AddNotification( new MyHudNotification.MyNotification(MyTextsWrapperEnum.YouObtainNotification, MyGuiManager.GetFontMinerWarsGreen(), 5000, null, new object[] { MyMwcUtils.GetFormatedPriceForGame((decimal)cashMoveToPlayer) })); }
void LootSucces(MyMissionBase sender) { MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Loot_Spawn); MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.TarjaAndValentinStaying, MyGuiManager.GetFontMinerWarsGreen(), 5000)); }
Draw() { if (!Visible || MySession.PlayerShip == null) { return; } MySession.PlayerShip.Config.Items(ref m_displayedItems); MyGuiManager.BeginSpriteBatch(); var offset = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0); //Draw background MyGuiManager.DrawSpriteBatch(m_backgroundtexture, new Vector2(0.5f, 0.5f) + offset, m_size.Value, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); //Draw items for (int i = 0, j = 0; i < m_displayedItems.Length; i++) { if (m_displayedItems[i] == null) { continue; } if (m_selected == i) { var pos = new Vector2(0.5f, m_position.Y - (ITEM_HEIGHT * m_displayedItems.Length / 2) + (ITEM_HEIGHT * j) - 0.003f); MyGuiManager.DrawSpriteBatch(m_smallBgHover, pos + offset, itemSize, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); } //Draw item name var nameWithKey = new StringBuilder().Append(m_displayedItems[i].Name); MyGameControlEnums?control = m_displayedItems[i].AssociatedControl; if (control != null) { string key = MyGuiManager.GetInput().GetGameControlTextEnum(control.Value); if (key != MyTextsWrapper.Get(MyTextsWrapperEnum.UnknownControl).ToString()) { nameWithKey.Append(" (").Append(key).Append(")"); } } MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), nameWithKey, new Vector2(m_position.X - (TOTAL_WIDTH / 2) - 0.02f, m_position.Y - (ITEM_HEIGHT * m_displayedItems.Length / 2) + (ITEM_HEIGHT * j)) + offset, TEXT_SCALE, Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); //Draw item value bg var smallBgSize = MyGuiManager.GetNormalizedSizeFromScreenSize(MyGuiManager.GetFontMinerWarsGreen().MeasureString(m_displayedItems[i].CurrentValueText, TEXT_SCALE)); if (smallBgSize.LengthSquared() > 0.00f) { var bgPos = new Vector2(m_position.X + (TOTAL_WIDTH / 2) - SLIDER_WIDTH + 0.01f - smallBgSize.X / 2, m_position.Y - (ITEM_HEIGHT * m_displayedItems.Length / 2) + (ITEM_HEIGHT * j) - 0.003f); smallBgSize.Y = itemSize.Y; smallBgSize.X *= 1.6f; MyGuiManager.DrawSpriteBatch(m_smallBgHover, bgPos + offset, smallBgSize, new Color(255, 255, 255, 200), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); } //draw item MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsGreen(), m_displayedItems[i].CurrentValueText, new Vector2(m_position.X + (TOTAL_WIDTH / 2) - SLIDER_WIDTH + 0.01f, m_position.Y - (ITEM_HEIGHT * m_displayedItems.Length / 2) + (ITEM_HEIGHT * j)) + offset, TEXT_SCALE, Color.White, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); j++; } /* * //Draw top button * if (IsUpButtonVisible) * { * MyGuiManager.DrawSpriteBatch(MyGuiManager.GetConfigWheelArrowTextureUp(), * new Vector2(m_position.X - (TOTAL_WIDTH / 2), m_position.Y - (ITEM_HEIGHT * ITEM_COUNT / 2) - BUTTON_HEIGHT - BUTTON_VERTICAL_DIFF) + offset, * new Vector2(TOTAL_WIDTH, BUTTON_HEIGHT), Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); * } * * */ //Draw bottom button //if (IsDownButtonVisible) //{ // MyGuiManager.DrawSpriteBatch(MyGuiManager.GetConfigWheelArrowTextureDown(), // new Vector2(m_position.X - (TOTAL_WIDTH / 2), m_position.Y + (ITEM_HEIGHT * m_displayedItems.Length / 2) + BUTTON_VERTICAL_DIFF) + offset, // new Vector2(TOTAL_WIDTH, BUTTON_HEIGHT), Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); //} //Draw scrollbar //if (IsScrollBarVisible) //{ // MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), // new Vector2(m_position.X + (TOTAL_WIDTH / 2) - SLIDER_WIDTH, m_position.Y - (ITEM_HEIGHT * m_displayedItems.Length / 2)) + offset, // new Vector2(SLIDER_WIDTH, m_displayedItems.Length * ITEM_HEIGHT), new Color(Color.RoyalBlue.R, Color.RoyalBlue.G, Color.RoyalBlue.B, (byte)(255 * 0.3f)), // MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); // MyGuiManager.DrawSpriteBatch(MyGuiManager.GetScrollbarSlider(), // SliderNormalizedCoord, SliderNormalizedSize, Color.White, // MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); //} MyGuiManager.EndSpriteBatch(); }