protected override void LoadContent() { base.LoadContent(); Skin.Current.ButtonBrush = NineTileBrush.FromSingleTexture( Game.Screen.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_brown.png", GraphicsDevice), 15, 15); Skin.Current.ButtonHoverBrush = NineTileBrush.FromSingleTexture( Game.Screen.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_beige.png", GraphicsDevice), 15, 15); Skin.Current.ButtonPressedBrush = NineTileBrush.FromSingleTexture( Game.Screen.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_beige_pressed.png", GraphicsDevice), 15, 15); Frame.Background = new BorderBrush(Color.CornflowerBlue); NavigateFromTransition = new AlphaTransition(Frame, Transition.Linear, TimeSpan.FromMilliseconds(200), 0f); NavigateToTransition = new AlphaTransition(Frame, Transition.Linear, TimeSpan.FromMilliseconds(200), 1f); NavigateToScreen(new MainScreen(this)); }
public void ReloadAssets() { Skin.Current.ButtonBrush = NineTileBrush.FromSingleTexture(Game.Assets.LoadTexture(typeof(ScreenComponent), "buttonLong_brown"), 15, 15); Skin.Current.ButtonHoverBrush = NineTileBrush.FromSingleTexture(Game.Assets.LoadTexture(typeof(ScreenComponent), "buttonLong_beige"), 15, 15); Skin.Current.ButtonPressedBrush = NineTileBrush.FromSingleTexture(Game.Assets.LoadTexture(typeof(ScreenComponent), "buttonLong_beige_pressed"), 15, 15); Skin.Current.ProgressBarBrush = NineTileBrush.FromSingleTexture(Game.Assets.LoadTexture(typeof(ScreenComponent), "progress_red"), 10, 8); Skin.Current.HorizontalScrollBackgroundBrush = NineTileBrush.FromSingleTexture(Game.Assets.LoadTexture(typeof(ScreenComponent), "progress_background"), 10, 8); }
public MessageScreen(ScreenComponent manager, string title, string content, string buttonText = "OK", Action <Control, MouseEventArgs> buttonClick = null) : base(manager) { assets = manager.Game.Assets; IsOverlay = true; Background = new BorderBrush(Color.Black * 0.5f); Title = title; panel = new Panel(manager) { Padding = Border.All(20), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Controls.Add(panel); StackPanel spanel = new StackPanel(manager); panel.Controls.Add(spanel); Label headLine = new Label(manager) { Text = title, Font = Skin.Current.HeadlineFont, HorizontalAlignment = HorizontalAlignment.Stretch }; spanel.Controls.Add(headLine); Label contentLabel = new Label(manager) { Text = content, Font = Skin.Current.TextFont, HorizontalAlignment = HorizontalAlignment.Stretch }; spanel.Controls.Add(contentLabel); Button closeButton = Button.TextButton(manager, buttonText); closeButton.HorizontalAlignment = HorizontalAlignment.Stretch; closeButton.LeftMouseClick += (s, e) => { if (buttonClick != null) { buttonClick(s, e); } else { manager.NavigateBack(); } }; spanel.Controls.Add(closeButton); panel.Background = NineTileBrush.FromSingleTexture(assets.LoadTexture(typeof(ScreenComponent), "panel"), 30, 30); }
public CompassControl(ScreenComponent screenManager) : base(screenManager) { Player = screenManager.Player; Padding = Border.All(7); Background = NineTileBrush.FromSingleTexture( screenManager.Game.Screen.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_brown_pressed.png", screenManager.GraphicsDevice), 7, 7); compassTexture = ScreenManager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/compass.png", ScreenManager.GraphicsDevice); }
public CompassControl(ScreenComponent screenManager) : base(screenManager) { assets = screenManager.Game.Assets; Player = screenManager.Player; Padding = Border.All(7); Texture2D background = assets.LoadTexture(typeof(ScreenComponent), "buttonLong_brown_pressed"); Background = NineTileBrush.FromSingleTexture(background, 7, 7); compassTexture = assets.LoadTexture(GetType(), "compass"); }
public InventoryScreen(ScreenComponent manager) : base(manager) { player = manager.Player; IsOverlay = true; Texture2D panelBackground = manager.Game.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30); HorizontalAlignment = HorizontalAlignment.Center; VerticalAlignment = VerticalAlignment.Center; Width = 600; Height = 400; Label headLine = new Label(manager); headLine.Text = Languages.OctoClient.Inventory; headLine.Font = Skin.Current.HeadlineFont; headLine.HorizontalAlignment = HorizontalAlignment.Left; headLine.VerticalAlignment = VerticalAlignment.Top; Controls.Add(headLine); Button closeButton = Button.TextButton(manager, Languages.OctoClient.Close); closeButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); }; Controls.Add(closeButton); //counter = new LabelControl(ScreenManager) //{ // Font = ScreenManager.NormalText, // Color = Color.Black, // Position = new Index2(((ScreenManager.ScreenSize.X - 600) / 2) + 100, // ((ScreenManager.ScreenSize.Y - 400) / 2) + 140), //}; //Controls.Add(counter); Title = Languages.OctoClient.Inventory; }
public InventoryScreen(ScreenComponent manager) : base(manager) { player = manager.Player; IsOverlay = true; Texture2D panelBackground = manager.Content.Load <Texture2D>("Textures/panel"); Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30); HorizontalAlignment = HorizontalAlignment.Center; VerticalAlignment = VerticalAlignment.Center; Width = 600; Height = 400; Label headLine = new Label(manager); headLine.Text = "Inventory"; headLine.Font = Skin.Current.HeadlineFont; headLine.HorizontalAlignment = HorizontalAlignment.Left; headLine.VerticalAlignment = VerticalAlignment.Top; Controls.Add(headLine); Button closeButton = Button.TextButton(Manager, "Close"); closeButton.LeftMouseClick += (s, e) => { Manager.NavigateBack(); }; Controls.Add(closeButton); //counter = new LabelControl(ScreenManager) //{ // Font = ScreenManager.NormalText, // Color = Color.Black, // Position = new Index2(((ScreenManager.ScreenSize.X - 600) / 2) + 100, // ((ScreenManager.ScreenSize.Y - 400) / 2) + 140), //}; //Controls.Add(counter); }
public InventoryScreen(ScreenComponent manager) : base(manager) { assets = manager.Game.Assets; foreach (var item in manager.Game.DefinitionManager.GetDefinitions()) { Texture2D texture = manager.Game.Assets.LoadTexture(item.GetType(), item.Icon); toolTextures.Add(item.GetType().FullName, texture); } player = manager.Player; IsOverlay = true; Background = new BorderBrush(Color.Black * 0.3f); backgroundBrush = new BorderBrush(Color.Black); hoverBrush = new BorderBrush(Color.Brown); Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel"); Grid grid = new Grid(manager) { Width = 800, Height = 500, }; grid.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Fixed, Width = 600 }); grid.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Fixed, Width = 200 }); grid.Rows.Add(new RowDefinition() { ResizeMode = ResizeMode.Parts, Height = 1 }); grid.Rows.Add(new RowDefinition() { ResizeMode = ResizeMode.Fixed, Height = 100 }); Controls.Add(grid); inventory = new InventoryControl(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = Border.All(20), }; grid.AddControl(inventory, 0, 0); StackPanel infoPanel = new StackPanel(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = Border.All(20), Margin = Border.All(10, 0, 0, 0), }; nameLabel = new Label(manager); infoPanel.Controls.Add(nameLabel); massLabel = new Label(manager); infoPanel.Controls.Add(massLabel); volumeLabel = new Label(manager); infoPanel.Controls.Add(volumeLabel); grid.AddControl(infoPanel, 1, 0); Grid toolbar = new Grid(manager) { Margin = Border.All(0, 10, 0, 0), Height = 100, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), }; toolbar.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Parts, Width = 1 }); for (int i = 0; i < ToolBarComponent.TOOLCOUNT; i++) { toolbar.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Fixed, Width = 50 }); } toolbar.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Parts, Width = 1 }); toolbar.Rows.Add(new RowDefinition() { ResizeMode = ResizeMode.Parts, Height = 1 }); images = new Image[ToolBarComponent.TOOLCOUNT]; for (int i = 0; i < ToolBarComponent.TOOLCOUNT; i++) { Image image = images[i] = new Image(manager) { Width = 42, Height = 42, Background = backgroundBrush, HorizontalAlignment = HorizontalAlignment.Center, Tag = i, Padding = Border.All(2), }; image.StartDrag += (e) => { InventorySlot slot = player.Toolbar.Tools[(int)image.Tag]; if (slot != null) { e.Handled = true; e.Icon = toolTextures[slot.Definition.GetType().FullName]; e.Content = slot; e.Sender = toolbar; } }; image.DropEnter += (e) => { image.Background = hoverBrush; }; image.DropLeave += (e) => { image.Background = backgroundBrush; }; image.EndDrop += (e) => { e.Handled = true; if (e.Sender is Grid) // && ShiftPressed { // Swap int targetIndex = (int)image.Tag; InventorySlot targetSlot = player.Toolbar.Tools[targetIndex]; InventorySlot sourceSlot = e.Content as InventorySlot; int sourceIndex = player.Toolbar.GetSlotIndex(sourceSlot); player.Toolbar.SetTool(sourceSlot, targetIndex); player.Toolbar.SetTool(targetSlot, sourceIndex); } else { // Inventory Drop InventorySlot slot = e.Content as InventorySlot; player.Toolbar.SetTool(slot, (int)image.Tag); } }; toolbar.AddControl(image, i + 1, 0); } grid.AddControl(toolbar, 0, 1, 2); Title = Languages.OctoClient.Inventory; }
public OptionsScreen(ScreenComponent manager) : base(manager) { game = manager.Game; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.Options; Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); SetDefaultBackground(); TabControl tabs = new TabControl(manager) { Padding = new Border(20, 20, 20, 20), Width = 700, TabPageBackground = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), TabBrush = NineTileBrush.FromSingleTexture(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_brown.png", manager.GraphicsDevice), 15, 15), TabActiveBrush = NineTileBrush.FromSingleTexture(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/buttonLong_beige.png", manager.GraphicsDevice), 15, 15), }; Controls.Add(tabs); #region OptionsPage TabPage optionsPage = new TabPage(manager, "Options"); tabs.Pages.Add(optionsPage); ////////////////////////////////////////////Settings Stack//////////////////////////////////////////// StackPanel settingsStack = new StackPanel(manager) { Orientation = Orientation.Vertical, VerticalAlignment = VerticalAlignment.Top, Padding = new Border(20, 20, 20, 20), Width = 650 }; optionsPage.Controls.Add(settingsStack); //////////////////////Viewrange////////////////////// string viewrange = SettingsManager.Get("Viewrange"); rangeTitle = new Label(manager) { Text = Languages.OctoClient.Viewrange + ": " + viewrange }; settingsStack.Controls.Add(rangeTitle); Slider viewrangeSlider = new Slider(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, Height = 20, Range = 9, Value = int.Parse(viewrange) - 1 }; viewrangeSlider.ValueChanged += (value) => SetViewrange(value + 1); settingsStack.Controls.Add(viewrangeSlider); //////////////////////Persistence////////////////////// StackPanel persistenceStack = new StackPanel(manager) { Orientation = Orientation.Horizontal, Margin = new Border(0, 20, 0, 0) }; settingsStack.Controls.Add(persistenceStack); Label persistenceTitle = new Label(manager) { Text = Languages.OctoClient.DisablePersistence + ":" }; persistenceStack.Controls.Add(persistenceTitle); Checkbox disablePersistence = new Checkbox(manager) { Checked = bool.Parse(SettingsManager.Get("DisablePersistence")), HookBrush = new TextureBrush(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/iconCheck_brown.png", manager.GraphicsDevice), TextureBrushMode.Stretch), }; disablePersistence.CheckedChanged += (state) => SetPersistence(state); persistenceStack.Controls.Add(disablePersistence); //////////////////////Map Path////////////////////// StackPanel mapPathStack = new StackPanel(manager) { Orientation = Orientation.Vertical, Margin = new Border(0, 20, 0, 0), HorizontalAlignment = HorizontalAlignment.Stretch }; settingsStack.Controls.Add(mapPathStack); mapPath = new Textbox(manager) { Text = SettingsManager.Get("ChunkRoot"), Enabled = false, HorizontalAlignment = HorizontalAlignment.Stretch, Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray) }; mapPathStack.Controls.Add(mapPath); Button changePath = Button.TextButton(manager, Languages.OctoClient.ChangePath); changePath.HorizontalAlignment = HorizontalAlignment.Center; changePath.Height = 40; changePath.LeftMouseClick += (s, e) => ChangePath(); mapPathStack.Controls.Add(changePath); //////////////////////Fullscreen////////////////////// StackPanel fullscreenStack = new StackPanel(manager) { Orientation = Orientation.Horizontal, Margin = new Border(0, 20, 0, 0) }; settingsStack.Controls.Add(fullscreenStack); Label fullscreenTitle = new Label(manager) { Text = Languages.OctoClient.EnableFullscreenOnStartup + ":" }; fullscreenStack.Controls.Add(fullscreenTitle); Checkbox enableFullscreen = new Checkbox(manager) { Checked = bool.Parse(SettingsManager.Get("EnableFullscreen")), HookBrush = new TextureBrush(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/UI/iconCheck_brown.png", manager.GraphicsDevice), TextureBrushMode.Stretch), }; enableFullscreen.CheckedChanged += (state) => SetFullscreen(state); fullscreenStack.Controls.Add(enableFullscreen); //////////////////////Auflösung////////////////////// StackPanel resolutionStack = new StackPanel(manager) { Orientation = Orientation.Horizontal, Margin = new Border(0, 20, 0, 0) }; settingsStack.Controls.Add(resolutionStack); Label resolutionTitle = new Label(manager) { Text = Languages.OctoClient.Resolution + ":" }; resolutionStack.Controls.Add(resolutionTitle); Textbox resolutionWidthTextbox = new Textbox(manager) { Text = SettingsManager.Get("Width"), Width = 50, Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray) }; resolutionWidthTextbox.TextChanged += ResolutionWidthTextbox_TextChanged; resolutionStack.Controls.Add(resolutionWidthTextbox); Label xLabel = new Label(manager) { Text = "x" }; resolutionStack.Controls.Add(xLabel); Textbox resolutionHeightTextbox = new Textbox(manager) { Text = SettingsManager.Get("Height"), Width = 50, Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray) }; resolutionHeightTextbox.TextChanged += ResolutionHeightTextbox_TextChanged; resolutionStack.Controls.Add(resolutionHeightTextbox); Label pxLabel = new Label(manager) { Text = Languages.OctoClient.Pixels }; resolutionStack.Controls.Add(pxLabel); #endregion #region BindingsPage TabPage bindingsPage = new TabPage(manager, "Bindings"); tabs.Pages.Add(bindingsPage); ScrollContainer bindingsScroll = new ScrollContainer(manager); bindingsPage.Controls.Add(bindingsScroll); StackPanel bindingsStack = new StackPanel(manager) { Orientation = Orientation.Vertical, Padding = new Border(20, 20, 20, 20), Width = 650 }; bindingsScroll.Content = bindingsStack; //////////////////////////////KeyBindings//////////////////////////////////////////// var bindings = game.KeyMapper.GetBindings(); foreach (var binding in bindings) { StackPanel bindingStack = new StackPanel(manager) { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Stretch, Height = 35 }; Label lbl = new Label(manager) { Text = binding.DisplayName, Width = 480 }; Label bindingKeyLabel = new Label(manager) { Text = binding.Keys.First().ToString(), HorizontalAlignment = HorizontalAlignment.Right, Width = 90, Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray), Tag = new object[] { binding.Id, binding.Keys.First() } }; bindingKeyLabel.LeftMouseClick += BindingKeyLabel_LeftMouseClick; bindingStack.Controls.Add(lbl); bindingStack.Controls.Add(bindingKeyLabel); bindingsStack.Controls.Add(bindingStack); } #endregion ////////////////////////////////////////////Restart Button//////////////////////////////////////////// exitButton = Button.TextButton(manager, Languages.OctoClient.RestartGameToApplyChanges); exitButton.VerticalAlignment = VerticalAlignment.Top; exitButton.HorizontalAlignment = HorizontalAlignment.Right; exitButton.Enabled = false; exitButton.Visible = false; exitButton.LeftMouseClick += (s, e) => Program.Restart(); exitButton.Margin = new Border(10, 10, 10, 10); Controls.Add(exitButton); }
public CrewMemberScreen(ScreenComponent manager, CrewMember member) : base(manager) { VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; SpriteFont boldFont = manager.Content.Load <SpriteFont>("BoldFont"); Padding = new Border(0, 0, 0, 0); SetDefaultBackground(); //The Panel Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); Panel panel = new Panel(manager) { MaxWidth = 750, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = new Border(15, 15, 15, 15), }; Controls.Add(panel); //The Vertical Stack - Split the Panel in half Vertical StackPanel verticalStack = new StackPanel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, }; // panel.Controls.Add(verticalStack); //The Main Stack - Split the Panel in half Horizontal StackPanel horizontalStack = new StackPanel(manager) { HorizontalAlignment = HorizontalAlignment.Center, Orientation = Orientation.Horizontal }; panel.Controls.Add(horizontalStack); //The Profile Image Image profileImage = new Image(manager) { Height = 200, Width = 200, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Padding = new Border(0, 0, 10, 0) }; if (member.PictureFilename == null) { profileImage.Texture = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/Crew/base.png", manager.GraphicsDevice); } else { profileImage.Texture = manager.Content.LoadTexture2DFromFile(member.PictureFilename, manager.GraphicsDevice); } horizontalStack.Controls.Add(profileImage); //The Text Stack StackPanel textStack = new StackPanel(manager); textStack.VerticalAlignment = VerticalAlignment.Stretch; textStack.HorizontalAlignment = HorizontalAlignment.Left; textStack.Width = 430; horizontalStack.Controls.Add(textStack); //The Username Label username = new Label(manager) { Text = member.Username, Font = manager.Content.Load <SpriteFont>("HeadlineFont"), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; textStack.Controls.Add(username); //The Alias Label alias = new Label(manager) { Text = member.Alias, HorizontalAlignment = HorizontalAlignment.Left }; textStack.Controls.Add(alias); //Achievements string achievementString = ""; foreach (CrewMember.Achievements achievement in member.AchievementList) { achievementString += " " + achievement.ToString(); if (member.AchievementList.IndexOf(achievement) != member.AchievementList.Count - 1) { achievementString += ", "; } } StackPanel achievementStack = new StackPanel(manager); achievementStack.VerticalAlignment = VerticalAlignment.Top; achievementStack.HorizontalAlignment = HorizontalAlignment.Left; achievementStack.Orientation = Orientation.Horizontal; textStack.Controls.Add(achievementStack); Label achievementsTitle = new Label(manager) { Text = Languages.OctoClient.Achievements + ": ", Font = boldFont, HorizontalAlignment = HorizontalAlignment.Left }; Label achievements = new Label(manager) { Text = achievementString, HorizontalAlignment = HorizontalAlignment.Left }; achievementStack.Controls.Add(achievementsTitle); achievementStack.Controls.Add(achievements); Panel DescriptionPanel = new Panel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, }; textStack.Controls.Add(DescriptionPanel); Label Description = new Label(manager) { Text = member.Description, WordWrap = true, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Left, HorizontalTextAlignment = HorizontalAlignment.Left, VerticalTextAlignment = VerticalAlignment.Top, }; Description.InvalidateDimensions(); DescriptionPanel.Controls.Add(Description); panel.Width = 700; }
public OptionsScreen(ScreenComponent manager) : base(manager) { assets = manager.Game.Assets; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.Options; Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel"); SetDefaultBackground(); TabControl tabs = new TabControl(manager) { Padding = new Border(20, 20, 20, 20), Width = 700, TabPageBackground = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), TabBrush = NineTileBrush.FromSingleTexture(assets.LoadTexture(typeof(ScreenComponent), "buttonLong_brown"), 15, 15), TabActiveBrush = NineTileBrush.FromSingleTexture(assets.LoadTexture(typeof(ScreenComponent), "buttonLong_beige"), 15, 15), }; Controls.Add(tabs); #region OptionsPage TabPage optionsPage = new TabPage(manager, Languages.OctoClient.Options); tabs.Pages.Add(optionsPage); OptionsOptionControl optionsOptions = new OptionsOptionControl(manager, this) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; optionsPage.Controls.Add(optionsOptions); #endregion #region BindingsPage TabPage bindingsPage = new TabPage(manager, Languages.OctoClient.KeyBindings); tabs.Pages.Add(bindingsPage); BindingsOptionControl bindingsOptions = new BindingsOptionControl(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; bindingsPage.Controls.Add(bindingsOptions); #endregion #region TexturePackPage TabPage resourcePackPage = new TabPage(manager, "Resource Packs"); tabs.Pages.Add(resourcePackPage); ResourcePacksOptionControl resourcePacksOptions = new ResourcePacksOptionControl(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; resourcePackPage.Controls.Add(resourcePacksOptions); #endregion ////////////////////////////////////////////Restart Button//////////////////////////////////////////// exitButton = Button.TextButton(manager, Languages.OctoClient.RestartGameToApplyChanges); exitButton.VerticalAlignment = VerticalAlignment.Top; exitButton.HorizontalAlignment = HorizontalAlignment.Right; exitButton.Enabled = false; exitButton.Visible = false; exitButton.LeftMouseClick += (s, e) => Program.Restart(); exitButton.Margin = new Border(10, 10, 10, 10); Controls.Add(exitButton); }
public CrewMemberScreen(ScreenComponent manager, CrewMember member) : base(manager) { assets = manager.Game.Assets; VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; Title = Languages.OctoClient.CreditsCrew + ": " + member.Username; SpriteFont boldFont = manager.Content.Load <SpriteFont>("BoldFont"); Padding = new Border(0, 0, 0, 0); SetDefaultBackground(); //The Panel Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel"); Panel panel = new Panel(manager) { MaxWidth = 750, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = new Border(15, 15, 15, 15), }; Controls.Add(panel); //The Main Stack - Split the Panel in half Horizontal StackPanel horizontalStack = new StackPanel(manager) { HorizontalAlignment = HorizontalAlignment.Center, Orientation = Orientation.Horizontal }; panel.Controls.Add(horizontalStack); //The Profile Image Image profileImage = new Image(manager) { Height = 200, Width = 200, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Padding = new Border(0, 0, 10, 0) }; if (member.PictureFilename == null) { profileImage.Texture = assets.LoadTexture(typeof(CrewMember), "base"); } else { profileImage.Texture = assets.LoadTexture(typeof(CrewMember), member.PictureFilename); } horizontalStack.Controls.Add(profileImage); //The Text Stack StackPanel textStack = new StackPanel(manager); textStack.VerticalAlignment = VerticalAlignment.Stretch; textStack.HorizontalAlignment = HorizontalAlignment.Left; textStack.Width = 430; horizontalStack.Controls.Add(textStack); //The Username & Alias string usernameText = member.Username; if (member.Alias != member.Username) { usernameText += " (" + member.Alias + ")"; } Label username = new Label(manager) { Text = usernameText, Font = manager.Content.Load <SpriteFont>("HeadlineFont"), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; textStack.Controls.Add(username); //Achievements string achievementString = string.Join(", ", member.AchievementList.Select(a => a.ToString())); StackPanel achievementStack = new StackPanel(manager) { VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Orientation = Orientation.Horizontal, }; textStack.Controls.Add(achievementStack); Label achievementsTitle = new Label(manager) { Text = Languages.OctoClient.Achievements + ": ", Font = boldFont, HorizontalAlignment = HorizontalAlignment.Left }; achievementStack.Controls.Add(achievementsTitle); Label achievements = new Label(manager) { Text = achievementString, HorizontalAlignment = HorizontalAlignment.Left }; achievementStack.Controls.Add(achievements); // Links string linkString = string.Join(", ", member.Links.Select(a => a.Title)); StackPanel linkStack = new StackPanel(manager) { VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Orientation = Orientation.Horizontal, }; textStack.Controls.Add(linkStack); Label linkTitle = new Label(manager) { Text = Languages.OctoClient.Links + ": ", Font = boldFont, HorizontalAlignment = HorizontalAlignment.Left }; linkStack.Controls.Add(linkTitle); foreach (var link in member.Links) { if (CheckHttpUrl(link.Url)) { Button linkButton = Button.TextButton(manager, link.Title); linkButton.LeftMouseClick += (s, e) => Process.Start(link.Url); linkStack.Controls.Add(linkButton); } } Panel descriptionPanel = new Panel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, }; textStack.Controls.Add(descriptionPanel); Label description = new Label(manager) { Text = member.Description, WordWrap = true, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Left, HorizontalTextAlignment = HorizontalAlignment.Left, VerticalTextAlignment = VerticalAlignment.Top, }; description.InvalidateDimensions(); descriptionPanel.Controls.Add(description); panel.Width = 700; }
public TargetScreen(ScreenComponent manager, Action <int, int> tp, int x, int y) : base(manager) { assets = manager.Game.Assets; IsOverlay = true; Background = new BorderBrush(Color.Black * 0.5f); Title = "Select target"; Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel"); Panel panel = new Panel(manager) { Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = Border.All(20), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Controls.Add(panel); StackPanel spanel = new StackPanel(manager); panel.Controls.Add(spanel); Label headLine = new Label(manager) { Text = Title, Font = Skin.Current.HeadlineFont, HorizontalAlignment = HorizontalAlignment.Stretch }; spanel.Controls.Add(headLine); StackPanel vstack = new StackPanel(manager); vstack.Orientation = Orientation.Vertical; spanel.Controls.Add(vstack); StackPanel xStack = new StackPanel(manager); xStack.Orientation = Orientation.Horizontal; vstack.Controls.Add(xStack); Label xLabel = new Label(manager); xLabel.Text = "X:"; xStack.Controls.Add(xLabel); Textbox xText = new Textbox(manager) { Background = new BorderBrush(Color.Gray), Width = 150, Margin = new Border(2, 10, 2, 10), Text = x.ToString() }; xStack.Controls.Add(xText); StackPanel yStack = new StackPanel(manager); yStack.Orientation = Orientation.Horizontal; vstack.Controls.Add(yStack); Label yLabel = new Label(manager); yLabel.Text = "Y:"; yStack.Controls.Add(yLabel); Textbox yText = new Textbox(manager) { Background = new BorderBrush(Color.Gray), Width = 150, Margin = new Border(2, 10, 2, 10), Text = y.ToString() }; yStack.Controls.Add(yText); Button closeButton = Button.TextButton(manager, "Teleport"); closeButton.HorizontalAlignment = HorizontalAlignment.Stretch; closeButton.LeftMouseClick += (s, e) => { if (tp != null) { tp(int.Parse(xText.Text), int.Parse(yText.Text)); } else { manager.NavigateBack(); } }; spanel.Controls.Add(closeButton); }
public OptionsScreen(ScreenComponent manager) : base(manager) { game = (OctoGame)manager.Game; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.Options; SetDefaultBackground(); ////////////////////////////////////////////Settings Stack//////////////////////////////////////////// StackPanel settingsStack = new StackPanel(manager); settingsStack.Orientation = Orientation.Vertical; Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); settingsStack.Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30); settingsStack.Padding = new Border(20, 20, 20, 20); settingsStack.Width = 500; Controls.Add(settingsStack); //////////////////////Viewrange////////////////////// string viewrange = SettingsManager.Get("Viewrange"); rangeTitle = new Label(manager); rangeTitle.Text = Languages.OctoClient.Viewrange + ": " + viewrange; settingsStack.Controls.Add(rangeTitle); Slider viewrangeSlider = new Slider(manager); viewrangeSlider.HorizontalAlignment = HorizontalAlignment.Stretch; viewrangeSlider.Height = 20; viewrangeSlider.Range = 9; viewrangeSlider.Value = int.Parse(viewrange) - 1; viewrangeSlider.ValueChanged += (value) => SetViewrange(value + 1); settingsStack.Controls.Add(viewrangeSlider); //////////////////////Persistence////////////////////// StackPanel persistenceStack = new StackPanel(manager); persistenceStack.Orientation = Orientation.Horizontal; persistenceStack.Margin = new Border(0, 10, 0, 0); settingsStack.Controls.Add(persistenceStack); persistenceTitle = new Label(manager); persistenceTitle.Text = Languages.OctoClient.DisablePersistence + ":"; persistenceStack.Controls.Add(persistenceTitle); Checkbox disablePersistence = new Checkbox(manager); disablePersistence.Checked = bool.Parse(SettingsManager.Get("DisablePersistence")); disablePersistence.CheckedChanged += (state) => SetPersistence(state); persistenceStack.Controls.Add(disablePersistence); //////////////////////Map Path////////////////////// StackPanel mapPathStack = new StackPanel(manager); mapPathStack.Orientation = Orientation.Horizontal; mapPathStack.Margin = new Border(0, 10, 0, 0); mapPathStack.HorizontalAlignment = HorizontalAlignment.Stretch; settingsStack.Controls.Add(mapPathStack); mapPath = new Textbox(manager); // mapPath.HorizontalAlignment = HorizontalAlignment.Stretch; mapPath.Text = SettingsManager.Get("ChunkRoot"); mapPath.Enabled = false; mapPath.Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray); mapPathStack.Controls.Add(mapPath); Button changePath = Button.TextButton(manager, Languages.OctoClient.ChangePath); changePath.Height = 31; changePath.LeftMouseClick += (s, e) => ChangePath(); mapPathStack.Controls.Add(changePath); ////////////////////////////////////////////Restart Button//////////////////////////////////////////// exitButton = Button.TextButton(manager, Languages.OctoClient.RestartGameToApplyChanges); exitButton.VerticalAlignment = VerticalAlignment.Top; exitButton.HorizontalAlignment = HorizontalAlignment.Right; exitButton.Enabled = false; exitButton.Visible = false; exitButton.LeftMouseClick += (s, e) => Program.Restart(); exitButton.Margin = new Border(10, 10, 10, 10); Controls.Add(exitButton); }
public OptionsScreen(ScreenComponent manager) : base(manager) { game = (OctoGame)manager.Game; Padding = new Border(0, 0, 0, 0); Title = Languages.OctoClient.Options; ////////////////////////////////////////////Background//////////////////////////////////////////// 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); ////////////////////////////////////////////Back Button//////////////////////////////////////////// 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); ////////////////////////////////////////////Settings Stack//////////////////////////////////////////// StackPanel settingsStack = new StackPanel(manager); settingsStack.Orientation = Orientation.Vertical; Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); settingsStack.Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30); settingsStack.Padding = new Border(20, 20, 20, 20); Controls.Add(settingsStack); //////////////////////Viewrange////////////////////// string viewrange = ConfigurationManager.AppSettings["Viewrange"]; rangeTitle = new Label(manager); rangeTitle.Text = Languages.OctoClient.Viewrange + ": " + viewrange; settingsStack.Controls.Add(rangeTitle); Slider viewrangeSlider = new Slider(manager); viewrangeSlider.HorizontalAlignment = HorizontalAlignment.Stretch; viewrangeSlider.Height = 20; viewrangeSlider.Range = 9; viewrangeSlider.Value = int.Parse(viewrange) - 1; viewrangeSlider.ValueChanged += (value) => SetViewrange(value + 1); settingsStack.Controls.Add(viewrangeSlider); //////////////////////Persistence////////////////////// StackPanel persistenceStack = new StackPanel(manager); persistenceStack.Orientation = Orientation.Horizontal; persistenceStack.Margin = new Border(0, 10, 0, 0); settingsStack.Controls.Add(persistenceStack); persistenceTitle = new Label(manager); persistenceTitle.Text = Languages.OctoClient.DisablePersistence + ":"; persistenceStack.Controls.Add(persistenceTitle); Checkbox disablePersistence = new Checkbox(manager); disablePersistence.Checked = bool.Parse(ConfigurationManager.AppSettings["DisablePersistence"]); disablePersistence.CheckedChanged += (state) => SetPersistence(state); persistenceStack.Controls.Add(disablePersistence); //////////////////////Map Path////////////////////// StackPanel mapPathStack = new StackPanel(manager); mapPathStack.Orientation = Orientation.Horizontal; mapPathStack.Margin = new Border(0, 10, 0, 0); mapPathStack.HorizontalAlignment = HorizontalAlignment.Stretch; settingsStack.Controls.Add(mapPathStack); mapPath = new Textbox(manager); // mapPath.HorizontalAlignment = HorizontalAlignment.Stretch; mapPath.Text = ConfigurationManager.AppSettings["ChunkRoot"]; mapPath.Enabled = false; mapPath.Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray); mapPathStack.Controls.Add(mapPath); Button changePath = Button.TextButton(manager, Languages.OctoClient.ChangePath); changePath.Height = 31; changePath.LeftMouseClick += (s, e) => ChangePath(); mapPathStack.Controls.Add(changePath); //////////////////////Delete Map////////////////////// deleteButton = Button.TextButton(manager, Languages.OctoClient.DeleteMap); deleteButton.HorizontalAlignment = HorizontalAlignment.Stretch; deleteButton.Margin = new Border(0, 10, 0, 0); deleteButton.LeftMouseClick += (s, e) => deleteMap(); settingsStack.Controls.Add(deleteButton); ////////////////////////////////////////////Restart Button//////////////////////////////////////////// exitButton = Button.TextButton(manager, Languages.OctoClient.RestartGameToApplyChanges); exitButton.VerticalAlignment = VerticalAlignment.Top; exitButton.HorizontalAlignment = HorizontalAlignment.Right; exitButton.Enabled = false; exitButton.Visible = false; exitButton.LeftMouseClick += (s, e) => { Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location); game.Exit(); }; exitButton.Margin = new Border(10, 10, 10, 10); Controls.Add(exitButton); }