Ejemplo n.º 1
0
    private string OnTooltip()
    {
        GetAmounts(true, out float available, out float total, out float reserved);
        string str = elements.LabelText.text + "\n";

        return(str + string.Format(UI.RESOURCESCREEN.AVAILABLE_TOOLTIP, ResourceCategoryScreen.QuantityTextForMeasure(available, Measure), ResourceCategoryScreen.QuantityTextForMeasure(reserved, Measure), ResourceCategoryScreen.QuantityTextForMeasure(total, Measure)));
    }
Ejemplo n.º 2
0
    public void UpdateValue()
    {
        SetName(Resource.ProperName());
        bool allowInsufficientMaterialBuild = GenericGameSettings.instance.allowInsufficientMaterialBuild;

        GetAmounts(allowInsufficientMaterialBuild, out float available, out float total, out float reserved);
        if (currentQuantity != available)
        {
            currentQuantity    = available;
            QuantityLabel.text = ResourceCategoryScreen.QuantityTextForMeasure(available, Measure);
        }
        Color color = AvailableColor;

        if (reserved > total)
        {
            color = OverdrawnColor;
        }
        else if (available == 0f)
        {
            color = UnavailableColor;
        }
        if (QuantityLabel.color != color)
        {
            QuantityLabel.color = color;
        }
        if (NameLabel.color != color)
        {
            NameLabel.color = color;
        }
    }