예제 #1
0
    AlloyFieldDrawer SetupVectorDrawer(AlloyInspectorBase editor,
                                       AlloyValueToken valProp,
                                       AlloyFieldDrawer ret)
    {
        if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.String)
        {
            switch (valProp.StringValue)
            {
            case "Euler":
                ret = new AlloyVectorDrawer(editor, MaterialProperty);
                ((AlloyVectorDrawer)ret).Mode = AlloyVectorDrawer.VectorMode.Euler;
                break;

            case "TexCoord":
                ret = new AlloyTexCoordDrawer(editor, MaterialProperty);
                break;

            case "Channels":
                ret = new AlloyMaskDrawer(editor, MaterialProperty);
                break;

            default:
                Debug.LogError("Non supported vector property!");
                break;
            }
        }
        else if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.Float)
        {
            switch ((int)valProp.FloatValue)
            {
            case 2:
                ret = new AlloyVectorDrawer(editor, MaterialProperty);
                ((AlloyVectorDrawer)ret).Mode = AlloyVectorDrawer.VectorMode.Vector2;
                break;

            case 3:
                ret = new AlloyVectorDrawer(editor, MaterialProperty);
                ((AlloyVectorDrawer)ret).Mode = AlloyVectorDrawer.VectorMode.Vector3;
                break;

            case 4:
                ret = new AlloyVectorDrawer(editor, MaterialProperty);
                ((AlloyVectorDrawer)ret).Mode = AlloyVectorDrawer.VectorMode.Vector4;
                break;

            default:
                Debug.LogError("Non supported vector property!");
                break;
            }
        }
        return(ret);
    }
    private AlloyFieldDrawer SetupVectorDrawer(AlloyInspectorBase editor, AlloyValueToken valProp,
        AlloyFieldDrawer ret) {
        if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.String) {
            switch (valProp.StringValue) {
                case "Euler":
                    ret = new AlloyVectorDrawer(editor, MaterialProperty);
                    ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Euler;
                    break;

                case "TexCoord":
                    ret = new AlloyTexCoordDrawer(editor, MaterialProperty);
                    break;

                case "Mask":
                    ret = new AlloyMaskDrawer(editor, MaterialProperty);
                    break;

                default:
                    Debug.LogError("Non supported vector property!");
                    break;
            }
        }
        else if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.Float) {
            switch ((int) valProp.FloatValue) {
                case 2:
                    ret = new AlloyVectorDrawer(editor, MaterialProperty);
                    ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector2;
                    break;

                case 3:
                    ret = new AlloyVectorDrawer(editor, MaterialProperty);
                    ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector3;
                    break;

                case 4:
                    ret = new AlloyVectorDrawer(editor, MaterialProperty);
                    ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector4;
                    break;

                default:
                    Debug.LogError("Non supported vector property!");
                    break;
            }
        }
        return ret;
    }