public static BTPrjSettingsDef FromJSONEncodedString(string str) { var tbl = (Hashtable)MiniJSON.jsonDecode(str); if (tbl == null) { throw new System.Exception("Error, string is not json or json object : " + str); } var ret = new BTPrjSettingsDef(); ret.keys = tbl.GetArrayOfSimple <string>("keys").ToList(); ret.dispName = tbl.GetArrayOfSimple <string>("dispName").ToList(); ret.types = tbl.GetArrayOfSimple <string>("types").ToList(); ret.defaultValue = tbl.GetArrayOfSimple <string>("defaultValue").ToList(); ret.value = tbl.GetArrayOfSimple <string>("value").ToList(); ret.writeEnabled = tbl.GetArrayOfSimple <bool>("writeEnabled").ToList(); ret.needsChange = tbl.GetArrayOfSimple <bool>("needsChange").ToList(); //Debug.Log( tbl.Get<ArrayList>( "format" )[0].GetType().Name ); var _format = tbl.GetArrayOfSimple <System.Double> ("format"); ret.format = new System.Collections.Generic.List <int> (); foreach (var e in _format) { ret.format.Add(System.Convert.ToInt32((System.Double)e)); } return(ret); }
void iOSNativeCallback_TransactionPurchasing(string json) { Hashtable args = (Hashtable)MiniJSON.jsonDecode(json); if (args == null) { Debug.LogError("MobyShop: Panic! Error decoding JSON from string : " + json); } }
public void CallDelegateFromNative(string strData) { if (invoked) { Debug.LogError("Error the delegate is allready invoked"); return; } System.Collections.Hashtable retParams = MiniJSON.jsonDecode(strData) as System.Collections.Hashtable; if (retParams == null) { Debug.LogError("Error parsing return data from native call based on data : " + (string.IsNullOrEmpty(strData) ? "[EMPTY STRING]" : strData)); return; } deleg(retParams); this.enabled = false; this.gameObject.SetActive(false); GameObject.DestroyObject(this.gameObject); }
void iOSNativeCallback_TransactionRestored(string json) { Hashtable args = (Hashtable)MiniJSON.jsonDecode(json); if (args == null) { Debug.LogError("MobyShop: Panic! Error decoding JSON from string : " + json); } // transaction... string transaction = (string)args["transactinId"]; string billingId = (string)args["productId"]; var product = GetProductInfoByBillingId(billingId); Debug.Log("MobyShop: Transaction Restored: " + transaction + " pid=" + billingId); //numPurchasesInProgress--; // not very sure this is a good idea since this gets called a multiple number of times. CallUnlockProduct(BoughtOrRestored.Restored, product); if (onRestoredProduct != null) { onRestoredProduct(billingId); } }
void iOSNativeCallback_TransactionCompleted(string json) { Hashtable args = (Hashtable)MiniJSON.jsonDecode(json); if (args == null) { Debug.LogError("MobyShop: Panic! Error decoding JSON from string : " + json); } string transaction = (string)args["transactinId"]; string billingId = (string)args["productId"]; Debug.Log("MobyShop: Transaction Completed: " + transaction + " pid=" + billingId); var product = GetProductInfoByBillingId(billingId); CallUnlockProduct(BoughtOrRestored.Bought, product); if (iOS_BuyDeleg != null) { var tmp = iOS_BuyDeleg; iOS_BuyDeleg = null; tmp(true, "", Shop.BuyResponse.Ok); } }
void iOSNativeCallback_TransactionFailed(string json) { Hashtable args = (Hashtable)MiniJSON.jsonDecode(json); if (args == null) { Debug.LogError("MobyShop: Panic! Error decoding JSON from string : " + json); } string msg = args.ContainsKey("msg") == false ? "no message" : (string)args["msg"]; Debug.Log("MobyShop: Transaction Failed: " + msg); if (iOS_BuyDeleg != null) { var tmp = iOS_BuyDeleg; iOS_BuyDeleg = null; tmp(false, msg, Shop.BuyResponse.Failed); } numPurchasesInProgress--; }
public static Hashtable hashtableFromJson(this string json) { return(MiniJSON.jsonDecode(json) as Hashtable); }
public static ArrayList arrayListFromJson(this string json) { return(MiniJSON.jsonDecode(json) as ArrayList); }