예제 #1
0
        protected void BuildDescription()
        {
            StringBuilder sb           = new StringBuilder();
            Color         currentColor = Colors.Alpha(Colors.BlendThree(LowColorValue, MidColorValue, HighColorValue, NormalizedValue), 1f);

            //static description
            sb.Append(Colors.ColorWrap(Name, KeeperColor));
            sb.Append(Colors.ColorWrap(": ", KeeperColor));
            sb.Append(Colors.ColorWrap(Description.Trim(), KeeperColor));
            sb.Append("\n_\n");
            //current value description
            bool overFlow  = false;
            bool underFlow = false;

            if (mValueWithFlow > 1)
            {
                overFlow = true;
                sb.Append(Colors.ColorWrap(ValueDescriptionGreaterThanFull.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.95)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionFull.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.8)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionFourFifths.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.6)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionThreeFifths.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.4)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionTwoFifths.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.2)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionOneFifth.Trim(), currentColor));
            }
            else if (mValueWithFlow > 0.01)
            {
                sb.Append(Colors.ColorWrap(ValueDescriptionEmpty.Trim(), currentColor));
            }
            else
            {
                underFlow = true;
                sb.Append(Colors.ColorWrap(ValueDescriptionLessThanEmpty, currentColor));
            }
            //flows - how this affects other keepers
            //and how we are affected by other keepers
            if (overFlow &&
                !string.IsNullOrEmpty(mActiveState.Overflow.TargetName) &&
                mActiveState.Overflow.HasEffect &&
                !string.IsNullOrEmpty(mActiveState.Overflow.Description.Trim()))
            {
                sb.Append("\n");
                sb.Append(Colors.ColorWrap(mActiveState.Overflow.Description.Trim(), HighColorValue));
            }
            else if (underFlow &&
                     !string.IsNullOrEmpty(mActiveState.Underflow.TargetName) &&
                     mActiveState.Underflow.HasEffect &&
                     !string.IsNullOrEmpty(mActiveState.Underflow.Description.Trim()))
            {
                sb.Append("\n");
                sb.Append(Colors.ColorWrap(mActiveState.Underflow.Description.Trim(), LowColorValue));
            }

            if (StatusFlows.Count > 0)
            {
                sb.Append("\n");
                for (int i = 0; i < StatusFlows.Count; i++)
                {
                    StatusFlow sf = StatusFlows [i];
                    if (sf.HasEffect && !string.IsNullOrEmpty(sf.Description.Trim()))
                    {
                        if (sf.FlowType == StatusSeekType.Negative)
                        {
                            sb.Append(Colors.ColorWrap(sf.Description.Trim(), LowColorValue));
                        }
                        else
                        {
                            sb.Append(Colors.ColorWrap(sf.Description.Trim(), HighColorValue));
                        }
                    }
                }
            }
            //current state description
            if (!string.IsNullOrEmpty(mActiveState.StateDescription))
            {
                sb.Append("\n_\n");
                sb.Append(mActiveState.StateDescription.Trim());
            }

            mCurrentDescription = sb.ToString();
            sb.Clear();
            sb = null;
        }