public MainScreen(ScreenComponent manager) : base(manager) { Padding = new Border(0, 0, 0, 0); Background = new TextureBrush(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background.png", manager.GraphicsDevice), TextureBrushMode.Stretch); StackPanel stack = new StackPanel(manager); Controls.Add(stack); Button startButton = Button.TextButton(manager, Languages.OctoClient.Start); startButton.HorizontalAlignment = HorizontalAlignment.Stretch; startButton.Margin = new Border(0, 0, 0, 10); startButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new LoadScreen(manager)); }; stack.Controls.Add(startButton); Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options); optionButton.HorizontalAlignment = HorizontalAlignment.Stretch; optionButton.Margin = new Border(0, 0, 0, 10); optionButton.MinWidth = 300; optionButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new OptionsScreen(manager)); }; stack.Controls.Add(optionButton); Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew); creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch; creditsButton.Margin = new Border(0, 0, 0, 10); creditsButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CreditsScreen(manager)); }; stack.Controls.Add(creditsButton); Button webButton = Button.TextButton(manager, "Octoawesome.net"); webButton.VerticalAlignment = VerticalAlignment.Bottom; webButton.HorizontalAlignment = HorizontalAlignment.Right; webButton.Margin = new Border(10, 10, 10, 10); webButton.LeftMouseClick += (s, e) => { Process.Start("http://octoawesome.net/"); }; Controls.Add(webButton); Button exitButton = Button.TextButton(manager, Languages.OctoClient.Exit); exitButton.HorizontalAlignment = HorizontalAlignment.Stretch; exitButton.Margin = new Border(0, 0, 0, 10); exitButton.LeftMouseClick += (s, e) => { manager.Exit(); }; stack.Controls.Add(exitButton); }
public PauseScreen(ScreenComponent manager) : base(manager) { assets = manager.Game.Assets; // IsOverlay = true; // Background = new BorderBrush(new Color(Color.Black, 0.5f)); Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background"), TextureBrushMode.Stretch); StackPanel stack = new StackPanel(manager); Controls.Add(stack); Button resumeButton = Button.TextButton(manager, Languages.OctoClient.Resume); resumeButton.HorizontalAlignment = HorizontalAlignment.Stretch; resumeButton.Margin = new Border(0, 0, 0, 10); resumeButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); }; stack.Controls.Add(resumeButton); Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options); optionButton.HorizontalAlignment = HorizontalAlignment.Stretch; optionButton.Margin = new Border(0, 0, 0, 10); optionButton.MinWidth = 300; optionButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new OptionsScreen(manager)); }; stack.Controls.Add(optionButton); Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew); creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch; creditsButton.Margin = new Border(0, 0, 0, 10); creditsButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CreditsScreen(manager)); }; stack.Controls.Add(creditsButton); Button mainMenuButton = Button.TextButton(manager, Languages.OctoClient.ToMainMenu); mainMenuButton.HorizontalAlignment = HorizontalAlignment.Stretch; mainMenuButton.Margin = new Border(0, 0, 0, 10); mainMenuButton.LeftMouseClick += (s, e) => { manager.Player.RemovePlayer(); manager.Game.Simulation.ExitGame(); manager.NavigateHome(); }; stack.Controls.Add(mainMenuButton); }
public MainScreen(ScreenComponent manager) : base(manager) { StackPanel stack = new StackPanel(manager); Controls.Add(stack); Button startButton = Button.TextButton(manager, "Start"); startButton.HorizontalAlignment = HorizontalAlignment.Stretch; startButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new GameScreen(manager)); }; stack.Controls.Add(startButton); Button optionButton = Button.TextButton(manager, "Options"); optionButton.HorizontalAlignment = HorizontalAlignment.Stretch; optionButton.MinWidth = 200; stack.Controls.Add(optionButton); Button exitButton = Button.TextButton(manager, "Exit"); exitButton.HorizontalAlignment = HorizontalAlignment.Stretch; exitButton.LeftMouseClick += (s, e) => { manager.Exit(); }; stack.Controls.Add(exitButton); }
private void Play() { Manager.Player.RemovePlayer(); Manager.Game.Simulation.LoadGame(levelList.SelectedItem.Id); settings.Set("LastUniverse", levelList.SelectedItem.Id.ToString()); Manager.Game.Player.InsertPlayer(); Manager.NavigateToScreen(new GameScreen(Manager)); }
public CreditsScreen(ScreenComponent manager) : base(manager) { Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.CreditsCrew; SetDefaultBackground(); List <CrewMember> crew = CrewMember.getCrew(manager); ScrollContainer crewScroll = new ScrollContainer(manager) { VerticalAlignment = VerticalAlignment.Stretch, Margin = new Border(10, 10, 10, 10), CanFocus = false }; StackPanel crewList = new StackPanel(manager) { MinWidth = 700, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; crewScroll.Content = crewList; foreach (CrewMember member in crew) { Panel memberPanel = new Panel(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, MinHeight = 30, Background = new BorderBrush(Color.White), Margin = new Border(5, 5, 5, 5), HoveredBackground = new BorderBrush(Color.LightGray) }; memberPanel.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CrewMemberScreen(manager, member)); }; Label name = new Label(manager) { Text = member.Username, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Center, Padding = new Border(5, 5, 5, 5) }; memberPanel.Controls.Add(name); crewList.Controls.Add(memberPanel); } Controls.Add(crewScroll); }
private void Play() { Manager.Player.SetEntity(null); Manager.Game.Simulation.LoadGame(levelList.SelectedItem.Id); settings.Set("LastUniverse", levelList.SelectedItem.Id.ToString()); Player player = Manager.Game.Simulation.LoginPlayer(""); Manager.Game.Player.SetEntity(player); Manager.NavigateToScreen(new GameScreen(Manager)); }
public CreditsScreen(ScreenComponent manager) : base(manager) { Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.CreditsCrew; SetDefaultBackground(); List <CrewMember> crew = CrewMember.getCrew(manager); ScrollContainer crewScroll = new ScrollContainer(manager) { VerticalAlignment = VerticalAlignment.Stretch, Margin = new Border(10, 10, 10, 10), CanFocus = false }; StackPanel crewList = new StackPanel(manager) { MinWidth = 700, Padding = new Border(10, 0, 10, 0), VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; crewScroll.Content = crewList; foreach (CrewMember member in crew) { Button memberButton = new TextButton(manager, member.Username); memberButton.HorizontalAlignment = HorizontalAlignment.Stretch; memberButton.Margin = new Border(5, 5, 5, 5); memberButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CrewMemberScreen(manager, member)); }; crewList.Controls.Add(memberButton); } Controls.Add(crewScroll); }
public LoadScreen(ScreenComponent manager) : base(manager) { Manager = manager; settings = manager.Game.Settings; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.SelectUniverse; SetDefaultBackground(); //Main Panel mainStack = new Grid(manager); mainStack.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Parts, Width = 3 }); mainStack.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Parts, Width = 1 }); mainStack.Rows.Add(new RowDefinition() { ResizeMode = ResizeMode.Parts, Height = 1 }); mainStack.Margin = Border.All(50); mainStack.HorizontalAlignment = HorizontalAlignment.Stretch; mainStack.VerticalAlignment = VerticalAlignment.Stretch; Controls.Add(mainStack); //Level Stack levelList = new Listbox <IUniverse>(manager); levelList.Background = new BorderBrush(Color.White * 0.5f); levelList.VerticalAlignment = VerticalAlignment.Stretch; levelList.HorizontalAlignment = HorizontalAlignment.Stretch; levelList.Margin = Border.All(10); levelList.SelectedItemBrush = new BorderBrush(Color.SaddleBrown * 0.7f); levelList.TemplateGenerator += (x) => { return(new Label(manager) { Text = string.Format("{0} ({1})", x.Name, x.Seed), HorizontalAlignment = HorizontalAlignment.Stretch, Padding = Border.All(10), }); }; mainStack.AddControl(levelList, 0, 0); //Sidebar Panel sidebar = new Panel(manager); sidebar.Padding = Border.All(20); sidebar.VerticalAlignment = VerticalAlignment.Stretch; sidebar.HorizontalAlignment = HorizontalAlignment.Stretch; sidebar.Background = new BorderBrush(Color.White * 0.5f); sidebar.Margin = Border.All(10); mainStack.AddControl(sidebar, 1, 0); //Universe Info Label l = new Label(manager); l.Text = " Placeholder "; l.VerticalAlignment = VerticalAlignment.Top; l.HorizontalAlignment = HorizontalAlignment.Left; sidebar.Controls.Add(l); //Buttons StackPanel buttonStack = new StackPanel(manager); buttonStack.VerticalAlignment = VerticalAlignment.Bottom; buttonStack.HorizontalAlignment = HorizontalAlignment.Stretch; sidebar.Controls.Add(buttonStack); //renameButton = getButton("Rename"); //buttonStack.Controls.Add(renameButton); deleteButton = GetButton(Languages.OctoClient.Delete); buttonStack.Controls.Add(deleteButton); deleteButton.LeftMouseClick += (s, e) => { if (levelList.SelectedItem == null) { MessageScreen msg = new MessageScreen(manager, Languages.OctoClient.Error, Languages.OctoClient.SelectUniverseFirst); manager.NavigateToScreen(msg); return; } // Sicherstellen, dass universe nicht geladen ist if (ResourceManager.Instance.CurrentUniverse != null && ResourceManager.Instance.CurrentUniverse.Id == levelList.SelectedItem.Id) { return; } ResourceManager.Instance.DeleteUniverse(levelList.SelectedItem.Id); levelList.Items.Remove(levelList.SelectedItem); levelList.SelectedItem = null; levelList.InvalidateDimensions(); settings.Set("LastUniverse", ""); }; createButton = GetButton(Languages.OctoClient.Create); createButton.LeftMouseClick += (s, e) => manager.NavigateToScreen(new CreateUniverseScreen(manager)); buttonStack.Controls.Add(createButton); playButton = GetButton(Languages.OctoClient.Play); playButton.LeftMouseClick += (s, e) => { if (levelList.SelectedItem == null) { MessageScreen msg = new MessageScreen(manager, Languages.OctoClient.Error, Languages.OctoClient.SelectUniverseFirst); manager.NavigateToScreen(msg); return; } Play(); }; buttonStack.Controls.Add(playButton); foreach (var universe in ResourceManager.Instance.ListUniverses()) { levelList.Items.Add(universe); } // Erstes Element auswählen, oder falls vorhanden das letzte gespielte Universum if (levelList.Items.Count >= 1) { levelList.SelectedItem = levelList.Items[0]; } if (settings.KeyExists("LastUniverse") && settings.Get <string>("LastUniverse") != null && settings.Get <string>("LastUniverse") != "") { var lastlevel = levelList.Items.FirstOrDefault(u => u.Id == Guid.Parse(settings.Get <string>("LastUniverse"))); if (lastlevel != null) { levelList.SelectedItem = lastlevel; } } }
public CreateUniverseScreen(ScreenComponent manager) : base(manager) { Manager = manager; Padding = new Border(0, 0, 0, 0); SetDefaultBackground(); Panel panel = new Panel(manager); panel.VerticalAlignment = VerticalAlignment.Stretch; panel.HorizontalAlignment = HorizontalAlignment.Stretch; panel.Margin = Border.All(50); panel.Background = new BorderBrush(Color.White * 0.5f); panel.Padding = Border.All(10); Controls.Add(panel); Grid grid = new Grid(manager); grid.VerticalAlignment = VerticalAlignment.Stretch; grid.HorizontalAlignment = HorizontalAlignment.Stretch; panel.Controls.Add(grid); grid.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Auto }); grid.Columns.Add(new ColumnDefinition() { Width = 1, ResizeMode = ResizeMode.Parts }); nameInput = GetTextbox(); nameInput.TextChanged += (s, e) => { createButton.Visible = !string.IsNullOrEmpty(e.NewValue); }; AddLabeledControl(grid, "Name: ", nameInput); seedInput = GetTextbox(); AddLabeledControl(grid, "Seed: ", seedInput); createButton = Button.TextButton(manager, "Create"); createButton.HorizontalAlignment = HorizontalAlignment.Right; createButton.VerticalAlignment = VerticalAlignment.Bottom; createButton.Visible = false; createButton.LeftMouseClick += (s, e) => { if (string.IsNullOrEmpty(nameInput.Text)) { return; } int?seed = null; int textseed; if (int.TryParse(seedInput.Text, out textseed)) { seed = textseed; } manager.Player.RemovePlayer(); Guid guid = Manager.Game.Simulation.NewGame(nameInput.Text, seed); SettingsManager.Set("LastUniverse", guid.ToString()); manager.Game.Player.InsertPlayer(); manager.NavigateToScreen(new GameScreen(manager)); }; panel.Controls.Add(createButton); }
public MainScreen(ScreenComponent manager) : base(manager) { assets = manager.Game.Assets; Padding = new Border(0, 0, 0, 0); Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background"), TextureBrushMode.Stretch); StackPanel stack = new StackPanel(manager); Controls.Add(stack); Button startButton = new TextButton(manager, Languages.OctoClient.Start); startButton.HorizontalAlignment = HorizontalAlignment.Stretch; startButton.Margin = new Border(0, 0, 0, 10); startButton.LeftMouseClick += (s, e) => { ((ContainerResourceManager)manager.Game.ResourceManager).CreateManager(false); manager.NavigateToScreen(new LoadScreen(manager)); }; stack.Controls.Add(startButton); Button multiplayerButton = new TextButton(manager, Languages.OctoClient.Multiplayer); multiplayerButton.HorizontalAlignment = HorizontalAlignment.Stretch; multiplayerButton.Margin = new Border(0, 0, 0, 10); multiplayerButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new ConnectionScreen(manager)); }; stack.Controls.Add(multiplayerButton); Button optionButton = new TextButton(manager, Languages.OctoClient.Options); optionButton.HorizontalAlignment = HorizontalAlignment.Stretch; optionButton.Margin = new Border(0, 0, 0, 10); optionButton.MinWidth = 300; optionButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new OptionsScreen(manager)); }; stack.Controls.Add(optionButton); Button creditsButton = new TextButton(manager, Languages.OctoClient.CreditsCrew); creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch; creditsButton.Margin = new Border(0, 0, 0, 10); creditsButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CreditsScreen(manager)); }; stack.Controls.Add(creditsButton); Button webButton = new TextButton(manager, "Octoawesome.net"); webButton.VerticalAlignment = VerticalAlignment.Bottom; webButton.HorizontalAlignment = HorizontalAlignment.Right; webButton.Margin = new Border(10, 10, 10, 10); webButton.LeftMouseClick += (s, e) => { Process.Start("http://octoawesome.net/"); }; Controls.Add(webButton); Button exitButton = new TextButton(manager, Languages.OctoClient.Exit); exitButton.HorizontalAlignment = HorizontalAlignment.Stretch; exitButton.Margin = new Border(0, 0, 0, 10); exitButton.LeftMouseClick += (s, e) => { manager.Exit(); }; stack.Controls.Add(exitButton); }
public CreateUniverseScreen(ScreenComponent manager) : base(manager) { Manager = manager; settings = manager.Game.Settings; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.CreateUniverse; SetDefaultBackground(); var panel = new Panel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Margin = Border.All(50), Background = new BorderBrush(Color.White * 0.5f), Padding = Border.All(10) }; Controls.Add(panel); var grid = new Grid(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch }; panel.Controls.Add(grid); grid.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Auto }); grid.Columns.Add(new ColumnDefinition() { Width = 1, ResizeMode = ResizeMode.Parts }); nameInput = GetTextbox(); nameInput.TextChanged += (s, e) => { createButton.Visible = !string.IsNullOrEmpty(e.NewValue); }; AddLabeledControl(grid, string.Format("{0}: ", Languages.OctoClient.Name), nameInput); seedInput = GetTextbox(); AddLabeledControl(grid, string.Format("{0}: ", Languages.OctoClient.Seed), seedInput); createButton = Button.TextButton(manager, Languages.OctoClient.Create); createButton.HorizontalAlignment = HorizontalAlignment.Right; createButton.VerticalAlignment = VerticalAlignment.Bottom; createButton.Visible = false; createButton.LeftMouseClick += (s, e) => { if (string.IsNullOrEmpty(nameInput.Text)) { return; } int?seed = null; int textseed; if (int.TryParse(seedInput.Text, out textseed)) { seed = textseed; } manager.Player.SetEntity(null); Guid guid = Manager.Game.Simulation.NewGame(nameInput.Text, seed); settings.Set("LastUniverse", guid.ToString()); Player player = manager.Game.Simulation.LoginPlayer(""); manager.Game.Player.SetEntity(player); manager.NavigateToScreen(new GameScreen(manager)); }; panel.Controls.Add(createButton); }
public CreditsScreen(ScreenComponent manager) : base(manager) { Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.CreditsCrew; Image background = new Image(manager); background.Texture = Manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background_notext.png", Manager.GraphicsDevice); background.VerticalAlignment = VerticalAlignment.Stretch; background.HorizontalAlignment = HorizontalAlignment.Stretch; Controls.Add(background); Button backButton = Button.TextButton(manager, Languages.OctoClient.Back); backButton.VerticalAlignment = VerticalAlignment.Top; backButton.HorizontalAlignment = HorizontalAlignment.Left; backButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); }; backButton.Margin = new Border(10, 10, 10, 10); Controls.Add(backButton); List <CrewMember> crew = CrewMember.getCrew(manager); ScrollContainer crewScroll = new ScrollContainer(manager) { VerticalAlignment = VerticalAlignment.Stretch, Margin = new Border(10, 10, 10, 10), CanFocus = false }; StackPanel crewList = new StackPanel(manager) { MinWidth = 700, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; crewScroll.Content = crewList; foreach (CrewMember member in crew) { Panel memberPanel = new Panel(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, MinHeight = 30, Background = new BorderBrush(Color.White), Margin = new Border(5, 5, 5, 5), HoveredBackground = new BorderBrush(Color.LightGray) }; memberPanel.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new CrewMemberScreen(manager, member)); }; Label name = new Label(manager) { Text = member.Username, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Center, Padding = new Border(5, 5, 5, 5) }; memberPanel.Controls.Add(name); crewList.Controls.Add(memberPanel); } Controls.Add(crewScroll); }