protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); ngui = Gui as NeoforceGui; manager = ngui.Manager; Window window = new Window(manager); window.Init(); window.Text = "Options"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; Button button = new Button(manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); manager.Add(window); }
protected override void CreateButtons() { base.CreateButtons(); DenyButton.Text = "No"; AffirmButton = new Button(Manager) { Text = "Yes", Top = yPos, Parent = this, }; AffirmButton.Init(); Add(AffirmButton); if (AutoClose) { AffirmButton.Click += (sender, args) => Close(); } Manager.Add(this); // Align the buttons beside each other const int buttonGap = 20; var totalButtonWidth = DenyButton.Width + AffirmButton.Width + buttonGap; var buttonPosLeft = (Width / 2) - (totalButtonWidth / 2); AffirmButton.Left = buttonPosLeft; buttonPosLeft += AffirmButton.Width + buttonGap; DenyButton.Left = buttonPosLeft; }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Construstors ////// //////////////////////////////////////////////////////////////////////////// public ScrollBar(Manager manager, Orientation orientation) : base(manager) { this.orientation = orientation; CanFocus = false; if (orientation == Orientation.Horizontal) { strButton = "ScrollBar.ButtonHorz"; strRail = "ScrollBar.RailHorz"; strSlider = "ScrollBar.SliderHorz"; strGlyph = "ScrollBar.GlyphHorz"; strMinus = "ScrollBar.ArrowLeft"; strPlus = "ScrollBar.ArrowRight"; MinimumHeight = 16; MinimumWidth = 46; Width = 64; Height = 16; } else { strButton = "ScrollBar.ButtonVert"; strRail = "ScrollBar.RailVert"; strSlider = "ScrollBar.SliderVert"; strGlyph = "ScrollBar.GlyphVert"; strMinus = "ScrollBar.ArrowUp"; strPlus = "ScrollBar.ArrowDown"; MinimumHeight = 46; MinimumWidth = 16; Width = 16; Height = 64; } btnMinus = new Button(Manager); btnMinus.Init(); btnMinus.Text = ""; btnMinus.MousePress += new MouseEventHandler(ArrowPress); btnMinus.CanFocus = false; btnSlider = new Button(Manager); btnSlider.Init(); btnSlider.Text = ""; btnSlider.CanFocus = false; btnSlider.MinimumHeight = 16; btnSlider.MinimumWidth = 16; btnPlus = new Button(Manager); btnPlus.Init(); btnPlus.Text = ""; btnPlus.MousePress += new MouseEventHandler(ArrowPress); btnPlus.CanFocus = false; btnSlider.Move += new MoveEventHandler(btnSlider_Move); Add(btnMinus); Add(btnSlider); Add(btnPlus); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Methods /////////// //////////////////////////////////////////////////////////////////////////// protected override void Initialize() { base.Initialize(); // Create and setup Window control. window = new Window(Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. button = new Button(Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; // Add the window control to the manager processing queue. Manager.Add(window); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Constructors ////// //////////////////////////////////////////////////////////////////////////// public Window(Manager manager): base(manager) { CheckLayer(Skin, lrWindow); CheckLayer(Skin, lrCaption); CheckLayer(Skin, lrFrameTop); CheckLayer(Skin, lrFrameLeft); CheckLayer(Skin, lrFrameRight); CheckLayer(Skin, lrFrameBottom); CheckLayer(Manager.Skin.Controls[skButton], lrButton); CheckLayer(Manager.Skin.Controls[skShadow], lrShadow); SetDefaultSize(640, 480); SetMinimumSize(100, 75); btnClose = new Button(manager); btnClose.Skin = new SkinControl(Manager.Skin.Controls[skButton]); btnClose.Init(); btnClose.Detached = true; btnClose.CanFocus = false; btnClose.Text = null; btnClose.Click += new EventHandler(btnClose_Click); btnClose.SkinChanged += new EventHandler(btnClose_SkinChanged); AdjustMargins(); AutoScroll = true; Movable = true; Resizable = true; Center(); Add(btnClose, false); oldAlpha = Alpha; }
private UnitInfoDialog(Manager manager) : base(manager) { Init(); Height = 300; Width = 500; txtBox = new TextBox(manager); txtBox.Init(); txtBox.Width = ClientWidth; txtBox.Height = ClientHeight - 30; txtBox.Left = 0; txtBox.Top = 0; txtBox.Parent = this; okButton = new Button(manager); okButton.Init(); okButton.Text = "OK"; okButton.Width = txtBox.Width; ; okButton.Height = 30; okButton.Top = txtBox.Height; okButton.Parent = this; okButton.Click += new TomShane.Neoforce.Controls.EventHandler(okButton_Click); manager.Add(this); }
public virtual void CreatePlayerInfo(Manager manager, Player player, Control control, ref int yPos) { var playerAvatar = player.Avatar; var imageIcon = new Button(manager) { Glyph = new Glyph(playerAvatar), Height = (int)(playerAvatar.Height / 1.5), Width = (int)(playerAvatar.Width / 1.5), Left = 16, Top = 16, Parent = control, Color = player.PlayerColor, Name = IgnoreString }; imageIcon.Init(); imageIcon.FocusGained += (sender, args) => imageIcon.Enabled = false; var descriptionText = new Label(manager) { Left = imageIcon.Left + imageIcon.Width + 16, Width = 200, Height = imageIcon.Height, Top = 25, Text = String.Format( "Player Name : {0}\n\n" + "Player Cash : ${1:N0}\n\n" + "Player Total Worth : ${2:N0}\n\n" + "Player Position : {3:N0}\n\n", player.Name, player.Cash, player.TotalValue, PlayerPos(player)), Alignment = Alignment.TopLeft, Parent = control, Name = IgnoreString }; descriptionText.Init(); yPos = imageIcon.Top + imageIcon.Height + 16; }
public override void Initialize() { base.Initialize(); const int Padding = 50; int top = Padding; const int buttonWidth = 200; const int buttonHeight = 50; var menuInfos = new[] { new Tuple<string, EventHandler>("Load Existing World", (sender, args) =>ShowExistingWorld()), new Tuple<string, EventHandler>("Create New World", (sender, args) => ShowNewWorld()), new Tuple<string, EventHandler>("Return", (sender, args) => ScreenManager.SwapScreens(this, Constants.ScreenNames.MainMenu)) }; foreach (var menuInfo in menuInfos) { var menuButton = new Button(ControlManager.Manager) { Text = menuInfo.Item1, Top = top, Left = Padding, Width = buttonWidth, Height = buttonHeight }; menuButton.Init(); menuButton.Click += menuInfo.Item2; top += menuButton.Height + Padding; ControlManager.Add(menuButton); } }
public CollapsePanel(Manager manager, Control parent, string Name, int expandedHeight = 100, bool extended = true) { this.panel = new GroupPanel(manager); panel.Init(); panel.Height = expandedHeight; panel.Width = parent.Width - 20; panel.Resizable = true; //panel.Text = " " + Name.Trim(); Text = Name; this.collapseButton = new Button(manager); collapseButton.Init(); collapseButton.Width = 15; collapseButton.Height = 18; collapseButton.Text = "^"; collapseButton.Click += collapseButton_Click; this.ExpandedHeight = expandedHeight; this.panelControls = new Dictionary<string, Control>(); this.parent = parent; parent.Add(panel); parent.Add(collapseButton); this.IsExtended = extended; parent.Refresh(); }
public override void Initialize() { base.Initialize(); int top = padding; const int buttonWidth = 200; const int buttonHeight = 50; playerObjectEditors = new ObjectEditor<Player>[maxPlayers]; tabs = new TabControl(ControlManager.Manager); tabs.Init(); tabs.SetPosition(300, 50); int width = (int)(ScreenWidth * 0.75f); int height = (int)(ScreenHeight * 0.75f); tabs.MinimumHeight = height; tabs.MinimumWidth = width; var playGame = new Button(ControlManager.Manager) { Text = "Play Game", Left = padding, Top = padding, Width = buttonWidth, Height = buttonHeight}; playGame.Init(); playGame.Click += (sender, args) => StartGame(); top += playGame.Height + padding; var addPlayer = new Button(ControlManager.Manager) { Text = "Add Player", Left = padding, Top = top, Width = buttonWidth, Height = buttonHeight }; addPlayer.Init(); addPlayer.Click += (sender, args) => AddPlayer(); top += addPlayer.Height+padding; var removePlayer = new Button(ControlManager.Manager) { Text = "Remove Player", Left = padding, Top = top, Width = buttonWidth, Height = buttonHeight }; removePlayer.Init(); removePlayer.Click += (sender, args) => RemovePlayer(); top += addPlayer.Height + padding; var backButton = new Button(ControlManager.Manager) { Text = "Main Menu", Left = padding, Top = top, Width = buttonWidth, Height = buttonHeight }; backButton.Init(); backButton.Click += (sender, args) => ScreenManager.SwapScreens(this, Constants.ScreenNames.MainMenu); ControlManager.Add(tabs); ControlManager.Add(addPlayer); ControlManager.Add(removePlayer); ControlManager.Add(playGame); ControlManager.Add(backButton); gameInfoTab = tabs.AddPage(); PopulateGameInfo(gameInfoTab); for (var i = 0; i < minPlayers; i++) { AddPlayer(); } SwitchToTab(0); }
//, Control under) public LoadLevelWindow(Sidebar sidebar) { previouslyPaused = sidebar.ui.IsPaused; sidebar.ui.IsPaused = true; sidebar.master.Visible = false; Control par = sidebar.tbcViews.TabPages[0]; UserInterface.GameInputDisabled = true; this.manager = sidebar.manager; this.sidebar = sidebar; tomShaneSidebar = new TomShaneSidebar(manager); tomShaneSidebar.Init(); tomShaneSidebar.Left = sidebar.master.Left; tomShaneSidebar.Width = par.Width; tomShaneSidebar.Top = 20; tomShaneSidebar.Height = par.Height + 15; tomShaneSidebar.BevelBorder = BevelBorder.All; tomShaneSidebar.BevelColor = Color.Black; tomShaneSidebar.Left = LeftPadding; tomShaneSidebar.Text = "Load Level"; tomShaneSidebar.BackColor = new Color(30, 60, 30); manager.Add(tomShaneSidebar); wallGroup = sidebar.room.groups.walls; foreach(Node n in wallGroup.entities) { previousWallNodes.Add(n); } TitlePanel titlePanelAddComponent = new TitlePanel(sidebar, tomShaneSidebar, "Load Level", false); //titlePanelAddComponent.btnBack.Click += Close; HeightCounter += titlePanelAddComponent.Height; normalView = new NormalView(sidebar, tomShaneSidebar, 0, 100, Height: 350); normalView.Width -= 15; PopulateLevelSaves(); normalView.OnSelectionChanged += normalView_OnSelectionChanged; btnLoad = new Button(manager); btnLoad.Init(); tomShaneSidebar.Add(btnLoad); btnLoad.Text = "Load"; btnLoad.Top = 500; btnLoad.Left = LeftPadding * 4; btnLoad.Width = 70; btnLoad.Click += btnLoad_Click; btnCancel = new Button(manager); btnCancel.Init(); tomShaneSidebar.Add(btnCancel); btnCancel.Text = "Cancel"; btnCancel.Top = 500; btnCancel.Left = btnLoad.Left + btnLoad.Width + 50; btnCancel.Width = 70; btnCancel.Click += btnCancel_Click; }
public override void LoadContent(ContentManager contentloader) { _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default"); _guiman.Initialize(); _settingsmenu = new Window(_guiman); _settingsmenu.Init(); _settingsmenu.Resizable = false; _settingsmenu.Movable = false; _settingsmenu.CloseButtonVisible = false; _settingsmenu.Text = "Settings Menu"; _settingsmenu.Width = 300; _settingsmenu.Height = 400; _settingsmenu.Center(); _settingsmenu.Visible = true; _settingsmenu.BorderVisible = true; _settingsmenu.Cursor = _guiman.Skin.Cursors["Default"].Resource; _back = new Button(_guiman); _back.Init(); _back.Text = "Go Back"; _back.Width = 200; _back.Height = 50; _back.Left = 50; _back.Top = 300; _back.Anchor = Anchors.Bottom; _back.Parent = _settingsmenu; _playername = new TextBox(_guiman); _playername.Init(); _playername.Text = _gamemanager.Pbag.Player.Name; _playername.Width = 200; _playername.Height = 50; _playername.Left = 50; _playername.Top = 0; _playername.Anchor = Anchors.Bottom; _playername.Parent = _settingsmenu; _volume = new ScrollBar(_guiman, Orientation.Horizontal); _volume.Init(); //Todo check why volume.value is reseting it to 50 :S _volume.Value = _gamemanager.Audiomanager.GetVolume(); _volume.Range = 100; _volume.PageSize = 10; _volume.StepSize = 1; _volume.Width = 200; _volume.Height = 50; _volume.Left = 50; _volume.Top = 50; _volume.Anchor = Anchors.Bottom; _volume.Parent = _settingsmenu; _guiman.Add(_settingsmenu); _gamemanager.Game.IsMouseVisible = true; }
/// <summary> /// Shows the simple input dialog. /// </summary> public void ShowSimpleInputDialog(Manager manager, string caption, string text, string initialValue, TomShane.Neoforce.Controls.EventHandler okBtnEventHandler) { window = new Window(manager); window.Init(); window.Width = 450; window.Height = 150; window.Text = caption; window.Closing += OnSimpleInputDialogClosing; window.Visible = true; Label label = new Label(manager); label.Init(); label.Text = text; label.Width = 400; label.Height = 20; label.Left = 5; label.Top = 5; label.Parent = window; TextBox textBox = new TextBox(manager); textBox.Init(); textBox.Width = 400; textBox.Height = 20; textBox.Left = 5; textBox.Top = 40; textBox.Text = initialValue; textBox.Parent = window; Button btnSimpleInputDialogOk = new Button(manager); btnSimpleInputDialogOk.Init(); btnSimpleInputDialogOk.Text = "Ok"; btnSimpleInputDialogOk.Width = 100; btnSimpleInputDialogOk.Height = 30; btnSimpleInputDialogOk.Left = 5; btnSimpleInputDialogOk.Top = 75; btnSimpleInputDialogOk.Click += okBtnEventHandler; btnSimpleInputDialogOk.Click += OnClickBtnSimpleInputDialogOk; btnSimpleInputDialogOk.Tag = textBox; // Textbox as Tag, to access the value btnSimpleInputDialogOk.Parent = window; Button btnSimpleInputDialogCancel = new Button(manager); btnSimpleInputDialogCancel.Init(); btnSimpleInputDialogCancel.Text = "Cancel"; btnSimpleInputDialogCancel.Width = 100; btnSimpleInputDialogCancel.Height = 30; btnSimpleInputDialogCancel.Left = 110; btnSimpleInputDialogCancel.Top = 75; btnSimpleInputDialogCancel.Click += OnClickBtnSimpleInputDialogCancel; btnSimpleInputDialogCancel.Parent = window; manager.Add(window); }
public override void LoadContent(ContentManager contentloader) { _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default"); _guiman.Initialize(); _mainmenu = new Window(_guiman); _mainmenu.Init(); _mainmenu.Resizable = false; _mainmenu.Movable = false; _mainmenu.CloseButtonVisible = false; _mainmenu.Text = "Main Menu"; _mainmenu.Width = 300; _mainmenu.Height = 400; _mainmenu.Center(); _mainmenu.Visible = true; _mainmenu.BorderVisible = true; //mainmenu.Cursor = guiman.Skin.Cursors["Default"].Resource; _play = new Button(_guiman); _play.Init(); _play.Text = "Play"; _play.Width = 200; _play.Height = 50; _play.Left = 50; _play.Top = 0; _play.Anchor = Anchors.Bottom; _play.Parent = _mainmenu; _settings = new Button(_guiman); _settings.Init(); _settings.Text = "Settings"; _settings.Width = 200; _settings.Height = 50; _settings.Left = 50; _settings.Top = 50; _settings.Anchor = Anchors.Bottom; _settings.Parent = _mainmenu; _exit = new Button(_guiman); _exit.Init(); _exit.Text = "Exit"; _exit.Width = 200; _exit.Height = 50; _exit.Left = 50; _exit.Top = 100; _exit.Anchor = Anchors.Bottom; _exit.Parent = _mainmenu; _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource; _guiman.Add(_mainmenu); _gamemanager.Game.IsMouseVisible = true; }
public CreateWorldDialog(Manager manager, LobbyWindow parent) : base(manager) { roomList = parent; //Setup the window Text = "Create World"; TopPanel.Visible = false; Resizable = false; Width = 250; Height = 190; Center(); //Add controls lblName = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 }; lblName.Init(); Add(lblName); txtName = new TextBox(manager) { Left = 8, Top = lblName.Bottom + 4, Width = this.ClientWidth - 16 }; txtName.Init(); txtName.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { if (txtName.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength) txtName.Text = txtName.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength); }); Add(txtName); lblDescription = new Label(manager) { Left = 8, Top = txtName.Bottom + 4, Text = "Description:", Width = this.ClientWidth - 16 }; lblDescription.Init(); Add(lblDescription); txtDescription = new TextBox(manager) { Left = 8, Top = lblDescription.Bottom + 4, Width = this.ClientWidth - 16, Height = 34, Mode = TextBoxMode.Multiline, ScrollBars = ScrollBars.None }; txtDescription.Init(); txtDescription.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { //Filter the text by checking for length and lines if (txtDescription.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength) txtDescription.Text = txtDescription.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength); int newLines = txtDescription.Text.Count(c => c == '\n'); if (newLines >= Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLines) { txtDescription.Text = txtDescription.Text.Substring(0, txtDescription.Text.Length - 1); txtDescription.CursorPosition = 0; } }); Add(txtDescription); createBtn = new Button(manager) { Top = 8, Text = "Create" }; createBtn.Init(); createBtn.Left = (Width / 2) - (createBtn.Width / 2); createBtn.Click += CreateBtn_Click; BottomPanel.Add(createBtn); }
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public SelectPlayerNumberDialog(Manager manager) : base(manager) { Center(); Text = "Select Player Number"; Icon = IconProvider.ApplicationIcon; TopPanel.Visible = true; Caption.Text = "Information"; Description.Text = "Demonstration of various controls available in Neoforce Controls library."; Caption.TextColor = Description.TextColor = new Color(96, 96, 96); lstMain = new ImageListBox(manager); lstMain.Init(); lstMain.Parent = this; lstMain.Top = TopPanel.Height + 8; lstMain.Left = 8; lstMain.Width = ClientWidth - lstMain.Left - 8; lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height; lstMain.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom; lstMain.HideSelection = false; lstMain.Items.AddRange(entities); 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; btnClose = new Button(manager); btnClose.Init(); btnClose.Parent = BottomPanel; btnClose.Anchor = Anchors.Top | Anchors.Right; btnClose.Top = btnOk.Parent.ClientHeight - btnOk.Height - 8; btnClose.Left = btnOk.Parent.ClientWidth - 4 - btnOk.Width * 2 - 8; btnClose.Text = "Cancel"; btnClose.ModalResult = TomShane.Neoforce.Controls.ModalResult.Cancel; DefaultControl = lstMain; OutlineMoving = true; OutlineResizing = true; BottomPanel.BringToFront(); }
public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address) : base(manager) { //Are we editing a server or adding one (They use same dialog) Edit = edit; Index = index; ServerList = parent; //Setup the window Text = Edit ? "Edit Server" : "Add Server"; TopPanel.Visible = false; Resizable = false; Width = 250; Height = 180; Center(); //Add controls NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 }; NameLbl.Init(); Add(NameLbl); NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 }; NameTxt.Init(); NameTxt.Text = name; NameTxt.TextChanged += NameTxt_TextChanged; Add(NameTxt); AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8, Text = string.Format("Address: (Default port is {0})", Bricklayer.Common.GlobalSettings.DefaultPort), Width = this.ClientWidth - 16 }; AddressLbl.Init(); Add(AddressLbl); AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 }; AddressTxt.Init(); AddressTxt.Text = address; AddressTxt.TextChanged += AddressTxt_TextChanged; Add(AddressTxt); SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", }; SaveBtn.Init(); SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2); SaveBtn.Click += SaveBtn_Click; SaveBtn.Enabled = false; BottomPanel.Add(SaveBtn); if (Edit) Validate(); //Validate existing text }
public override void Add(ScreenManager screenManager) { base.Add(screenManager); Window.Focused = true; Bar = new StatusBar(Manager) { Top = Window.Height - 24, Width = Window.Width }; Bar.Init(); Window.Add(Bar); StatsLabel = new Label(Manager) { Top = 4, Left = 8, Width = Window.Width - 16, Text = "" }; StatsLabel.Init(); Bar.Add(StatsLabel); LeaveButton = new Button(Manager) { Right = Bar.ClientWidth - 4, Top = 4, Height = 16, Text = "Lobby" }; LeaveButton.Init(); LeaveButton.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { ScreenManager.SwitchScreen(new LobbyScreen()); }); Bar.Add(LeaveButton); Sidebar = new StatusBar(Manager); Sidebar.Init(); Sidebar.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height))); Sidebar.SetPosition(Window.Width - Sidebar.Width, 0); Window.Add(Sidebar); PlayerList = new ListBox(Manager); PlayerList.Init(); PlayerList.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height - 4) * .25f)); PlayerList.SetPosition(1, 2); Sidebar.Add(PlayerList); ChatBox = new Console(Manager); Manager.Add(ChatBox); ChatBox.Init(); ChatBox.SetSize(PlayerList.Width, (int)((Window.Height - Bar.Height - 4) * .75f)); ChatBox.SetPosition(Sidebar.Left + 1, PlayerList.Bottom + 1); ChatBox.ChannelsVisible = false; ChatBox.MessageSent += new ConsoleMessageEventHandler(SentChat); ChatBox.Channels.Add(new ConsoleChannel(0, "Global", Color.White)); // Select default channel ChatBox.SelectedChannel = 0; // Do we want to add timestamp or channel name at the start of every message? ChatBox.MessageFormat = ConsoleMessageFormats.None; ChatBox.TextBox.TextChanged += TextBox_TextChanged; //Hide them until we recieve the Init packet ChatBox.Visible = PlayerList.Visible = Sidebar.Visible = false; }
//////////////////////////////////////////////////////////////////////////// public TaskEvents(Manager manager) : base(manager) { Height = 360; MinimumHeight = 99; MinimumWidth = 78; Text = "Events Test"; Center(); btn = new Button(manager); btn.Init(); btn.Parent = this; btn.Left = 20; btn.Top = 20; btn.MouseMove += new MouseEventHandler(btn_MouseMove); btn.MouseDown += new MouseEventHandler(btn_MouseDown); btn.MouseUp += new MouseEventHandler(btn_MouseUp); btn.MouseOver += new MouseEventHandler(btn_MouseOver); btn.MouseOut += new MouseEventHandler(btn_MouseOut); btn.MousePress += new MouseEventHandler(btn_MousePress); btn.Click += new EventHandler(btn_Click); lst = new ListBox(manager); lst.Init(); lst.Parent = this; lst.Left = 20; lst.Top = 60; lst.Width = 128; lst.Height = 128; lst.MouseMove += new MouseEventHandler(btn_MouseMove); lst.MouseDown += new MouseEventHandler(btn_MouseDown); lst.MouseUp += new MouseEventHandler(btn_MouseUp); lst.MouseOver += new MouseEventHandler(btn_MouseOver); lst.MouseOut += new MouseEventHandler(btn_MouseOut); lst.MousePress += new MouseEventHandler(btn_MousePress); lst.MouseScroll += new MouseEventHandler(lst_MouseScroll); lst.Click += new EventHandler(btn_Click); txt = new ListBox(manager); txt.Init(); txt.Parent = this; txt.Left = 200; txt.Top = 8; txt.Width = 160; txt.Height = 300; }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo,factory, contentManager); { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); // Add the window control to the manager processing queue. guiManager.Manager.Add(window); this.World.CameraManager.AddCamera(new CameraFirstPerson(false,GraphicInfo)); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Construstors ////// //////////////////////////////////////////////////////////////////////////// public TrackBar(Manager manager) : base(manager) { Width = 64; Height = 20; CanFocus = false; btnSlider = new Button(Manager); btnSlider.Init(); btnSlider.Text = ""; btnSlider.CanFocus = true; btnSlider.Parent = this; btnSlider.Anchor = Anchors.Left | Anchors.Top | Anchors.Bottom; btnSlider.Detached = true; btnSlider.Movable = true; btnSlider.Move += new MoveEventHandler(btnSlider_Move); btnSlider.KeyPress += new KeyEventHandler(btnSlider_KeyPress); btnSlider.GamePadPress += new GamePadEventHandler(btnSlider_GamePadPress); }
/// <summary> /// Shows the chose enum dialog. /// </summary> public void ShowChooseEnumDialog(Manager manager, string caption, Type type, EnumChooseEventHandler btnEventHandler) { _type = type; _handler = btnEventHandler; window = new Window(manager); window.Init(); window.Width = 175; window.Text = caption; window.Icon = IconProvider.ApplicationIcon; window.CaptionVisible = true; window.Closing += OnChooseEnumDialogClosing; window.Visible = true; if (!type.IsEnum) { CloseDialog(); } else { int offsetY = 5; foreach (object value in Enum.GetValues(type)) { string name = value.ToString(); Button btnEnumName = new Button(manager); btnEnumName.Init(); btnEnumName.Text = name; btnEnumName.Width = 150; btnEnumName.Height = 30; btnEnumName.Left = 5; btnEnumName.Top = offsetY; btnEnumName.Tag = value; btnEnumName.Click += OnClickBtnEnumName; btnEnumName.Parent = window; offsetY += 35; } window.Height = offsetY + 35; manager.Add(window); } }
public void AddButton(string s, Action action, string tooltip = null) { Button button = new Button(manager); button.Init(); button.Parent = toolBar; button.Text = ""; button.Width = toolBar.Width - (30 / 2); button.Left = 5; button.Top = HeightCounter; button.Height = button.Width; button.MouseOver += delegate { UserInterface.tomShaneWasClicked = true; }; button.MouseOut += delegate { UserInterface.tomShaneWasClicked = false; }; HeightCounter += button.Height + 5; button.Click += (se, e) => { foreach(Button bb in buttons.Values) { reset(); button.Enabled = false; bb.TextColor = Color.White; bb.Refresh(); } button.TextColor = UserInterface.TomShanePuke; if (action != null) action(); }; OrbIt.game.Graphics.DeviceReset += (se, e) => { button.Refresh(); }; if (!String.IsNullOrWhiteSpace(tooltip)) button.ToolTip.Text = tooltip; else button.ToolTip.Text = s; Texture2D tt = buttonTextures[s]; button.Draw += (se, e) => { if (!(se as Button).Enabled) e.Renderer.Draw(Assets.textureDict[textures.whitepixel], e.Rectangle.contract(5), Color.Goldenrod); e.Renderer.Draw(tt, e.Rectangle, Color.White); }; buttons.Add(s, button); }
void AddCreepsButton_Click(object sender, EventArgs e) { try { int health = Convert.ToInt32(_healthOfCreeps.Text); int speed = Convert.ToInt32(_speedOfCreeps.Text); int number = Convert.ToInt32(_numberOfCreeps.Text); string texture = _creepTexture.Text.Substring(0, 3).ToLower(); for (int i = 0; i < number; i++) { _currentCreepList.Add(new Creep(health, speed, texture)); } UpdateCreepBox(); } catch (Exception) { _isEditorActive = false; var msg = new Window(_manager); msg.Init(); msg.Text = "Fehler"; msg.Visible = true; msg.Width = 255; msg.Height = 100; msg.Center(); msg.Closed += delegate { _isEditorActive = true; }; var lbl = new Label(_manager); lbl.Init(); lbl.Text = "Bitte verwenden Sie korrekte Eingaben!"; lbl.Parent = msg; lbl.Width = 230; lbl.Left = 5; lbl.Top = 5; var close = new Button(_manager); close.Init(); close.Text = "Schließen"; close.Width = 100; close.Parent = msg; close.Left = (msg.ClientWidth / 2) - (close.Width / 2); close.Top = msg.ClientHeight - close.Height - 8; close.Anchor = Anchors.Bottom; close.Click += delegate { msg.Close(); }; _manager.Add(msg); } }
//////////////////////////////////////////////////////////////////////////// public Slider(Manager manager) : base(manager) { Width = 64; Height = 20; CanFocus = false; btnSlider = new Button(Manager); btnSlider.Init(); btnSlider.Text = ""; btnSlider.CanFocus = true; btnSlider.Parent = this; btnSlider.Anchor = Anchors.Left | Anchors.Top | Anchors.Bottom; btnSlider.Detached = true; btnSlider.Movable = true; btnSlider.Move += new MoveEventHandler(btnSlider_Move); btnSlider.KeyPress += new KeyEventHandler(btnSlider_KeyPress); btnSlider.GamePadPress += new GamePadEventHandler(btnSlider_GamePadPress); }
public PlayerView(Sidebar sidebar, Control parent, int Left, int Top) : base(sidebar, parent, Left, Top, false) { playerGroup = sidebar.room.groups.player; btnEditAllPlayers = new Button(manager); btnEditAllPlayers.Init(); btnEditAllPlayers.Parent = parent; btnEditAllPlayers.Text = "Edit All Players"; btnEditAllPlayers.Width = 150; btnEditAllPlayers.Left = parent.Width / 2 - btnEditAllPlayers.Width / 2; btnEditAllPlayers.Top = Top + VertPadding * 2; HeightCounter += btnEditAllPlayers.Height * 2; btnEditAllPlayers.Click += (s, e) => { editGroupWindow = new EditNodeWindow(sidebar, "All Players", room.groups.player.Name, ViewType.Group); editGroupWindow.componentView.SwitchGroup(room.groups.player); //editGroupWindow.componentView.SwitchNode(n, false); }; lblPlayers = new Label(manager); lblPlayers.Init(); lblPlayers.Parent = parent; lblPlayers.Text = "Players"; lblPlayers.Width = 150; lblPlayers.Left = LeftPadding; lblPlayers.TextColor = Color.Black; lblPlayers.Top = HeightCounter; HeightCounter += lblPlayers.Height + VertPadding; Width = parent.Width - LeftPadding * 4; base.Initialize(); insView = new InspectorView(sidebar, parent, Left, HeightCounter); insView.GroupSync = true; insView.Height = 120; insView.Width = Width; this.ItemCreator += ItemCreatorDelegate; InitializePlayers(); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Construstors ////// //////////////////////////////////////////////////////////////////////////// public SpinBox(Manager manager, SpinBoxMode mode) : base(manager) { this.mode = mode; ReadOnly = true; Height = 20; Width = 64; btnUp = new Button(Manager); btnUp.Init(); btnUp.CanFocus = false; btnUp.MousePress += new MouseEventHandler(btn_MousePress); Add(btnUp, false); btnDown = new Button(Manager); btnDown.Init(); btnDown.CanFocus = false; btnDown.MousePress += new MouseEventHandler(btn_MousePress); Add(btnDown, false); }
public override void Initialize() { base.Initialize(); var top = 50; foreach (var screenName in ScreensNames) { var button = new Button(ControlManager.Manager) { Text = screenName, Left = 50, Top = top, Width = 200, Height = 50 }; button.Init(); var label1 = screenName; button.Click += (sender, args) => OpenScreen(label1); ControlManager.Add(button); top += 100; } if (ExitButton) { var button = new Button(ControlManager.Manager) { Text = "Exit Game", Left = 50, Top = top, Width = 200, Height = 50 }; button.Init(); button.Click += (sender, args) => Application.MainWindow.Close(); ControlManager.Add(button); } }
//////////////////////////////////////////////////////////////////////////// public SpinBox(Manager manager, SpinBoxMode mode) : base(manager) { this.mode = mode; ReadOnly = true; Height = 20; Width = 64; btnUp = new Button(Manager); btnUp.Init(); btnUp.CanFocus = false; btnUp.MousePress += new MouseEventHandler(btn_MousePress); Add(btnUp, false); btnDown = new Button(Manager); btnDown.Init(); btnDown.CanFocus = false; btnDown.MousePress += new MouseEventHandler(btn_MousePress); Add(btnDown, false); }
public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address) : base(manager) { //Are we editing a server or adding one (They use same dialog) Edit = edit; Index = index; ServerList = parent; //Setup the window Text = Edit ? "Edit Server" : "Add Server"; TopPanel.Visible = false; Resizable = false; Width = 250; Height = 180; Center(); //Add controls NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 }; NameLbl.Init(); Add(NameLbl); NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 }; NameTxt.Init(); NameTxt.Text = name; Add(NameTxt); AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8, Text = "Address: (Default port is 14242)", Width = this.ClientWidth - 16 }; AddressLbl.Init(); Add(AddressLbl); AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 }; AddressTxt.Init(); AddressTxt.Text = address; Add(AddressTxt); SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", }; SaveBtn.Init(); SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2); SaveBtn.Click += SaveBtn_Click; BottomPanel.Add(SaveBtn); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Construstors ////// //////////////////////////////////////////////////////////////////////////// public ComboBox(Manager manager) : base(manager) { Height = 20; Width = 64; ReadOnly = true; btnDown = new Button(Manager); btnDown.Init(); btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]); btnDown.CanFocus = false; btnDown.Click += new EventHandler(btnDown_Click); Add(btnDown, false); lstCombo = new ListBox(Manager); lstCombo.Init(); lstCombo.HotTrack = true; lstCombo.Detached = true; lstCombo.Visible = false; lstCombo.Click += new EventHandler(lstCombo_Click); lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost); lstCombo.Items = items; manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown); }
public override void Initialize() { Point screenSize = ((ContentSystem)world.SystemManager.GetSystem<ContentSystem>()[0]).GetViewportSize(); confirmWindow = new Window(manager); confirmWindow.Init(); confirmWindow.Text = "Would you like to exit?"; confirmWindow.Width = 248; confirmWindow.Height = 48; confirmWindow.Center(); confirmWindow.Visible = false; confirmWindow.Resizable = false; confirmWindow.IconVisible = false; confirmWindow.CloseButtonVisible = false; confirmWindow.Closing += new WindowClosingEventHandler(WindowCloseBehavior); manager.Add(confirmWindow); acceptButton = new Button(manager); acceptButton.Init(); acceptButton.Parent = confirmWindow; acceptButton.Width = 100; acceptButton.Height = 24; acceptButton.Click +=new TomShane.Neoforce.Controls.EventHandler(ConfirmedExit); acceptButton.Left = 12; acceptButton.Top = 8; acceptButton.Text = "Yes"; cancelButton = new Button(manager); cancelButton.Init(); cancelButton.Parent = confirmWindow; cancelButton.Width = 100; cancelButton.Height = 24; cancelButton.Click += new TomShane.Neoforce.Controls.EventHandler(CancelExit); cancelButton.Left = 124; cancelButton.Top = 8; cancelButton.Text = "No thanks"; }
public TitlePanel(Sidebar sidebar, Control parent, string Title, bool BackButton, int Top = 0, int Padding = 5) { this.Padding = Padding; topPanel = new Panel(sidebar.manager); topPanel.Init(); topPanel.Parent = parent; topPanel.Left = Padding; topPanel.Top = Top + Padding; topPanel.Width = parent.Width - Padding * 3; if (parent is SideBar) topPanel.Width -= Padding * 1; int col = 30; topPanel.Color = new Color(col, col, col); topPanel.BevelBorder = BevelBorder.All; topPanel.BevelStyle = BevelStyle.Flat; topPanel.BevelColor = Color.Black; lblTitle = new Label(sidebar.manager); lblTitle.Init(); lblTitle.Parent = topPanel; lblTitle.Top = Padding * 2; lblTitle.Width = 120; lblTitle.Left = parent.Width / 2 - lblTitle.Width / 4; //lblTitle.Text = Title; this.Title = Title; topPanel.Height = 24 + Padding * 3; if (!BackButton) return; btnBack = new Button(sidebar.manager); btnBack.Init(); btnBack.Parent = topPanel; btnBack.Top = Padding; btnBack.Text = "Back"; btnBack.Width = 40; btnBack.Left = Padding; //topPanel.Height = btnBack.Height + Padding * 3; }
//////////////////////////////////////////////////////////////////////////// public ComboBox(Manager manager) : base(manager) { Height = 20; Width = 64; ReadOnly = true; btnDown = new Button(Manager); btnDown.Init(); btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]); btnDown.CanFocus = false; btnDown.Click += new EventHandler(btnDown_Click); Add(btnDown, false); lstCombo = new ListBox(Manager); lstCombo.Init(); lstCombo.HotTrack = true; lstCombo.Detached = true; lstCombo.Visible = false; lstCombo.Click += new EventHandler(lstCombo_Click); lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost); lstCombo.Items = items; manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown); }
private void CreateFirstPage(Manager manager, Player[] playerList, TabPage control) { var yPos = 16; var padding = 10; // Get the player that won var winningPlayer = playerList.MaxBy(i => i.TotalValue); var winningPlayerLabel = new Label(manager) { Text = "The current leader is " + winningPlayer.Name, Width = 400, Alignment = Alignment.MiddleCenter, Parent = control, Top = yPos, Name = IgnoreString }; yPos += winningPlayerLabel.Height + 16; var playerAvatar = winningPlayer.Avatar; var imageIcon = new Button(manager) { Glyph = new Glyph(playerAvatar), Height = (int)(playerAvatar.Height / 1.5), Width = (int)(playerAvatar.Width / 1.5), Left = 16, Name = IgnoreString, Top = yPos, Parent = control, Color = winningPlayer.PlayerColor, }; imageIcon.Init(); imageIcon.FocusGained += (sender, args) => imageIcon.Enabled = false; var descriptionText = new Label(manager) { Left = imageIcon.Left + imageIcon.Width + 16, Width = 200, Height = imageIcon.Height, Top = yPos + 9, Text = String.Format( "Player Name : {0}\n\n" + "Player Cash : ${1:N0}\n\n" + "Player Total Worth : ${2:N0}\n\n" + "Player Position : {3:N0}\n\n", winningPlayer.Name, winningPlayer.Cash, winningPlayer.TotalValue, 1), Alignment = Alignment.TopLeft, Parent = control, Name = IgnoreString, }; descriptionText.Init(); yPos = imageIcon.Top + imageIcon.Height + 16; int playerCount = 0; var leaderBoard = new ImageBox(manager) { Image = manager.Game.Content.Load<Texture2D>("images/leaderboard"), Top = yPos - padding, Left = 200 - 100, Parent = control, Width = 250, Name = IgnoreString }; leaderBoard.Init(); yPos += leaderBoard.Height / 3; foreach (var player in playerList.OrderByDescending(i => i.TotalValue)) { playerCount++; var label = new Label(manager) { Text = String.Format("{0}. {1}\n\n " + "Total Value : ${3:N0}\n " + "Current Cash : ${2:N0}", playerCount, player.Name, player.Cash, player.TotalValue), Height = 50, Width = 400, Parent = control, Left = 80, Top = yPos, Name = IgnoreString }; yPos += label.Height + 10; } createdPages[control] = yPos + 30; }
private void InitializeControls() { _manager.Initialize(); _manager.AutoCreateRenderTarget = true; _tabControl = new TabControl(_manager); _tabControl.Init(); _tabControl.Left = 600; _tabControl.Top = 0; _tabControl.Width = Width; _tabControl.Height = Height; _tabControl.Show(); #region WavePage _wavePage = _tabControl.AddPage(); _wavePage.Text = "Waves"; #region Constructors _health = new Label(_manager); _health.Init(); _texture = new Label(_manager); _texture.Init(); _speed = new Label(_manager); _speed.Init(); _number = new Label(_manager); _number.Init(); _waves = new ListBox(_manager); _waves.Init(); _deleteWaveButton = new Button(_manager); _deleteWaveButton.Init(); _addWaveButton = new Button(_manager); _addWaveButton.Init(); _currentWave = new ListBox(_manager); _currentWave.Init(); _addCreepsButton = new Button(_manager); _addCreepsButton.Init(); _numberOfCreeps = new TextBox(_manager); _numberOfCreeps.Init(); _speedOfCreeps = new TextBox(_manager); _speedOfCreeps.Init(); _healthOfCreeps = new TextBox(_manager); _healthOfCreeps.Init(); _creepTexture = new ComboBox(_manager); _creepTexture.Init(); #endregion #region Properties _texture.Text = "Textur"; _texture.Top = 2; _texture.Left = 2; _texture.Parent = _wavePage; _wavePage.Add(_texture); _creepTexture.Items.AddRange(new[] { "Slyder", "Drone", "Ape", "Paw" }); _creepTexture.Text = "Slyder"; _creepTexture.Width = 80; _creepTexture.Left = 2; _creepTexture.Top = _texture.Top + _texture.Height + 2; _creepTexture.TextColor = Color.LightGray; _creepTexture.Parent = _wavePage; _health.Text = "Gesundheit"; _health.Top = 2; _health.Left = _creepTexture.Left + _creepTexture.Width + 5; _health.Parent = _wavePage; _healthOfCreeps.Left = _health.Left; _healthOfCreeps.Top = _health.Top + _health.Height + 2; _healthOfCreeps.Width = _health.Width; _healthOfCreeps.TextColor = Color.LightGray; _healthOfCreeps.Parent = _wavePage; _speed.Text = "Geschwindigkeit"; _speed.Left = _health.Left + _health.Width + 5; _speed.Top = 2; _speed.Width = 93; _speed.Parent = _wavePage; _speedOfCreeps.Left = _speed.Left; _speedOfCreeps.Top = _speed.Top + _speed.Height + 2; _speedOfCreeps.Width = _speed.Width; _speedOfCreeps.TextColor = Color.LightGray; _speedOfCreeps.Parent = _wavePage; _number.Text = "Anzahl"; _number.Top = 2; _number.Left = _speed.Left + _speed.Width + 5; _number.Width = 40; _number.Parent = _wavePage; _numberOfCreeps.Left = _number.Left; _numberOfCreeps.Top = _number.Top + _number.Height + 2; _numberOfCreeps.Width = _number.Width; _numberOfCreeps.TextColor = Color.LightGray; _numberOfCreeps.Parent = _wavePage; _addCreepsButton.Text = "Creeps hinzufügen"; _addCreepsButton.Top = _numberOfCreeps.Top + _numberOfCreeps.Height - _addCreepsButton.Height; _addCreepsButton.Left = _numberOfCreeps.Left + _numberOfCreeps.Width + 5; _addCreepsButton.Width = 120; _addCreepsButton.Parent = _wavePage; _currentWave.Left = 2; _currentWave.Top = _creepTexture.Top + _creepTexture.Height + 5; _currentWave.Width = _addCreepsButton.Left + _addCreepsButton.Width; _currentWave.Height = 150; _currentWave.TextColor = Color.LightGray; _currentWave.Parent = _wavePage; _addWaveButton.Text = "Wave hinzufügen"; _addWaveButton.Left = 2; _addWaveButton.Top = _currentWave.Top + _currentWave.Height + 5; _addWaveButton.Width = 150; _addWaveButton.Parent = _wavePage; _deleteWaveButton.Text = "Wave löschen"; _deleteWaveButton.Left = _addWaveButton.Left + _addWaveButton.Width + 5; _deleteWaveButton.Top = _currentWave.Top + _currentWave.Height + 5; _deleteWaveButton.Width = _addWaveButton.Width; _deleteWaveButton.Parent = _wavePage; _waves.Left = 2; _waves.Top = _addWaveButton.Top + _addWaveButton.Height + 5; _waves.Width = _currentWave.Width; _waves.Height = 150; _waves.TextColor = Color.LightGray; _waves.Parent = _wavePage; _waves.ItemIndexChanged += _waves_ItemIndexChanged; #endregion #region Events _addCreepsButton.Click += AddCreepsButton_Click; _addWaveButton.Click += AddWaveButton_Click; _deleteWaveButton.Click += DeleteWaveButton_Click; #endregion #endregion #region SavePage _savePage = _tabControl.AddPage(); _savePage.Text = "Speichern & Laden"; _path = new TextBox(_manager); _path.Init(); _path.Top = 2; _path.Left = 2; _path.Width = 200; _path.Parent = _savePage; _path.ReadOnly = true; _fileNameButton = new Button(_manager); _fileNameButton.Init(); _fileNameButton.Text = "..."; _fileNameButton.Width = 17; _fileNameButton.Height = _fileNameButton.Width; _fileNameButton.Top = _path.Top + _path.Height / 2 - _fileNameButton.Height / 2; _fileNameButton.Left = _path.Left + _path.Width + 2; _fileNameButton.Parent = _savePage; _fileNameButton.Click += delegate { var dlg = new SaveFileDialog { Filter = "Level-Dateien|*.xml", InitialDirectory = Path.GetFullPath( Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location) + @"\..\Content\Map") }; dlg.ShowDialog(); _path.Text = dlg.FileName; }; _saveButton = new Button(_manager); _saveButton.Init(); _saveButton.Top = _path.Top + _path.Height + 2; _saveButton.Left = 2; _saveButton.Text = "Speichern"; _saveButton.Width = 120; _saveButton.Parent = _savePage; _saveButton.Click += delegate { if (_path.Text.Length > 0) { string fileName = _path.Text; Save(fileName); } }; LoadButton = new Button(_manager); LoadButton.Init(); LoadButton.Left = 2; LoadButton.Top = 50; LoadButton.Text = "Laden"; LoadButton.Width = 120; LoadButton.Parent = _savePage; LoadButton.Click += LoadButton_Click; #endregion _manager.Add(_tabControl); }