public override string GetLabelPostfix(Inspector inspector, object data, Type type)
        {
            var time = (DateTime)data;

            return(" " + time.Kind);
        }
示例#2
0
        public override bool InspectChildren(Inspector inspector, string path, ref object data, Type type)
        {
            var curTable = data as LuaTable;

            if (curTable == null)
            {
                return(false);
            }
            var _tables = _SpawnDict();
            var _funs   = _SpawnDict();
            var _others = _SpawnDict();

            var enumerator = curTable.ToDictTable().GetEnumerator();

            while (enumerator.MoveNext())
            {
                var pair = enumerator.Current;
                if (pair.Value is LuaTable)
                {
                    _tables.Add(pair.Key, pair.Value);
                }
                else if (pair.Value is LuaFunction)
                {
                    _funs.Add(pair.Key, pair.Value);
                }
                else
                {
                    _others.Add(pair.Key, pair.Value);
                }
            }
            enumerator.Dispose();

            var e = _tables.GetEnumerator();

            while (e.MoveNext())
            {
                inspector.Inspect(e.Current.Key.ToString(), path + "." + e.Current.Key, e.Current.Value);
            }

            var metatable = curTable.GetMetaTable();

            if (metatable != null)
            {
                inspector.Inspect(".metatable", path + "." + ".metatable", metatable);
            }

            e = _others.GetEnumerator();
            while (e.MoveNext())
            {
                var pair = e.Current;
                inspector.Inspect(pair.Key.ToString(), path + "." + pair.Key, pair.Value, null, null,
                                  (v) => _SetTableValue(curTable, pair.Key, v));
            }

            e = _funs.GetEnumerator();
            while (e.MoveNext())
            {
                EditorGUILayout.LabelField(e.Current.Key.ToString(), "LuaFunction");
            }
            _RecycleDict(_tables);
            _RecycleDict(_others);
            _RecycleDict(_funs);
            return(false);
        }
 public override string GetLabelPostfix(Inspector inspector, object data, Type type)
 {
     return(" [" + TimeZone.CurrentTimeZone.StandardName + "]");
 }
        public override bool InspectChildren(Inspector inspector, string path, ref object data, Type type)
        {
            var timestamp = (int)data;

            return(ApplyValueIfNotEqual(ref data, GUITools.IntField("Unix Time Stamp", timestamp)));
        }
示例#5
0
 // OnGUI中回调
 //
 // 用于展现子内容,典型的用途为:容器展示其数据,自定义数据结构展示其成员
 // GUI上下文:垂直排列,多行控件。
 //
 // 一般递归对每个成员调用 inspector.InspectContent()
 //
 // 返回数据是否被修改
 public virtual bool InspectChildren(Inspector inspector, string path, ref object data, Type type)
 {
     return(false);
 }
示例#6
0
 // OnGUI中回调。用GUI显示或编辑自己的单行数据值,并返回数据是否被修改。
 //
 // GUI上下文:水平排列,其左侧会是自己的名称,当自己为引用类型时右侧会有一个+/-按钮。
 // 应当正好产生一个 GUI 控件,这样可以维持一行两列的整齐排布。
 // 在不产生控件的情况下,应当产生一个 flexibleSpace (正如本基类做的一样),以便保证右侧的 +/- 按钮靠右对齐
 public virtual bool InspectSelf(Inspector inspector, string name, ref object data, Type type)
 {
     GUILayout.FlexibleSpace();
     return(false);
 }
示例#7
0
 //
 // Normally, the label is field name.
 // If not null, field will be appended with the returned postfix
 public virtual string GetLabelPostfix(Inspector inspector, object data, Type type)
 {
     return(null);
 }