Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void InitalizeInterface()
- {
- var font = this.ContentManager.Load<SpriteFont>(Constants.FILEPATH_GFX + "Fonts/interfaceFont");
- var chatFont = this.ContentManager.Load<SpriteFont>(Constants.FILEPATH_GFX + "Fonts/chatFont");
- var idleButtonSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/idleButton");
- var hoverButtonSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/hoverButton");
- var backBar = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/statusBar");
- var windowBackSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/windowBack");
- var chatBack = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/chat");
- var chat = new Chatbox(chatBack, chatFont, 12)
- {
- Position = new Vector2(0, 630 - chatBack.Height),
- Draggable = true,
- ChatOffset = new Vector2(30, chatBack.Height - 15),
- Visible = true
- };
- this.GuiManager.AddWidget(chat, "chatbox");
- var messageEntrySprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/textboxNormal");
- var messageEntry = new Textbox(messageEntrySprite, chatFont, new Vector2(12, 0))
- {
- Position = new Vector2(17, (chat.Position.Y + chatBack.Height)),
- Scale =
- new Vector2(
- MathFunctions.RoundDown((float)chatBack.Width / (float)messageEntrySprite.Width, 1), 1)
- };
- messageEntry.BindTo(chat);
- messageEntry.Visible = true;
- messageEntry.ReturnPressed += messageEntry_ReturnPressed;
- this.GuiManager.AddWidget(messageEntry, "messageEntry");
- var logoutButton = new Button(idleButtonSprite, "Logout", font)
- {
- HoverSprite = hoverButtonSprite,
- Position = new Vector2(1020, 640),
- Visible = true
- };
- logoutButton.Clicked += logoutButton_ButtonClicked;
- this.GuiManager.AddWidget(logoutButton, "btnLogout");
- var toggleInventoryButton = new Button(idleButtonSprite, "Inventory", font)
- {
- HoverSprite = hoverButtonSprite,
- Position = new Vector2(1020, 520),
- Visible = true
- };
- toggleInventoryButton.Clicked += toggleInventoryButton_ButtonClicked;
- this.GuiManager.AddWidget(toggleInventoryButton, "toggleInventoryButton");
- var toggleCharacterWindowButton = new Button(idleButtonSprite, "Character", font)
- {
- HoverSprite = hoverButtonSprite,
- Position = new Vector2(1020, 580),
- Visible = true
- };
- toggleCharacterWindowButton.Clicked += toggleCharacterWindowButton_ButtonClicked;
- this.GuiManager.AddWidget(toggleCharacterWindowButton, "toggleCharacterWindowButton");
- Texture2D healthFillSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/healthFillSprite");
- var healthStatusBar = new StatusBar(backBar, healthFillSprite, new Rectangle(7, 7, healthFillSprite.Width, healthFillSprite.Height), font)
- {
- Visible = true,
- ForeColor = Color.Black,
- Position = new Vector2(25, 5),
- Text = "HP: 100/100",
- Value = 100
- };
- healthStatusBar.TextOffset =
- new Vector2(healthFillSprite.Width - font.MeasureString(healthStatusBar.Text).X,
- healthFillSprite.Height / 2f);
- this.GuiManager.AddWidget(healthStatusBar, "healthStatusBar");
- Texture2D manaFillSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/manaFillSprite");
- var manaStatusBar = new StatusBar(backBar, manaFillSprite, new Rectangle(7, 7, manaFillSprite.Width, manaFillSprite.Height), font)
- {
- Visible = true,
- ForeColor = Color.Black,
- Position = new Vector2(25, 35),
- Text = "MP: 100/100",
- Value = 100
- };
- manaStatusBar.TextOffset =
- new Vector2(manaFillSprite.Width - font.MeasureString(manaStatusBar.Text).X,
- manaFillSprite.Height / 2f);
- this.GuiManager.AddWidget(manaStatusBar, "manaStatusBar");
- Texture2D inventoryBackSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/inventory");
- var inventoryWidget = new WidgetContainer(inventoryBackSprite)
- {
- Visible = false,
- Position = new Vector2(500, 400),
- Draggable = true
- };
- this.GuiManager.AddWidget(inventoryWidget, "inventoryWidget");
- Texture2D experienceBarSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/experienceBar");
- Texture2D experienceBarPool = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/experiencePool");
- var experienceBar = new StatusBar(experienceBarSprite, experienceBarPool, new Rectangle(8, 31, 440, 23), font)
- {
- Visible = true,
- ForeColor = Color.Black,
- Position = new Vector2(chat.Position.X, chat.Position.Y - 50),
- Value = 50
- };
- this.GuiManager.AddWidget(experienceBar, "experienceBar");
- var characterWindowSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/statScreen");
- var characterWindow = new WidgetContainer(characterWindowSprite)
- {
- Visible = false,
- Position = new Vector2(300, 200),
- Draggable = true
- };
- this.GuiManager.AddWidget(characterWindow, "characterWindow");
- var equipmentContainer = new WidgetContainer(characterWindow.Size)
- {
- Visible = true,
- Position = characterWindow.Position,
- ZOrder = 1
- };
- characterWindow.AddWidget(equipmentContainer, "equipmentContainer");
- var charWindowNameLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 170, characterWindow.Position.Y + 65),
- Visible= true,
- Text = "Player Name",
- ZOrder = 1
- };
- characterWindow.AddWidget(charWindowNameLabel, "charWindowNameLabel");
- var charStatsHeaderLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 410, characterWindow.Position.Y + 110),
- Visible = true,
- Text = "Character Stats:"
- };
- characterWindow.AddWidget(charStatsHeaderLabel, "charStatsHeaderLabel");
- var charHealthLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 390, characterWindow.Position.Y + 150),
- Visible = true,
- Text = "Health: 0/0"
- };
- characterWindow.AddWidget(charHealthLabel, "charHealthLabel");
- var charStrengthLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 390, characterWindow.Position.Y + 175),
- Visible = true,
- Text = "Strength: 0"
- };
- characterWindow.AddWidget(charStrengthLabel, "charStrengthLabel");
- var charIntLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 390, characterWindow.Position.Y + 200),
- Visible = true,
- Text = "Intelligence: 0"
- };
- characterWindow.AddWidget(charIntLabel, "charIntLabel");
- var charDexLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 390, characterWindow.Position.Y + 225),
- Visible = true,
- Text = "Dexterity: 0"
- };
- characterWindow.AddWidget(charDexLabel, "charDexLabel");
- var charDefLabel = new Label(font)
- {
- Position = new Vector2(characterWindow.Position.X + 390, characterWindow.Position.Y + 250),
- Visible = true,
- Text = "Defence: 0"
- };
- characterWindow.AddWidget(charDefLabel, "charDefLabel");
- var targetPortrait = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/portrait");
- var targetPortraitContainer = new WidgetContainer(targetPortrait)
- {
- Position = new Vector2(Settings.ResolutionX - (healthStatusBar.BackSprite.Width + targetPortrait.Width), 5),
- Visible = false,
- ZOrder = 1
- };
- this.GuiManager.AddWidget(targetPortraitContainer, "targetPortraitContainer");
- var targetHealthBar = new StatusBar(backBar, healthFillSprite, new Rectangle(7, 7, healthFillSprite.Width, healthFillSprite.Height), font)
- {
- Visible = true,
- ForeColor = Color.Black,
- Position = new Vector2(targetPortraitContainer.Position.X + 75, targetPortraitContainer.Position.Y + 25),
- Text = "HP: 100/100",
- Value = 100,
- ZOrder = 0
- };
- targetHealthBar.TextOffset =
- new Vector2(healthFillSprite.Width - font.MeasureString(targetHealthBar.Text).X,
- healthFillSprite.Height / 2f);
- targetPortraitContainer.AddWidget(targetHealthBar, "targetHealthBar");
- var enemyIndicatorSprite = this.ContentManager.Load<Texture2D>(Constants.FILEPATH_GFX + "Interface/enemyIndicator");
- var enemyIndicatorPicture = new Picture(enemyIndicatorSprite)
- {
- Visible = false,
- Position = new Vector2(targetPortraitContainer.Position.X + 50, targetPortraitContainer.Position.Y + 25),
- ZOrder = 2
- };
- targetPortraitContainer.AddWidget(enemyIndicatorPicture, "enemyIndicatorPicture");
- var dialogueWindow = new WidgetContainer(windowBackSprite)
- {
- Visible = false,
- Size = new Vector2(characterWindow.Size.X, 200),
- Position = new Vector2(400, 450),
- Draggable = true
- };
- this.GuiManager.AddWidget(dialogueWindow, "dialogueWindow");
- }
Advertisement
Add Comment
Please, Sign In to add comment