Commit d6b0abba authored by zwebrain's avatar zwebrain
Browse files

.

parent b3a43574
Loading
Loading
Loading
Loading
+27112 −27112

File changed.

Preview size limit exceeded, changes collapsed.

+489 −10

File changed.

Preview size limit exceeded, changes collapsed.

+25 −25
Original line number Diff line number Diff line
@@ -29,16 +29,16 @@ public class GeographyManager : MonoBehaviour
    private string baidu = "UexT0eqWG8q7X6YF1DQmSw3K3mH5dSw8";


#if ENABLE_WINMD_SUPPORT
    [DllImport("HL2RmUnityPlugin", EntryPoint = "StartStreaming", CallingConvention = CallingConvention.StdCall)]
    public static extern void StartStreaming();
    [DllImport("HL2RmUnityPlugin", EntryPoint = "GetAccelSample", CallingConvention = CallingConvention.StdCall)]
    public static extern int GetAccelSample(IntPtr pv1);
    [DllImport("HL2RmUnityPlugin", EntryPoint = "GetGyroSample", CallingConvention = CallingConvention.StdCall)]
    public static extern int GetGyroSample(IntPtr pv1);
    [DllImport("HL2RmUnityPlugin", EntryPoint = "GetMagSample", CallingConvention = CallingConvention.StdCall)]
    public static extern int GetMagSample(IntPtr pv1);
#endif
// #if ENABLE_WINMD_SUPPORT
//     [DllImport("HL2RmUnityPlugin", EntryPoint = "StartStreaming", CallingConvention = CallingConvention.StdCall)]
//     public static extern void StartStreaming();
//     [DllImport("HL2RmUnityPlugin", EntryPoint = "GetAccelSample", CallingConvention = CallingConvention.StdCall)]
//     public static extern int GetAccelSample(IntPtr pv1);
//     [DllImport("HL2RmUnityPlugin", EntryPoint = "GetGyroSample", CallingConvention = CallingConvention.StdCall)]
//     public static extern int GetGyroSample(IntPtr pv1);
//     [DllImport("HL2RmUnityPlugin", EntryPoint = "GetMagSample", CallingConvention = CallingConvention.StdCall)]
//     public static extern int GetMagSample(IntPtr pv1);
// #endif

    public void OnClickBtn()
    {
@@ -52,9 +52,9 @@ public class GeographyManager : MonoBehaviour
    void Start()
    {
        text.text = "0";
#if ENABLE_WINMD_SUPPORT
        StartStreaming();
#endif
// #if ENABLE_WINMD_SUPPORT
//         StartStreaming();
// #endif
        StartCoroutine("StartGPS");
        StartCoroutine("StartBattery");
    }
@@ -95,17 +95,17 @@ public class GeographyManager : MonoBehaviour
            fpsChart.title.text = $"FPS:{fps:f1}";
        }

#if ENABLE_WINMD_SUPPORT
        int sizeOut = Marshal.SizeOf(typeof(OUTPUT));
        IntPtr pBuffOut = Marshal.AllocHGlobal(sizeOut);

        int result = GetAccelSample(pBuffOut);
        OUTPUT pOut = (OUTPUT)Marshal.PtrToStructure(pBuffOut, typeof(OUTPUT));
        accelTextMesh.text = $"Accel: {pOut.x} {pOut.y} {pOut.z}";
        result = GetMagSample(pBuffOut);
        pOut = (OUTPUT)Marshal.PtrToStructure(pBuffOut, typeof(OUTPUT));
        magTextMesh.text = $"Mag: {pOut.x} {pOut.y} {pOut.z}";
#endif
// #if ENABLE_WINMD_SUPPORT
//         int sizeOut = Marshal.SizeOf(typeof(OUTPUT));
//         IntPtr pBuffOut = Marshal.AllocHGlobal(sizeOut);
//
//         int result = GetAccelSample(pBuffOut);
//         OUTPUT pOut = (OUTPUT)Marshal.PtrToStructure(pBuffOut, typeof(OUTPUT));
//         accelTextMesh.text = $"Accel: {pOut.x} {pOut.y} {pOut.z}";
//         result = GetMagSample(pBuffOut);
//         pOut = (OUTPUT)Marshal.PtrToStructure(pBuffOut, typeof(OUTPUT));
//         magTextMesh.text = $"Mag: {pOut.x} {pOut.y} {pOut.z}";
// #endif
    }

    IEnumerator StartBattery()
@@ -113,7 +113,7 @@ public class GeographyManager : MonoBehaviour
        // Create aggregate battery object
        while (true)
        {
            if (battery != float.Parse(SystemInfo.batteryLevel.ToString()) * 100)
            if (Math.Abs(battery - float.Parse(SystemInfo.batteryLevel.ToString()) * 100) > 0.01)
            {
                battery = float.Parse(SystemInfo.batteryLevel.ToString()) * 100;
                batteryChart.ClearData();