Example #1
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, 8, 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();
        }
Example #2
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();
 }
Example #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 * 30, "" + (i + 1) + ". " + node.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;
        }
Example #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;
        }
Example #5
0
        public virtual void OnActivate()
        {
            // 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;
        }
Example #6
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();
        }
Example #7
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;
        }