/// <summary> /// Adds the controls for this screen to the window /// </summary> public virtual void Add(ScreenManager screenManager) { if (Initialized != null) { Initialized(); } ScreenManager = screenManager; }
public override void Add(ScreenManager screenManager) { Game.CurrentGameState = GameState.Lobby; base.Add(screenManager); (Manager.Game as Application).BackgroundImage = ContentPack.Textures["gui\\background"]; //Add the login window Lobby = new LobbyWindow(Manager); Lobby.Init(); Window.Add(Lobby); Lobby.Show(); }
public MainWindow(Manager manager) : base(manager) { ElapsedTime = TimeSpan.Zero; Width = Game.Resolution.Width; Height = Game.Resolution.Height; Transparent = true; AutoScroll = false; //Set up the ScreenManager which will handle all of the controls from here ScreenManager = new ScreenManager(this); ScreenManager.SwitchScreen(new LoginScreen()); }
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 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 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(); }