예제 #1
0
/*        public override RectangleF Bounds => new RectangleF(0, 0, 200, 200);
 */     public override void Initialize()
        {
            var skin  = Skin.CreateDefaultSkin();
            var table = Stage.AddElement(new Table());

            table.Defaults().SetPadTop(10).SetMinWidth(170).SetMinHeight(30);
            table.SetFillParent(true).Center();

            // add a button for each of the actions/AI types we need
            table.Add(new TextButton(Constants.MENU_PLAY, skin))
            .GetElement <TextButton>()
            .OnClicked += LoadGame;
            table.Row();

            table.Add(new TextButton(Constants.MENU_OPTION, skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton(Constants.MENU_CREDITS, skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton(Constants.MENU_EXIT, skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();
        }
예제 #2
0
/*        public override RectangleF Bounds => new RectangleF(0, 0, 200, 200);
 */     public override void Initialize()
        {
            var skin  = Skin.CreateDefaultSkin();
            var table = Stage.AddElement(new Table());

            table.Defaults().SetPadTop(10).SetMinWidth(170).SetMinHeight(30);
            table.SetFillParent(true).Center();

            // add a button for each of the actions/AI types we need
            table.Add(new TextButton("Continue", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton("New game", skin))
            .GetElement <TextButton>()
            .OnClicked += LoadGame;
            table.Row();

            table.Add(new TextButton("Settings", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton("Credits", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton("Quit game", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();
        }
예제 #3
0
        /// <summary>
        /// {@link #pack() Packs} the dialog and adds it to the stage
        /// </summary>
        /// <param name="stage">Stage.</param>
        public Dialog Show(Stage stage)
        {
            stage.AddElement(this);
            SetPosition(Mathf.Round((stage.GetWidth() - GetWidth()) / 2),
                        Mathf.Round((stage.GetHeight() - GetHeight()) / 2));

            Pack();

            return(this);
        }
예제 #4
0
        private static void OnHovered(ItemButton obj, WeaponItem item, Skin skin, Stage stage)
        {
            ItemHoverWindow hoverWindow = new ItemHoverWindow("HoverWindow", skin, item);
            Vector2         tempPos     = CalculatePosition(hoverWindow);

            hoverWindow.SetPosition(tempPos.X, tempPos.Y);

            stage.AddElement(hoverWindow);
            obj.HoverWindow = hoverWindow;
        }
예제 #5
0
        public static Window GenerateCharacterWindow(Skin skin, Scene scene, Vector2 position, float width, float height)
        {
            Stage stage = (scene as MainScene).UICanvas.Stage;

            //removes window if it exists
            CharacterWindow.RemoveCharacterWindow(scene);

            //Creates new window after removing old one
            CharacterWindow window = new CharacterWindow(skin, position);

            stage.AddElement(window);
            return(window);
        }
예제 #6
0
        public static InventoryWindow GenerateInventoryWindow(Skin skin, Scene scene, Vector2 position, float width, float height)
        {
            Stage stage = (scene as MainScene).UICanvas.Stage;

            //removes window if it exists
            InventoryWindow.RemoveInventory(scene);

            //Creates new window after removing old one
            InventoryWindow inventoryWindow = new InventoryWindow(skin, position, width, height);

            stage.AddElement(inventoryWindow);
            return(inventoryWindow);
        }
예제 #7
0
        public override void OnAddedToEntity()
        {
            base.OnAddedToEntity();

            // setup a Skin and a Table for our UI
            var skin  = Skin.CreateDefaultSkin();
            var table = Stage.AddElement(new Table());

            table.Defaults().SetPadTop(10).SetMinWidth(170).SetMinHeight(30);
            table.SetFillParent(true).Center();

            // add a button for each of the actions/AI types we need
            table.Add(new TextButton("BT: LowerPriority Abort Tree", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtLowerPriority;
            table.Row();

            table.Add(new TextButton("BT: Self Abort Tree", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickBtSelfAbort;
            table.Row();

            table.Add(new TextButton("Utility AI", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickUtilityAi;
            table.Row();

            table.Add(new TextButton("GOAP", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickGoap;
            table.Row().SetPadTop(40);

            table.Add(new TextButton("Stop All Running AI", skin))
            .GetElement <TextButton>()
            .OnClicked += OnClickStopAllAi;

            // fetch our different AI Components
            _miner        = Entity.Scene.FindComponentOfType <BehaviorTreeMiner>();
            _utilityMiner = Entity.Scene.FindComponentOfType <UtilityMiner>();
            _goapMiner    = Entity.Scene.FindComponentOfType <GoapMiner>();
        }