コード例 #1
0
    /// <summary>
    /// Displays a field according to what the argument display type and value type.
    /// </summary>
    /// <param name="newType">New type.</param>
    /// <param name="currentArg">Current argument.</param>
    void DisplayField(BaseITweenArg currentArg, SerializedProperty arrayProperty = null)
    {
        DisplayType newType = currentArg.typeOfDisplay;


        switch (newType)
        {
        case DisplayType.Int:
            currentArg.intValue = EditorGUILayout.IntField(currentArg.intValue);
            break;

        case DisplayType.Float:
            currentArg.floatValue = EditorGUILayout.FloatField(currentArg.floatValue);
            break;

        case DisplayType.Double:
            currentArg.doubleValue = EditorGUILayout.DoubleField(currentArg.doubleValue);
            break;

        case DisplayType.String:
            currentArg.stringValue = EditorGUILayout.TextField(currentArg.stringValue);
            break;

        case DisplayType.Bool:
            currentArg.boolValue = EditorGUILayout.Toggle(currentArg.boolValue);
            break;

        case DisplayType.Color:
            currentArg.colorValue = EditorGUILayout.ColorField(currentArg.colorValue);
            break;

        case DisplayType.GameObject:
            currentArg.gameObjectValue = (GameObject)EditorGUILayout.ObjectField(currentArg.gameObjectValue, typeof(GameObject), true);
            break;

        case DisplayType.Object:
            currentArg.objectValue = (UnityEngine.Object)EditorGUILayout.ObjectField(currentArg.objectValue, typeof(UnityEngine.Object), false);
            break;

        case DisplayType.AudioSource:
            currentArg.audioSourceValue = (AudioSource)EditorGUILayout.ObjectField(currentArg.audioSourceValue, typeof(AudioSource), true);
            break;

        case DisplayType.AudioClip:
            currentArg.audioClipValue = (AudioClip)EditorGUILayout.ObjectField(currentArg.audioClipValue, typeof(AudioClip), false);
            break;

        case DisplayType.Vector3:
            currentArg.vector3Value = EditorGUILayout.Vector3Field("", currentArg.vector3Value);
            break;

        case DisplayType.Vector3Array:
            EditorGUILayout.PropertyField(arrayProperty.FindPropertyRelative("vector3ArrayValue"), true);
            break;

        case DisplayType.Vector2:
            currentArg.vector2Value = EditorGUILayout.Vector2Field("", currentArg.vector2Value);
            break;

        case DisplayType.Transform:
            currentArg.transformValue = (Transform)EditorGUILayout.ObjectField(currentArg.transformValue, typeof(Transform), true);
            break;

        case DisplayType.TransformArray:
            EditorGUILayout.PropertyField(arrayProperty.FindPropertyRelative("transformArrayValue"), true);
            break;

        case DisplayType.Rect:
            currentArg.rectValue = EditorGUILayout.RectField(currentArg.rectValue);
            break;

        case DisplayType.EaseType:
            currentArg.easeTypeValue = (iTween.EaseType)EditorGUILayout.EnumPopup(currentArg.easeTypeValue);
            break;

        case DisplayType.LoopType:
            currentArg.loopTypeValue = (iTween.LoopType)EditorGUILayout.EnumPopup(currentArg.loopTypeValue);
            break;

        case DisplayType.NameColorValue:
            currentArg.namedValueColorValue = (iTween.NamedValueColor)EditorGUILayout.EnumPopup(currentArg.namedValueColorValue);
            break;

        case DisplayType.Space:
            currentArg.spaceValue = (Space)EditorGUILayout.EnumPopup(currentArg.spaceValue);
            break;
        }
    }
コード例 #2
0
    void AddToHashTable(Hashtable currentTable, BaseITweenArg newArg)
    {
        switch (newArg.typeOfDisplay)
        {
        case DisplayType.Int:
            currentTable.Add(newArg.argName, newArg.intValue);
            break;

        case DisplayType.Float:
            currentTable.Add(newArg.argName, newArg.floatValue);
            break;

        case DisplayType.Double:
            currentTable.Add(newArg.argName, newArg.doubleValue);
            break;

        case DisplayType.String:
            currentTable.Add(newArg.argName, newArg.stringValue);
            break;

        case DisplayType.Bool:
            currentTable.Add(newArg.argName, newArg.boolValue);
            break;

        case DisplayType.Color:
            currentTable.Add(newArg.argName, newArg.colorValue);
            break;

        case DisplayType.GameObject:
            currentTable.Add(newArg.argName, newArg.gameObjectValue);
            break;

        case DisplayType.Object:
            currentTable.Add(newArg.argName, newArg.objectValue);
            break;

        case DisplayType.AudioSource:
            currentTable.Add(newArg.argName, newArg.audioSourceValue);
            break;

        case DisplayType.AudioClip:
            currentTable.Add(newArg.argName, newArg.audioClipValue);
            break;

        case DisplayType.Vector3:
            currentTable.Add(newArg.argName, newArg.vector3Value);
            break;

        case DisplayType.Vector3Array:
            currentTable.Add(newArg.argName, newArg.vector3ArrayValue);
            break;

        case DisplayType.Vector2:
            currentTable.Add(newArg.argName, newArg.vector2Value);
            break;

        case DisplayType.Transform:
            currentTable.Add(newArg.argName, newArg.transformValue);
            break;

        case DisplayType.TransformArray:
            currentTable.Add(newArg.argName, newArg.transformArrayValue);
            break;

        case DisplayType.Rect:
            currentTable.Add(newArg.argName, newArg.rectValue);
            break;

        case DisplayType.EaseType:
            currentTable.Add(newArg.argName, newArg.easeTypeValue);
            break;

        case DisplayType.LoopType:
            currentTable.Add(newArg.argName, newArg.loopTypeValue);
            break;

        case DisplayType.NameColorValue:
            currentTable.Add(newArg.argName, newArg.namedValueColorValue);
            break;

        case DisplayType.Space:
            currentTable.Add(newArg.argName, newArg.spaceValue);
            break;
        }
    }