Exemplo n.º 1
0
        public override void OnActivate(params object[] args)
        {
            if (args.Length >= 1 && args[0] is SectorMap)
            {
                Map = (SectorMap)args[0];
            }
            else
            {
                Map = new SectorMap();
            }

            BackgroundImage = Root.Singleton.Material("img/box_text_sectors.png");
            base.OnActivate();

            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 = Window;
            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, ScreenRectangle);
            map.Parent = Window;
            map.Init();
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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++;
            }
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
0
        public override void OnActivate(params object[] args)
        {
            // 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;

            BackgroundImage = Root.Singleton.Material("img/box_text1.png");
            base.OnActivate();

            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 = Window;
            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();
        }
Exemplo n.º 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;
        }