Exemplo n.º 1
0
        /// <summary>
        /// Adds all the buttons we use to interact with our deck
        /// </summary>
        public override void Initialise()
        {
            CheckShouldInitialise();

            base.Initialise();

            // Use this to change the initial state of our UI
            float padding = 5;

            Vector2 buttonSize = new Vector2(Size.X, Size.Y * 0.1f);

            DeckNameButton = AddChild(new Button(Deck.Name, buttonSize, new Vector2(0, -((Size.Y - buttonSize.Y) * 0.5f - padding)), AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true);
            DeckNameButton.ClickableModule.OnLeftClicked += DeckNameButton_OnLeftClicked;

            CreateButton = AddChild(new Button("Create", buttonSize, new Vector2(0, Size.Y * 0.5f - padding - buttonSize.Y), AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true);
            CreateButton.ClickableModule.OnLeftClicked += CreateButton_OnLeftClicked;

            // The edit button is parented to this so we can access this DeckSlotUI from an event callback
            EditButton = AddChild(new Button("Edit", buttonSize, new Vector2(0, CreateButton.LocalPosition.Y + buttonSize.Y + padding), AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true);

            DeleteButton = EditButton.AddChild(new Button("Delete", buttonSize, new Vector2(0, EditButton.Size.Y + padding), AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true);
            DeleteButton.ClickableModule.OnLeftClicked += DeleteButton_OnLeftClicked;
        }