public void UpdateOffer(int playerMoney) { if (playerMoney >= _element.Cost) { _offerState = EOfferState.Available; _icon.color = _availableStyleSheet.ForegroundColor; } else { _offerState = EOfferState.Unavailable; _icon.color = _unavailableStyleSheet.ForegroundColor; } }
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; } }
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(); }
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; } }
public ShowPartDescriptionEA(ReferencePart part, EOfferState state) { Part = part; State = state; }
public DescriptOfferEA(IDescriptableElement element, RectTransform rectTransform, EOfferState state) { DescriptableElement = element; RectTransform = rectTransform; State = state; }