예제 #1
0
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Label(
                    rectangle: new Rectangle(260, 10, 230, 30),
                    spriteFont: WK.Font.font_7,
                    "PunchHole",
                    Label.TextAlignment.Midle_Center,
                    ""
                    ),
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Others",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToOthers",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Others)
                    ),
            };

            this.entities = new List <IEntity>()
            {
                //new Light(new Point(30, 30)),
                new Player(new Point(100, 100))
            };



            Point[] points = entities.Select(x => x.rigidbody.centerPosition.ToPoint()).ToArray();
            UIs.Add(new Shadow(points));
        }
예제 #2
0
        private void GenerateUI_SaveMenu()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            mMenuUII = new UIItem("game", Toolbox.UIItemType.ImageFix, "Game", new UIAction(Toolbox.UIAction.Toggle_UII, "savegame,leavegame,exit"), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter, "gear_24");
            mMenuUI.uiItems.Add(mMenuUII);

            mMenuUII = new UIItem("savegame", Toolbox.UIItemType.TextFix, "Save Game", new UIAction(Toolbox.UIAction.GameMap_SaveGame), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter)
            {
                Visible = false
            };
            mMenuUI.uiItems.Add(mMenuUII);

            mMenuUII = new UIItem("leavegame", Toolbox.UIItemType.TextFix, "Leave Game", new UIAction(Toolbox.UIAction.GameMap_MainMenu), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter)
            {
                Visible = false
            };
            mMenuUI.uiItems.Add(mMenuUII);

            mMenuUII = new UIItem("exit", Toolbox.UIItemType.TextFix, "Exit to Desktop", new UIAction(Toolbox.UIAction.GameMap_Exit), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter)
            {
                Visible = false
            };
            mMenuUI.uiItems.Add(mMenuUII);

            //Vector2 uiiSize = ToT.Fonts[Toolbox.Font.menuItem02.ToString()].MeasureString(mMenuUII.DisplayText);
            mMenuUI.RefreshUISize(false);
            mMenuUI.Position = new Vector2(ToT.Settings.Resolution.X - mMenuUI.Size.X, 0);
            mMenuUI.RefreshUISize();

            UIs.Add("GameMenu", mMenuUI);
            UIs["GameMenu"].Visible = true;
        }
예제 #3
0
        private void GenerateUI_Resources()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            mMenuUII = new UIItem(
                "imgGold",
                Toolbox.UIItemType.ImageText,
                ((GameMapScreen)ToT.screenManager.Screens[Toolbox.ScreenType.GameMap]).GameMap.player.Resources[Toolbox.ResourceType.Gold].ToString(),
                new UIAction(),
                Toolbox.Font.menuItem02,
                Toolbox.TextAlignment.TopLeft,
                "Resource_Gold_01"
                );
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem(
                "imgWood",
                Toolbox.UIItemType.ImageText,
                ((GameMapScreen)ToT.screenManager.Screens[Toolbox.ScreenType.GameMap]).GameMap.player.Resources[Toolbox.ResourceType.Wood].ToString(),
                new UIAction(),
                Toolbox.Font.menuItem02,
                Toolbox.TextAlignment.TopLeft,
                "Resource_Wood_01"
                );
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem(
                "imgRock",
                Toolbox.UIItemType.ImageText,
                ((GameMapScreen)ToT.screenManager.Screens[Toolbox.ScreenType.GameMap]).GameMap.player.Resources[Toolbox.ResourceType.Rock].ToString(),
                new UIAction(),
                Toolbox.Font.menuItem02,
                Toolbox.TextAlignment.TopLeft,
                "Resource_Rock_01"
                );
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem(
                "imgCrystal",
                Toolbox.UIItemType.ImageText,
                ((GameMapScreen)ToT.screenManager.Screens[Toolbox.ScreenType.GameMap]).GameMap.player.Resources[Toolbox.ResourceType.Crystal].ToString(),
                new UIAction(),
                Toolbox.Font.menuItem02,
                Toolbox.TextAlignment.TopLeft,
                "Resource_Crystal_01"
                );
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUI.uIAlignment = Toolbox.UIAlignment.Horizontal;

            mMenuUI.RefreshUISize(false);
            mMenuUI.Position = new Vector2(5, 5);
            mMenuUI.RefreshUISize();

            UIs.Add("ResourcesMenu", mMenuUI);
            UIs["ResourcesMenu"].Visible = true;
        }
