public override void Add(ScreenManager screenManager) { Game.CurrentGameState = GameState.Login; base.Add(screenManager); (Manager.Game as Application).BackgroundImage = ContentPack.Textures["gui\\background"]; //Add the logo image LogoImage = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\logosmall"], SizeMode = SizeMode.Centered }; LogoImage.SetSize(LogoImage.Image.Width, LogoImage.Image.Height); LogoImage.SetPosition((Window.Width / 2) - (LogoImage.Width / 2), 0); LogoImage.Init(); Window.Add(LogoImage); //Add github contribute link GithubIcon = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\github"], SizeMode = SizeMode.Auto, }; GithubIcon.ToolTip.Text = "We love open source! Contribute to Bricklayer at our GitHub repo."; GithubIcon.SetSize(GithubIcon.Width, GithubIcon.Height); GithubIcon.SetPosition(Window.Width - GithubIcon.Width - 8, Window.Height - GithubIcon.Height - 8); GithubIcon.Init(); GithubIcon.Color = Color.White * .6f; //Click/Hover events GithubIcon.MouseOut += new MouseEventHandler(delegate(object o, MouseEventArgs e) { GithubIcon.Color = Color.White * .6f; }); GithubIcon.MouseOver += new MouseEventHandler(delegate(object o, MouseEventArgs e) { GithubIcon.Color = Color.White; }); GithubIcon.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { if (Manager.Game.IsActive) Process.Start(githubLink); //Open the link in a browser }); Window.Add(GithubIcon); //Add version tag Version = new Label(Manager) { Font = FontSize.Default14 }; Version.SetSize(200, 16); Version.SetPosition(8, Window.Height - Version.Height - 8); Version.Init(); Version.Text = AssemblyVersionName.GetVersion(); Window.Add(Version); //Add the login window Login = new ServerWindow(Manager); Login.Init(); if (Login.Top - 24 < LogoImage.Height + LogoImage.Top) //If it is too close to logo, move it down a bit Login.Top = LogoImage.Height + LogoImage.Top - 24; Window.Add(Login); Login.Show(); }
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 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); }
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) { Game.CurrentGameState = GameState.Login; base.Add(screenManager); (Manager.Game as Application).BackgroundImage = ContentPack.Textures["gui\\background"]; //Add the logo image LogoImage = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\logosmall"], SizeMode = SizeMode.Centered }; LogoImage.SetSize(LogoImage.Image.Width, LogoImage.Image.Height); LogoImage.SetPosition((Window.Width / 2) - (LogoImage.Width / 2), 0); LogoImage.Init(); Window.Add(LogoImage); //Add github contribute link GithubIcon = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\github"], SizeMode = SizeMode.Auto, }; GithubIcon.ToolTip.Text = "We love open source! Contribute to Bricklayer at our GitHub repo."; GithubIcon.SetSize(GithubIcon.Width, GithubIcon.Height); GithubIcon.SetPosition(Window.Width - GithubIcon.Width - 8, Window.Height - GithubIcon.Height - 8); GithubIcon.Init(); GithubIcon.Color = Color.White * .6f; //Click/Hover events GithubIcon.MouseOut += new MouseEventHandler(delegate(object o, MouseEventArgs e) { GithubIcon.Color = Color.White * .6f; }); GithubIcon.MouseOver += new MouseEventHandler(delegate(object o, MouseEventArgs e) { GithubIcon.Color = Color.White; }); GithubIcon.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { if (Manager.Game.IsActive) { Process.Start(githubLink); //Open the link in a browser } }); Window.Add(GithubIcon); //Add version tag Version = new Label(Manager) { Font = FontSize.Default14 }; Version.SetSize(200, 16); Version.SetPosition(8, Window.Height - Version.Height - 8); Version.Init(); Version.Text = AssemblyVersionName.GetVersion(); Window.Add(Version); //Add the login window Login = new ServerWindow(Manager); Login.Init(); if (Login.Top - 24 < LogoImage.Height + LogoImage.Top) //If it is too close to logo, move it down a bit { Login.Top = LogoImage.Height + LogoImage.Top - 24; } Window.Add(Login); Login.Show(); }