Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        void iOSNativeCallback_TransactionPurchasing(string json)
        {
            Hashtable args = (Hashtable)MiniJSON.jsonDecode(json);

            if (args == null)
            {
                Debug.LogError("MobyShop: Panic! Error decoding JSON from string : " + json);
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        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--;
        }
Exemplo n.º 7
0
 public static Hashtable hashtableFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as Hashtable);
 }
Exemplo n.º 8
0
 public static ArrayList arrayListFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as ArrayList);
 }