Example #1
0
        public MapItem(System.Random R, Cards.Loading.CardPool cardPool,
                       Cards.Loading.MetaDataLibrary metaDataLibrary, string name, int difficultyTier)
        {
            mRewards = new Cards.CardList();
            // Difficuly tier goes up in ones
            // Dif. => Reward
            // 0, 1 => 1
            // 2, 3 => 2
            // etc.
            int rewardTier = (difficultyTier / 2) + 1;

            for (int i = 0; i < 3; i++)
            {
                Cards.Loading.CardMetaData metaData = metaDataLibrary.GetRandomCardByTier(rewardTier);
                if (metaData != null)
                {
                    mRewards.AddCard(Cards.Loading.CardLoading.ProduceCard(
                                         metaData.mName,
                                         cardPool));
                }
            }
            Completed       = false;
            Available       = false;
            mName           = name;
            mDifficultyTier = difficultyTier;
            mDidPlayerWin   = false;
        }
Example #2
0
 public CardGallerySetupState(Cards.CardList cards, GameScene currentScene)
 {
     mIsUsingCardList = true;
     mType            = PassedStateType.CardGallery;
     mCardList        = cards;
     mLastScene       = currentScene;
 }
        // Use this for initialization
        void Start()
        {
            mNumUpdates         = 0;
            mRandom             = new System.Random();
            mRewardCards        = new List <UICard>();
            mCurrentRewardCards = new Cards.CardList();
            mConfirmButton      = ConfirmButtonObject.GetComponentInChildren <UnityEngine.UI.Button>();

            mMapManager    = this.gameObject.GetComponentInChildren <MapManager>();
            mLayerTreeList = new List <TreeNode <LayerTreeNode> >();

            SetMapState(mMapManager.GetMapState());
        }
        public override void UpdateUI()
        {
            mTreeRoot.DoForAll((m) =>
            {
                Color itemColour = Color.grey;
                if (m.mMapItem.Completed == true)
                {
                    itemColour = m.mMapItem.mDidPlayerWin ? Color.green : Color.red;
                }
                else if (m.mMapItem.Available == true)
                {
                    itemColour = Color.white;
                }

                m.mTreeUIItem.GetComponentInChildren <UnityEngine.UI.Image>().color = itemColour;
                m.mTreeUIItem.GetComponentInChildren <UnityEngine.UI.Text>().text   = m.mMapItem.mName;

                return(true);
            });

            if (mSelectedMapItem != null)
            {
                if (mSelectedMapItem.mItem.mMapItem.Available &&
                    !mSelectedMapItem.mItem.mMapItem.Completed)
                {
                    mSelectedMapItem.mItem.mTreeUIItem.GetComponentInChildren <UnityEngine.UI.Image>().color = Color.yellow;
                }
                else
                {
                    mSelectedMapItem.mItem.mTreeUIItem.GetComponentInChildren <UnityEngine.UI.Image>().color = Color.Lerp(Color.red, Color.yellow, 0.5f);
                }

                mCurrentRewardCards = mSelectedMapItem.mItem.mMapItem.Rewards;
            }

            if (mMapState.IsMapCompleted())
            {
                mConfirmButton.interactable = true;
                mConfirmButton.transform.GetComponentInChildren <UnityEngine.UI.Text>().text = "Move to next region";
            }
            else
            {
                mConfirmButton.transform.GetComponentInChildren <UnityEngine.UI.Text>().text = "Start battle";
                if (mSelectedMapItem != null &&
                    !mSelectedMapItem.mItem.mMapItem.Completed &&
                    mSelectedMapItem.mItem.mMapItem.Available)
                {
                    mConfirmButton.interactable = true;
                }
                else
                {
                    mConfirmButton.interactable = false;
                }
            }

            foreach (Cards.UI.UICard card in mRewardCards)
            {
                card.UnityCard.transform.SetParent(null, false);
            }
            foreach (Cards.Entities.Entity entity in mCurrentRewardCards.Cards)
            {
                UpdateCard(entity, mCardRewardPanel.transform);
            }
        }