예제 #1
0
    public bool GetInputMappingPair(WVR_DeviceType type, WVR_InputId destination, ref WVR_InputMappingPair_t pair)
    {
        WVR_InputMappingPair_t[] inputTable = new WVR_InputMappingPair_t[10];
        switch (type)
        {
        case WVR_DeviceType.WVR_DeviceType_HMD:
            inputTable = inputTable_Hmd;
            break;

        case WVR_DeviceType.WVR_DeviceType_Controller_Right:
            inputTable = inputTable_Right;
            break;

        case WVR_DeviceType.WVR_DeviceType_Controller_Left:
            inputTable = inputTable_Left;
            break;

        default:
            break;
        }

        for (int i = 0; i < inputTable.Length; i++)
        {
            if (destination == inputTable [i].destination.id)
            {
                pair.source      = inputTable [i].source;
                pair.destination = inputTable [i].destination;
                return(true);
            }
        }

        return(false);
    }
예제 #2
0
    public bool SetInputRequest(WVR_DeviceType type, WVR_InputAttribute_t[] request, uint size)
    {
        if (type == WVR_DeviceType.WVR_DeviceType_HMD)
        {
            inputTable_Hmd = new WVR_InputMappingPair_t[size];
            WVR_InputId[] inputId_Hmd = new WVR_InputId[size];
            for (int i = 0; i < (int)size; i++)
            {
                inputId_Hmd [i] = request [i].id;
                inputTable_Hmd [i].destination = request [i];
            }
            UpdateInputTable(inputId_Hmd, inputTable_Hmd);
            for (int i = 0; i < inputTable_Hmd.Length; i++)
            {
                DEBUG("SetInputRequest() " + type + ", src: " + inputTable_Hmd[i].source.id + ", dst: " + inputTable_Hmd[i].destination.id);
            }
        }

        if (type == WVR_DeviceType.WVR_DeviceType_Controller_Right)
        {
            inputTable_Right = new WVR_InputMappingPair_t[size];
            WVR_InputId[] inputId_Right = new WVR_InputId[size];
            for (int i = 0; i < (int)size; i++)
            {
                inputId_Right [i] = request [i].id;
                inputTable_Right [i].destination = request [i];
            }
            UpdateInputTable(inputId_Right, inputTable_Right);
            for (int i = 0; i < inputTable_Right.Length; i++)
            {
                DEBUG("SetInputRequest() " + type + ", src: " + inputTable_Right[i].source.id + ", dst: " + inputTable_Right[i].destination.id);
            }
        }
        if (type == WVR_DeviceType.WVR_DeviceType_Controller_Left)
        {
            inputTable_Left = new WVR_InputMappingPair_t[size];
            WVR_InputId[] inputId_Left = new WVR_InputId[size];
            for (int i = 0; i < (int)size; i++)
            {
                inputId_Left [i] = request [i].id;
                inputTable_Left [i].destination = request [i];
            }
            UpdateInputTable(inputId_Left, inputTable_Left);
            for (int i = 0; i < inputTable_Left.Length; i++)
            {
                DEBUG("SetInputRequest() " + type + ", src: " + inputTable_Left[i].source.id + ", dst: " + inputTable_Left[i].destination.id);
            }
        }
        return(true);
    }
예제 #3
0
    public void SetDefaultButtons()
    {
        if (!this.Initialized)
        {
            return;
        }

        #if UNITY_EDITOR
        if (Application.isEditor)
        {
            return;
        }
        #endif

        Log.i(LOG_TAG, "SetDefaultButtons()");

        WVR_InputAttribute_t[] inputAttribtues_hmd = new WVR_InputAttribute_t[1];
        inputAttribtues_hmd [0].id         = WVR_InputId.WVR_InputId_Alias1_Enter;
        inputAttribtues_hmd [0].capability = (uint)WVR_InputType.WVR_InputType_Button;
        inputAttribtues_hmd [0].axis_type  = WVR_AnalogType.WVR_AnalogType_None;

        WVR_DeviceType _type = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Head).DeviceType;
        bool           _ret  = Interop.WVR_SetInputRequest(_type, inputAttribtues_hmd, (uint)inputAttribtues_hmd.Length);
        if (_ret)
        {
            uint inputTableSize = (uint)WVR_InputId.WVR_InputId_Max;
            WVR_InputMappingPair_t[] inputTable = new WVR_InputMappingPair_t[inputTableSize];
            uint _size = Interop.WVR_GetInputMappingTable(_type, inputTable, inputTableSize);
            if (_size > 0)
            {
                for (int _i = 0; _i < (int)_size; _i++)
                {
                    PrintDebugLog("SetDefaultButtons() " + _type
                                  + " button: " + inputTable [_i].source.id
                                  + " is mapping to HMD input ID: " + inputTable [_i].destination.id);
                }
            }
        }
    }
예제 #4
0
    public void SetDefaultButtons()
    {
        if (!this.Initialized)
        {
            return;
        }

        PrintInfoLog("SetDefaultButtons()");

        WVR_InputAttribute_t[] inputAttribtues_hmd = new WVR_InputAttribute_t[1];
        inputAttribtues_hmd [0].id         = WVR_InputId.WVR_InputId_Alias1_Enter;
        inputAttribtues_hmd [0].capability = (uint)WVR_InputType.WVR_InputType_Button;
        inputAttribtues_hmd [0].axis_type  = WVR_AnalogType.WVR_AnalogType_None;

        WVR_DeviceType _type = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Head).DeviceType;
        bool           _ret  = Interop.WVR_SetInputRequest(_type, inputAttribtues_hmd, (uint)inputAttribtues_hmd.Length);

        if (_ret)
        {
            uint inputTableSize = (uint)WVR_InputId.WVR_InputId_Max;
            WVR_InputMappingPair_t[] inputTable = new WVR_InputMappingPair_t[inputTableSize];
            uint _size = Interop.WVR_GetInputMappingTable(_type, inputTable, inputTableSize);
            if (_size > 0)
            {
                for (int _i = 0; _i < (int)_size; _i++)
                {
                    Log.d(LOG_TAG, Log.CSB
                          .Append("SetDefaultButtons() ")
                          .Append(_type.Name())
                          .Append(" button: ")
                          .Append(inputTable[_i].source.id)
                          .Append(" is mapping to HMD input ID: ")
                          .Append(inputTable[_i].destination.id)
                          .ToString());
                }
            }
        }
    }
 public override bool GetInputMappingPair(WVR_DeviceType type, WVR_InputId destination, ref WVR_InputMappingPair_t pair)
 {
     return(WVR_GetInputMappingPair_Android(type, destination, ref pair));
 }
 public static extern bool WVR_GetInputMappingPair_Android(WVR_DeviceType type, WVR_InputId destination, ref WVR_InputMappingPair_t pair);