public LevelUI(Texture2D texture, List <Texture2D> lanterns) { Lanterns = lanterns; /* * LowerUI = new Panel(new Vector2(700, 250), PanelSkin.Fancy, Anchor.BottomCenter, new Vector2(0, 125)); * LowerUI.Opacity = 70; */ LowerUI = new Image(texture, new Vector2(700, 250), ImageDrawMode.Stretch, Anchor.BottomCenter, new Vector2(0, 125)); LowerUI.Opacity = 70; frame = new Panel(new Vector2(175, 250), PanelSkin.None, Anchor.BottomCenter, new Vector2(-250, -25)); LowerUI.AddChild(frame); lantern = new Image(Lanterns[0]); frame.AddChild(lantern); TextBox = new Panel(new Vector2(500, 200), PanelSkin.None, Anchor.BottomCenter, new Vector2(frame.Size.X / 2, 0)); LowerUI.AddChild(TextBox); text = new Paragraph(); TextBox.AddChild(text); LowerUI.Visible = false; UserInterface.Active.AddEntity(LowerUI); }
/// <summary> /// Add all of the information for the mission /// </summary> public override void Initialise() { CheckShouldInitialise(); base.Initialise(); // Add the mission thumbnail image Image thumbnail = AddChild(new Image(new Vector2(0, -Size.Y * 0.25f), MissionData.MissionThumbnailTextureAsset), true, true); // Add the mission name label Label missionNameLabel = thumbnail.AddChild(new Label(MissionData.MissionName, Anchor.kTopCentre, 2), true, true); missionNameLabel.Colour = Color.White; // Add the mission description Label missionDescriptionLabel = thumbnail.AddChild(new Label(MissionData.MissionDescription, Anchor.kBottomCentre, 2), true, true); missionDescriptionLabel.Colour = Color.White; // Add the button to play the mission Button playMissionButton = missionDescriptionLabel.AddChild(new Button("Play Mission", Anchor.kBottomCentre, 2, AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true); playMissionButton.LocalPosition = new Vector2(0, missionDescriptionLabel.Size.Y + playMissionButton.Size.Y); playMissionButton.ClickableModule.OnLeftClicked += PlayMissionCallback; }
/// <summary> /// Create various pieces of UI for the card's info /// </summary> public override void LoadContent() { CheckShouldLoad(); Image cardImage = AddChild(new Image(Size * 0.8f, Vector2.Zero, CardData.TextureAsset)); Label cardName = cardImage.AddChild(new Label(CardData.DisplayName, Anchor.kTopCentre, 2)); Label cardPrice = cardImage.AddChild(new Label("100 - Hard Coded", Anchor.kBottomCentre, 2)); base.LoadContent(); }
/// <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(); }