public override void Initialize() { PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.TILED; Name = nameof(MapSharingConfirmationPanel); BackgroundTexture = AssetLoader.LoadTexture("msgboxform.png"); lblDescription = new XNALabel(WindowManager); lblDescription.Name = nameof(lblDescription); lblDescription.X = UIDesignConstants.EMPTY_SPACE_SIDES; lblDescription.Y = UIDesignConstants.EMPTY_SPACE_TOP; lblDescription.Text = MapSharingRequestText; AddChild(lblDescription); Width = lblDescription.Right + UIDesignConstants.EMPTY_SPACE_SIDES; btnDownload = new XNAClientButton(WindowManager); btnDownload.Name = nameof(btnDownload); btnDownload.Width = UIDesignConstants.BUTTON_WIDTH_92; btnDownload.Y = lblDescription.Bottom + UIDesignConstants.EMPTY_SPACE_TOP * 2; btnDownload.Text = "Download"; btnDownload.LeftClick += (s, e) => MapDownloadConfirmed?.Invoke(this, EventArgs.Empty); AddChild(btnDownload); btnDownload.CenterOnParentHorizontally(); Height = btnDownload.Bottom + UIDesignConstants.EMPTY_SPACE_BOTTOM; base.Initialize(); CenterOnParent(); Disable(); }
public override void Initialize() { if (Initialized) { return; } Name = "TunnelSelectionWindow"; BackgroundTexture = AssetLoader.LoadTexture("gamecreationoptionsbg.png"); PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lblDescription = new XNALabel(WindowManager); lblDescription.Name = "lblDescription"; lblDescription.Text = "Line 1" + Environment.NewLine + "Line 2"; lblDescription.X = UIDesignConstants.EMPTY_SPACE_SIDES; lblDescription.Y = UIDesignConstants.EMPTY_SPACE_TOP; AddChild(lblDescription); lbTunnelList = new TunnelListBox(WindowManager, tunnelHandler); lbTunnelList.Name = "lbTunnelList"; lbTunnelList.Y = lblDescription.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; lbTunnelList.X = UIDesignConstants.EMPTY_SPACE_SIDES; AddChild(lbTunnelList); var btnApply = new XNAClientButton(WindowManager); btnApply.Name = "btnApply"; btnApply.Width = UIDesignConstants.BUTTON_WIDTH_92; btnApply.Height = UIDesignConstants.BUTTON_HEIGHT; btnApply.Text = "Apply"; btnApply.Y = lbTunnelList.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; AddChild(btnApply); btnApply.LeftClick += BtnApply_LeftClick; Width = lbTunnelList.Right + UIDesignConstants.EMPTY_SPACE_SIDES; Height = btnApply.Bottom + UIDesignConstants.EMPTY_SPACE_BOTTOM; btnApply.CenterOnParentHorizontally(); base.Initialize(); Initialized = true; }
public override void Initialize() { Name = "GameLoadingWindow"; BackgroundTexture = AssetLoader.LoadTexture("loadmissionbg.png"); ClientRectangle = new Rectangle(0, 0, 800, 380); CenterOnParent(); lbSaveGameList = new XNAMultiColumnListBox(WindowManager); lbSaveGameList.Name = nameof(lbSaveGameList); lbSaveGameList.ClientRectangle = new Rectangle(13, 13, 574, 317); lbSaveGameList.AddColumn("SAVED GAME NAME", 400); lbSaveGameList.AddColumn("DATE / TIME", 174); lbSaveGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbSaveGameList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbSaveGameList.SelectedIndexChanged += ListBox_SelectedIndexChanged; lbSaveGameList.AllowKeyboardInput = true; btnLaunch = new XNAClientButton(WindowManager); btnLaunch.Name = nameof(btnLaunch); btnLaunch.ClientRectangle = new Rectangle(0, 345, 110, 23); btnLaunch.Text = "Load"; btnLaunch.AllowClick = false; btnLaunch.LeftClick += BtnLaunch_LeftClick; btnDelete = new XNAClientButton(WindowManager); btnDelete.Name = nameof(btnDelete); btnDelete.ClientRectangle = new Rectangle(0, btnLaunch.Y, 110, 23); btnDelete.Text = "Delete"; btnDelete.AllowClick = false; btnDelete.LeftClick += BtnDelete_LeftClick; btnCancel = new XNAClientButton(WindowManager); btnCancel.Name = nameof(btnCancel); btnCancel.ClientRectangle = new Rectangle(0, btnLaunch.Y, 110, 23); btnCancel.Text = "Cancel"; btnCancel.LeftClick += BtnCancel_LeftClick; var lblSaveInfoHeader = new XNALabel(WindowManager); lblSaveInfoHeader.Name = nameof(lblSaveInfoHeader); lblSaveInfoHeader.Y = lbSaveGameList.Y; lblSaveInfoHeader.X = lbSaveGameList.Right + UIDesignConstants.CONTROL_HORIZONTAL_MARGIN * 2; lblSaveInfoHeader.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblSaveInfoHeader.Text = "SAVE INFORMATION"; AddChild(lblSaveInfoHeader); var lblSessionType = new XNALabel(WindowManager); lblSessionType.Name = nameof(lblSessionType); lblSessionType.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblSessionType.Y = lblSaveInfoHeader.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2; lblSessionType.X = lblSaveInfoHeader.X; lblSessionType.Text = "Session Type:"; AddChild(lblSessionType); lblSessionTypeValue = new XNALabel(WindowManager); lblSessionTypeValue.Name = nameof(lblSessionTypeValue); lblSessionTypeValue.Y = lblSessionType.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; lblSessionTypeValue.X = lblSaveInfoHeader.X; lblSessionTypeValue.Text = " "; AddChild(lblSessionTypeValue); var lblMissionName = new XNALabel(WindowManager); lblMissionName.Name = nameof(lblMissionName); lblMissionName.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblMissionName.Y = lblSessionTypeValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2; lblMissionName.X = lblSaveInfoHeader.X; lblMissionName.Text = "Mission Name:"; AddChild(lblMissionName); lblMissionNameValue = new XNALabel(WindowManager); lblMissionNameValue.Name = nameof(lblMissionNameValue); lblMissionNameValue.Y = lblMissionName.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; lblMissionNameValue.X = lblSessionTypeValue.X; lblMissionNameValue.Text = " "; AddChild(lblMissionNameValue); var lblDifficultyLevel = new XNALabel(WindowManager); lblDifficultyLevel.Name = nameof(lblDifficultyLevel); lblDifficultyLevel.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblDifficultyLevel.Y = lblMissionNameValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2; lblDifficultyLevel.X = lblSaveInfoHeader.X; lblDifficultyLevel.Text = "Difficulty Level:"; AddChild(lblDifficultyLevel); lblDifficultyLevelValue = new XNALabel(WindowManager); lblDifficultyLevelValue.Name = nameof(lblDifficultyLevelValue); lblDifficultyLevelValue.Y = lblDifficultyLevel.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; lblDifficultyLevelValue.X = lblSaveInfoHeader.X; lblDifficultyLevelValue.Text = " "; AddChild(lblDifficultyLevelValue); var lblGlobalFlags = new XNALabel(WindowManager); lblGlobalFlags.Name = nameof(lblGlobalFlags); lblGlobalFlags.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblGlobalFlags.Y = lblDifficultyLevelValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2; lblGlobalFlags.X = lblSaveInfoHeader.X; lblGlobalFlags.Text = "Preconditions:"; AddChild(lblGlobalFlags); lblGlobalFlagsValue = new XNALabel(WindowManager); lblGlobalFlagsValue.Name = nameof(lblGlobalFlagsValue); lblGlobalFlagsValue.Y = lblGlobalFlags.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN; lblGlobalFlagsValue.X = lblSaveInfoHeader.X; lblGlobalFlagsValue.Text = " "; AddChild(lblGlobalFlagsValue); AddChild(lbSaveGameList); AddChild(btnLaunch); AddChild(btnDelete); AddChild(btnCancel); btnDelete.CenterOnParentHorizontally(); btnLaunch.X = btnDelete.X - 10 - btnLaunch.Width; btnCancel.X = btnDelete.Right + 10; base.Initialize(); ListSaves(); }
public override void Initialize() { ReadGameCommands(); Name = "HotkeyConfigurationWindow"; ClientRectangle = new Rectangle(0, 0, 600, 450); BackgroundTexture = AssetLoader.LoadTextureUncached("hotkeyconfigbg.png"); var lblCategory = new XNALabel(WindowManager); lblCategory.Name = "lblCategory"; lblCategory.ClientRectangle = new Rectangle(12, 12, 0, 0); lblCategory.Text = "Category:"; ddCategory = new XNAClientDropDown(WindowManager); ddCategory.Name = "ddCategory"; ddCategory.ClientRectangle = new Rectangle(lblCategory.Right + 12, lblCategory.Y - 1, 250, ddCategory.Height); HashSet <string> categories = new HashSet <string>(); foreach (var command in gameCommands) { if (!categories.Contains(command.Category)) { categories.Add(command.Category); } } foreach (string category in categories) { ddCategory.AddItem(category); } lbHotkeys = new XNAMultiColumnListBox(WindowManager); lbHotkeys.Name = "lbHotkeys"; lbHotkeys.ClientRectangle = new Rectangle(12, ddCategory.Bottom + 12, ddCategory.Right - 12, Height - ddCategory.Bottom - 59); lbHotkeys.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbHotkeys.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbHotkeys.AddColumn("Command", 150); lbHotkeys.AddColumn("Shortcut", lbHotkeys.Width - 150); hotkeyInfoPanel = new XNAPanel(WindowManager); hotkeyInfoPanel.Name = "HotkeyInfoPanel"; hotkeyInfoPanel.ClientRectangle = new Rectangle(lbHotkeys.Right + 12, ddCategory.Y, Width - lbHotkeys.Right - 24, lbHotkeys.Height + ddCategory.Height + 12); lblCommandCaption = new XNALabel(WindowManager); lblCommandCaption.Name = "lblCommandCaption"; lblCommandCaption.FontIndex = 1; lblCommandCaption.ClientRectangle = new Rectangle(12, 12, 0, 0); lblCommandCaption.Text = "Command name"; lblDescription = new XNALabel(WindowManager); lblDescription.Name = "lblDescription"; lblDescription.ClientRectangle = new Rectangle(12, lblCommandCaption.Bottom + 12, 0, 0); lblDescription.Text = "Command description"; var lblCurrentHotkey = new XNALabel(WindowManager); lblCurrentHotkey.Name = "lblCurrentHotkey"; lblCurrentHotkey.ClientRectangle = new Rectangle(lblDescription.X, lblDescription.Bottom + 48, 0, 0); lblCurrentHotkey.FontIndex = 1; lblCurrentHotkey.Text = "Currently assigned hotkey:"; lblCurrentHotkeyValue = new XNALabel(WindowManager); lblCurrentHotkeyValue.Name = "lblCurrentHotkeyValue"; lblCurrentHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X, lblCurrentHotkey.Bottom + 6, 0, 0); lblCurrentHotkeyValue.Text = "Current hotkey value"; var lblNewHotkey = new XNALabel(WindowManager); lblNewHotkey.Name = "lblNewHotkey"; lblNewHotkey.ClientRectangle = new Rectangle(lblDescription.X, lblCurrentHotkeyValue.Bottom + 48, 0, 0); lblNewHotkey.FontIndex = 1; lblNewHotkey.Text = "New hotkey:"; lblNewHotkeyValue = new XNALabel(WindowManager); lblNewHotkeyValue.Name = "lblNewHotkeyValue"; lblNewHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X, lblNewHotkey.Bottom + 6, 0, 0); lblNewHotkeyValue.Text = HOTKEY_TIP_TEXT; lblCurrentlyAssignedTo = new XNALabel(WindowManager); lblCurrentlyAssignedTo.Name = "lblCurrentlyAssignedTo"; lblCurrentlyAssignedTo.ClientRectangle = new Rectangle(lblDescription.X, lblNewHotkeyValue.Bottom + 12, 0, 0); lblCurrentlyAssignedTo.Text = "Currently assigned to:\nKey"; var btnAssign = new XNAClientButton(WindowManager); btnAssign.Name = "btnAssign"; btnAssign.ClientRectangle = new Rectangle(lblDescription.X, lblCurrentlyAssignedTo.Bottom + 24, 121, 23); btnAssign.Text = "Assign Hotkey"; btnAssign.LeftClick += BtnAssign_LeftClick; btnResetKey = new XNAClientButton(WindowManager); btnResetKey.Name = "btnResetKey"; btnResetKey.ClientRectangle = new Rectangle(btnAssign.X, btnAssign.Bottom + 12, btnAssign.Width, 23); btnResetKey.Text = "Reset to Default"; btnResetKey.LeftClick += BtnReset_LeftClick; var lblDefaultHotkey = new XNALabel(WindowManager); lblDefaultHotkey.Name = "lblOriginalHotkey"; lblDefaultHotkey.ClientRectangle = new Rectangle(lblCurrentHotkey.X, btnResetKey.Bottom + 12, 0, 0); lblDefaultHotkey.Text = "Default hotkey:"; lblDefaultHotkeyValue = new XNALabel(WindowManager); lblDefaultHotkeyValue.Name = "lblDefaultHotkeyValue"; lblDefaultHotkeyValue.ClientRectangle = new Rectangle(lblDefaultHotkey.Right + 12, lblDefaultHotkey.Y, 0, 0); var btnSave = new XNAClientButton(WindowManager); btnSave.Name = "btnSave"; btnSave.ClientRectangle = new Rectangle(12, lbHotkeys.Bottom + 12, 92, 23); btnSave.Text = "Save"; btnSave.LeftClick += BtnSave_LeftClick; var btnResetAllKeys = new XNAClientButton(WindowManager); btnResetAllKeys.Name = "btnResetAllToDefaults"; btnResetAllKeys.ClientRectangle = new Rectangle(0, btnSave.Y, 121, 23); btnResetAllKeys.Text = "Reset All Keys"; btnResetAllKeys.LeftClick += BtnResetToDefaults_LeftClick; AddChild(btnResetAllKeys); btnResetAllKeys.CenterOnParentHorizontally(); var btnCancel = new XNAClientButton(WindowManager); btnCancel.Name = "btnExit"; btnCancel.ClientRectangle = new Rectangle(Width - 104, btnSave.Y, 92, 23); btnCancel.Text = "Cancel"; btnCancel.LeftClick += BtnCancel_LeftClick; AddChild(lbHotkeys); AddChild(lblCategory); AddChild(ddCategory); AddChild(hotkeyInfoPanel); AddChild(btnSave); AddChild(btnCancel); hotkeyInfoPanel.AddChild(lblCommandCaption); hotkeyInfoPanel.AddChild(lblDescription); hotkeyInfoPanel.AddChild(lblCurrentHotkey); hotkeyInfoPanel.AddChild(lblCurrentHotkeyValue); hotkeyInfoPanel.AddChild(lblNewHotkey); hotkeyInfoPanel.AddChild(lblNewHotkeyValue); hotkeyInfoPanel.AddChild(lblCurrentlyAssignedTo); hotkeyInfoPanel.AddChild(lblDefaultHotkey); hotkeyInfoPanel.AddChild(lblDefaultHotkeyValue); hotkeyInfoPanel.AddChild(btnAssign); hotkeyInfoPanel.AddChild(btnResetKey); if (categories.Count > 0) { hotkeyInfoPanel.Disable(); lbHotkeys.SelectedIndexChanged += LbHotkeys_SelectedIndexChanged; ddCategory.SelectedIndexChanged += DdCategory_SelectedIndexChanged; ddCategory.SelectedIndex = 0; } else { Logger.Log("No keyboard game commands exist!"); } GameProcessLogic.GameProcessExited += GameProcessLogic_GameProcessExited; base.Initialize(); CenterOnParent(); Keyboard.OnKeyPressed += Keyboard_OnKeyPressed; EnabledChanged += HotkeyConfigurationWindow_EnabledChanged; }