예제 #1
0
        public override void Init()
        {
            base.Init();

            icon = new ImagePanel();
            icon.Image = SystemIcon;
            icon.Parent = this;
            icon.ImageScale = 1.9f;
            icon.Init();

            RebuildBars();

            UpdateLayout();
        }
예제 #2
0
        public override void Init()
        {
            base.Init();

            icon            = new ImagePanel();
            icon.Image      = SystemIcon;
            icon.Parent     = this;
            icon.ImageScale = 1.9f;
            icon.Init();

            RebuildBars();

            UpdateLayout();
        }
예제 #3
0
        public void OnActivate()
        {
            // Store window
            window = Root.Singleton.Window;
            rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            finishnow = false;
            window.KeyPressed += window_KeyPressed;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/box_text_sectors.png");
            Util.LayoutControl(pnWindow, (int)(1280 - pnWindow.Image.Size.X) / 2,
                                         (int)(720 - pnWindow.Image.Size.Y) / 2,
                                         (int)pnWindow.Image.Size.X,
                                         (int)pnWindow.Image.Size.Y,
                                         rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            var lblTitle = new Label();
            lblTitle.X = 25;
            lblTitle.Y = 40;
            lblTitle.Text = "Choose the next sector:";
            lblTitle.Font = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.AutoScale = false;
            lblTitle.Scale = 0.475f;
            lblTitle.Parent = pnWindow;
            lblTitle.Init();

            var nodes = Map.CurrentNode.NextNodes;
            for (int i = 0; i < nodes.Count; i++) {
                var node = nodes[i];
                AddButton(80 + i * 25, "" + (i + 1) + ". " + node.Sector.Name);
            }

            var map = new SectorMapPanel(Map);
            Util.LayoutControl(map, 28, 210, 558, 148, rctScreen);
            map.Parent = pnWindow;
            map.Init();

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }
예제 #4
0
        public void OnActivate()
        {
            // Store window
            window = Root.Singleton.Window;
            rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            finishnow = false;
            window.KeyPressed += window_KeyPressed;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/customizeUI/ship_list_main.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (647 / 2), (720 / 2) - (465 / 2), 647, 465, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            int shipX = 0;
            int shipY = 0;
            foreach (var gen in Root.Singleton.mgrState.Get<Library>().GetPlayerShipGenerators())
            {
                var btnShip = new ShipButton(gen);
                Util.LayoutControl(btnShip, 24 + 205 * shipX, 52 + 135 * shipY, 191, 121, rctScreen);
                btnShip.Parent = pnWindow;
                btnShip.Init();

                shipX++;
                if (shipX >= 3)
                {
                    shipX = 0;
                    shipY++;
                }
            }

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }
예제 #5
0
        public virtual void OnActivate(params object[] args)
        {
            // Store window
            window = Root.Singleton.Window;
            ScreenRectangle = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            Finish = false;
            window.KeyPressed += OnKeyPressed;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, ScreenRectangle);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            Window = new ImagePanel();
            Window.Image = BackgroundImage;
            Util.LayoutControl(Window, (new Vector2u(1280U, 720U) - Window.Image.Size) / 2, Window.Image.Size, ScreenRectangle);
            Window.Parent = Root.Singleton.Canvas;
            Window.Init();

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = Window;
        }
예제 #6
0
 void InitShipNamePanel()
 {
     pnRename = new ImagePanel();
     pnRename.Image = Root.Singleton.Material("img/customizeUI/box_shipname.png");
     Util.LayoutControl(pnRename, 10, 10, 442, 48, rctScreen);
     pnRename.Parent = Root.Singleton.Canvas;
     pnRename.Init();
 }
예제 #7
0
        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();
        }
예제 #8
0
        private void UpdateShields()
        {
            if (pnShields == null) pnShields = new ImagePanel();
            pnShields.Remove();

            pnShields.Image = Root.Singleton.Material("img/statusUI/top_shields4_on.png");
            Util.LayoutControl(pnShields, 0, 45, pnShields.Image.Size, rctScreen);
            pnShields.Parent = Root.Singleton.Canvas;
            pnShields.Init();
        }
예제 #9
0
        private void UpdateScrapMeter()
        {
            if (pnScrap == null) pnScrap = new ImagePanel();
            pnScrap.Remove();

            pnScrap.Image = Root.Singleton.Material((PlayerShip.Scrap > 0) ?
                                                    "img/statusUI/top_scrap.png" :
                                                    "img/statusUI/top_scrap_red.png");
            Util.LayoutControl(pnScrap, 378, 0, pnScrap.Image.Size, rctScreen);
            pnScrap.Parent = Root.Singleton.Canvas;
            pnScrap.Init();

            var lbScrap = new Label();
            lbScrap.Text = PlayerShip.Scrap.ToString();
            lbScrap.Centered = true;
            lbScrap.Scale = 0.6F;
            lbScrap.AutoScale = false;
            lbScrap.Font = Root.Singleton.Font("fonts/num_font.ttf");
            Util.LayoutControl(lbScrap, 40, 14, 84, 28, rctScreen);
            lbScrap.Parent = pnScrap;
            lbScrap.Init();
        }
예제 #10
0
        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();
        }
