示例#1
0
        public void OnGUI(object instance)
        {
            crawled.Clear();
            crawled.Add("name");
            crawled.Add("tag");
            PropertyInfo[] allProperties = instance.GetType().GetProperties(
                BindingFlags.Public |
                BindingFlags.Instance |
                BindingFlags.DeclaredOnly
                );

            if (instance is Transform)
            {
                object getProperty = ((Transform)instance).name;
                object setProperty = ETGModInspector.DrawProperty(p_Object_name, getProperty);
                if (getProperty != setProperty)
                {
                    ((Transform)instance).name = (string)setProperty;
                }

                getProperty = ((Transform)instance).tag;
                setProperty = ETGModInspector.DrawProperty(p_Transform_tag, getProperty);
                if (getProperty != setProperty)
                {
                    ((Transform)instance).tag = (string)setProperty;
                }
            }

            GUILayout.Label("");
            GUILayout.Label("Component: " + instance.GetType().FullName);

            foreach (PropertyInfo inf in allProperties)
            {
                string fullName = inf.DeclaringType.FullName + "::" + inf.Name;
                if (PropertyBlacklist.Contains(fullName) ||
                    crawled.Contains(fullName) ||
                    inf.MemberType == MemberTypes.Method ||
                    inf.GetIndexParameters().Length != 0 ||
                    !inf.CanRead || !inf.CanWrite)
                {
                    continue;
                }
                crawled.Add(inf.Name);

                try {
                    object getProperty = ReflectionHelper.GetValue(inf, instance);
                    object setProperty = ETGModInspector.DrawProperty(inf, getProperty);
                    if (getProperty != setProperty)
                    {
                        ReflectionHelper.SetValue(inf, instance, setProperty);
                    }
                } catch (Exception e) {
                    Debug.LogWarning("GenericComponentInspector: Blacklisting " + fullName);
                    Debug.LogWarning(e);
                    PropertyBlacklist.Add(fullName);
                }
            }
        }
示例#2
0
    public void Awake()
    {
        LoggerMenu    = new ETGModDebugLogMenu();
        LoaderMenu    = new ETGModLoaderMenu();
        ConsoleMenu   = new ETGModConsole();
        InspectorMenu = new ETGModInspector();

        ETGDamageIndicatorGUI.Create();
    }
示例#3
0
    public void Awake()
    {
        BoxTexture = new Texture2D(1, 1);
        BoxTexture.SetPixel(0, 0, Color.white);
        BoxTexture.Apply();

        loggerMenu = new ETGModDebugLogMenu();
        loggerMenu.Start();

        loaderMenu = new ETGModLoaderMenu();
        loaderMenu.Start();

        consoleMenu = new ETGModConsole();
        consoleMenu.Start();

        inspectorMenu = new ETGModInspector();
        inspectorMenu.Start();

        ETGDamageIndicatorGUI.Create();
        StartCoroutine(ListAllItemsAndGuns());
    }