public override bool InitDevice()
    {
        Debug.Log("NoloVR_AndroidPlayform InitDevice");
        if (playformError == NoloError.None)
        {
            return(true);
        }
        try
        {
            func = new ConnectedStatusCallBackFunc(ConnectedStatusCallBack);
            NoloClientSo.SetConnectedStatus(func);

            unityPlayer     = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            currentActivity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            jc = new AndroidJavaClass("com.nolovr.androidsdkclient.NoloVR");
            jo = jc.CallStatic <AndroidJavaObject>("getInstance", currentActivity);
            if (jo.Call <bool>("isStallServer"))
            {
                jo.Call("openServer");
                playformError = NoloError.None;
                Debug.Log("NoloVR_AndroidPlayform InitDevice Finish");
            }
        }
        catch (Exception e)
        {
            Debug.Log("NoloVR_AndroidPlayform InitDevice:error" + e.Message);
            playformError = NoloError.ConnectFail;
            return(false);
        }
        return(true);
    }
Beispiel #2
0
    /// <summary>
    /// 获取定位信息
    /// </summary>
    /// <param name="deviceIndex">设备类型</param>
    /// <returns>Nolo_Transform</returns>
    public static Nolo_Transform GetPose(int deviceIndex)
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        return(NOLO.NOLOClient_V2_API.GetPoseByDeviceType(deviceIndex));
#elif UNITY_ANDROID
        return(new Nolo_Transform(NoloClientSo.GetPoseByDeviceType(deviceIndex)));
#endif
    }
Beispiel #3
0
    /// <summary>
    /// 获取设备连接状态
    /// </summary>
    /// <param name="deviceIndex"></param>
    /// <returns></returns>
    public static bool GetNoloConnectStatus(int deviceIndex)
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        return(NOLO.NOLOClient_V2_API.GetNoloConnectStatus(deviceIndex));
#elif UNITY_ANDROID
        return(NoloClientSo.GetPoseByDeviceType(deviceIndex).bDeviceIsConnected);
#endif
    }
Beispiel #4
0
//    public static int GetElectricityNumber(int deviceIndex)
//    {
//#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
//        return NOLO.NOLOClient_V2_API.GetElectricityNumberByDeviceType(deviceIndex);
//#elif UNITY_ANDROID
//      return NoloClientSo.GetElectricityNumberByDeviceType(deviceIndex);
//#endif
//    }
//    public static int GetElectricityNumber(NoloDeviceType type)
//    {
//        return GetElectricityNumber((int)type);
//    }

    /// <summary>
    /// 手柄震动接口
    /// </summary>
    /// <param name="deviceIndex">手柄设备类型</param>
    /// <param name="intensity">震动强度,范围0~100,50以上有震感</param>
    public static void TriggerHapticPulse(int deviceIndex, int intensity)
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        NOLO.NOLOClient_V2_API.TriggerHapticPulse((ENoloDeviceType)deviceIndex, intensity);
#elif UNITY_ANDROID
        NoloClientSo.Nolovr_TriggerHapticPulse(deviceIndex, intensity);
#endif
    }
Beispiel #5
0
    /// <summary>
    /// 获取电量等级
    /// </summary>
    /// <param name="deviceIndex">设备类型</param>
    /// <returns>0~5</returns>
    public static int GetElectricity(int deviceIndex)
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        return(NOLO.NOLOClient_V2_API.GetElectricityByDeviceType(deviceIndex));
#elif UNITY_ANDROID
        return(NoloClientSo.GetElectricityByDeviceType(deviceIndex));
#endif
    }
Beispiel #6
0
    /// <summary>
    /// 获取按键信息
    /// </summary>
    /// <param name="deviceIndex">设备类型</param>
    /// <returns>Nolo_ControllerStates</returns>
    public static Nolo_ControllerStates GetControllerStates(int deviceIndex)
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        return(NOLO.NOLOClient_V2_API.GetControllerStatesByDeviceType(deviceIndex));
#elif UNITY_ANDROID
        return(NoloClientSo.GetControllerStatesByDeviceType(deviceIndex));
#endif
    }
Beispiel #7
0
    /// <summary>
    /// 获取设备是3dof还是6dof
    /// </summary>
    /// <returns>0 = 3dof  1= 6dof</returns>
    public static int GetTrackModel()
    {
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        if (NoloVR_System.GetInstance().trackModel == NoloVR_Manager.TrackModel.Track_3dof)
        {
            return(3);
        }
        else
        {
            return(6);
        }
#elif UNITY_ANDROID
        return(NoloClientSo.GetNoloTrackModel());
#endif
    }