internal CommodityView(Vector2 position, Alignment positionAlignment, SettlementView settlementView, string imageTextureName1, string imageTextureName2, string name) : base(name) { Size = new PointI(100, 30); PositionAlignment = positionAlignment; Position = position.ToPointI(); SettlementView = settlementView; var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("textureName1", $"Icons_1.{imageTextureName1}"), new KeyValuePair <string, string>("textureName2", $"Icons_1.{imageTextureName2}") }; Controls = ControlCreator.CreateFromSpecification( @" image1 : Image { TextureNormal: '%textureName1%' Size: [30;30] } image2 : Image { TextureNormal: '%textureName2%' Size: [20;20] }", pairs); Controls.SetOwner(this); }
internal CitizenView(string name, Vector2 position, Alignment positionAlignment, SettlementView settlementView, string textureAtlas) : base(name) { Size = new PointI(100, 30); PositionAlignment = positionAlignment; Position = position.ToPointI(); SettlementView = settlementView; var kvps = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("position1", $"{Convert.ToInt32(position.X + Bounds.X)};{Convert.ToInt32(position.Y + Bounds.Y)}"), new KeyValuePair <string, string>("position2", $"{Convert.ToInt32(position.X + Bounds.X + 20)};{Convert.ToInt32(position.Y + Bounds.Y)}"), new KeyValuePair <string, string>("position3", $"{Convert.ToInt32(position.X + Bounds.X)};{Convert.ToInt32(position.Y + Bounds.Y + 30)}"), new KeyValuePair <string, string>("position4", $"{Convert.ToInt32(position.X + Bounds.X + 20)};{Convert.ToInt32(position.Y + Bounds.Y + 30)}"), new KeyValuePair <string, string>("textureName1", $"{textureAtlas}.Citizen_{settlementView.Settlement.Race.Name}_Farmer"), new KeyValuePair <string, string>("textureName2", $"{textureAtlas}.Citizen_{settlementView.Settlement.Race.Name}_Worker"), new KeyValuePair <string, string>("textureName3", $"{textureAtlas}.Citizen_{settlementView.Settlement.Race.Name}_Rebel") }; var spec = ResourceReader.ReadResource("PhoenixGamePresentation.Views.SettlementViewComposite.CitizenViewControls.txt", Assembly.GetExecutingAssembly()); Controls = ControlCreator.CreateFromSpecification(spec, kvps); Controls.SetOwner(this); }
internal HudView(WorldView worldView, StackViews stackViews, InputHandler input) { var x = worldView.Camera.GetViewport.Right; var y = 0; var width = 1920 - x; var height = 1020; Area = new Rectangle(x, y, width, height); // 1680,0,240,1020 var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("position1", "0;0"), new KeyValuePair <string, string>("size1", $"{width};{height}"), new KeyValuePair <string, string>("size2", $"{width - 20};{Convert.ToInt32(height * 0.15f)}"), // 15% of parent new KeyValuePair <string, string>("size3", $"{width - 20};{Convert.ToInt32(height * 0.20f)}"), // 20% of parent new KeyValuePair <string, string>("size4", $"{width - 20};{Convert.ToInt32(height * 0.30f)}") // 30% of parent }; var spec = ResourceReader.ReadResource("PhoenixGamePresentation.Views.HudViewControls.txt", Assembly.GetExecutingAssembly()); Controls = ControlCreator.CreateFromSpecification(spec, pairs); Controls.SetOwner(this); WorldView = worldView; StackViews = stackViews; worldView.CellGrid.NewCellSeen += NewCellSeen; SetupViewport(x, y, width, height + Controls["frmHudView.btnEndTurn"].Height); // 1680,0,240,1020 + 56 : btnEndTurn.Height = 56 Input = input; }
public MainFrame(SettlementView settlementView, Vector2 topLeftPosition, string textureAtlas) : base("MainFrame") { Size = new PointI(556, 741); Position = topLeftPosition.ToPointI(); SettlementView = settlementView; var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("textureName1", $"{textureAtlas}.frame_main"), new KeyValuePair <string, string>("textureName2", $"{textureAtlas}.frame_big_heading"), new KeyValuePair <string, string>("textureName3", $"{textureAtlas}.frame2_whole"), new KeyValuePair <string, string>("textureName4", $"{textureAtlas}.frame_bottom"), new KeyValuePair <string, string>("position1", $"{Convert.ToInt32(topLeftPosition.X)};{Convert.ToInt32(topLeftPosition.Y)}"), new KeyValuePair <string, string>("size1", $"{Size.X};{Size.Y}"), new KeyValuePair <string, string>("textureNormal1", $"{textureAtlas}.close_button_n"), new KeyValuePair <string, string>("textureActive1", $"{textureAtlas}.close_button_a"), new KeyValuePair <string, string>("textureHover1", $"{textureAtlas}.close_button_h"), }; var spec = File.ReadAllText(@".\Views\SettlementViewComposite\MainFrameControls.txt"); Controls = ControlCreator.CreateFromSpecification(spec, pairs); Controls.SetOwner(this); Controls["frmMain.frmPopulation"].AddControl(new CitizenView("citizenView", new Vector2(90.0f, 135.0f), Alignment.TopLeft, settlementView, "Citizens")); Controls["frmMain.frmResources"].AddControl(new FoodView("foodView", new Vector2(130.0f, 0.0f), Alignment.TopLeft, settlementView, "Bread", "Corn"), Alignment.TopLeft, Alignment.TopLeft, new PointI(130, 20)); Controls["frmMain.frmResources"].AddControl(new ProductionView("productionView", new Vector2(130.0f, 0.0f), Alignment.TopLeft, settlementView, "Anvil", "Pickaxe"), Alignment.TopLeft, Alignment.TopLeft, new PointI(130, 50)); }
public MetricsPanel() { var spec = ResourceReader.ReadResource("PhoenixGamePresentation.MetricsPanelControls.txt", Assembly.GetExecutingAssembly()); Controls = ControlCreator.CreateFromSpecification(spec); Controls.SetOwner(this); SetupViewport(0, 1060, 1920, 20); }
internal SecondaryFrame(SettlementView settlementView, Vector2 topLeftPosition, string textureAtlas) : base("SecondaryFrame") { _gameConfigCache = CallContext <GameConfigCache> .GetData("GameConfigCache"); Size = new PointI(556, 741); Position = topLeftPosition.ToPointI(); SettlementView = settlementView; var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("textureName1", $"{textureAtlas}.frame_main"), new KeyValuePair <string, string>("textureName2", $"{textureAtlas}.frame2_whole"), new KeyValuePair <string, string>("textureName3", $"{textureAtlas}.frame_bottom"), new KeyValuePair <string, string>("position1", $"{Convert.ToInt32(topLeftPosition.X)};{Convert.ToInt32(topLeftPosition.Y)}"), new KeyValuePair <string, string>("size1", $"{Size.X};{Size.Y}") }; var spec = ResourceReader.ReadResource("PhoenixGamePresentation.Views.SettlementViewComposite.SecondaryFrameControls.txt", Assembly.GetExecutingAssembly()); Controls = ControlCreator.CreateFromSpecification(spec, pairs); var buildingsView = new BuildingsView("buildingsView", settlementView, textureAtlas); var frmBuildings = Controls["frmSecondary.frmBuildings"]; frmBuildings.AddControl(buildingsView, Alignment.TopCenter); var slots10 = new DynamicSlots("slots20", $"{textureAtlas}.slot", new PointI(515, 65), 5, 2, 10.0f); var frmUnits = Controls["frmSecondary.frmUnits"]; frmUnits.AddControl(slots10, Alignment.TopLeft, Alignment.TopLeft, new PointI(0, 5)); CreateUnitLabels(slots10); var slots5 = new DynamicSlots("slots2", $"{textureAtlas}.slot", new PointI(515, 65), 5, 1, 10.0f); var frmOther = Controls["frmSecondary.frmOther"]; frmOther.AddControl(slots5, Alignment.TopLeft, Alignment.TopLeft, new PointI(0, 5)); CreateOtherLabels(slots5); }