예제 #4
0
        private void GenerateUI_MMenuLogo()
        {
            UI     mMenuUI  = new UI();
            UIItem mMenuUII = new UIItem("logomainmenu", Toolbox.UIItemType.TextFix, "Tales of Tiles", new UIAction(), Toolbox.Font.logo01, Toolbox.TextAlignment.TopLeft);

            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUI.Position = new Vector2((ToT.Settings.Resolution.X - ToT.Fonts[Toolbox.Font.logo01.ToString()].MeasureString(mMenuUII.DisplayText).X) / 2, ToT.Settings.Resolution.Y / 20);
            mMenuUI.RefreshUISize();

            UIs.Add("mMenuLogo", mMenuUI);
            UIs["mMenuLogo"].Visible = true;
        }
예제 #5
0
        private void GenerateUI_Adventure()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            mMenuUII = new UIItem("adventure", Toolbox.UIItemType.TextFix, "Adventure!", new UIAction(Toolbox.UIAction.GameMap_Adventure, ""), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);

            mMenuUI.RefreshUISize(false);
            mMenuUI.Position = new Vector2(5, ToT.Settings.Resolution.Y - mMenuUI.Size.Y);
            mMenuUI.RefreshUISize();

            UIs.Add("AdventureMenu", mMenuUI);
            UIs["AdventureMenu"].Visible = true;
        }
예제 #6
0
        private void GenerateUI_BackMenu()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            mMenuUII = new UIItem("backmainmenu", Toolbox.UIItemType.TextFix, "< Back", new UIAction(Toolbox.UIAction.MainMenu), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);
            Vector2 uiiSize = ToT.Fonts[Toolbox.Font.menuItem02.ToString()].MeasureString(mMenuUII.DisplayText);

            mMenuUI.Position = new Vector2(10, ToT.Settings.Resolution.Y - (uiiSize.Y * mMenuUI.uiItems.Count()) - 5);
            mMenuUI.RefreshUISize();

            UIs.Add("BackMenu", mMenuUI);
            UIs["BackMenu"].Visible = true;
        }
예제 #7
0
        private void GenerateUI_MMenu()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            mMenuUII = new UIItem("newgame", Toolbox.UIItemType.TextFix, "New Game", new UIAction(Toolbox.UIAction.MainMenu_NewGame), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem("loadgame", Toolbox.UIItemType.TextFix, "Load Game", new UIAction(Toolbox.UIAction.MainMenu_LoadGame), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem("settings", Toolbox.UIItemType.TextFix, "Settings", new UIAction(Toolbox.UIAction.MainMenu_Settings), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);
            mMenuUII = new UIItem("exit", Toolbox.UIItemType.TextFix, "Exit", new UIAction(Toolbox.UIAction.MainMenu_Exit), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
            mMenuUI.uiItems.Add(mMenuUII);
            Vector2 uiiSize = ToT.Fonts[Toolbox.Font.menuItem02.ToString()].MeasureString(mMenuUII.DisplayText);

            mMenuUI.Position = new Vector2(10, ToT.Settings.Resolution.Y - (uiiSize.Y * mMenuUI.uiItems.Count()) - 5);
            mMenuUI.RefreshUISize();

            UIs.Add("mMenu", mMenuUI);
            UIs["mMenu"].Visible = true;
        }
예제 #8
0
        private void GenerateUI_LoadGames()
        {
            UI     mMenuUI = new UI();
            UIItem mMenuUII;

            string[] saves = FileManager.GetSaves();
            Array.Reverse(saves);
            float fLongest = 0f;

            foreach (string sFile in saves)
            {
                mMenuUII = new UIItem("savename", Toolbox.UIItemType.TextFix, sFile, new UIAction(Toolbox.UIAction.GameMap_LoadGame, sFile), Toolbox.Font.menuItem02, Toolbox.TextAlignment.MiddleCenter);
                mMenuUI.uiItems.Add(mMenuUII);
                fLongest = ToT.Fonts[Toolbox.Font.menuItem02.ToString()].MeasureString(mMenuUII.DisplayText).X > fLongest ? ToT.Fonts[Toolbox.Font.menuItem02.ToString()].MeasureString(mMenuUII.DisplayText).X : fLongest;
            }
            mMenuUI.Position = new Vector2((ToT.Settings.Resolution.X - fLongest) / 2, ToT.Settings.Resolution.Y / 4);
            mMenuUI.RefreshUISize();

            UIs.Add("loadGames", mMenuUI);
            UIs["loadGames"].Visible = true;
        }