public void UpdateOffer(int playerMoney)
 {
     if (playerMoney >= _element.Cost)
     {
         _offerState = EOfferState.Available;
         _icon.color = _availableStyleSheet.ForegroundColor;
     }
     else
     {
         _offerState = EOfferState.Unavailable;
         _icon.color = _unavailableStyleSheet.ForegroundColor;
     }
 }
Exemple #2
0
        public void Refresh(EOfferState state)
        {
            _state = state;
            switch (state)
            {
            case EOfferState.Available:
                colors = new ColorBlock()
                {
                    normalColor      = Color.green,
                    highlightedColor = colors.highlightedColor,
                    pressedColor     = colors.pressedColor,
                    selectedColor    = colors.selectedColor,
                    fadeDuration     = colors.fadeDuration,
                    colorMultiplier  = colors.colorMultiplier
                };
                break;

            case EOfferState.Bought:
                colors = new ColorBlock()
                {
                    normalColor      = Color.yellow,
                    highlightedColor = colors.highlightedColor,
                    pressedColor     = colors.pressedColor,
                    selectedColor    = colors.selectedColor,
                    fadeDuration     = colors.fadeDuration,
                    colorMultiplier  = colors.colorMultiplier
                };
                break;

            case EOfferState.Unavailable:
                colors = new ColorBlock()
                {
                    normalColor      = Color.red,
                    highlightedColor = colors.highlightedColor,
                    pressedColor     = colors.pressedColor,
                    selectedColor    = colors.selectedColor,
                    fadeDuration     = colors.fadeDuration,
                    colorMultiplier  = colors.colorMultiplier
                };
                break;
            }
        }
Exemple #3
0
        public void CreateDescription(ReferencePart part, EOfferState state)
        {
            _descriptionBuilder.Clear();
            if (state == EOfferState.Available)
            {
                _name.text = part.Name;
            }
            else if (state == EOfferState.Bought)
            {
                _name.text = "<color=yellow>" + part.Name + "</color>";
            }
            else
            {
                _name.text = "<color=red>" + part.Name + "</color>";
            }

            _image.sprite = part.Sprite;
            _descriptionBuilder.Append("<size=14>" + part.ShortDescription + "</size>\n");
            if (state == EOfferState.Available)
            {
                _descriptionBuilder.Append("Cost: " + part.Cost.ToString() + " $\n");
            }
            else if (state == EOfferState.Unavailable)
            {
                _descriptionBuilder.Append("<color=red>Cost: " + part.Cost.ToString() + " $</color>\n");
            }

            string specDesc = part.GetOfferDescription();

            _descriptionBuilder.Append("\n" + specDesc);

            if (state == EOfferState.Bought)
            {
                _descriptionBuilder.Append("\n\n<color=yellow>Owned!</color>");
                _descriptionBuilder.Append("\n<size=14><color=yellow>Buy again to get brand new part - fully performant.</color></size>");
            }

            _description.text = _descriptionBuilder.ToString();
        }
Exemple #4
0
        private void AdjustToType(EOfferState state)
        {
            switch (state)
            {
            case EOfferState.Available:
                StyleSheet = _availableStyle;
                break;

            case EOfferState.Bought:
                StyleSheet = _boughtStyle;
                break;

            case EOfferState.Locked:
                StyleSheet = _unavailableStyle;
                break;

            case EOfferState.Unavailable:
                StyleSheet = _unavailableStyle;
                break;

            default:
                break;
            }
        }
Exemple #5
0
 public ShowPartDescriptionEA(ReferencePart part, EOfferState state)
 {
     Part  = part;
     State = state;
 }
Exemple #6
0
 public DescriptOfferEA(IDescriptableElement element, RectTransform rectTransform, EOfferState state)
 {
     DescriptableElement = element;
     RectTransform       = rectTransform;
     State = state;
 }