// AsString public virtual StringBuilder AsString(StringBuilder s) { s.Length = 0; if (Var == null) { s.Append((Child1 != null) ? "=>" : ""); } else { switch (Var.Type) { case E_VarType.Bool: { BoolD v = (BoolD)Var; s.Append(v.Value ? "true" : "false"); break; } case E_VarType.Int: { IntD v = (IntD)Var; s.AppendFormat("{0:#,0}", v.Value); break; } case E_VarType.Float: { FloatD v = (FloatD)Var; s.AppendFormat("{0:#,0.0####}", v.Value); break; } case E_VarType.Enum: { EnumD v = (EnumD)Var; s.Append(v.Options[v.Value].Name); break; } case E_VarType.Function: { s.Append("-call-"); break; } case E_VarType.String: { StringD v = (StringD)Var; s.Append(v.Value); break; } case E_VarType.Color: { ColorD v = (ColorD)Var; s.AppendFormat("A:{0} R:{1} G:{2} B:{3}", v.A, v.R, v.G, v.B); break; } } } return(s); }
// ResetToDefault protected void ResetToDefault() { if (Current.Var == null) { return; } switch (Current.Var.Type) { case E_VarType.Bool: { BoolD v = (BoolD)Current.Var; v.Value = v.Default; break; } case E_VarType.Int: { IntD v = (IntD)Current.Var; v.Value = v.Default; break; } case E_VarType.Float: { FloatD v = (FloatD)Current.Var; v.Value = v.Default; break; } case E_VarType.Enum: { EnumD v = (EnumD)Current.Var; v.Value = v.Default; break; } case E_VarType.String: { StringD v = (StringD)Current.Var; v.Value = v.Default; break; } case E_VarType.Color: { ColorD v = (ColorD)Current.Var; v.Value = v.Default; break; } } }