Пример #1
0
        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);
            }
        }