/// <summary> /// Create a checkbox for a particular squad /// </summary> private static CheckBox CreateCheckbox(Manager manager, string text, int squadIndex) { CheckBox checkBox = new CheckBox(manager); checkBox.Init(); checkBox.Margins = new Margins(3); checkBox.Width = 232; checkBox.Height = 20; checkBox.Text = text; checkBox.Tag = squadIndex; checkBox.Checked = true; checkBox.Anchor = Anchors.Top | Anchors.Horizontal; return(checkBox); }
public Control CreateControl(Manager manager, Control parent, PropertyInfo field, object existingData) { var radioButton = new CheckBox(manager) { Parent = parent, Name = field.Name, Text = String.Empty }; radioButton.Init(); if (existingData != null) { radioButton.Checked = (bool)existingData; } return(radioButton); }
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// private void InitRes() { pnlRes = new SideBarPanel(Manager); pnlRes.Init(); pnlRes.Passive = true; pnlRes.Parent = sidebar; pnlRes.Left = 16; pnlRes.Top = 16; pnlRes.Width = sidebar.Width - pnlRes.Left; pnlRes.Height = 86; pnlRes.CanFocus = false; rdbRes1024 = new RadioButton(Manager); rdbRes1024.Init(); rdbRes1024.Parent = pnlRes; rdbRes1024.Left = 8; rdbRes1024.Width = pnlRes.Width - rdbRes1024.Left * 2; rdbRes1024.Height = 16; rdbRes1024.Text = "Resolution 1024x768"; rdbRes1024.Top = 8; rdbRes1024.Checked = true; rdbRes1280 = new RadioButton(Manager); rdbRes1280.Init(); rdbRes1280.Parent = pnlRes; rdbRes1280.Left = rdbRes1024.Left; rdbRes1280.Width = rdbRes1024.Width; rdbRes1280.Height = rdbRes1024.Height; rdbRes1280.Text = "Resolution 1280x1024"; rdbRes1280.Top = 24; rdbRes1680 = new RadioButton(Manager); rdbRes1680.Init(); rdbRes1680.Parent = pnlRes; rdbRes1680.Left = rdbRes1024.Left; rdbRes1680.Width = rdbRes1024.Width; rdbRes1680.Height = rdbRes1024.Height; rdbRes1680.Text = "Resolution 1680x1050"; rdbRes1680.Top = 40; chkResFull = new CheckBox(Manager); chkResFull.Parent = pnlRes; chkResFull.Init(); chkResFull.Left = rdbRes1024.Left; chkResFull.Width = rdbRes1024.Width; chkResFull.Height = rdbRes1024.Height; chkResFull.Text = "Fullscreen Mode"; chkResFull.Top = 64; btnApply = new Button(Manager); btnApply.Init(); btnApply.Width = 80; btnApply.Parent = sidebar; btnApply.Left = pnlRes.Left; btnApply.Top = pnlRes.Top + pnlRes.Height + 8; btnApply.Text = "Apply"; btnApply.Click += new Controls.EventHandler(btnApply_Click); btnExit = new Button(Manager); btnExit.Init(); btnExit.Width = 80; btnExit.Parent = sidebar; btnExit.Left = btnApply.Left + btnApply.Width + 8; btnExit.Top = pnlRes.Top + pnlRes.Height + 8; btnExit.Text = "Exit"; btnExit.Click += new Controls.EventHandler(btnExit_Click); }
public TaskControls(Manager manager) : base(manager) { MinimumWidth = 340; MinimumHeight = 140; Height = 480; Center(); Text = "Controls Test"; TopPanel.Visible = true; Caption.Text = "Information"; Description.Text = "Demonstration of various controls available in Window Library"; Caption.TextColor = Description.TextColor = new Color(96, 96, 96); grpEdit = new GroupPanel(Manager); grpEdit.Init(); grpEdit.Parent = this; grpEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; grpEdit.Width = ClientWidth - 200; grpEdit.Height = 160; grpEdit.Left = 8; grpEdit.Top = TopPanel.Height + 8; grpEdit.Text = "EditBox"; pnlControls = new Panel(Manager); pnlControls.Init(); pnlControls.Passive = true; pnlControls.Parent = this; pnlControls.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; pnlControls.Left = 8; pnlControls.Top = grpEdit.Top + grpEdit.Height + 8; pnlControls.Width = ClientWidth - 200; pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top; pnlControls.BevelBorder = EBevelBorder.All; pnlControls.BevelMargin = 1; pnlControls.BevelStyle = EBevelStyle.Etched; pnlControls.Color = Color.Transparent; lblEdit = new Label(manager); lblEdit.Init(); lblEdit.Parent = grpEdit; lblEdit.Left = 16; lblEdit.Top = 8; lblEdit.Text = "Testing field:"; lblEdit.Width = 128; lblEdit.Height = 16; txtEdit = new TextBox(manager); txtEdit.Init(); txtEdit.Parent = grpEdit; txtEdit.Left = 16; txtEdit.Top = 24; txtEdit.Width = grpEdit.ClientWidth - 32; txtEdit.Height = 20; txtEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom; txtEdit.Text = "Text"; rdbNormal = new RadioButton(manager); rdbNormal.Init(); rdbNormal.Parent = grpEdit; rdbNormal.Left = 16; rdbNormal.Top = 52; rdbNormal.Width = grpEdit.ClientWidth - 32; rdbNormal.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbNormal.Checked = true; rdbNormal.Text = "Normal mode"; rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control."; rdbNormal.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); rdbPassword = new RadioButton(manager); rdbPassword.Init(); rdbPassword.Parent = grpEdit; rdbPassword.Left = 16; rdbPassword.Top = 68; rdbPassword.Width = grpEdit.ClientWidth - 32; rdbPassword.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbPassword.Checked = false; rdbPassword.Text = "Password mode"; rdbPassword.ToolTip.Text = "Enables password mode for TextBox control."; rdbPassword.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); chkBorders = new CheckBox(manager); chkBorders.Init(); chkBorders.Parent = grpEdit; chkBorders.Left = 16; chkBorders.Top = 96; chkBorders.Width = grpEdit.ClientWidth - 32; chkBorders.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkBorders.Checked = false; chkBorders.Text = "Borderless mode"; chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control."; chkBorders.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkBorders_CheckedChanged); chkReadOnly = new CheckBox(manager); chkReadOnly.Init(); chkReadOnly.Parent = grpEdit; chkReadOnly.Left = 16; chkReadOnly.Top = 110; chkReadOnly.Width = grpEdit.ClientWidth - 32; chkReadOnly.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkReadOnly.Checked = false; chkReadOnly.Text = "Read only mode"; chkReadOnly.ToolTip.Text = "Enables or disables read only mode for TextBox control.\nThis mode is necessary to enable explicitly."; chkReadOnly.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkReadOnly_CheckedChanged); string[] colors = new string[] { "Red", "Green", "Blue", "Yellow", "Orange", "Purple", "White", "Black", "Magenta", "Cyan", "Brown", "Aqua", "Beige", "Coral", "Crimson", "Gray", "Azure", "Ivory", "Indigo", "Khaki", "Orchid", "Plum", "Salmon", "Silver", "Gold", "Pink", "Linen", "Lime", "Olive", "Slate" }; spnMain = new SpinBox(manager, ESpinBoxMode.List); spnMain.Init(); spnMain.Parent = pnlControls; spnMain.Left = 16; spnMain.Top = 16; spnMain.Width = pnlControls.Width - 32; spnMain.Height = 20; spnMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; spnMain.Items.AddRange(colors); spnMain.Mode = ESpinBoxMode.Range; spnMain.ItemIndex = 0; cmbMain = new ComboBox(manager); cmbMain.Init(); cmbMain.Parent = pnlControls; cmbMain.Left = 16; cmbMain.Top = 44; cmbMain.Width = pnlControls.Width - 32; cmbMain.Height = 20; cmbMain.ReadOnly = true; cmbMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; cmbMain.Items.AddRange(colors); cmbMain.ItemIndex = 0; cmbMain.MaxItems = 5; cmbMain.ToolTip.Color = Color.Yellow; cmbMain.Movable = cmbMain.Resizable = true; cmbMain.OutlineMoving = cmbMain.OutlineResizing = true; trkMain = new TrackBar(manager); trkMain.Init(); trkMain.Parent = pnlControls; trkMain.Left = 16; trkMain.Top = 72; trkMain.Width = pnlControls.Width - 32; trkMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; trkMain.Range = 64; trkMain.Value = 16; trkMain.ValueChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(trkMain_ValueChanged); lblTrack = new Label(manager); lblTrack.Init(); lblTrack.Parent = pnlControls; lblTrack.Left = 16; lblTrack.Top = 96; lblTrack.Width = pnlControls.Width - 32; lblTrack.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; lblTrack.Alignment = EAlignment.TopRight; lblTrack.TextColor = new Color(32, 32, 32); trkMain_ValueChanged(this, null); // forcing label redraw with init values mnuListBox = new ContextMenu(manager); MenuItem i1 = new MenuItem("This is very long text"); MenuItem i2 = new MenuItem("Menu", true); MenuItem i3 = new MenuItem("Item", false); //i3.Enabled = false; MenuItem i4 = new MenuItem("Separated", true); MenuItem i11 = new MenuItem(); MenuItem i12 = new MenuItem(); MenuItem i13 = new MenuItem(); MenuItem i14 = new MenuItem(); MenuItem i111 = new MenuItem(); MenuItem i112 = new MenuItem(); MenuItem i113 = new MenuItem(); mnuListBox.Items.AddRange(new MenuItem[] { i1, i2, i3, i4 }); i2.Items.AddRange(new MenuItem[] { i11, i12, i13, i14 }); i13.Items.AddRange(new MenuItem[] { i111, i112, i113 }); lstMain = new ListBox(manager); lstMain.Init(); lstMain.Parent = this; lstMain.Top = TopPanel.Height + 8; lstMain.Left = grpEdit.Left + grpEdit.Width + 8; lstMain.Width = ClientWidth - lstMain.Left - 8; lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height; lstMain.Anchor = EAnchors.Top | EAnchors.Right | EAnchors.Bottom; lstMain.HideSelection = false; lstMain.Items.AddRange(colors); lstMain.ContextMenu = mnuListBox; prgMain = new ProgressBar(manager); prgMain.Init(); prgMain.Parent = this.BottomPanel; prgMain.Left = lstMain.Left; prgMain.Top = 10; prgMain.Width = lstMain.Width; prgMain.Height = 16; prgMain.Anchor = EAnchors.Top | EAnchors.Right; prgMain.Mode = EProgressBarMode.Infinite; prgMain.Passive = false; btnDisable = new Button(manager); btnDisable.Init(); btnDisable.Parent = BottomPanel; btnDisable.Left = 8; btnDisable.Top = 8; btnDisable.Text = "Disable"; btnDisable.Click += new Controls.EventHandler(btnDisable_Click); btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200); btnProgress = new Button(manager); btnProgress.Init(); btnProgress.Parent = BottomPanel; btnProgress.Left = prgMain.Left - 16; btnProgress.Top = prgMain.Top; btnProgress.Height = 16; btnProgress.Width = 16; btnProgress.Text = "!"; btnProgress.Anchor = EAnchors.Top | EAnchors.Right; btnProgress.Click += new Controls.EventHandler(btnProgress_Click); mnuMain = new MainMenu(manager); mnuMain.Items.Add(i2); mnuMain.Items.Add(i13); mnuMain.Items.Add(i3); mnuMain.Items.Add(i4); MainMenu = mnuMain; ToolBarPanel tlp = new ToolBarPanel(manager); ToolBarPanel = tlp; ToolBar tlb = new ToolBar(manager); ToolBar tlbx = new ToolBar(manager); tlb.FullRow = true; tlbx.Row = 1; tlbx.FullRow = false; tlp.Add(tlb); tlp.Add(tlbx); /* * tlb.Init(); * tlb.Width = 256; * tlb.Parent = ToolBarPanel;*/ //tlbx.Init(); /* * tlbx.Width = 512; * tlbx.Top = 25; * tlbx.Parent = ToolBarPanel;*/ /* * ToolBarButton tb1 = new ToolBarButton(manager); * tb1.Init(); * tb1.Parent = tlb; * tb1.Left = 10; * tb1.Top = 1; * tb1.Glyph = new Glyph(Manager.Skin.Images["Icon.Warning"].Resource); * tb1.Glyph.SizeMode = SizeMode.Stretched; */ StatusBar stb = new StatusBar(Manager); StatusBar = stb; DefaultControl = txtEdit; OutlineMoving = true; OutlineResizing = true; BottomPanel.BringToFront(); SkinChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(TaskControls_SkinChanged); TaskControls_SkinChanged(null, null); }
public TaskCrafting(Manager manager) : base(manager) { //Set up the window TopPanel.Visible = true; BottomPanel.Visible = false; Resizable = false; Height = 512; Width = 696; imageCaption = new ImageBox(manager); imageCaption.Init(); imageCaption.Left = 8; imageCaption.Width = 48; imageCaption.Height = 48; imageCaption.Top = -4; Add(imageCaption); Caption.Left = Description.Left = imageCaption.Left + imageCaption.Width + 8; TopPanel.Height = imageCaption.Height + 8; grpPnlRecipie = new GroupPanel(manager); grpPnlRecipie.Init(); grpPnlRecipie.Left = 4; grpPnlRecipie.Top = TopPanel.Height + 2; grpPnlRecipie.Width = (ClientWidth / 2) - 4 - 2; grpPnlRecipie.Height = ClientHeight - grpPnlRecipie.Top - 6; grpPnlRecipie.Text = "Recipies"; grpPnlRecipie.Color = Color.White; Add(grpPnlRecipie); grpPnlItem = new GroupPanel(manager); grpPnlItem.Init(); grpPnlItem.Left = (ClientWidth / 2) + 2; grpPnlItem.Top = TopPanel.Height + 2; grpPnlItem.Width = (ClientWidth / 2) - 6; grpPnlItem.Height = ClientHeight - grpPnlRecipie.Top - 6; grpPnlItem.Text = "Item"; grpPnlItem.Color = Color.White; Add(grpPnlItem); pnlItem = new Panel(manager); pnlItem.Anchor = Anchors.Left | Anchors.Top | Anchors.Right; pnlItem.Init(); pnlItem.Width = grpPnlItem.ClientWidth; pnlItem.Height = 64; pnlItem.BevelBorder = BevelBorder.Bottom; grpPnlItem.Add(pnlItem); grpPnlReq = new GroupPanel(manager); grpPnlReq.Init(); grpPnlReq.Left = -1; grpPnlReq.Top = 62; grpPnlReq.Width = (ClientWidth / 2) - 6; grpPnlReq.Height = 84; grpPnlReq.Text = "Requirements"; grpPnlReq.Color = Color.White; grpPnlItem.Add(grpPnlReq); imgItem = new ImageBox(manager); imgItem.Init(); imgItem.Left = 8; imgItem.Width = 0; imgItem.Height = 0; imgItem.Top = 8; pnlItem.Add(imgItem); lblName = new Label(manager); lblName.Init(); lblName.Left = imgItem.Width + imgItem.Left + 6; lblName.Top = imgItem.Top; lblName.Width = pnlItem.Width - lblName.Left; lblName.Font = FontSize.Default12; pnlItem.Add(lblName); lblDesc = new Label(manager); lblDesc.Init(); lblDesc.Left = imgItem.Width + imgItem.Left + 10; lblDesc.Top = lblName.Top + lblName.Height; lblDesc.Width = pnlItem.Width - lblName.Left; lblDesc.TextColor = Color.Gray; pnlItem.Add(lblDesc); lblIngredients = new Label(manager); lblIngredients.Init(); lblIngredients.Left = 8; lblIngredients.Top = 4; lblIngredients.Height = Tile.Height; lblIngredients.Text = "Ingredients:"; lblIngredients.Width = (int)manager.Skin.Fonts[0].Resource.MeasureRichString(lblIngredients.Text, manager).X; grpPnlReq.Add(lblIngredients); lblStation = new Label(manager); lblStation.Init(); lblStation.Left = 8; lblStation.Top = lblIngredients.Top + lblIngredients.Height + 8; lblStation.Text = "Station:"; lblStation.Width = (int)manager.Skin.Fonts[0].Resource.MeasureRichString(lblStation.Text, manager).X; grpPnlReq.Add(lblStation); cmbTopCat = new ComboBox(manager); cmbTopCat.Init(); cmbTopCat.Left = 8; cmbTopCat.Top = 8; cmbTopCat.Width = grpPnlRecipie.Width / 2 - 11; cmbTopCat.Items.AddRange(ItemCategory.ItemCategories.Where(x => x.TopLevel).Select(element => element.Name).ToList()); grpPnlRecipie.Add(cmbTopCat); cmbSubCat = new ComboBox(manager); cmbSubCat.Init(); cmbSubCat.Left = cmbTopCat.Left + cmbTopCat.Width + 2; cmbSubCat.Top = cmbTopCat.Top; cmbSubCat.Width = grpPnlRecipie.Width / 2 - 8; cmbSubCat.MaxItems = 128; grpPnlRecipie.Add(cmbSubCat); cmbSubCat.Items.Add(ItemCategory.All.Name); chkHasMaterials = new CheckBox(manager); chkHasMaterials.Init(); chkHasMaterials.Top = cmbTopCat.Top + cmbTopCat.Height + 8; chkHasMaterials.Left = cmbTopCat.Left; chkHasMaterials.Text = "Have Materials"; chkHasMaterials.Width = 106; chkHasMaterials.ToolTip.Text = "Only display items that you have materials for."; chkHasMaterials.CheckedChanged += chkHasMaterials_CheckedChanged; grpPnlRecipie.Add(chkHasMaterials); chkAtStation = new CheckBox(manager); chkAtStation.Init(); chkAtStation.Top = cmbTopCat.Top + cmbTopCat.Height + 8; chkAtStation.Left = cmbTopCat.Left + chkHasMaterials.Width; chkAtStation.Text = "At Station"; chkAtStation.Width = 80; chkAtStation.ToolTip.Text = "Only display items who's crafting station is near."; chkAtStation.CheckedChanged += chkAtStation_CheckedChanged; grpPnlRecipie.Add(chkAtStation); txtSearch = new TextBox(manager); txtSearch.Init(); txtSearch.Top = cmbTopCat.Top + cmbTopCat.Height + 4; txtSearch.Left = chkAtStation.Left + chkAtStation.Width; txtSearch.Text = "Search..."; txtSearch.Width = 131; txtSearch.ToolTip.Text = "Only display items that contain or match the search text."; txtSearch.FocusGained += txtSearch_FocusGained; txtSearch.FocusLost += txtSearch_FocusLost; txtSearch.TextChanged += txtSearch_TextChanged; grpPnlRecipie.Add(txtSearch); itemSelector = new ControlList <ItemListControl>(manager); itemSelector.Init(); itemSelector.Width = grpPnlRecipie.ClientWidth - 16; itemSelector.Height = grpPnlRecipie.ClientHeight - 16 - chkHasMaterials.Top - chkHasMaterials.Height; itemSelector.Left = 8; itemSelector.Top = chkHasMaterials.Top + chkHasMaterials.Height + 8; grpPnlRecipie.Add(itemSelector); pnlCraft = new Panel(manager); pnlCraft.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right; pnlCraft.Init(); pnlCraft.Width = grpPnlItem.ClientWidth; pnlCraft.Height = 56 + 8 + 8; pnlCraft.Top = grpPnlItem.ClientHeight - pnlCraft.Height; pnlCraft.BevelBorder = BevelBorder.Top; grpPnlItem.Add(pnlCraft); grpPnlStats = new GroupPanel(manager); grpPnlStats.Init(); grpPnlStats.Left = -1; grpPnlStats.Top = grpPnlReq.Top + grpPnlReq.Height; grpPnlStats.Width = grpPnlReq.Width; grpPnlStats.Height = (int)Math.Abs(pnlCraft.Top - (grpPnlReq.Top + grpPnlReq.Height)) + 2; grpPnlStats.Text = "Stats"; grpPnlStats.Color = Color.White; grpPnlItem.Add(grpPnlStats); btnCraft = new Button(manager); btnCraft.Init(); btnCraft.Enabled = false; btnCraft.Text = "Craft"; btnCraft.Left = (grpPnlItem.Width / 2) - btnCraft.Width - 4; btnCraft.Top = grpPnlItem.ClientHeight - btnCraft.Height - 8; btnCraft.Click += btnCraft_Click; grpPnlItem.Add(btnCraft); itemSlotOutput[0] = new Slot(Item.Blank, 0); sltOutput = new SlotContainer(manager, 1, 1); sltOutput.ItemSlots = itemSlotOutput; sltOutput.Init(); sltOutput.Left = (grpPnlItem.ClientWidth / 2) + 4; sltOutput.Top = grpPnlItem.ClientHeight - sltOutput.Height; sltOutput.MoveItems += sltOutput_MoveItems; sltOutput.CanAdd = false; spnCraft = new SpinBox(manager, SpinBoxMode.Range); spnCraft.Init(); spnCraft.Width = btnCraft.Width; spnCraft.Left = (grpPnlItem.Width / 2) - spnCraft.Width - 4; spnCraft.Minimum = 0; spnCraft.Maximum = (int)StackSize.Max; spnCraft.ReadOnly = false; spnCraft.Rounding = 0; spnCraft.Top = sltOutput.Top; spnCraft.TextChanged += spnCraft_TextChanged; grpPnlItem.Add(spnCraft); grpPnlItem.Add(sltOutput); itemSlotInput[0] = new Slot(Item.Blank, 0); sltInput = new SlotContainer(manager, 1, 1); sltInput.ItemSlots = itemSlotInput; sltInput.Init(); sltInput.Left = btnCraft.Left - sltInput.ClientWidth; sltInput.Top = grpPnlItem.ClientHeight - sltOutput.Height + 4; sltInput.CheckItems += sltInput_CheckItems; sltInput.MoveItems += sltInput_MoveItems; sltInput.CanAdd = true; grpPnlItem.Add(sltOutput); grpPnlItem.Add(sltInput); prgFuel = new ProgressBar(manager); prgFuel.Init(); prgFuel.Color = Color.Orange; prgFuel.Text = "Fuel"; prgFuel.ToolTip.Text = "Fuel"; prgFuel.Top = pnlCraft.Top + 4; prgFuel.Left = sltInput.Left; prgFuel.Width = sltInput.ClientWidth - 8; prgFuel.Height = 15; grpPnlItem.Add(prgFuel); prgOutput = new ProgressBar(manager); prgOutput.Init(); prgOutput.Color = Color.ForestGreen; prgOutput.Text = "Output"; prgOutput.ToolTip.Text = "Output"; prgOutput.Top = pnlCraft.Top + 4; prgOutput.Left = sltOutput.Left; prgOutput.Width = sltOutput.ClientWidth - 8; prgOutput.Height = 15; grpPnlItem.Add(prgOutput); imgStationNeeded = new ImageBox(Manager); imgStationNeeded.Init(); grpPnlReq.Add(imgStationNeeded); lblStationNeeded = new Label(Manager); lblStationNeeded.Init(); grpPnlReq.Add(lblStationNeeded); ItemStatLabels = new Label[15]; for (int j = 0; j < 15; j++) { ItemStatLabels[j] = new Label(Manager); ItemStatLabels[j].Init(); ingredientsNeeded.Add(Tuple.Create(new ImageBox(Manager), new Label(Manager))); ingredientsNeeded[j].Item1.Init(); } HideAll(); SetupCraftingControls(manager); Center(); }
public GeneralDialog(Manager manager) { _manager = manager; _window = new Window(_manager); _window.Init(); _window.Text = "General"; _window.Width = 200; _window.Height = 200; _window.Left = 809; _window.Top = 15; _window.Visible = true; _window.Movable = false; _window.CloseButtonVisible = false; _wireframe = new CheckBox(_manager); _wireframe.Init(); _wireframe.Text = "Wireframe"; _wireframe.Width = 100; _wireframe.Height = 24; _wireframe.Anchor = Anchors.Bottom; _wireframe.Left = 15; _wireframe.Top = 15; _wireframe.Visible = true; _wireframe.Parent = _window; _terrain = new CheckBox(_manager); _terrain.Init(); _terrain.Text = "Terrain"; _terrain.Width = 100; _terrain.Height = 24; _terrain.Anchor = Anchors.Bottom; _terrain.Left = 15; _terrain.Top = 45; _terrain.Visible = true; _terrain.Parent = _window; _doodad = new CheckBox(_manager); _doodad.Init(); _doodad.Text = "Doodads"; _doodad.Width = 100; _doodad.Height = 24; _doodad.Anchor = Anchors.Bottom; _doodad.Left = 15; _doodad.Top = 75; _doodad.Visible = true; _doodad.Parent = _window; _wmo = new CheckBox(_manager); _wmo.Init(); _wmo.Text = "WMOs"; _wmo.Width = 100; _wmo.Height = 24; _wmo.Anchor = Anchors.Bottom; _wmo.Left = 15; _wmo.Top = 105; _wmo.Visible = true; _wmo.Parent = _window; _water = new CheckBox(_manager); _water.Init(); _water.Text = "Water"; _water.Width = 100; _water.Height = 24; _water.Anchor = Anchors.Bottom; _water.Left = 15; _water.Top = 135; _water.Visible = true; _water.Parent = _window; _console = new Console(_manager); _console.Init(); _console.Left = 15; _console.Top = 15; _console.Width = 779; _console.Height = 200; _console.Visible = true; _console.Text = "meshDisplay Console"; _console.Visible = true; _console.Movable = false; _console.Channels.Add(new ConsoleChannel(1, "Default", Color.White)); _console.MessageSent += HandleMessage; _manager.Add(_console); _manager.Add(_window); }
/// <summary> /// Create a checkbox for a particular squad /// </summary> private static CheckBox CreateCheckbox(Manager manager, string text, int squadIndex) { CheckBox checkBox = new CheckBox(manager); checkBox.Init(); checkBox.Margins = new Margins(3); checkBox.Width = 232; checkBox.Height = 20; checkBox.Text = text; checkBox.Tag = squadIndex; checkBox.Checked = true; checkBox.Anchor = Anchors.Top | Anchors.Horizontal; return checkBox; }
public TaskOptions(Manager manager) : base(manager) { //Set up window UI MinimumHeight = 100; Height = Manager.ScreenHeight - 48; Width = 300; Resizable = false; Text = "Options"; Caption.Text = "Information"; Description.Text = "Customize and edit the game settings for your liking and best performance.\nHover over an option for more details."; Caption.TextColor = Description.TextColor = new Color(96, 96, 96); //Custom UI Controls ContentPackPnl = new GroupPanel(Manager); //Panel for content pack settings ContentPackPnl.Init(); ContentPackPnl.Parent = this; ContentPackPnl.Width = ClientWidth - 16; ContentPackPnl.ClientHeight = 32; ContentPackPnl.Left = 8; ContentPackPnl.Top = TopPanel.Height + 8; ContentPackPnl.Text = "Content Packs"; btnContentPack = new Button(Manager); btnContentPack.Init(); btnContentPack.Left = 8; btnContentPack.Top = 6; btnContentPack.Text = Game.level != null ? "Choose Content Pack >>" : "Join World To Edit"; btnContentPack.Width = 164; btnContentPack.Height = 18; btnContentPack.Click += btnContentPack_Click; btnContentPack.Enabled = Game.level != null; ContentPackPnl.Add(btnContentPack); GraphicsPnl = new GroupPanel(Manager); //Panel for graphics settings GraphicsPnl.Init(); GraphicsPnl.Parent = this; GraphicsPnl.Width = ClientWidth - 16; GraphicsPnl.Height = 226; GraphicsPnl.Left = 8; GraphicsPnl.Top = ContentPackPnl.Height + ContentPackPnl.Top + 8; GraphicsPnl.Text = "General"; ControlsPnl = new GroupPanel(Manager); //Panel for controls settings ControlsPnl.Init(); ControlsPnl.Parent = this; ControlsPnl.Width = ClientWidth - 16; ControlsPnl.Height = 176; ControlsPnl.Left = GraphicsPnl.Left + GraphicsPnl.Width + 8; ControlsPnl.Top = ContentPackPnl.Top; ControlsPnl.Text = "Controls"; ParticleLbl = new Label(manager); ParticleLbl.Init(); ParticleLbl.Parent = GraphicsPnl; ParticleLbl.Left = 8; ParticleLbl.Top = 8; ParticleLbl.Width = 92; ParticleLbl.Anchor = Anchors.Left; ParticleLbl.Text = "Particle Quality:"; ParticleLbl.ToolTip.Text = "Adjust the particle quality (amount)"; ParticleCmb = new ComboBox(Manager); ParticleCmb.Init(); ParticleCmb.Parent = GraphicsPnl; ParticleCmb.Left = ParticleLbl.Left + ParticleLbl.Width + 4; ParticleCmb.Top = 7; ParticleCmb.Width = 82; ParticleCmb.Height = 20; ParticleCmb.ReadOnly = true; ParticleCmb.Items.Add("Low"); ParticleCmb.Items.Add("Medium"); ParticleCmb.Items.Add("High"); ParticleCmb.Movable = ParticleCmb.Resizable = false; ParticleCmb.OutlineMoving = ParticleCmb.OutlineResizing = false; ParticleCmb.ItemIndex = Game.ParticleQuality; SkinLbl = new Label(manager); SkinLbl.Init(); SkinLbl.Parent = GraphicsPnl; SkinLbl.Left = 8; SkinLbl.Top = ParticleCmb.Top + ParticleCmb.Height + 5; SkinLbl.Width = 48; SkinLbl.Anchor = Anchors.Left; SkinLbl.Text = "UI Skin:"; SkinLbl.ToolTip.Text = "Adjust the visual appearence of the user interface"; SkinCmb = new ComboBox(Manager); SkinCmb.Init(); SkinCmb.Parent = GraphicsPnl; SkinCmb.Left = SkinLbl.Left + SkinLbl.Width + 4; SkinCmb.Top = ParticleCmb.Top + ParticleCmb.Height + 4; SkinCmb.Width = 72; SkinCmb.Height = 20; SkinCmb.ReadOnly = true; SkinCmb.Items.Add("Red"); SkinCmb.Items.Add("Blue"); SkinCmb.Items.Add("Green"); SkinCmb.MaxItems = 3; SkinCmb.Movable = SkinCmb.Resizable = false; SkinCmb.OutlineMoving = SkinCmb.OutlineResizing = false; SkinCmb.ItemIndex = Game.Skin; LightingQualityLbl = new Label(manager); LightingQualityLbl.Init(); LightingQualityLbl.Parent = GraphicsPnl; LightingQualityLbl.Left = 8; LightingQualityLbl.Top = SkinCmb.Top + SkinCmb.Height + 6; LightingQualityLbl.Width = 96; LightingQualityLbl.Anchor = Anchors.Left; LightingQualityLbl.Text = "Lighting Quality:"; LightingQualityLbl.ToolTip.Text = "Adjust the lighting quality\nLow: Simple, Original lighting, twice as fast as medium. However, there may be lighting glitches in complex areas such as caves\nMedium: 'Dual Pass' lighting, which will smooth out any inconsistancies\nHigh: Same as medium, however the lighting gets 'blurred' even more, reducing sharp edges and giving light a smoother look"; LightingQualityCmb = new ComboBox(Manager); LightingQualityCmb.Init(); LightingQualityCmb.Parent = GraphicsPnl; LightingQualityCmb.Left = LightingQualityLbl.Left + LightingQualityLbl.Width + 4; LightingQualityCmb.Top = SkinCmb.Top + SkinCmb.Height + 4; LightingQualityCmb.Width = 72; LightingQualityCmb.Height = 20; LightingQualityCmb.ReadOnly = true; LightingQualityCmb.Items.Add("Low"); LightingQualityCmb.Items.Add("Medium"); LightingQualityCmb.Items.Add("High"); LightingQualityCmb.MaxItems = 3; LightingQualityCmb.Movable = LightingQualityCmb.Resizable = false; LightingQualityCmb.OutlineMoving = LightingQualityCmb.OutlineResizing = false; LightingQualityCmb.ItemIndex = Game.LightingQuality; LightingRefreshLbl = new Label(manager); LightingRefreshLbl.Init(); LightingRefreshLbl.Parent = GraphicsPnl; LightingRefreshLbl.Left = 8; LightingRefreshLbl.Top = LightingQualityLbl.Top + LightingQualityLbl.Height + 6; LightingRefreshLbl.Width = 132; LightingRefreshLbl.Anchor = Anchors.Left; LightingRefreshLbl.Text = "Lighting Refresh Rate:"; LightingRefreshLbl.ToolTip.Text = "Adjust the lighting refresh rate. Slow will cause less lighting re-calculations, thus less lag.\nHowever, fast will have better quality but cause more lag."; LightingRefreshCmb = new ComboBox(Manager); LightingRefreshCmb.Init(); LightingRefreshCmb.Parent = GraphicsPnl; LightingRefreshCmb.Left = LightingQualityLbl.Left + LightingRefreshLbl.Width + 4; LightingRefreshCmb.Top = LightingQualityLbl.Top + LightingQualityLbl.Height + 4; LightingRefreshCmb.Width = 72; LightingRefreshCmb.Height = 20; LightingRefreshCmb.ReadOnly = true; LightingRefreshCmb.Items.Add("Slow"); LightingRefreshCmb.Items.Add("Default"); LightingRefreshCmb.Items.Add("Fast"); LightingRefreshCmb.MaxItems = 3; LightingRefreshCmb.Movable = LightingQualityCmb.Resizable = false; LightingRefreshCmb.OutlineMoving = LightingQualityCmb.OutlineResizing = false; LightingRefreshCmb.ItemIndex = Game.LightingRefresh; FullscreenChk = new CheckBox(Manager); FullscreenChk.Parent = GraphicsPnl; FullscreenChk.Init(); FullscreenChk.Left = 8; FullscreenChk.Width = 150; FullscreenChk.Height = ParticleCmb.Height; FullscreenChk.Text = "Fullscreen Mode"; FullscreenChk.Checked = Game.Fullscreen; FullscreenChk.Top = LightingRefreshCmb.Top + LightingRefreshCmb.Height + 4; DropShadowsChk = new CheckBox(Manager); DropShadowsChk.Parent = GraphicsPnl; DropShadowsChk.Init(); DropShadowsChk.Left = 8; DropShadowsChk.Width = 150; DropShadowsChk.Height = FullscreenChk.Height; DropShadowsChk.Text = "Drop Shadows"; DropShadowsChk.ToolTip.Text = "Gives blocks and collectables small shadows to display a 3D effect (Recommended: On for quality, off for performance)"; DropShadowsChk.Top = FullscreenChk.Top + FullscreenChk.Height; DropShadowsChk.Checked = Game.DropShadows; TilesidesChk = new CheckBox(Manager); TilesidesChk.Parent = GraphicsPnl; TilesidesChk.Init(); TilesidesChk.Left = 8; TilesidesChk.Width = 150; TilesidesChk.Height = FullscreenChk.Height; TilesidesChk.Text = "Tile Edges"; TilesidesChk.Checked = Game.TileEdges; TilesidesChk.ToolTip.Text = "Makes edges of tiles differ from normal tiles, (Recommended: On for quality, Decreases peformance)"; TilesidesChk.Top = DropShadowsChk.Top + DropShadowsChk.Height; AntialiasingChk = new CheckBox(Manager); AntialiasingChk.Parent = GraphicsPnl; AntialiasingChk.Init(); AntialiasingChk.Left = 8; AntialiasingChk.Width = 150; AntialiasingChk.Height = FullscreenChk.Height; AntialiasingChk.Text = "Anti-aliasing"; AntialiasingChk.Checked = Game.Antialiasing; AntialiasingChk.ToolTip.Text = "Smooths out jagged edges on lines, NOTE: Disable this if text/graphics appear extremly blurred. (Recommended: On for quality, Decreases peformance)"; AntialiasingChk.Top = TilesidesChk.Top + TilesidesChk.Height; AutosaveChk = new CheckBox(Manager); AutosaveChk.Parent = GraphicsPnl; AutosaveChk.Init(); AutosaveChk.Left = 8; AutosaveChk.Width = 150; AutosaveChk.Height = AntialiasingChk.Height; AutosaveChk.Text = "Autosave"; AutosaveChk.Checked = Game.Autosave; AutosaveChk.ToolTip.Text = "Autosaves the level every 10 minutes to prevent data loss (Recommended: On)"; AutosaveChk.Top = AntialiasingChk.Top + AntialiasingChk.Height; btnOk = new Button(manager); btnOk.Init(); btnOk.Parent = BottomPanel; btnOk.Anchor = Anchors.Top | Anchors.Right; btnOk.Top = btnOk.Parent.ClientHeight - btnOk.Height - 8; btnOk.Left = btnOk.Parent.ClientWidth - 8 - btnOk.Width * 3 - 8; btnOk.Text = "OK"; btnOk.ModalResult = ModalResult.Ok; btnOk.Click += new TomShane.Neoforce.Controls.EventHandler(btnApply_Click); btnApply = new Button(manager); btnApply.Init(); btnApply.Parent = BottomPanel; btnApply.Anchor = Anchors.Top | Anchors.Right; btnApply.Top = btnOk.Parent.ClientHeight - btnOk.Height - 8; btnApply.Left = btnOk.Parent.ClientWidth - 4 - btnOk.Width * 2 - 8; btnApply.Text = "Apply"; btnApply.Click += new TomShane.Neoforce.Controls.EventHandler(btnApply_Click); btnClose = new Button(manager); btnClose.Init(); btnClose.Parent = BottomPanel; btnClose.Anchor = Anchors.Top | Anchors.Right; btnClose.Top = btnOk.Parent.ClientHeight - btnClose.Height - 8; btnClose.Left = btnOk.Parent.ClientWidth - btnClose.Width - 8; btnClose.Text = "Cancel"; btnClose.ModalResult = ModalResult.Cancel; lblControls = new Label[Game.Controls.Count]; btnControls = new Button[Game.Controls.Count]; for (int i = 0; i < Game.Controls.Count; i++) { Label l = new Label(manager); l.Init(); l.Parent = ControlsPnl; l.Left = 8; l.Top = 2 + ((l.Height + 6) * i); l.Width = 128; l.Text = Game.Controls.ElementAt(i).Key; lblControls[i] = l; Button b = new Button(manager); b.Init(); b.Parent = ControlsPnl; b.Left = ControlsPnl.ClientWidth - 8 - b.Width; b.Top = 2 + ((l.Height + 6) * i); b.Height = 18; b.Text = Game.Controls.ElementAt(i).Value.ToString().AddSpacesToSentence(); b.Click += b_Click; btnControls[i] = b; } ControlsPnl.ClientHeight = btnControls[btnControls.Length - 1].Height + btnControls[btnControls.Length - 1].Top + 4; Height = ControlsPnl.Top + ControlsPnl.Height + BottomPanel.Height + 48; TopPanel.Visible = true; BottomPanel.Visible = true; BottomPanel.Top = ClientHeight - BottomPanel.Height; ClientWidth = ControlsPnl.Left + ControlsPnl.Width + 8; Center(); }
public TaskLauncher(Manager manager) : base(manager) { Game.CurrentGameState = Game.GameState.HomeLoggedOff; //Setup window Text = "Zarknorth Launcher"; CaptionVisible = false; TopPanel.Visible = true; BottomPanel.Visible = false; Caption.Text = "Welcome To Zarknorth!"; Description.Text = "Sign in, sign up or view the latest news!"; Description.TextColor = new Color(96, 96, 96); Caption.TextColor = Color.LightGray; Resizable = false; Movable = false; DefaultControl = txtUser; RealTop = Top; //Add feeds tab tabFeeds = new TabControl(manager); tabFeeds.Init(); tabFeeds.Left = 8; tabFeeds.Top = 8 + TopPanel.Height; tabFeeds.Width = 400; tabFeeds.Height = 164; Add(tabFeeds); //Add news item configs NewsItem.NewsItems.Clear(); //Just in case we logged in then out again NewsItem.NewsItems.Add(new NewsItem("News", "The latest news from the official Zarknorth news forum", "http://www.zarknorth.com/forum/viewforum.php?f=1", "http://www.zarknorth.com/forum/feed.php?mode=news")); NewsItem.NewsItems[0].ToolTip += delegate(object o, NewsItem n, SyndicationItem s) { return("Posted by " + s.Authors[0].Name + " " + s.PublishDate.DateTime.GetPrettyDate() + "."); }; NewsItem.NewsItems.Add(new NewsItem("Reddit", "Hottest links around the /r/Zarknorth Reddit community", "http://www.reddit.com/r/zarknorth", "http://www.reddit.com/r/Zarknorth/.rss")); NewsItem.NewsItems[1].ToolTip += delegate(object o, NewsItem n, SyndicationItem s) { //Get /u/username from html int a = s.Summary.Text.IndexOf("<a href=\"http://www.reddit.com/user/"); int b = s.Summary.Text.IndexOf("\">", a); string author = s.Summary.Text.Substring(a + 36, (b) - (a + 36)); return("Submitted by " + author + " " + s.PublishDate.DateTime.GetPrettyDate() + "."); }; NewsItem.NewsItems.Add(new NewsItem("YouTube", "Newest videos about Zarknorth on the official YouTube", "https://youtube.com/Zarknorth", "http://www.youtube.com/rss/user/Zarknorth/videos.rss")); NewsItem.NewsItems[2].ToolTip += delegate(object o, NewsItem n, SyndicationItem s) { return("Published " + s.PublishDate.DateTime.GetPrettyDate() + "."); }; //Load them for (int i = 0; i < NewsItem.NewsItems.Count; i++) { tabFeeds.AddPage(NewsItem.NewsItems[i].Name); NewsItem.NewsItems[i].Load(tabFeeds.TabPages[i]); } #region Init Controls //Add user account area grpLogin = new GroupPanel(manager); grpLogin.Init(); grpLogin.Text = "Sign In"; grpLogin.Left = 16 + tabFeeds.Width; grpLogin.Top = 8 + TopPanel.Height; grpLogin.Width = 200; grpLogin.Height = 124; grpLogin.Enabled = false; // 2018 - Disable login Add(grpLogin); //Username label_TextChanged and input lblUser = new Label(manager); lblUser.Init(); lblUser.Top = 2; lblUser.Left = 8; lblUser.Width = grpLogin.Width - 16; lblUser.Text = "Username:"******"Password:"******"Remember Me"; chkRememberMe.Top = txtPass.Top + txtPass.Height + 4; chkRememberMe.Left = 8; chkRememberMe.Width = 110; lblResetPass = new Label(manager); lblResetPass.Init(); lblResetPass.Text = "Forgot Password?"; lblResetPass.Top = lblPass.Top; lblResetPass.Width = 100; lblResetPass.Left = grpLogin.Width - lblResetPass.Width - 8; lblResetPass.TextColor = Color.SkyBlue; lblResetPass.Passive = false; lblResetPass.Visible = false; lblResetPass.MouseOver += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, TomShane.Neoforce.Controls.MouseEventArgs e) { lblResetPass.TextColor = Color.DeepSkyBlue; }); lblResetPass.MouseOut += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, TomShane.Neoforce.Controls.MouseEventArgs e) { lblResetPass.TextColor = Color.SkyBlue; }); lblResetPass.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { System.Diagnostics.Process.Start("http://zarknorth.com/profile?view=reset"); }); lblRemindUser = new Label(manager); lblRemindUser.Init(); lblRemindUser.Text = "Forgot Username?"; lblRemindUser.Top = lblUser.Top; lblRemindUser.Width = 104; lblRemindUser.Left = grpLogin.Width - lblRemindUser.Width - 8; lblRemindUser.TextColor = Color.SkyBlue; lblRemindUser.Passive = false; lblRemindUser.Visible = false; lblRemindUser.MouseOver += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, TomShane.Neoforce.Controls.MouseEventArgs e) { lblRemindUser.TextColor = Color.DeepSkyBlue; }); lblRemindUser.MouseOut += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, TomShane.Neoforce.Controls.MouseEventArgs e) { lblRemindUser.TextColor = Color.SkyBlue; }); lblRemindUser.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { System.Diagnostics.Process.Start("http://zarknorth.com/profile?view=remind"); }); //Add controls grpLogin.Add(txtUser); grpLogin.Add(txtPass); grpLogin.Add(lblPass); grpLogin.Add(lblUser); grpLogin.Add(chkRememberMe); grpLogin.Add(lblRemindUser); grpLogin.Add(lblResetPass); //Add Login and Register buttons btnLogin = new Button(manager); btnLogin.Init(); btnLogin.Left = 16 + tabFeeds.Width; btnLogin.Height = 32; btnLogin.Width = 96; btnLogin.Top = grpLogin.Height + grpLogin.Top + 6; btnLogin.Text = "Sign In"; btnLogin.Click += new TomShane.Neoforce.Controls.EventHandler(LoginClick); Add(btnLogin); btnRegister = new Button(manager); btnRegister.Init(); btnRegister.Left = 16 + tabFeeds.Width + 104; btnRegister.Height = 32; btnRegister.Width = 96; btnRegister.Top = grpLogin.Height + grpLogin.Top + 6; btnRegister.Text = "Sign Up"; btnRegister.Click += new TomShane.Neoforce.Controls.EventHandler(RegisterClick); Add(btnRegister); // 2018 btnStart = new Button(manager); btnStart.Init(); btnStart.Left = 16; btnStart.Height = 64; btnStart.Width = 256; btnStart.Text = "Start Game"; btnStart.Color = new Color(30, 255, 0); btnStart.Click += new TomShane.Neoforce.Controls.EventHandler(BypassLoginAndStartGame); Add(btnStart); // 2018 btnRegister.Enabled = btnLogin.Enabled = false; #endregion //Change dimensions based on control size Width = tabFeeds.Width + grpLogin.Width + 40; Height = tabFeeds.Height + tabFeeds.Top + 22 + 64 + 16; btnStart.Left = (Width / 2) - (btnStart.Width / 2); btnStart.Top = Height - 64 - 24; //Center window Center(); //Populate username and password fields if remember me data is present GetRememberMeData(); }
public LoginWindow(Manager manager, LoginScreen screen) : base(manager) { this.screen = screen; // Events // Listen for valid response from auth server screen.Client.Events.Network.Auth.InitReceived.AddHandler(OnInit); // Listen for failed login response from auth server screen.Client.Events.Network.Auth.FailedLogin.AddHandler(OnFailedLogin); // Setup the window CaptionVisible = false; Caption.Text = "Welcome to Bricklayer!"; Description.Text = "An open source, fully moddable and customizable 2D\nbuilding game."; Movable = false; Resizable = false; Width = 450; Height = 218; TopPanel.Height = 72; Shadow = true; Center(); // Text boxes txtUsername = new TextBox(Manager); txtUsername.Init(); txtUsername.Width = ClientWidth / 2 - 16; txtUsername.Left = 8; txtUsername.Top = TopPanel.Bottom + 8; txtUsername.Placeholder = "Username"; txtUsername.Text = screen.Client.IO.Config.Client.Username; Add(txtUsername); txtPassword = new TextBox(Manager); txtPassword.Init(); txtPassword.Width = txtUsername.Width; txtPassword.Left = txtUsername.Left; txtPassword.Top = txtUsername.Bottom + 8; txtPassword.Placeholder = "Password"; txtPassword.Text = screen.Client.IO.GetPassword(); txtPassword.Mode = TextBoxMode.Password; Add(txtPassword); chkRemember = new CheckBox(Manager); chkRemember.Init(); chkRemember.Width = txtUsername.Width; chkRemember.Left = txtUsername.Right + 16; chkRemember.Top = txtPassword.Top + 3; chkRemember.Text = "Remember Me"; chkRemember.Checked = screen.Client.IO.Config.Client.RememberMe; Add(chkRemember); // Sign in buttons btnLoginAccount = new Button(Manager); btnLoginAccount.Init(); btnLoginAccount.Width = txtUsername.Width; btnLoginAccount.Left = txtUsername.Left; btnLoginAccount.Top = 8; btnLoginAccount.Click += LoginAccountClick; btnLoginAccount.Text = "Sign in"; BottomPanel.Add(btnLoginAccount); btnLoginGuest = new Button(Manager); btnLoginGuest.Enabled = false; btnLoginGuest.Init(); btnLoginGuest.Width = btnLoginAccount.Width; btnLoginGuest.Left = btnLoginAccount.Right + 16; btnLoginGuest.Top = btnLoginAccount.Top; btnLoginGuest.Text = "Try as Guest"; BottomPanel.Add(btnLoginGuest); // Links lnkForgot = new LinkLabel(Manager); lnkForgot.Init(); lnkForgot.Width = txtUsername.Width; lnkForgot.Alignment = Alignment.MiddleCenter; lnkForgot.Left = txtUsername.Left; lnkForgot.Top = btnLoginAccount.Bottom + 8; lnkForgot.Text = "Forgot Password?"; lnkForgot.URL = Constants.Strings.ForgotPasswordURL; lnkForgot.ToolTip = new ToolTip(Manager) { Text = "A new browser window will be opened." }; BottomPanel.Add(lnkForgot); lnkCreateAccount = new LinkLabel(Manager); lnkCreateAccount.Init(); lnkCreateAccount.Width = txtUsername.Width; lnkCreateAccount.Alignment = Alignment.MiddleCenter; lnkCreateAccount.Left = btnLoginGuest.Left; lnkCreateAccount.Top = lnkForgot.Top; lnkCreateAccount.Text = "Create an account"; lnkCreateAccount.URL = Constants.Strings.CreateAccountURL; BottomPanel.Add(lnkCreateAccount); // Color selector bodyClr = new ColorPicker(Manager) { Left = txtUsername.Right + 16, Top = txtUsername.Top, Width = txtUsername.Width - 18 - 8, Saturation = 210, Value = 250 }; bodyClr.Init(); bodyClr.ValueChanged += (sender, args) => { BodyImg.Color = bodyClr.SelectedColor; // TODO: Update value in the game class }; Add(bodyClr); BodyImg = new ImageBox(Manager) { Left = bodyClr.Right + 8, Top = bodyClr.Top, Width = 18, Height = 18, Image = screen.Client.Content["entity.body"] }; BodyImg.Init(); Add(BodyImg); SmileyImg = new ImageBox(Manager) { Left = BodyImg.Left, Top = BodyImg.Top, Width = 18, Height = 18, Image = screen.Client.Content["entity.smileys"], SourceRect = new Rectangle(0, 0, 18, 18) }; SmileyImg.Init(); SmileyImg.ToolTip.Text = "I love this color!"; Add(SmileyImg); bodyClr.Hue = screen.Client.IO.Config.Client.Color; BottomPanel.Height = lnkForgot.Bottom + 28; BottomPanel.Top = Height - BottomPanel.Height; }
void AddSettingsWindow(Manager gui) { SettingsWindow = new Window(gui); SettingsWindow.Width = 300; SettingsWindow.Height = 200; SettingsWindow.CloseButtonVisible = false; SettingsWindow.Text = GlblRes.Settings; SettingsWindow.Parent = MainMenuBackground; SettingsWindow.Init(); SettingsWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); SettingsWindow.Visible = false; SettingsWindow.Resizable = false; SettingsWindow.IconVisible = false; SettingsWindow.DragAlpha = 255; SettingsWindow.Movable = false; var MusicVolumeLabel = new Label(gui); MusicVolumeLabel.Init(); MusicVolumeLabel.Width = 120; MusicVolumeLabel.Parent = SettingsWindow; MusicVolumeLabel.Text = GlblRes.Music_Volume; MusicVolumeLabel.Top = 5; MusicVolumeLabel.Left = 5; var MusicVolumeBar = new TrackBar(gui); MusicVolumeBar.Init(); MusicVolumeBar.Width = 160; MusicVolumeBar.Value = (int)(GameSettings.MusicVolume * 100); MusicVolumeBar.ValueChanged += (o, e) => { GameSettings.MusicVolume = (float)MusicVolumeBar.Value / 100f; Engine.ApplyGameSettingsVolume(); MediaPlayer.Volume = MathHelper.Clamp(GameSettings.MusicVolume, 0.0f, 1.0f); MainMenuLabel.Text = string.Empty; }; MusicVolumeBar.Top = 5; MusicVolumeBar.Left = 120; MusicVolumeBar.Parent = SettingsWindow; var SoundVolumeLabel = new Label(gui); SoundVolumeLabel.Init(); SoundVolumeLabel.Width = 120; SoundVolumeLabel.Parent = SettingsWindow; SoundVolumeLabel.Text = GlblRes.Sound_Volume; SoundVolumeLabel.Top = 30; SoundVolumeLabel.Left = 5; var SoundVolumeBar = new TrackBar(gui); SoundVolumeBar.Init(); SoundVolumeBar.Width = 160; SoundVolumeBar.Value = (int)(GameSettings.SoundEffectVolume * 100); SoundVolumeBar.ValueChanged += (o, e) => { GameSettings.SoundEffectVolume = (float)SoundVolumeBar.Value / 100f; Engine.ApplyGameSettingsVolume(); MainMenuLabel.Text = string.Empty; }; SoundVolumeBar.Top = 30; SoundVolumeBar.Left = 120; SoundVolumeBar.Parent = SettingsWindow; var BloomLabel = new Label(gui); BloomLabel.Init(); BloomLabel.Width = 120; BloomLabel.Parent = SettingsWindow; BloomLabel.Text = GlblRes.Bloom; BloomLabel.Top = 55; BloomLabel.Left = 5; var BloomCheckBox = new CheckBox(gui); BloomCheckBox.Init(); BloomCheckBox.Parent = SettingsWindow; BloomCheckBox.Text = string.Empty; BloomCheckBox.Checked = GameSettings.Bloom; BloomCheckBox.CheckedChanged += (o, e) => { GameSettings.Bloom = BloomCheckBox.Checked; MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; BloomCheckBox.Top = 55; BloomCheckBox.Left = 120; var VSyncLabel = new Label(gui); VSyncLabel.Init(); VSyncLabel.Width = 120; VSyncLabel.Parent = SettingsWindow; VSyncLabel.Text = GlblRes.VSync; VSyncLabel.Top = 80; VSyncLabel.Left = 5; var VSyncCheckBox = new CheckBox(gui); VSyncCheckBox.Init(); VSyncCheckBox.Parent = SettingsWindow; VSyncCheckBox.Text = string.Empty; VSyncCheckBox.Checked = GameSettings.VSync; VSyncCheckBox.CheckedChanged += (o, e) => { GameSettings.VSync = VSyncCheckBox.Checked; MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; VSyncCheckBox.Top = 80; VSyncCheckBox.Left = 120; var DisplayModeLabel = new Label(gui); DisplayModeLabel.Init(); DisplayModeLabel.Width = 120; DisplayModeLabel.Parent = SettingsWindow; DisplayModeLabel.Text = GlblRes.Display_Mode; DisplayModeLabel.Top = 105; DisplayModeLabel.Left = 5; var DisplayModeCombo = new ComboBox(gui); DisplayModeCombo.Init(); DisplayModeCombo.Items = GetDisplayModes(); DisplayModeCombo.Width = 120; DisplayModeCombo.Parent = SettingsWindow; DisplayModeCombo.Width = 160; DisplayModeCombo.Text = DisplayModeToString(GameSettings.DisplayMode); DisplayModeCombo.ItemIndexChanged += (o, e) => { GameSettings.DisplayMode = StringToDisplayMode(DisplayModeCombo.Text); MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; DisplayModeCombo.Top = 105; DisplayModeCombo.Left = 120; var Bevel = new Bevel(gui); Bevel.Parent = SettingsWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = SettingsWindow.ClientHeight - Bevel.Height; Bevel.Width = SettingsWindow.ClientWidth; var OKButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); OKButton.Init(); OKButton.Parent = Bevel; OKButton.Text = GlblRes.OK; OKButton.Click += (s, e) => { SettingsWindow.Close(); ShowLogo(true); GameSettings.Save(Engine.Game.SaveGameFolder); }; OKButton.Width = 130; OKButton.Left = 150; OKButton.Top = 5; gui.Add(SettingsWindow); }
public TaskControls(Manager manager) : base(manager) { MinimumWidth = 340; MinimumHeight = 140; Height = 480; Center(); Text = "Controls Test"; TopPanel.Visible = true; Caption.Text = "Information"; Description.Text = "Demonstration of various controls available in Window Library"; Caption.TextColor = Description.TextColor = new Color(96, 96, 96); grpEdit = new GroupPanel(Manager); grpEdit.Init(); grpEdit.Parent = this; grpEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; grpEdit.Width = ClientWidth - 200; grpEdit.Height = 160; grpEdit.Left = 8; grpEdit.Top = TopPanel.Height + 8; grpEdit.Text = "EditBox"; pnlControls = new Panel(Manager); pnlControls.Init(); pnlControls.Passive = true; pnlControls.Parent = this; pnlControls.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; pnlControls.Left = 8; pnlControls.Top = grpEdit.Top + grpEdit.Height + 8; pnlControls.Width = ClientWidth - 200; pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top; pnlControls.BevelBorder = EBevelBorder.All; pnlControls.BevelMargin = 1; pnlControls.BevelStyle = EBevelStyle.Etched; pnlControls.Color = Color.Transparent; lblEdit = new Label(manager); lblEdit.Init(); lblEdit.Parent = grpEdit; lblEdit.Left = 16; lblEdit.Top = 8; lblEdit.Text = "Testing field:"; lblEdit.Width = 128; lblEdit.Height = 16; txtEdit = new TextBox(manager); txtEdit.Init(); txtEdit.Parent = grpEdit; txtEdit.Left = 16; txtEdit.Top = 24; txtEdit.Width = grpEdit.ClientWidth - 32; txtEdit.Height = 20; txtEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom; txtEdit.Text = "Text"; rdbNormal = new RadioButton(manager); rdbNormal.Init(); rdbNormal.Parent = grpEdit; rdbNormal.Left = 16; rdbNormal.Top = 52; rdbNormal.Width = grpEdit.ClientWidth - 32; rdbNormal.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbNormal.Checked = true; rdbNormal.Text = "Normal mode"; rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control."; rdbNormal.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); rdbPassword = new RadioButton(manager); rdbPassword.Init(); rdbPassword.Parent = grpEdit; rdbPassword.Left = 16; rdbPassword.Top = 68; rdbPassword.Width = grpEdit.ClientWidth - 32; rdbPassword.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbPassword.Checked = false; rdbPassword.Text = "Password mode"; rdbPassword.ToolTip.Text = "Enables password mode for TextBox control."; rdbPassword.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); chkBorders = new CheckBox(manager); chkBorders.Init(); chkBorders.Parent = grpEdit; chkBorders.Left = 16; chkBorders.Top = 96; chkBorders.Width = grpEdit.ClientWidth - 32; chkBorders.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkBorders.Checked = false; chkBorders.Text = "Borderless mode"; chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control."; chkBorders.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkBorders_CheckedChanged); chkReadOnly = new CheckBox(manager); chkReadOnly.Init(); chkReadOnly.Parent = grpEdit; chkReadOnly.Left = 16; chkReadOnly.Top = 110; chkReadOnly.Width = grpEdit.ClientWidth - 32; chkReadOnly.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkReadOnly.Checked = false; chkReadOnly.Text = "Read only mode"; chkReadOnly.ToolTip.Text = "Enables or disables read only mode for TextBox control.\nThis mode is necessary to enable explicitly."; chkReadOnly.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkReadOnly_CheckedChanged); string[] colors = new string[] {"Red", "Green", "Blue", "Yellow", "Orange", "Purple", "White", "Black", "Magenta", "Cyan", "Brown", "Aqua", "Beige", "Coral", "Crimson", "Gray", "Azure", "Ivory", "Indigo", "Khaki", "Orchid", "Plum", "Salmon", "Silver", "Gold", "Pink", "Linen", "Lime", "Olive", "Slate"}; spnMain = new SpinBox(manager, ESpinBoxMode.List); spnMain.Init(); spnMain.Parent = pnlControls; spnMain.Left = 16; spnMain.Top = 16; spnMain.Width = pnlControls.Width - 32; spnMain.Height = 20; spnMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; spnMain.Items.AddRange(colors); spnMain.Mode = ESpinBoxMode.Range; spnMain.ItemIndex = 0; cmbMain = new ComboBox(manager); cmbMain.Init(); cmbMain.Parent = pnlControls; cmbMain.Left = 16; cmbMain.Top = 44; cmbMain.Width = pnlControls.Width - 32; cmbMain.Height = 20; cmbMain.ReadOnly = true; cmbMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; cmbMain.Items.AddRange(colors); cmbMain.ItemIndex = 0; cmbMain.MaxItems = 5; cmbMain.ToolTip.Color = Color.Yellow; cmbMain.Movable = cmbMain.Resizable = true; cmbMain.OutlineMoving = cmbMain.OutlineResizing = true; trkMain = new TrackBar(manager); trkMain.Init(); trkMain.Parent = pnlControls; trkMain.Left = 16; trkMain.Top = 72; trkMain.Width = pnlControls.Width - 32; trkMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; trkMain.Range = 64; trkMain.Value = 16; trkMain.ValueChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(trkMain_ValueChanged); lblTrack = new Label(manager); lblTrack.Init(); lblTrack.Parent = pnlControls; lblTrack.Left = 16; lblTrack.Top = 96; lblTrack.Width = pnlControls.Width - 32; lblTrack.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; lblTrack.Alignment = EAlignment.TopRight; lblTrack.TextColor = new Color(32, 32, 32); trkMain_ValueChanged(this, null); // forcing label redraw with init values mnuListBox = new ContextMenu(manager); MenuItem i1 = new MenuItem("This is very long text"); MenuItem i2 = new MenuItem("Menu", true); MenuItem i3 = new MenuItem("Item", false); //i3.Enabled = false; MenuItem i4 = new MenuItem("Separated", true); MenuItem i11 = new MenuItem(); MenuItem i12 = new MenuItem(); MenuItem i13 = new MenuItem(); MenuItem i14 = new MenuItem(); MenuItem i111 = new MenuItem(); MenuItem i112 = new MenuItem(); MenuItem i113 = new MenuItem(); mnuListBox.Items.AddRange(new MenuItem[] { i1, i2, i3, i4 }); i2.Items.AddRange(new MenuItem[] { i11, i12, i13, i14 }); i13.Items.AddRange(new MenuItem[] { i111, i112, i113 }); lstMain = new ListBox(manager); lstMain.Init(); lstMain.Parent = this; lstMain.Top = TopPanel.Height + 8; lstMain.Left = grpEdit.Left + grpEdit.Width + 8; lstMain.Width = ClientWidth - lstMain.Left - 8; lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height; lstMain.Anchor = EAnchors.Top | EAnchors.Right | EAnchors.Bottom; lstMain.HideSelection = false; lstMain.Items.AddRange(colors); lstMain.ContextMenu = mnuListBox; prgMain = new ProgressBar(manager); prgMain.Init(); prgMain.Parent = this.BottomPanel; prgMain.Left = lstMain.Left; prgMain.Top = 10; prgMain.Width = lstMain.Width; prgMain.Height = 16; prgMain.Anchor = EAnchors.Top | EAnchors.Right; prgMain.Mode = EProgressBarMode.Infinite; prgMain.Passive = false; btnDisable = new Button(manager); btnDisable.Init(); btnDisable.Parent = BottomPanel; btnDisable.Left = 8; btnDisable.Top = 8; btnDisable.Text = "Disable"; btnDisable.Click += new Controls.EventHandler(btnDisable_Click); btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200); btnProgress = new Button(manager); btnProgress.Init(); btnProgress.Parent = BottomPanel; btnProgress.Left = prgMain.Left - 16; btnProgress.Top = prgMain.Top; btnProgress.Height = 16; btnProgress.Width = 16; btnProgress.Text = "!"; btnProgress.Anchor = EAnchors.Top | EAnchors.Right; btnProgress.Click += new Controls.EventHandler(btnProgress_Click); mnuMain = new MainMenu(manager); mnuMain.Items.Add(i2); mnuMain.Items.Add(i13); mnuMain.Items.Add(i3); mnuMain.Items.Add(i4); MainMenu = mnuMain; ToolBarPanel tlp = new ToolBarPanel(manager); ToolBarPanel = tlp; ToolBar tlb = new ToolBar(manager); ToolBar tlbx = new ToolBar(manager); tlb.FullRow = true; tlbx.Row = 1; tlbx.FullRow = false; tlp.Add(tlb); tlp.Add(tlbx); /* tlb.Init(); tlb.Width = 256; tlb.Parent = ToolBarPanel;*/ //tlbx.Init(); /* tlbx.Width = 512; tlbx.Top = 25; tlbx.Parent = ToolBarPanel;*/ /* ToolBarButton tb1 = new ToolBarButton(manager); tb1.Init(); tb1.Parent = tlb; tb1.Left = 10; tb1.Top = 1; tb1.Glyph = new Glyph(Manager.Skin.Images["Icon.Warning"].Resource); tb1.Glyph.SizeMode = SizeMode.Stretched; */ StatusBar stb = new StatusBar(Manager); StatusBar = stb; DefaultControl = txtEdit; OutlineMoving = true; OutlineResizing = true; BottomPanel.BringToFront(); SkinChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(TaskControls_SkinChanged); TaskControls_SkinChanged(null, null); }
private void InitRes() { pnlRes = new SideBarPanel(Manager); pnlRes.Init(); pnlRes.Passive = true; pnlRes.Parent = sidebar; pnlRes.Left = 16; pnlRes.Top = 16; pnlRes.Width = sidebar.Width - pnlRes.Left; pnlRes.Height = 86; pnlRes.CanFocus = false; rdbRes1024 = new RadioButton(Manager); rdbRes1024.Init(); rdbRes1024.Parent = pnlRes; rdbRes1024.Left = 8; rdbRes1024.Width = pnlRes.Width - rdbRes1024.Left * 2; rdbRes1024.Height = 16; rdbRes1024.Text = "Resolution 1024x768"; rdbRes1024.Top = 8; rdbRes1024.Checked = true; rdbRes1280 = new RadioButton(Manager); rdbRes1280.Init(); rdbRes1280.Parent = pnlRes; rdbRes1280.Left = rdbRes1024.Left; rdbRes1280.Width = rdbRes1024.Width; rdbRes1280.Height = rdbRes1024.Height; rdbRes1280.Text = "Resolution 1280x1024"; rdbRes1280.Top = 24; rdbRes1680 = new RadioButton(Manager); rdbRes1680.Init(); rdbRes1680.Parent = pnlRes; rdbRes1680.Left = rdbRes1024.Left; rdbRes1680.Width = rdbRes1024.Width; rdbRes1680.Height = rdbRes1024.Height; rdbRes1680.Text = "Resolution 1680x1050"; rdbRes1680.Top = 40; chkResFull = new CheckBox(Manager); chkResFull.Parent = pnlRes; chkResFull.Init(); chkResFull.Left = rdbRes1024.Left; chkResFull.Width = rdbRes1024.Width; chkResFull.Height = rdbRes1024.Height; chkResFull.Text = "Fullscreen Mode"; chkResFull.Top = 64; btnApply = new Button(Manager); btnApply.Init(); btnApply.Width = 80; btnApply.Parent = sidebar; btnApply.Left = pnlRes.Left; btnApply.Top = pnlRes.Top + pnlRes.Height + 8; btnApply.Text = "Apply"; btnApply.Click += new Controls.EventHandler(btnApply_Click); btnExit = new Button(Manager); btnExit.Init(); btnExit.Width = 80; btnExit.Parent = sidebar; btnExit.Left = btnApply.Left + btnApply.Width + 8; btnExit.Top = pnlRes.Top + pnlRes.Height + 8; btnExit.Text = "Exit"; btnExit.Click += new Controls.EventHandler(btnExit_Click); }