public virtual void Init(object obj, Type valueType)
        {
            if (valueType == null && obj == null)
            {
                return;
            }

            InteractiveValue interactive;

            if (valueType == typeof(GameObject) || valueType == typeof(Transform))
            {
                interactive = new InteractiveGameObject();
            }
            else if (valueType.IsPrimitive || valueType == typeof(string))
            {
                interactive = new InteractivePrimitive();
            }
            else if (valueType.IsEnum)
            {
                if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true) is object[] attributes && attributes.Length > 0)
                {
                    interactive = new InteractiveFlags();
                }
                else
                {
                    interactive = new InteractiveEnum();
                }
            }
Exemple #2
0
        public virtual void Init(object obj, Type valueType)
        {
            if (valueType == null && obj == null)
            {
                return;
            }

            //ExplorerCore.Log("Initializing InteractiveValue of type " + valueType.FullName);

            InteractiveValue interactive;

            if (valueType == typeof(GameObject) || valueType == typeof(Transform))
            {
                interactive = new InteractiveGameObject();
            }
            else if (valueType == typeof(Texture2D))
            {
                interactive = new InteractiveTexture2D();
            }
            else if (valueType == typeof(Texture))
            {
                interactive = new InteractiveTexture();
            }
            else if (valueType == typeof(Sprite))
            {
                interactive = new InteractiveSprite();
            }
            else if (valueType.IsPrimitive || valueType == typeof(string))
            {
                interactive = new InteractivePrimitive();
            }
            else if (valueType.IsEnum)
            {
                if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true) is object[] attributes && attributes.Length > 0)
                {
                    interactive = new InteractiveFlags();
                }
                else
                {
                    interactive = new InteractiveEnum();
                }
            }