예제 #1
0
        /// <summary>
        /// Set up all of the UI for this window from the RewardData
        /// </summary>
        public override void LoadContent()
        {
            CheckShouldLoad();

            PreviousRewardButton = AddChild(new Button("Previous", Anchor.kCentreLeft, 1, AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset));
            PreviousRewardButton.ClickableModule.OnLeftClicked += GoToPreviousRewardUI;

            NextRewardButton = AddChild(new Button("Next", Anchor.kCentreRight, 1, AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset));
            NextRewardButton.ClickableModule.OnLeftClicked += GoToNextRewardUI;

            Button doneButton = AddChild(new Button("Done", Anchor.kBottomCentre, 0, AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset));

            doneButton.ClickableModule.OnLeftClicked += AddRewards;

            // Create the reward UI here

            // Money earnt
            Image moneyImage            = AddChild(new Image(Vector2.Zero, "UI\\MoneyIcon"));
            Label moneyEarntExplanation = moneyImage.AddChild(new Label("Money Earnt", Anchor.kTopCentre, 4));

            moneyEarntExplanation.Colour = Color.White;
            Label moneyEarntValue = moneyImage.AddChild(new Label(RewardData.Money.ToString(), Anchor.kBottomCentre, 4));

            moneyEarntValue.Colour = Color.White;
            RewardUI.Add(moneyImage);

            // Cards earnt
            foreach (string cardDataAsset in RewardData.CardDataAssets)
            {
                CardData cardData           = AssetManager.GetData <CardData>("Cards\\" + cardDataAsset);
                Image    cardImage          = AddChild(new Image(Vector2.Zero, cardData.TextureAsset));
                Label    cardWonExplanation = cardImage.AddChild(new Label("Card Won", Anchor.kTopCentre, 2));
                cardWonExplanation.Colour = Color.White;
                Label cardWonName = cardImage.AddChild(new Label(cardData.DisplayName, Anchor.kBottomCentre, 2));
                cardWonName.Colour = Color.White;
                RewardUI.Add(cardImage);
            }

            // Packs won
            Image packsWonImage       = AddChild(new Image(Vector2.Zero, Card.CardBackTextureAsset));
            Label packsWonExplanation = packsWonImage.AddChild(new Label("Packs Won", Anchor.kTopCentre, 2));

            packsWonExplanation.Colour = Color.White;
            Label packsWonValue = packsWonImage.AddChild(new Label(RewardData.CardPacks.ToString(), Anchor.kBottomCentre, 2));

            packsWonValue.Colour = Color.White;
            RewardUI.Add(packsWonImage);

            // We have set the current UI to be 0, so make sure the UI is updated to reflect this
            RefreshUI();

            base.LoadContent();
        }