예제 #1
0
        /// <summary>
        /// Construct texture id for button background, based on prefix, button state and whether
        /// the button is active.
        /// </summary>
        /// <returns>Atlas sprite id.</returns>
        internal string GetBackgroundTextureId(ControlEnabledState enabledState,
                                               ControlHoveredState hoveredState,
                                               ControlActiveState activeState)
        {
            string chosenPrefix = string.IsNullOrEmpty(BackgroundPrefix)
                                      ? Prefix
                                      : BackgroundPrefix;
            string ret = chosenPrefix + "-bg";

            if (enabledState == ControlEnabledState.Disabled)
            {
                return(BackgroundDisabled ? ret + "-disabled" : ret + "-normal");
            }

            if (activeState == ControlActiveState.Active)
            {
                return(BackgroundActive ? ret + "-active" : ret + "-normal");
            }

            if (hoveredState == ControlHoveredState.Hovered)
            {
                return(BackgroundHovered ? ret + "-hovered" : ret + "-normal");
            }

            return(ret + "-normal");
        }
예제 #2
0
        /// <summary>
        /// Construct texture id for button foreground, based on prefix, what the button does,
        /// and whether it is active.
        /// </summary>
        /// <returns>Atlas sprite id.</returns>
        internal string GetForegroundTextureId(ControlEnabledState enabledState,
                                               ControlHoveredState hoveredState,
                                               ControlActiveState activeState)
        {
            string ret = Prefix + "-fg";

            if (enabledState == ControlEnabledState.Disabled)
            {
                return(ForegroundDisabled ? ret + "-disabled" : ret + "-normal");
            }

            if (activeState == ControlActiveState.Active)
            {
                return(ForegroundActive ? ret + "-active" : ret + "-normal");
            }

            if (hoveredState == ControlHoveredState.Hovered)
            {
                return(ForegroundHovered ? ret + "-hovered" : ret + "-normal");
            }

            return(ret + "-normal");
        }