/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { backgroundImage = new GuiImage { SourceRectangle = Rectangle2D.Empty }; layer1Image = new GuiImage { SourceRectangle = Rectangle2D.Empty }; layer2Image = new GuiImage { SourceRectangle = Rectangle2D.Empty }; emblemImage = new GuiImage { SourceRectangle = Rectangle2D.Empty }; skinImage = new GuiImage { SourceRectangle = Rectangle2D.Empty }; Children.Add(backgroundImage); Children.Add(layer1Image); Children.Add(layer2Image); Children.Add(emblemImage); Children.Add(skinImage); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { icon = new GuiImage(); text = new GuiText { HorizontalAlignment = HorizontalAlignment.Centre, VerticalAlignment = VerticalAlignment.Left }; Children.Add(icon); Children.Add(text); base.LoadContent(); }
/// <summary> /// Sets the province. /// </summary> /// <param name="provinceId">Province identifier.</param> public void SetProvince(string provinceId) { if (string.IsNullOrWhiteSpace(provinceId) || ProvinceId == provinceId) { return; } ProvinceId = provinceId; holdingTexts.ForEach(w => w.Dispose()); holdingImages.ForEach(w => w.Dispose()); holdingTexts.Clear(); holdingImages.Clear(); List <Holding> holdings = game.GetProvinceHoldings(ProvinceId).OrderBy(h => h.Name).ToList(); holdingImages = new List <GuiImage>(); foreach (Holding holding in holdings) { GuiImage holdingImage = new GuiImage { ContentFile = $"World/Assets/{game.GetWorld().Id}/holdings/generic", SourceRectangle = new Rectangle2D(64 * ((int)holding.Type - 1), 0, 64, 64), Location = new Point2D(Location.X + GameDefines.GUI_SPACING * (holdingImages.Count + 2) + 64 * (holdingImages.Count + 1), Location.Y + Size.Height - 64) }; GuiText holdingText = new GuiText { Location = new Point2D(holdingImage.Location.X - GameDefines.GUI_SPACING, Location.Y + 2), Text = holding.Name, Size = new Size2D(holdingImage.SourceRectangle.Width + GameDefines.GUI_SPACING * 2, Size.Height - holdingImage.SourceRectangle.Height + 10), FontName = "ProvinceBarHoldingFont", ForegroundColour = Colour.Black, HorizontalAlignment = HorizontalAlignment.Top }; holdingTexts.Add(holdingText); holdingText.LoadContent(); Children.Add(holdingText); holdingImages.Add(holdingImage); holdingImage.LoadContent(); Children.Add(holdingImage); } }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { backgroundImage = new GuiImage { ContentFile = "ScreenManager/FillImage", TextureLayout = TextureLayout.Tile }; textSprite = new Sprite(); Children.Add(backgroundImage); SetChildrenProperties(); textSprite.LoadContent(); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { background = new GuiImage { ContentFile = "Interface/notification_small", SourceRectangle = new Rectangle2D(GameDefines.GUI_TILE_SIZE * 3, GameDefines.GUI_TILE_SIZE * 3, GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; icon = new GuiImage { ContentFile = "Interface/notification_icons", SourceRectangle = CalculateIconSourceRectangle(Icon) }; Children.Add(background); Children.Add(icon); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { images = new List <GuiImage>(); text = new GuiText(); for (int x = 0; x < ButtonSize; x++) { GuiImage image = new GuiImage { ContentFile = "Interface/button", SourceRectangle = CalculateSourceRectangle(x, Style) }; images.Add(image); } Children.AddRange(images); Children.Add(text); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { holdingTypes = Enum.GetValues(typeof(HoldingType)).Cast <HoldingType>().Where(x => x != HoldingType.Empty).ToList(); background = new GuiImage { ContentFile = "Interface/Backgrounds/stone-bricks", TextureLayout = TextureLayout.Tile }; holdingBackground = new GuiImage { ContentFile = "ScreenManager/FillImage", TextureLayout = TextureLayout.Tile, Size = new Size2D(100, 100) }; holdingImage = new GuiImage { ContentFile = $"World/Assets/{game.GetWorld().Id}/holdings/generic" }; holdingText = new GuiText { Size = new Size2D(holdingBackground.Size.Width, 18), FontName = "InfoBarFont" }; provinceText = new GuiText { Size = new Size2D(holdingBackground.Size.Height, 18), FontName = "InfoBarFont" }; priceIcon = new GuiImage { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(16, 0, 16, 16) }; priceText = new GuiText { Size = new Size2D(priceIcon.SourceRectangle.Width * 2, priceIcon.SourceRectangle.Height), FontName = "InfoBarFont", VerticalAlignment = VerticalAlignment.Left }; previousHoldingButton = new GuiButton { Text = "<", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; nextHoldingButton = new GuiButton { Text = ">", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; previouseProvinceButton = new GuiButton { Text = "<", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; nextProvinceButton = new GuiButton { Text = ">", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; buildButton = new GuiButton { Text = "Build", Size = new Size2D(GameDefines.GUI_TILE_SIZE * 4, GameDefines.GUI_TILE_SIZE) }; cancelButton = new GuiButton { Text = "Cancel", Size = new Size2D(GameDefines.GUI_TILE_SIZE * 2, GameDefines.GUI_TILE_SIZE) }; Children.Add(background); Children.Add(holdingBackground); Children.Add(holdingImage); Children.Add(holdingText); Children.Add(provinceText); Children.Add(priceIcon); Children.Add(priceText); Children.Add(nextHoldingButton); Children.Add(previousHoldingButton); Children.Add(nextProvinceButton); Children.Add(previouseProvinceButton); Children.Add(buildButton); Children.Add(cancelButton); base.LoadContent(); UpdateProvinceList(); SelectHolding(0); SelectProvince(0); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { string imagePath, fontName; images = new GuiImage[NotificationSize.Width, NotificationSize.Height]; title = new GuiText(); text = new GuiText(); switch (Style) { default: imagePath = "Interface/notification_big"; fontName = "NotificationFontBig"; break; case NotificationStyle.Small: imagePath = "Interface/notification_small"; fontName = "NotificationFontSmall"; break; } title.FontName = "NotificationTitleFontBig"; text.FontName = fontName; for (int y = 0; y < NotificationSize.Height; y++) { for (int x = 0; x < NotificationSize.Width; x++) { images[x, y] = new GuiImage { ContentFile = imagePath, Location = new Point2D(Location.X + x * GameDefines.GUI_TILE_SIZE, Location.Y + y * GameDefines.GUI_TILE_SIZE), SourceRectangle = CalculateSourceRectangle(x, y) }; Children.Add(images[x, y]); } } yesButtonImage = new GuiImage { ContentFile = "Interface/notification_controls", SourceRectangle = new Rectangle2D(0, 0, GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE), Location = new Point2D(Location.X + (NotificationSize.Width - 1) * GameDefines.GUI_TILE_SIZE, Location.Y) }; if (Type == NotificationType.Interogative) { noButtonImage = new GuiImage { ContentFile = "Interface/notification_controls", SourceRectangle = new Rectangle2D(GameDefines.GUI_TILE_SIZE, 0, GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE), Location = new Point2D(Location.X, Location.Y) }; Children.Add(noButtonImage); } Children.Add(title); Children.Add(text); Children.Add(yesButtonImage); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { background = new GuiImage { ContentFile = "Interface/Backgrounds/stone-bricks", TextureLayout = TextureLayout.Tile }; factionImage = new GuiFactionFlag { Size = new Size2D(128, 128) }; factionText = new GuiText { FontName = "SideBarFont", Size = new Size2D(Size.Width * 2 / 3, 48), VerticalAlignment = VerticalAlignment.Left }; turnText = new GuiText { FontName = "SideBarFont", Size = new Size2D(Size.Width / 3, 48), VerticalAlignment = VerticalAlignment.Right }; StatsButton = new GuiButton { Text = "Stats", ForegroundColour = ForegroundColour, Size = new Size2D(GameDefines.GUI_TILE_SIZE * 3, GameDefines.GUI_TILE_SIZE) }; RecruitButton = new GuiButton { Text = "Recruit", ForegroundColour = ForegroundColour, Size = new Size2D(GameDefines.GUI_TILE_SIZE * 3, GameDefines.GUI_TILE_SIZE) }; BuildButton = new GuiButton { Text = "Build", ForegroundColour = ForegroundColour, Size = new Size2D(GameDefines.GUI_TILE_SIZE * 3, GameDefines.GUI_TILE_SIZE) }; TurnButton = new GuiButton { Text = "End Turn", ForegroundColour = ForegroundColour, Size = new Size2D(GameDefines.GUI_TILE_SIZE * 7, GameDefines.GUI_TILE_SIZE), Style = ButtonStyle.Narivian }; Children.Add(background); Children.Add(factionImage); Children.Add(factionText); Children.Add(turnText); Children.Add(StatsButton); Children.Add(RecruitButton); Children.Add(BuildButton); Children.Add(TurnButton); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { background = new GuiImage { ContentFile = "ScreenManager/FillImage", TextureLayout = TextureLayout.Tile }; provincesItem = new GuiInfoBarItem { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(0, 0, 16, 16) }; holdingsItem = new GuiInfoBarItem { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(48, 0, 16, 16) }; wealthItem = new GuiInfoBarItem { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(16, 0, 16, 16) }; troopsItem = new GuiInfoBarItem { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(32, 0, 16, 16) }; provincesTooltip = new GuiTooltip { Text = "Provinces", Size = new Size2D(100, 20), Visible = false }; holdingsTooltip = new GuiTooltip { Text = "Holdings", Size = new Size2D(100, 20), Visible = false }; wealthTooltip = new GuiTooltip { Text = "Wealth", Size = new Size2D(100, 20), Visible = false }; troopsTooltip = new GuiTooltip { Text = "Troops", Size = new Size2D(128, 128), Visible = false }; Children.Add(background); Children.Add(provincesItem); Children.Add(holdingsItem); Children.Add(wealthItem); Children.Add(troopsItem); Children.Add(provincesTooltip); Children.Add(holdingsTooltip); Children.Add(wealthTooltip); Children.Add(troopsTooltip); holdingsItem.MouseEntered += OnHoldingsMouseEntered; holdingsItem.MouseLeft += OnHoldingsMouseLeft; provincesItem.MouseEntered += OnProvincesMouseEntered; provincesItem.MouseLeft += OnProvincesMouseLeft; troopsItem.MouseEntered += OnTroopsMouseEntered; troopsItem.MouseLeft += OnTroopsMouseLeft; wealthItem.MouseEntered += OnWealthMouseEntered; wealthItem.MouseLeft += OnWealthMouseLeft; base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { holdingImages = new List <GuiImage>(); holdingTexts = new List <GuiText>(); background = new GuiImage { ContentFile = "Interface/Backgrounds/wool", TextureLayout = TextureLayout.Tile }; provinceNameBackground = new GuiImage { Size = new Size2D(256, 48), ContentFile = "Interface/province-panel-label", SourceRectangle = new Rectangle2D(0, 0, 256, 48) }; provinceNameBackgroundDecor = new GuiImage { Size = provinceNameBackground.Size, ContentFile = provinceNameBackground.ContentFile, SourceRectangle = new Rectangle2D(0, 48, 256, 48) }; provinceNameText = new GuiText { FontName = "SideBarFont", // TODO: Consider providing a dedicated font Size = new Size2D(provinceNameBackground.SourceRectangle.Width, provinceNameBackground.SourceRectangle.Height), TextOutline = true }; factionFlag = new GuiFactionFlag { Size = new Size2D(provinceNameBackground.Size.Height, provinceNameBackground.Size.Height) }; resourceImage = new GuiImage { SourceRectangle = new Rectangle2D(0, 0, 64, 64) }; resourceText = new GuiText { FontName = "ProvinceBarHoldingFont", ForegroundColour = Colour.Black, HorizontalAlignment = HorizontalAlignment.Top }; ProvinceId = game.GetFactionProvinces(game.PlayerFactionId).First().Id; Children.Add(background); Children.Add(provinceNameBackground); Children.Add(provinceNameBackgroundDecor); Children.Add(provinceNameText); Children.Add(factionFlag); Children.Add(resourceImage); Children.Add(resourceText); base.LoadContent(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { units = game.GetUnits().OrderBy(u => u.Price).ToList(); background = new GuiImage { ContentFile = "Interface/Backgrounds/stone-bricks", TextureLayout = TextureLayout.Tile }; unitBackground = new GuiImage { ContentFile = "ScreenManager/FillImage", TextureLayout = TextureLayout.Tile, Size = new Size2D(100, 100) }; unitImage = new GuiImage { ContentFile = $"World/Assets/{game.GetWorld().Id}/units/{units[currentUnitIndex].Id}", SourceRectangle = new Rectangle2D(0, 0, 64, 64) }; unitText = new GuiText { Size = new Size2D(unitBackground.Size.Width, 18), FontName = "InfoBarFont" }; healthIcon = new GuiImage { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(64, 0, 16, 16) }; powerIcon = new GuiImage { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(80, 0, 16, 16) }; priceIcon = new GuiImage { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(16, 0, 16, 16) }; maintenanceIcon = new GuiImage { ContentFile = "Interface/game_icons", SourceRectangle = new Rectangle2D(96, 0, 16, 16) }; healthText = new GuiText { Size = new Size2D(healthIcon.SourceRectangle.Width * 2, healthIcon.SourceRectangle.Height), FontName = "InfoBarFont", VerticalAlignment = VerticalAlignment.Left }; powerText = new GuiText { Size = new Size2D(powerIcon.SourceRectangle.Width * 2, powerIcon.SourceRectangle.Height), FontName = "InfoBarFont", VerticalAlignment = VerticalAlignment.Left }; priceText = new GuiText { Size = new Size2D(priceIcon.SourceRectangle.Width * 2, priceIcon.SourceRectangle.Height), FontName = "InfoBarFont", VerticalAlignment = VerticalAlignment.Left }; maintenanceText = new GuiText { Size = new Size2D(maintenanceIcon.SourceRectangle.Width * 2, maintenanceIcon.SourceRectangle.Height), FontName = "InfoBarFont", VerticalAlignment = VerticalAlignment.Left }; troopsText = new GuiText { Size = new Size2D(unitBackground.Size.Height, 18), FontName = "InfoBarFont" }; nextUnitButton = new GuiButton { Text = ">", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; previousUnitButton = new GuiButton { Text = "<", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; addUnitButton = new GuiButton { Text = "+", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; substractUnitButton = new GuiButton { Text = "-", Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE) }; recruitButton = new GuiButton { Text = "Recruit", Size = new Size2D(GameDefines.GUI_TILE_SIZE * 4, GameDefines.GUI_TILE_SIZE) }; cancelButton = new GuiButton { Text = "Cancel", Size = new Size2D(GameDefines.GUI_TILE_SIZE * 2, GameDefines.GUI_TILE_SIZE) }; Children.Add(background); Children.Add(unitBackground); Children.Add(unitImage); Children.Add(unitText); Children.Add(troopsText); Children.Add(healthIcon); Children.Add(powerIcon); Children.Add(priceIcon); Children.Add(maintenanceIcon); Children.Add(healthText); Children.Add(powerText); Children.Add(priceText); Children.Add(maintenanceText); Children.Add(nextUnitButton); Children.Add(previousUnitButton); Children.Add(addUnitButton); Children.Add(substractUnitButton); Children.Add(recruitButton); Children.Add(cancelButton); base.LoadContent(); }