예제 #11
0
        private void UpdateItems()
        {
            if (pnItems == null) pnItems = new Dictionary<string, ImagePanel>();

            int  i = 0;
            foreach (var name in PlayerShip.Items.Keys)
            {
                if (!pnItems.ContainsKey(name) || pnItems[name] == null) pnItems[name] = new ImagePanel();
                pnItems[name].Remove();

                pnItems[name].Image = Root.Singleton.Material((PlayerShip.Items[name] > 3) ?
                                                              Root.Singleton.mgrState.Get<Library>().GetItem(name).StatusImage :
                                                              Root.Singleton.mgrState.Get<Library>().GetItem(name).StatusImageRed);
                // Aligning to center because drones icon have different size than other items.
                Util.LayoutControl(pnItems[name], 158 + 68 * i - (int)pnItems[name].Image.Size.X / 2, 45, pnItems[name].Image.Size, rctScreen);
                pnItems[name].Parent = Root.Singleton.Canvas;
                pnItems[name].Init();

                var lbItem = new Label();
                lbItem.Text = PlayerShip.Items[name].ToString();
                lbItem.Centered = true;
                lbItem.Scale = 0.5F;
                lbItem.AutoScale = false;
                lbItem.Font = Root.Singleton.Font("fonts/num_font.ttf");
                Util.LayoutControl(lbItem, 34, 9, 32, 21, rctScreen);
                lbItem.Parent = pnItems[name];
                lbItem.Init();

                i++;
            }
        }
예제 #12
0
        private void UpdateHullMeter()
        {
            if (pnHull == null) pnHull = new ImagePanel();
            pnHull.Remove();

            pnHull.Image = GetHullMeterTexture();
            Util.LayoutControl(pnHull, 0, 0, pnHull.Image.Size, rctScreen);
            pnHull.Parent = Root.Singleton.Canvas;
            pnHull.Init();
        }
예제 #13
0
        private void initShipDescription()
        {
            pnDescription = new ImagePanel();
            // this is wrong image, but I can't find the correct one
            pnDescription.Image = Root.Singleton.Material("img/customizeUI/box_text_crewdrones.png");
            Util.LayoutControl(pnDescription, 925, 150, pnDescription.Image.Size, ScreenRectangle);
            pnDescription.Visible = false;
            pnDescription.Parent = Root.Singleton.Canvas;
            pnDescription.Init();

            lbName = new Label();
            lbName.Font = Root.Singleton.Font("fonts/JustinFont10.ttf");
            lbName.Scale = 0.8F;
            Util.LayoutControl(lbName, 15, 15, 0, 0, ScreenRectangle);
            lbName.Parent = pnDescription;
            lbName.Init();

            lbDescription = new Label();
            lbDescription.Font = Root.Singleton.Font("fonts/JustinFont7.ttf");
            lbDescription.Scale = 0.8F;
            Util.LayoutControl(lbDescription, 15, 35, 0, 0, ScreenRectangle);
            lbDescription.Parent = pnDescription;
            lbDescription.Init();
        }
예제 #14
0
        public void OnActivate()
        {
            // Store window
            window = Root.Singleton.Window;
            rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            windowresetneeded = false;
            finishnow = false;
            window.KeyPressed += new EventHandler<KeyEventArgs>(window_KeyPressed);

            // Load settings
            currentres = new ResolutionSetting(
                Root.Singleton.Settings.ReadInt("Video", "ResX"),
                Root.Singleton.Settings.ReadInt("Video", "ResY")
            );
            currentfs = Root.Singleton.Settings.ReadInt("Video", "Fullscreen") == 1;
            hotkeys = Root.Singleton.Settings.ReadInt("Video", "Hotkeys") == 1;
            backgrounds = Root.Singleton.Settings.ReadInt("Video", "Backgrounds") == 1;
            achievementPopups = Root.Singleton.Settings.ReadInt("Video", "AchievementPopups") == 1;
            autoPause = Root.Singleton.Settings.ReadInt("Video", "AutoPause") == 1;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/box_text1.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (616 / 2), (720 / 2) - (384 / 2), 616, 384, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            var lblTitle = new Label();
            lblTitle.Colour = Color.White;
            lblTitle.Text = "Options:  (ESCAPE when done)";
            lblTitle.Font = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.Scale = 0.475f;
            lblTitle.X = 22;
            lblTitle.Y = 35;
            lblTitle.Parent = pnWindow;
            lblTitle.Init();

            btnResolution = AddButton(70);
            btnResolution.OnClick += (sender) =>
            {
                int i = resolutions.IndexOf(currentres);
                i++;
                if (i >= resolutions.Count) i = 0;
                currentres = resolutions[i];
                updateButtons();
                windowresetneeded = true;
            };

            btnFullscreen = AddButton(96);
            btnFullscreen.OnClick += (sender) =>
            {
                currentfs = !currentfs;
                updateButtons();
                windowresetneeded = true;
            };

            btnHotkeys = AddButton(122);
            btnHotkeys.OnClick += (sender) =>
            {
                hotkeys = !hotkeys;
                updateButtons();
            };

            btnDynamicBackgrounds = AddButton(148);
            btnDynamicBackgrounds.OnClick += (sender) =>
            {
                backgrounds = !backgrounds;
                updateButtons();
            };

            btnAchievePopups = AddButton(174);
            btnAchievePopups.OnClick += (sender) =>
            {
                achievementPopups = !achievementPopups;
                updateButtons();
            };

            btnWindowFocusPause = AddButton(200);
            btnWindowFocusPause.OnClick += (sender) =>
            {
                autoPause = !autoPause;
                updateButtons();
            };
            updateButtons();

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }