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; }
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; }
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; }
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; }