Пример #1
0
        public virtual void CreateEditor()
        {
            EditorWindow <T> editor = new EditorWindow <T>();

            editor.init(800, 600, (uint)(PlatformSupportAbstract <T> .WindowFlags.Risizeable));
            editor.Caption = "Editing Default Something";
            Type gameObjectType = this.GetType();
            T    y_location     = M.Zero <T>();

            BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

            System.Reflection.FieldInfo[] gameObjectFields = gameObjectType.GetFields(bindingFlags);
            foreach (FieldInfo gameObjectField in gameObjectFields)
            {
                object[] TestAttributes = gameObjectField.GetCustomAttributes(typeof(GameDataAttribute), false);
                if (TestAttributes.Length > 0)
                {
                    GameDataAttribute gameDataAttribute = (GameDataAttribute)TestAttributes[0];
                    TextWidget <T>    name = new TextWidget <T>(gameDataAttribute.Name, M.Zero <T>(), y_location, M.New <T>(15));
                    editor.AddChild(name);

                    object         test  = gameObjectField.GetValue(this);
                    TextWidget <T> value = new TextWidget <T>(test.ToString(), name.Width, y_location, M.New <T>(15));
                    editor.AddChild(value);

                    y_location.AddEquals(name.Height);
                }
            }
        }