Example #1
0
        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;
            }
        }
Example #2
0
 public void AddInGameUIObject(InGameUIObject inGameUIobject, string tag, bool load = true, bool linkWithInGameUIManager = true)
 {
     InGameUIManager.AddObject(inGameUIobject, tag, load, linkWithInGameUIManager);
 }