Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        internal BuildingsView(string name, SettlementView settlementView, string textureAtlas) :
            base(name)
        {
            _gameConfigCache = CallContext <GameConfigCache> .GetData("GameConfigCache");

            Size            = new PointI(515, 450);
            _settlementView = settlementView;

            _slots = new DynamicSlots("slots", $"{textureAtlas}.slot", new PointI(515, 450), 10, 13, 10.0f);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
 internal ProductionView(string name, Vector2 position, Alignment positionAlignment, SettlementView settlementView, string imageTextureName1, string imageTextureName2) :
     base(position, positionAlignment, settlementView, imageTextureName1, imageTextureName2, name)
 {
 }
Exemple #7
0
 public FoodView(string name, Vector2 position, Alignment positionAlignment, SettlementView settlementView, string imageTextureName1, string imageTextureName2) :
     base(position, positionAlignment, settlementView, imageTextureName1, imageTextureName2, name)
 {
 }