update: GuruConsent 内 Json 解析改为 JsonConvert
							parent
							
								
									d839a68bf7
								
							
						
					
					
						commit
						7435bdf3d5
					
				|  | @ -1,8 +1,10 @@ | ||||||
|  | using System.Collections.Generic; | ||||||
|  | 
 | ||||||
| namespace Guru | namespace Guru | ||||||
| { | { | ||||||
|     using System; |     using System; | ||||||
|     using System.Collections; |     using System.Collections; | ||||||
|     using Guru.LitJson; |     using Newtonsoft.Json; | ||||||
|     using UnityEngine; |     using UnityEngine; | ||||||
|      |      | ||||||
|     /// <summary> |     /// <summary> | ||||||
|  | @ -74,17 +76,17 @@ namespace Guru | ||||||
|              |              | ||||||
|             //------- message send to unity ---------- |             //------- message send to unity ---------- | ||||||
|             Debug.Log($"{Tag} get callback msg:\n{msg}"); |             Debug.Log($"{Tag} get callback msg:\n{msg}"); | ||||||
|             var jo = JsonMapper.ToObject(msg); | 
 | ||||||
|             if (jo != null && jo.ContainsKey("action") |             var ditc = JsonConvert.DeserializeObject<Dictionary<string, string>>(msg); | ||||||
|                            && jo["action"].ToString() == "gdpr") |              | ||||||
|  |             if (ditc != null && ditc.ContainsKey("action") && ditc["action"] == "gdpr") | ||||||
|             { |             { | ||||||
|                 var json = jo["data"].ToJson(); |                 var json = ditc["data"]; | ||||||
|                 Debug.Log($"--- data json: {json}"); |                 var status = JsonConvert.DeserializeObject<ConsentStatus>(json); | ||||||
|                 var data = JsonMapper.ToObject<ConsentStatus>(json); |                 if (status != null) | ||||||
|                 if (data != null) |  | ||||||
|                 { |                 { | ||||||
|                     Debug.Log($"{Tag} ---  status: {data.status}    msg: {data.msg}"); |                     Debug.Log($"{Tag} ---  status: {status.status}    msg: {status.msg}"); | ||||||
|                     onCompleteHandler?.Invoke(data.status); |                     onCompleteHandler?.Invoke(status.status); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue