Exemplo n.º 1
0
    public static CustomGestureEditor Open(CustomGestureTemplate template)
    {
        CustomGestureEditor window = EditorWindow.GetWindow <CustomGestureEditor>(true, "Gesture Editor: " + template.name);

        window.maxSize = new Vector2(GestureAreaSize, GestureAreaSize + ToolbarHeight + 22);
        window.minSize = window.maxSize;
        window.Init(template);
        window.Focus();

        return(window);
    }
    public override void OnInspectorGUI()
    {
        CustomGestureTemplate template = target as CustomGestureTemplate;

        if (GUILayout.Button("Edit", GUILayout.Height(50)))
        {
            CustomGestureEditor.Open(template);
        }

        template.tolerance     = EditorGUILayout.IntField(LABEL_Tolerance, template.tolerance);
        template.isCaclTowards = EditorGUILayout.Toggle(LABEL_CaclTowards, template.isCaclTowards);
        template.isRotate      = EditorGUILayout.Toggle(LABEL_IsRotate, template.isRotate);
        template.RotateAngle   = EditorGUILayout.FloatField(LABEL_RotateAngle, template.RotateAngle);
        template.RotateStep    = EditorGUILayout.FloatField(LABEL_RotateStep, template.RotateStep);

        /*
         * if( GUILayout.Button( "Triangle" ) )
         * {
         *  template.BeginPoints();
         *  template.AddPoint( 0, 1, 1 );
         *  template.AddPoint( 0, 2, 2 );
         *  template.AddPoint( 0, 3, 1 );
         *  template.AddPoint( 0, 1, 1 );
         *  template.EndPoints();
         * }
         *
         * if( GUILayout.Button( "Square" ) )
         * {
         *  template.BeginPoints();
         *  template.AddPoint( 0, 2, 1 );
         *  template.AddPoint( 0, 2, 3 );
         *  template.AddPoint( 0, 4, 3 );
         *  template.AddPoint( 0, 4, 1 );
         *  template.AddPoint( 0, 2, 1 );
         *  template.EndPoints();
         * }*/
    }