private void AddSelectedShipUI(object sender, EventArgs e) { PlayerShip playerShip = sender as PlayerShip; FlashingInGameImage selectedShipUI = InGameUIManager.GetObject <FlashingInGameImage>("Selected Player Ship UI"); if (selectedShipUI == null) { InGameUIManager.AddObject(new FlashingInGameImage(Vector2.Zero, playerShip.Size, "Sprites\\UI\\Markers\\SelectedShipMarker", playerShip), "Selected Player Ship UI", true); } else if (selectedShipUI.Parent != playerShip) { selectedShipUI.Parent = playerShip; selectedShipUI.Size = playerShip.Size; selectedShipUI.Visible = true; } InGameShipInfo inGameShipInfo = UIManager.GetObject <InGameShipInfo>("Selected Player Ship Info UI"); if (inGameShipInfo == null) { InGameShipInfo shipInfo = new InGameShipInfo(playerShip, new Vector2(Viewport.Width - 150, ScreenCentre.Y), new Vector2(300, Viewport.Height), "Sprites\\UI\\Menus\\default", UnderSiegeGameplayScreen.SceneRoot); UIManager.AddObject(shipInfo, "Selected Player Ship Info UI", true); } else if (inGameShipInfo.PlayerShip != playerShip) { // This will automatically rebuild the UI - see the class inGameShipInfo.PlayerShip = playerShip; } }
private void RemoveSelectedShipUI(object sender, EventArgs e) { PlayerShip playerShip = sender as PlayerShip; FlashingInGameImage selectedShipUI = InGameUIManager.GetObject <FlashingInGameImage>("Selected Player Ship UI"); if (selectedShipUI != null && selectedShipUI.Parent == playerShip) { selectedShipUI.Visible = false; selectedShipUI.Parent = null; } InGameShipInfo inGameShipInfo = UIManager.GetObject <InGameShipInfo>("Selected Player Ship Info UI"); if (inGameShipInfo != null && inGameShipInfo.PlayerShip == playerShip) { // This will automatically hide the UI - see the class inGameShipInfo.PlayerShip = null; } }
private void CheckTurretSelected(object sender, EventArgs e) { Script script = sender as Script; script.Done = InGameUIManager.GetObject <PurchaseItemUI>("Purchase Object UI") != null; }