コード例 #1
0
        public FarmOptionsUI(FarmUI ctxFarm)
        {
            CtxFarmUI = ctxFarm;

            HenhouseTexture = new[]
            {
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse2.png"),
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse1.png")
            };

            StorageTexture = new[]
            {
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse2.png"),
                new Texture("../../../../Data/henhouse1.png"),
                new Texture("../../../../Data/henhouse1.png")
            };


            MapPath = new Dictionary <int, string[]>
            {
                {
                    (int)MapTypes.World,
                    new[] { "../../../../Data/map/3Layers.tmx" }
                },
                {
                    (int)MapTypes.InnerHenhouse,
                    new[] {
                        "../../../../Data/map/insideHenhouse.tmx",
                        "../../../../Data/map/insideHenhouse.tmx",
                        "../../../../Data/map/insideHenhouse.tmx"
                    }
                },
                {
                    (int)MapTypes.InnerMarket,
                    new[] {
                        "../../../../Data/map/henhouse1.tmx",
                        "../../../../Data/map/henhouse2.tmx",
                        "../../../../Data/map/henhouse3.tmx"
                    }
                },
                {
                    (int)MapTypes.InnerBuilder,
                    new[] {
                        "../../../../Data/map/henhouse1.tmx",
                        "../../../../Data/map/henhouse2.tmx",
                        "../../../../Data/map/henhouse3.tmx"
                    }
                }
            };
        }
コード例 #2
0
 public PlayerUI(FarmUI ctxFarmUI, Player player)
 {
     AnimFrame  = 0;
     Direction  = 0;
     SpriteSize = new Vector2f(16f, 32f);
     CtxFarmUI  = ctxFarmUI;
     Player     = player;
     Position   = new Vector2f(player.Position.X, player.Position.Y);
     Texture    = new Texture("../../../../Data/SpriteSheet/Player/Player.png");
     Sprite     = new Sprite(Texture);
 }
コード例 #3
0
        public GameLoop()
        {
            Window = new RenderWindow(new VideoMode(1280, 720), "ChickenFarmer",
                                      Styles.Default);
            Window.SetFramerateLimit(60);

            FarmUI      = new FarmUI(this);
            PlayerInput = new InputHandler(this);


            MapManager = new MapManager(this);
        }
コード例 #4
0
        void Update()
        {
            DateTime current = DateTime.Now;

            if (OldUpdate.Add(IntervalUpdate) < current)
            {
                FarmUI.Update();
                FarmUI.PlayerUI.AnimationLoop();
                FarmUI.PlayerUI.AnimFrame++;

                OldUpdate = current;
            }
        }
コード例 #5
0
        public void Run()
        {
            Init();


            Vector2f buttonsize = new Vector2f(80f, 60f);

            View = new View(new FloatRect(new Vector2f(0f, 0f),
                                          new Vector2f(1280 / 2, 720 / 2)));

            Shape button = new RectangleShape(buttonsize)
            {
                FillColor = Color.Blue, Position = View.Size
            };



            while (Window.IsOpen)
            {
                Window.View = View;
                Window.Clear(new Color(255, 0, 255));

                Window.Draw(MapManager.CurrentMap);

                FarmUI.PlayerUI.UpdateSpritePosition();
                FarmUI.PlayerUI.Draw(Window, State);
                FarmUI.BuildingCollectionUI.Draw(Window, State);

                MapManager.CurrentMap.DrawOver(Window, State);
                FarmUI.DrawInfo();
                Update();

                PlayerInput.Handle();

                Window.Display();
            }
        }
コード例 #6
0
 public BuildingCollectionUI(FarmUI farmUi)
 {
     CtxfarmUI       = farmUi;
     BuildingsUIList = new List <BuildingUI>();
     LoadBuildings();
 }