Esempio n. 1
0
        public TDSGlobalShareWrapper(string json)
        {
            Dictionary <string, object> dic = Json.Deserialize(json) as Dictionary <string, object>;

            this.cancel = SafeDictionary.GetValue <bool>(dic, "cancel");
            Dictionary <string, object> errorDic = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "error");

            if (errorDic != null)
            {
                this.error = new TDSGlobalError(errorDic);
            }
        }
Esempio n. 2
0
        public TDSGlobalUserWrapper(string json)
        {
            Dictionary <string, object> dic      = Json.Deserialize(json) as Dictionary <string, object>;
            Dictionary <string, object> userDic  = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "user");
            Dictionary <string, object> errorDic = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "error");

            Debug.Log("TDSGlobal User Parse After:" + json);
            if (userDic != null)
            {
                this.user = new TDSGlobalUser(userDic);
            }
            if (errorDic != null)
            {
                this.error = new TDSGlobalError(errorDic);
            }
        }
Esempio n. 3
0
        public TDSGlobalOrderInfoWrapper(string json)
        {
            Debug.Log("TDSGlobalOrderInfoWrapper json:" + json);
            Dictionary <string, object> dic          = Json.Deserialize(json) as Dictionary <string, object>;
            Dictionary <string, object> orderInfoDic = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "orderInfo");
            Dictionary <string, object> errorDic     = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "error");

            Debug.Log("TDSGlobalOrderInfoWrapper parse after orderInfoDic json:" + orderInfoDic);
            Debug.Log("TDSGlobalOrderInfoWrapper parse after errorDic json:" + errorDic);

            if (orderInfoDic != null)
            {
                this.orderInfo = new TDSGlobalOrderInfo(orderInfoDic);
            }

            if (errorDic != null)
            {
                this.error = new TDSGlobalError(errorDic);
            }
        }
Esempio n. 4
0
        public void PayWithWeb(string serverId, string roleId, Action <TDSGlobalError> callback)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("roleId", roleId);
            dic.Add("serverId", serverId);
            Command command = new Command(TDSGlobalBridgeName.IAP_SERVICE_NAME, "payWithWeb", true, dic);

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                if (!checkResultSuccess(result))
                {
                    callback(new TDSGlobalError(TDSGlobalUnKnowError.UN_KNOW, $"PayWithWeb Failed:{result.message}"));
                    return;
                }

                TDSGlobalError error = new TDSGlobalError(result.content);
                callback(error);
            });
        }
Esempio n. 5
0
        public TDSGlobalSkuDetailWrapper(string json)
        {
            Dictionary <string, object> dic      = Json.Deserialize(json) as Dictionary <string, object>;
            Dictionary <string, object> errorDic = SafeDictionary.GetValue <Dictionary <string, object> >(dic, "error");
            List <object> list = SafeDictionary.GetValue <List <object> >(dic, "products");

            if (errorDic != null)
            {
                this.error = new TDSGlobalError(errorDic);
            }
            if (list != null)
            {
                this.products = new List <TDSGlobalSkuDetail>();
                foreach (var skuDetail in list)
                {
                    Dictionary <string, object> innerDic = skuDetail as Dictionary <string, object>;
                    TDSGlobalSkuDetail          detail   = new TDSGlobalSkuDetail(innerDic);
                    products.Add(detail);
                }
            }
        }