private void initPageButtons() { var btnLeft = new ImageButton(); btnLeft.Image = Root.Singleton.Material("img/customizeUI/button_arrow_on.png"); btnLeft.HoveredImage = Root.Singleton.Material("img/customizeUI/button_arrow_select2.png"); btnLeft.DisabledImage = Root.Singleton.Material("img/customizeUI/button_arrow_off.png"); btnLeft.Enabled = true; btnLeft.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnLeft.OnClick += (sender) => { Page--; }; Util.LayoutControl(btnLeft, 125, 12, 32, 28, ScreenRectangle); btnLeft.Parent = Window; btnLeft.Init(); var btnRight = new ImageButton(); btnRight.Image = Root.Singleton.Material("img/customizeUI/button_arrow_on.png"); btnRight.HoveredImage = Root.Singleton.Material("img/customizeUI/button_arrow_select2.png"); btnRight.DisabledImage = Root.Singleton.Material("img/customizeUI/button_arrow_off.png"); btnRight.Enabled = true; btnRight.FlipH = true; btnRight.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnRight.OnClick += (sender) => { Page++; }; Util.LayoutControl(btnRight, 463, 12, 32, 28, ScreenRectangle); btnRight.Parent = Window; btnRight.Init(); }
public override void OnActivate(params object[] args) { if (args.Length >= 1 && args[0] is Sector) { Sector = (Sector)args[0]; } else { Sector = new Sector(); } BackgroundImage = getBackgroundTexture(); base.OnActivate(); Util.LayoutControl(Window, (1280 - 540) / 2, (720 - 420) / 2, Window.Image.Size, ScreenRectangle); foreach (var b in Sector.Beacons) { var btn = new BeaconIcon(); btn.Image = Root.Singleton.Material(b.Icon); btn.ShadowImage = Root.Singleton.Material(b.IconShadow); Util.LayoutControl(btn, b.X - 16, b.Y - 16, 32, 32, ScreenRectangle); btn.Parent = Window; btn.Init(); } var btnClose = new ImageButton(); btnClose.Image = Root.Singleton.Material("img/generalUI/general_close.png"); btnClose.HoveredImage = Root.Singleton.Material("img/generalUI/general_close3.png"); btnClose.DisabledImage = Root.Singleton.Material("img/generalUI/general_close4.png"); btnClose.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnClose.OnClick += (sender) => { Finish = true; }; Util.LayoutControl(btnClose, 504, 0, 64, 64, ScreenRectangle); btnClose.Parent = Window; btnClose.Init(); }
void InitStartButton() { var btnStart = new ImageButton(); btnStart.Image = Root.Singleton.Material("img/customizeUI/button_start_on.png"); btnStart.HoveredImage = Root.Singleton.Material("img/customizeUI/button_start_select2.png"); btnStart.DisabledImage = Root.Singleton.Material("img/customizeUI/button_start_off.png"); btnStart.Enabled = true; btnStart.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnStart.OnClick += sender => { var generators = Root.Singleton.mgrState.Get<Library>().GetSectorMapGenerators(); Root.Singleton.mgrState.Get<SectorMapScreen>().Map = generators[0].Generate(); Root.Singleton.mgrState.Activate<SectorMapScreen>(); }; Util.LayoutControl(btnStart, 1082, 16, 152, 48, rctScreen); btnStart.Parent = Root.Singleton.Canvas; btnStart.Init(); }
void InitShowRoomsButton() { var btnHideRooms = new ImageButton(); btnHideRooms.Image = Root.Singleton.Material("img/customizeUI/button_hide_on.png"); btnHideRooms.HoveredImage = Root.Singleton.Material("img/customizeUI/button_hide_select2.png"); btnHideRooms.DisabledImage = Root.Singleton.Material("img/customizeUI/button_hide_off.png"); btnHideRooms.Enabled = true; btnHideRooms.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnHideRooms.OnClick += sender => { if (!shipRenderer.ShowRooms) { btnHideRooms.Image = Root.Singleton.Material("img/customizeUI/button_hide_on.png"); btnHideRooms.HoveredImage = Root.Singleton.Material("img/customizeUI/button_hide_select2.png"); btnHideRooms.DisabledImage = Root.Singleton.Material("img/customizeUI/button_hide_off.png"); shipRenderer.ShowRooms = true; } else { btnHideRooms.Image = Root.Singleton.Material("img/customizeUI/button_show_on.png"); btnHideRooms.HoveredImage = Root.Singleton.Material("img/customizeUI/button_show_select2.png"); btnHideRooms.DisabledImage = Root.Singleton.Material("img/customizeUI/button_show_off.png"); shipRenderer.ShowRooms = false; } btnHideRooms.UpdateImage(); }; Util.LayoutControl(btnHideRooms, 23, 301, 150, 28, rctScreen); btnHideRooms.Parent = Root.Singleton.Canvas; btnHideRooms.Init(); }
void InitShipsRightButton() { var btnShipRight = new ImageButton(); btnShipRight.Image = Root.Singleton.Material("img/customizeUI/button_arrow_on.png"); btnShipRight.HoveredImage = Root.Singleton.Material("img/customizeUI/button_arrow_select2.png"); btnShipRight.DisabledImage = Root.Singleton.Material("img/customizeUI/button_arrow_off.png"); btnShipRight.Enabled = true; btnShipRight.FlipH = true; btnShipRight.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnShipRight.OnClick += (sender) => { var shiplist = Root.Singleton.mgrState.Get<Library>().GetPlayerShipGenerators(); int idx = shiplist.IndexOf(currentShipGen); do { idx++; if (idx >= shiplist.Count) idx = 0; } while (!shiplist[idx].Unlocked); SetShipGenerator(shiplist[idx]); }; Util.LayoutControl(btnShipRight, 128, 194, 32, 28, rctScreen); btnShipRight.Parent = Root.Singleton.Canvas; btnShipRight.Init(); }
void InitShipRenameButton() { var btnRenameShip = new ImageButton(); btnRenameShip.Image = Root.Singleton.Material("img/customizeUI/button_name_on.png"); btnRenameShip.HoveredImage = Root.Singleton.Material("img/customizeUI/button_name_select2.png"); btnRenameShip.DisabledImage = Root.Singleton.Material("img/customizeUI/button_name_off.png"); btnRenameShip.Enabled = true; btnRenameShip.OnClick += sender => { tbShipName.EditMode = true; Root.Singleton.Canvas.Focus = tbShipName; }; btnRenameShip.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnRenameShip, 8, 8, 95, 33, rctScreen); btnRenameShip.Parent = pnRename; btnRenameShip.Init(); }
void InitListShipsButton() { var btnListShips = new ImageButton(); btnListShips.Image = Root.Singleton.Material("img/customizeUI/button_list_on.png"); btnListShips.HoveredImage = Root.Singleton.Material("img/customizeUI/button_list_select2.png"); btnListShips.DisabledImage = Root.Singleton.Material("img/customizeUI/button_list_off.png"); btnListShips.Enabled = true; btnListShips.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnListShips, 64, 194, 62, 28, rctScreen); btnListShips.Parent = Root.Singleton.Canvas; btnListShips.Init(); btnListShips.OnClick += sender => { Root.Singleton.mgrState.Activate<ShipSelection>(); }; }
public void SetShipGenerator(Library.ShipGenerator gen) { if (lstSystems != null) { foreach (var system in lstSystems) system.Remove(); lstSystems.Clear(); lstSystems = null; } // Set current ship currentShipGen = gen; currentShip = gen.Generate(); // Update ship renderer shipRenderer.Ship = currentShip; // Create new UI tbShipName.Text = currentShip.Name; lstSystems = new List<ImageButton>(); var systems = currentShip.Systems; for (int i = 0; i < systems.Count; i++) { var system = systems[i]; var btnSystem = new ImageButton(); btnSystem.Image = Root.Singleton.Material("img/customizeUI/box_system_on.png"); btnSystem.HoveredImage = Root.Singleton.Material("img/customizeUI/box_system_select2.png"); btnSystem.DisabledImage = Root.Singleton.Material("img/customizeUI/box_system_off.png"); btnSystem.Enabled = true; //btnSystem.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnSystem, 370 + (i * 38), 380, 38, 96, rctScreen); btnSystem.Parent = Root.Singleton.Canvas; btnSystem.Init(); var systembox = new SystemBox(); systembox.SystemIcon = Root.Singleton.Material(system.IconGraphics["green"]); systembox.PowerLevel = system.MinPower; systembox.Width = btnSystem.Width - 2; systembox.Height = btnSystem.Height - 2; systembox.Parent = btnSystem; systembox.Init(); lstSystems.Add(btnSystem); } }
void InitShipRename() { pnRename = new ImagePanel(); pnRename.Image = Root.Singleton.Material("img/customizeUI/box_shipname.png"); Util.LayoutControl(pnRename, 10, 10, pnRename.Image.Size, rctScreen); pnRename.Parent = Root.Singleton.Canvas; pnRename.Init(); var btnRenameShip = new ImageButton(); btnRenameShip.Image = Root.Singleton.Material("img/customizeUI/button_name_on.png"); btnRenameShip.HoveredImage = Root.Singleton.Material("img/customizeUI/button_name_select2.png"); btnRenameShip.DisabledImage = Root.Singleton.Material("img/customizeUI/button_name_off.png"); btnRenameShip.Enabled = true; btnRenameShip.OnClick += sender => { tbShipName.EditMode = true; Root.Singleton.Canvas.Focus = tbShipName; }; btnRenameShip.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnRenameShip, 8, 9, btnRenameShip.Image.Size, rctScreen); btnRenameShip.Parent = pnRename; btnRenameShip.Init(); tbShipName = new TextEntry(); tbShipName.Centered = true; tbShipName.AutoScale = false; tbShipName.Font = Root.Singleton.Font("fonts/num_font.ttf"); tbShipName.Text = "test"; Util.LayoutControl(tbShipName, 115, 4, 320, 33, rctScreen); tbShipName.Parent = pnRename; tbShipName.Init(); }
void InitAugmentButtons() { var btnAug1 = new ImageButton(); btnAug1.Image = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_on.png"); btnAug1.HoveredImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_selected.png"); btnAug1.DisabledImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_off.png"); btnAug1.Enabled = false; btnAug1.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnAug1, 990, 525, btnAug1.Image.Size, rctScreen); btnAug1.Parent = Root.Singleton.Canvas; btnAug1.Init(); var btnAug2 = new ImageButton(); btnAug2.Image = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_on.png"); btnAug2.HoveredImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_selected.png"); btnAug2.DisabledImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_off.png"); btnAug2.Enabled = false; btnAug2.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnAug2, 990, 587, btnAug2.Image.Size, rctScreen); btnAug2.Parent = Root.Singleton.Canvas; btnAug2.Init(); var btnAug3 = new ImageButton(); btnAug3.Image = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_on.png"); btnAug3.HoveredImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_selected.png"); btnAug3.DisabledImage = Root.Singleton.Material("img/upgradeUI/Equipment/box_augment_off.png"); btnAug3.Enabled = false; btnAug3.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); Util.LayoutControl(btnAug3, 990, 650, btnAug3.Image.Size, rctScreen); btnAug3.Parent = Root.Singleton.Canvas; btnAug3.Init(); //TODO: Scan the Lua for starting augments and display them }
public void OnActivate() { // Store window window = Root.Singleton.Window; rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f); // Load sprites sprBackground = new Sprite(Root.Singleton.Material("img/main_menus/main_base2.png")); sprBackground.Position = new Vector2f(rctScreen.Left, rctScreen.Top); sprBackground.Scale = Util.Scale(sprBackground, new Vector2f(rctScreen.Width, rctScreen.Height)); // Load audio mscMenu = Root.Singleton.Music("audio/music/bp_MUS_TitleScreen.ogg"); sndButtonHover = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); //mscMenu.Stop(); //mscMenu.Play(); // Load UI var btnContinue = new ImageButton(); btnContinue.Image = Root.Singleton.Material("img/main_menus/continue_on.png"); btnContinue.HoveredImage = Root.Singleton.Material("img/main_menus/continue_select2.png"); btnContinue.DisabledImage = Root.Singleton.Material("img/main_menus/continue_off.png"); btnContinue.Enabled = false; btnContinue.HoverSound = sndButtonHover; Util.LayoutControl(btnContinue, (int)(1200 - btnContinue.Image.Size.X), 260, (int)btnContinue.Image.Size.X, (int)btnContinue.Image.Size.Y, rctScreen); btnContinue.Parent = Root.Singleton.Canvas; btnContinue.Init(); var btnNewGame = new ImageButton(); btnNewGame.Image = Root.Singleton.Material("img/main_menus/start_on.png"); btnNewGame.HoveredImage = Root.Singleton.Material("img/main_menus/start_select2.png"); btnNewGame.DisabledImage = Root.Singleton.Material("img/main_menus/start_off.png"); btnNewGame.Enabled = true; btnNewGame.HoverSound = sndButtonHover; btnNewGame.OnClick += (sender) => { Root.Singleton.mgrState.FSMTransist<NewGame>(); }; Util.LayoutControl(btnNewGame, (int)(1200 - btnNewGame.Image.Size.X), 320, (int)btnNewGame.Image.Size.X, (int)btnNewGame.Image.Size.Y, rctScreen); btnNewGame.Parent = Root.Singleton.Canvas; btnNewGame.Init(); var btnTutorial = new ImageButton(); btnTutorial.Image = Root.Singleton.Material("img/main_menus/tutorial_on.png"); btnTutorial.HoveredImage = Root.Singleton.Material("img/main_menus/tutorial_select2.png"); btnTutorial.DisabledImage = Root.Singleton.Material("img/main_menus/tutorial_off.png"); btnTutorial.Enabled = false; btnTutorial.HoverSound = sndButtonHover; Util.LayoutControl(btnTutorial, (int)(1200 - btnTutorial.Image.Size.X), 380, (int)btnTutorial.Image.Size.X, (int)btnTutorial.Image.Size.Y, rctScreen); btnTutorial.Parent = Root.Singleton.Canvas; btnTutorial.Init(); var btnStats = new ImageButton(); btnStats.Image = Root.Singleton.Material("img/main_menus/stats_on.png"); btnStats.HoveredImage = Root.Singleton.Material("img/main_menus/stats_select2.png"); btnStats.DisabledImage = Root.Singleton.Material("img/main_menus/stats_off.png"); btnStats.Enabled = false; btnStats.HoverSound = sndButtonHover; Util.LayoutControl(btnStats, (int)(1200 - btnStats.Image.Size.X), 440, (int)btnStats.Image.Size.X, (int)btnStats.Image.Size.Y, rctScreen); btnStats.Parent = Root.Singleton.Canvas; btnStats.Init(); var btnOptions = new ImageButton(); btnOptions.Image = Root.Singleton.Material("img/main_menus/options_on.png"); btnOptions.HoveredImage = Root.Singleton.Material("img/main_menus/options_select2.png"); btnOptions.DisabledImage = Root.Singleton.Material("img/main_menus/options_off.png"); btnOptions.Enabled = true; btnOptions.HoverSound = sndButtonHover; btnOptions.OnClick += (sender) => { Root.Singleton.mgrState.Activate<Gamestate.OptionsMenu>(); }; Util.LayoutControl(btnOptions, (int)(1200 - btnOptions.Image.Size.X), 500, (int)btnOptions.Image.Size.X, (int)btnOptions.Image.Size.Y, rctScreen); btnOptions.Parent = Root.Singleton.Canvas; btnOptions.Init(); var btnCredits = new ImageButton(); btnCredits.Image = Root.Singleton.Material("img/main_menus/credits_on.png"); btnCredits.HoveredImage = Root.Singleton.Material("img/main_menus/credits_select2.png"); btnCredits.DisabledImage = Root.Singleton.Material("img/main_menus/credits_off.png"); btnCredits.Enabled = false; btnCredits.HoverSound = sndButtonHover; Util.LayoutControl(btnCredits, (int)(1200 - btnCredits.Image.Size.X), 560, (int)btnCredits.Image.Size.X, (int)btnCredits.Image.Size.Y, rctScreen); btnCredits.Parent = Root.Singleton.Canvas; btnCredits.Init(); var btnQuit = new ImageButton(); btnQuit.Image = Root.Singleton.Material("img/main_menus/quit_on.png"); btnQuit.HoveredImage = Root.Singleton.Material("img/main_menus/quit_select2.png"); btnQuit.DisabledImage = Root.Singleton.Material("img/main_menus/quit_off.png"); btnQuit.Enabled = true; btnQuit.HoverSound = sndButtonHover; btnQuit.OnClick += (sender) => { Root.Singleton.Exiting = true; }; Util.LayoutControl(btnQuit, (int)(1200 - btnQuit.Image.Size.X), 620, (int)btnQuit.Image.Size.X, (int)btnQuit.Image.Size.Y, rctScreen); btnQuit.Parent = Root.Singleton.Canvas; btnQuit.Init(); }
private void InitStartButton() { var btnStart = new ImageButton(); btnStart.Image = Root.Singleton.Material("img/customizeUI/button_start_on.png"); btnStart.HoveredImage = Root.Singleton.Material("img/customizeUI/button_start_select2.png"); btnStart.DisabledImage = Root.Singleton.Material("img/customizeUI/button_start_off.png"); btnStart.Enabled = true; btnStart.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav"); btnStart.OnClick += sender => { var generators = Root.Singleton.mgrState.Get<Library>().GetSectorMapGenerators(); // TODO allow player to chose which generator to use Root.Singleton.mgrState.FSMTransist<CombatScreen>(generators[0].Generate().CurrentNode.Sector, currentShip); }; Util.LayoutControl(btnStart, 1082, 16, btnStart.Image.Size, rctScreen); btnStart.Parent = Root.Singleton.Canvas; btnStart.Init(); }
private void UpdateJumpButton() { if (pnJump == null) pnJump = new ImagePanel(); pnJump.Remove(); pnJump.Image = Root.Singleton.Material("img/buttons/FTL/FTL_base.png"); Util.LayoutControl(pnJump, 522, 10, pnJump.Image.Size, rctScreen); pnJump.Parent = Root.Singleton.Canvas; pnJump.Init(); var btnJump = new ImageButton(); // TODO make it yellow btnJump.Image = Root.Singleton.Material("img/buttons/FTL/FTL_JUMP.png"); btnJump.HoveredImage = Root.Singleton.Material("img/buttons/FTL/FTL_JUMP_yellow.png"); btnJump.DisabledImage = Root.Singleton.Material("img/buttons/FTL/FTL_JUMP_off.png"); btnJump.OnClick += (sender) => { Root.Singleton.mgrState.Activate<SectorScreen>(Sector); }; Util.LayoutControl(btnJump, 0, 0, btnJump.Image.Size, rctScreen); btnJump.Parent = pnJump; btnJump.Init(); var pnReady = new ReadyPanel(); pnReady.Image = Root.Singleton.Material("img/buttons/FTL/FTL_READY.png"); Util.LayoutControl(pnReady, 0, 0, pnJump.Image.Size, rctScreen); pnReady.Parent = pnJump; pnReady.Init(); }