|
|
@@ -5,6 +5,7 @@ using System.Linq;
|
|
|
using UnityEngine.UI;
|
|
|
using Newtonsoft.Json;
|
|
|
using o0._9Axis;
|
|
|
+using o0;
|
|
|
|
|
|
/* 瞄准处理器 */
|
|
|
public class AimHandler : MonoBehaviour
|
|
|
@@ -97,6 +98,9 @@ public class AimHandler : MonoBehaviour
|
|
|
{
|
|
|
// MagCalibrater = new o0MagneticCalibraterEllipsoidFitting();
|
|
|
MagCalibrater = new MagnetometerAutoCalibrater();
|
|
|
+ try {
|
|
|
+ Json.FromJson<MagnetometerAutoCalibrater>(PlayerPrefs.GetString("new_mag_record"), ref MagCalibrater);
|
|
|
+ } catch (System.Exception) {}
|
|
|
}
|
|
|
if (MagCalibrationButton)
|
|
|
{
|
|
|
@@ -124,6 +128,10 @@ public class AimHandler : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void OnDestroy() {
|
|
|
+ if (MagCalibrater.Complete) PlayerPrefs.SetString("new_mag_record", MagCalibrater.ToJson());
|
|
|
+ }
|
|
|
+
|
|
|
public void CalibrateGyr(bool calibration) {
|
|
|
try {
|
|
|
GyrCalibrater.Calibration = calibration;
|