// Update is called once per frame private void Update() { if (sdk == null) { return; } if (currentType == TypeEnum.None) { checkCountup += Time.deltaTime; if (checkCountup < CheckFrequency) { return; } else { checkCountup = 0; } if (Application.isEditor) { if (Input.GetKeyDown(KeyCode.B)) { ThresholdCheck(TypeEnum.Saber, 5); } } else { if (sdk.Connections.Peripherals.Count > 0 && sdk.Connections.Peripherals[0].Connected) { ThresholdCheck(TypeEnum.Saber, sdk.Connections.Peripherals[0].GetBatteryLevel()); } if (sdk.Tracking.Hmd.Connected) { ThresholdCheck(TypeEnum.Headset, sdk.Tracking.Hmd.GetBatteryLevel()); } ThresholdCheck(TypeEnum.Phone, (int)(native.GetBatteryRemaining() * 100)); } } else { displayCountup += Time.deltaTime; if (displayCountup > DisplayTime) { Show(TypeEnum.None); } else { CommonPanel.alpha = FadeCurve.Evaluate(displayCountup / DisplayTime); } } }
/// <summary> /// Records the kpis. /// </summary> public void RecordKpis() { kpiCallCount++; string sceneName = SceneManager.GetActiveScene().name; float fps = Fps.GetFps(); float playSession = Time.realtimeSinceStartup; long availableMemory = nativeSettings.GetAvailableMemory() / 1024 / 1024; float battery = nativeSettings.GetBatteryRemaining(); Log.Debug("fps = " + fps + " sessionLength = " + playSession + " availableMemory = " + availableMemory + " battery = " + battery); Dictionary <string, string> payload = new Dictionary <string, string>(); payload.Add("count", kpiCallCount.ToString()); payload.Add("fps", fps.ToString()); payload.Add("playTime", playSession.ToString()); payload.Add("scene", sceneName); SwrveComponent.Instance.SDK.NamedEvent(KpiGroupName + ".fps", payload); payload.Clear(); payload.Add("count", kpiCallCount.ToString()); payload.Add("availableMemory", availableMemory.ToString()); payload.Add("playTime", playSession.ToString()); payload.Add("scene", sceneName); SwrveComponent.Instance.SDK.NamedEvent(KpiGroupName + ".memory", payload); payload.Clear(); payload.Add("count", kpiCallCount.ToString()); payload.Add("battery", battery.ToString()); payload.Add("playTime", playSession.ToString()); payload.Add("scene", sceneName); SwrveComponent.Instance.SDK.NamedEvent(KpiGroupName + ".battery", payload); }