From 7435bdf3d5bce919c90a279134f73a27f5ca8136 Mon Sep 17 00:00:00 2001 From: huyfei Date: Mon, 26 Feb 2024 09:34:00 +0800 Subject: [PATCH] =?UTF-8?q?update:=20GuruConsent=20=E5=86=85=20Json=20?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=94=B9=E4=B8=BA=20JsonConvert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/Script/Consent/GuruConsent.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Runtime/GuruConsent/Runtime/Script/Consent/GuruConsent.cs b/Runtime/GuruConsent/Runtime/Script/Consent/GuruConsent.cs index 0cb236c..1d2a0bc 100644 --- a/Runtime/GuruConsent/Runtime/Script/Consent/GuruConsent.cs +++ b/Runtime/GuruConsent/Runtime/Script/Consent/GuruConsent.cs @@ -1,8 +1,10 @@ +using System.Collections.Generic; + namespace Guru { using System; using System.Collections; - using Guru.LitJson; + using Newtonsoft.Json; using UnityEngine; /// @@ -74,17 +76,17 @@ namespace Guru //------- message send to unity ---------- Debug.Log($"{Tag} get callback msg:\n{msg}"); - var jo = JsonMapper.ToObject(msg); - if (jo != null && jo.ContainsKey("action") - && jo["action"].ToString() == "gdpr") + + var ditc = JsonConvert.DeserializeObject>(msg); + + if (ditc != null && ditc.ContainsKey("action") && ditc["action"] == "gdpr") { - var json = jo["data"].ToJson(); - Debug.Log($"--- data json: {json}"); - var data = JsonMapper.ToObject(json); - if (data != null) + var json = ditc["data"]; + var status = JsonConvert.DeserializeObject(json); + if (status != null) { - Debug.Log($"{Tag} --- status: {data.status} msg: {data.msg}"); - onCompleteHandler?.Invoke(data.status); + Debug.Log($"{Tag} --- status: {status.status} msg: {status.msg}"); + onCompleteHandler?.Invoke(status.status); } } else