/** * Copyright 2019 Heroic Labs and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using DemoGame.Scripts.Menus; using UnityEngine; using UnityEngine.UI; namespace DemoGame.Scripts.Gameplay.Cards { /// /// Popup window displaying informations of supplied . /// public class CardInfoMenu : SingletonMenu { #region Fields /// /// Textfield displaying the name of . /// [SerializeField] private Text _cardName = null; /// /// Textfield displaying the level of . /// [SerializeField] private Text _cardLevel = null; /// /// Textfield displaying the description of . /// [SerializeField] private Text _cardDescription = null; /// /// The image representing . /// [SerializeField] private Image _cardImage = null; /// /// The card this is displaying info of. /// Can be set by invoking method. /// private Card _displayedCard; #endregion #region Mono /// /// Sets the back button listener. /// protected override void Awake() { base.SetBackButtonHandler(MenuManager.Instance.HideTopMenu); } #endregion #region Methods /// /// Sets the card to be displayed by this menu. /// public void SetCard(Card card) { _displayedCard = card; _cardLevel.text = card.level.ToString(); _cardName.text = card.GetCardInfo().Name; _cardDescription.text = card.GetCardInfo().Description; _cardImage.sprite = card.GetCardInfo().Sprite; } #endregion } }