Exemplo n.º 1
0
    public void WriteToSetup(VRInputSetup s)
    {
        //Buttons
        s.button1       = button1;
        s.button1_Touch = button1_Touch;

        s.button2       = button2;
        s.button2_Touch = button2_Touch;

        s.index_Touch = index_Touch;

        s.thumb_Touch = thumb_Touch;
        s.thumb_Press = thumb_Press;

        //Axes
        s.thumbX         = thumbX;
        s.thumbXInverted = thumbXInverted;

        s.thumbY         = thumbY;
        s.thumbYInverted = thumbYInverted;

        s.index         = index;
        s.indexInverted = indexInverted;

        s.grab         = grab;
        s.grabInverted = grabInverted;
    }
Exemplo n.º 2
0
    //InputAxis rIndex_NearTouch;
    public void CopyFromSetup(VRInputSetup s)
    {
        button1 = s.button1;

        button1_Touch = s.button1_Touch;

        button2       = s.button2;
        button2_Touch = s.button2_Touch;

        index_Touch = s.index_Touch;

        thumb_Touch = s.thumb_Touch;
        thumb_Press = s.thumb_Press;


        thumbX         = s.thumbX;
        thumbXInverted = s.thumbXInverted;

        thumbY         = s.thumbY;
        thumbYInverted = s.thumbYInverted;

        index         = s.index;
        indexInverted = s.indexInverted;

        grab         = s.grab;
        grabInverted = s.grabInverted;



        Apply();
    }
Exemplo n.º 3
0
    public void WriteIntoList(VRInputSetup s, List <int> bL, List <string> aL)
    {
        //UsedKeys
        s.AddButton(button1, bL);
        s.AddButton(button1_Touch, bL);
        s.AddButton(button2, bL);
        s.AddButton(button2_Touch, bL);
        s.AddButton(index_Touch, bL);
        s.AddButton(thumb_Touch, bL);
        s.AddButton(thumb_Press, bL);

        //UsedAxes
        s.AddAxis(thumbX, thumbXInverted, aL);
        s.AddAxis(thumbY, thumbYInverted, aL);
        s.AddAxis(index, indexInverted, aL);
        s.AddAxis(grab, grabInverted, aL);
    }
    public override void OnInspectorGUI()
    {
        errorStyle.fontSize = 12;
        float lightness = 0.35f;

        setStyle.normal.textColor = new Color(lightness, lightness, lightness);

        errorStyle.fontSize         = 12;
        errorStyle.normal.textColor = Color.red;
        errorStyle.fontStyle        = FontStyle.Bold;

        unassignedStyle.fontSize         = 10;
        unassignedStyle.normal.textColor = Color.yellow;
        unassignedStyle.normal.textColor = new Color(lightness, lightness, lightness);
        unassignedStyle.fontStyle        = FontStyle.Italic;

        header.fontSize  = 16;
        header.fontStyle = FontStyle.Bold;

        controllerStyle.fontSize         = 12;
        controllerStyle.normal.textColor = new Color(lightness, lightness, lightness);
        controllerStyle.fontStyle        = FontStyle.Bold;

        GUI.enabled = false;
        EditorGUILayout.ObjectField("Script:", MonoScript.FromMonoBehaviour((VRInputSetup)target), typeof(VRInputSetup), false);
        GUI.enabled = true;

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("About this script", GUILayout.Height(25)))
        {
            script.DisplayAbout();
        }

        Color bColor = GUI.backgroundColor;

        GUI.backgroundColor = new Color(0.5f, 1, 0.5f, 1);
        if (GUILayout.Button("Display Manual", GUILayout.Height(25)))
        {
            script.DisplayManual();
        }
        GUI.backgroundColor = bColor;
        GUILayout.EndHorizontal();

        AddSpace(3);


        SerializedObject so = base.serializedObject;

        EditorGUILayout.PropertyField(so.FindProperty("vrInputLookup"), true);
        so.ApplyModifiedProperties();

        AddSpace(3);


        // Choose controller for setup
        if (GUILayout.Button("Switch Controller to Set Up", GUILayout.Height(25)))
        {
            script.AskForSwitch();
        }

        EditorGUILayout.LabelField("Current Controller: " + HandStatus(), controllerStyle);



        AddSpace(3);

        script = (VRInputSetup)base.target;

        // ------------------------ Buttons
        EditorGUILayout.LabelField("Buttons", header);

        AddSpace(2);

        script.button1_Touch = DrawButtonInfo("Button1_Touch", script.button1_Touch, script.Button1_TouchStatus);
        script.button2_Touch = DrawButtonInfo("Button2_Touch", script.button2_Touch, script.Button2_TouchStatus);

        script.index_Touch = DrawButtonInfo("Index_Touch", script.index_Touch, script.Index_TouchStatus);
        script.thumb_Touch = DrawButtonInfo("Thumb_Touch", script.thumb_Touch, script.Thumb_TouchStatus);

        script.button1 = DrawButtonInfo("Button1", script.button1, script.Button1Status);
        script.button2 = DrawButtonInfo("Button2", script.button2, script.Button2Status);

        script.thumb_Press = DrawButtonInfo("Thumb_Press", script.thumb_Press, script.Thumb_PressStatus);

        EditorGUILayout.LabelField("Last Button Pressed: " + script.lastButtonPressed.ToString(), EditorStyles.boldLabel);

        AddSpace(6);


        //  ------------------------------- Axes

        EditorGUILayout.LabelField("Axes", header);

        AddSpace(2);

        AxisParameters info = DrawAxisInfo("ThumbX", script.thumbX, script.thumbXInverted, script.ThumbXStatus);

        script.thumbX         = info.num;
        script.thumbXInverted = info.inverted;

        info                  = DrawAxisInfo("ThumbY", script.thumbY, script.thumbYInverted, script.ThumbYStatus);
        script.thumbY         = info.num;
        script.thumbYInverted = info.inverted;

        info                 = DrawAxisInfo("Index", script.index, script.indexInverted, script.IndexStatus);
        script.index         = info.num;
        script.indexInverted = info.inverted;

        info                = DrawAxisInfo("Grab", script.grab, script.grabInverted, script.GrabStatus);
        script.grab         = info.num;
        script.grabInverted = info.inverted;

        EditorGUILayout.LabelField("Last Axis used: " + script.lastAxisUsed, EditorStyles.boldLabel);

        AddSpace(3);


        GUI.backgroundColor = Color.yellow;
        if (GUILayout.Button("Apply Settings", GUILayout.Height(50)))
        {
            EditorUtility.SetDirty(target);
            script.ApplySettings(true);
        }
        GUI.backgroundColor = bColor;

        AddSpace(3);
    }