示例#1
0
        protected override void LoadEnumeration(IEnumerable values)
        {
            LoadSingleObject(values);

            foreach (object o in values)
            {
                var member = new OutputEntry();
                member.LoadSingleObject(o);
                EnumerationItems.Add(member);
            }
        }
        /// <summary>
        /// Displays a single variable, returns true if the varible was deleted else false.
        /// </summary>
        /// <param name="VarName">Name of the var. (key of the <see cref="RexHelper.Variables"/>)</param>
        /// <param name="var">The varible to display. (Value of the <see cref="RexHelper.Variables"/>)</param>
        private bool DisplayVariable(string VarName, RexHelper.Variable var)
        {
            string highlightedString;

            var type = RexUtils.GetCSharpRepresentation(var.VarType);

            // Format the code for syntax highlighting using richtext.
            highlightedString = RexUIUtils.SyntaxHighlingting(type.Concat(new[] {
                Syntax.Space, Syntax.Name(VarName), Syntax.Space, Syntax.EqualsOp, Syntax.Space
            }).Concat(RexReflectionUtils.GetSyntaxForValue(var.VarValue)));

            var shouldDelete = GUILayout.Button(_texts.GetText("remove_variable", tooltipFormat: VarName), GUILayout.Width(20));

            // Draw the button as a label.
            if (GUILayout.Button(_texts.GetText("inspect_variable", highlightedString, VarName), varLabelStyle, GUILayout.ExpandWidth(true)))
            {
                var ouput = new OutputEntry();
                ouput.LoadObject(var.VarValue);
                RexHelper.AddOutput(ouput);
            }

            return(shouldDelete);
        }