예제 #1
0
        /// <summary>
        /// Returns a formatted label based on the display type.
        /// </summary>
        protected virtual string GetLabel(LabelDisplayType displayType, float current, float max)
        {
            switch (displayType)
            {
            case LabelDisplayType.Direct:
                return(string.Format("{0}/{1}", current.ToString("F2"), max));

            case LabelDisplayType.Percentage:
                return(string.Format("{0}%", ((current / max) * 100).ToString("F0")));

            default:
                throw new System.NotImplementedException("There's no support for label display type '" + sprintingBarType + "' in GoldPlayerUI!");
            }
        }
예제 #2
0
        /// <summary>
        /// Returns a formatted label based on the display type.
        /// </summary>
        protected virtual string GetLabel(LabelDisplayType displayType, float current, float max, string directValueFormat, string directMaxFormat, string percentageFormat)
        {
            switch (displayType)
            {
            case LabelDisplayType.Direct:
                return(string.Format("{0}/{1}", current.ToString(directValueFormat), max.ToString(directMaxFormat)));

            case LabelDisplayType.Percentage:
                return(string.Format("{0}%", ((current / max) * 100).ToString(percentageFormat)));

            default:
#if DEBUG || UNITY_EDITOR
                throw new System.NotImplementedException("There's no support for label display type '" + staminaBarType + "' in GoldPlayerUI!");
#else
                return(string.Empty);
#endif
            }
        }