Exemple #1
0
        public static Receipt Parse(JSONObject jsonObject)
        {
            Receipt result = new Receipt();

            if (jsonObject.has("identifier"))
            {
                result.identifier = jsonObject.getString("identifier");
            }
            if (jsonObject.has("purchaseDate"))
            {
                DateTime date;
                DateTime.TryParse(jsonObject.getString("purchaseDate"), out date);
                result.purchaseDate = date;
            }
            if (jsonObject.has("gamer"))
            {
                result.gamer = jsonObject.getString("gamer");
            }
            if (jsonObject.has("localPrice"))
            {
                result.localPrice = (float)jsonObject.getDouble("localPrice");
            }
            if (jsonObject.has("uuid"))
            {
                result.uuid = jsonObject.getString("uuid");
            }
            if (jsonObject.has("currency"))
            {
                result.currency = jsonObject.getString("currency");
            }
            if (jsonObject.has("generatedDate"))
            {
                DateTime date;
                DateTime.TryParse(jsonObject.getString("generatedDate"), out date);
                result.generatedDate = date;
            }

            return result;
        }
Exemple #2
0
        public static GamerInfo Parse(JSONObject jsonObject)
        {
            GamerInfo result = new GamerInfo();

            //Debug.Log(jsonData);
            if (jsonObject.has("uuid"))
            {
                result.uuid = jsonObject.getString("uuid");
            }
            if (jsonObject.has("username"))
            {
                result.username = jsonObject.getString("username");
            }
            return result;
        }
Exemple #3
0
 public static Product Parse(JSONObject jsonData)
 {
     Product result = new Product();
     if (jsonData.has("currencyCode"))
     {
         result.currencyCode = jsonData.getString("currencyCode");
     }
     if (jsonData.has("description"))
     {
         result.description = jsonData.getString("description");
     }
     if (jsonData.has("identifier"))
     {
         result.identifier = jsonData.getString("identifier");
     }
     if (jsonData.has("localPrice"))
     {
         result.localPrice = (float)jsonData.getDouble("localPrice");
     }
     if (jsonData.has("name"))
     {
         result.name = jsonData.getString("name");
     }
     if (jsonData.has("originalPrice"))
     {
         result.originalPrice = (float)jsonData.getDouble("originalPrice");
     }
     if (jsonData.has("percentOff"))
     {
         result.percentOff = (float)jsonData.getDouble("percentOff");
     }
     if (jsonData.has("developerName"))
     {
         result.developerName = jsonData.getString("developerName");
     }
     return result;
 }
Exemple #4
0
 public static Product Parse(string jsonData)
 {
     Product result = new Product();
     if(Application.platform != RuntimePlatform.Android) return result;
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("currencyCode"))
         {
             result.currencyCode = json.getString("currencyCode");
         }
         if (json.has("description"))
         {
             result.description = json.getString("description");
         }
         if (json.has("identifier"))
         {
             result.identifier = json.getString("identifier");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("name"))
         {
             result.name = json.getString("name");
         }
         if (json.has("originalPrice"))
         {
             result.originalPrice = (float) json.getDouble("originalPrice");
         }
         if (json.has("percentOff"))
         {
             result.percentOff = (float) json.getDouble("percentOff");
         }
         if (json.has("developerName"))
         {
             result.developerName = json.getString("developerName");
         }
     }
     return result;
 }
Exemple #5
0
 public static Receipt Parse(string jsonData)
 {
     Receipt result = new Receipt();
     if(Application.platform != RuntimePlatform.Android) return result;
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("identifier"))
         {
             result.identifier = json.getString("identifier");
         }
         if (json.has("purchaseDate"))
         {
             DateTime date;
             DateTime.TryParse(json.getString("purchaseDate"), out date);
             result.purchaseDate = date;
         }
         if (json.has("gamer"))
         {
             result.gamer = json.getString("gamer");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("uuid"))
         {
             result.uuid = json.getString("uuid");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("currency"))
         {
             result.currency = json.getString("currency");
         }
         if (json.has("generatedDate"))
         {
             DateTime date;
             DateTime.TryParse(json.getString("generatedDate"), out date);
             result.generatedDate = date;
         }
     }
     return result;
 }
Exemple #6
0
 public static GamerInfo Parse(string jsonData)
 {
     GamerInfo result = new GamerInfo();
     if(Application.platform != RuntimePlatform.Android) return result;
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("uuid"))
         {
             result.uuid = json.getString("uuid");
         }
         if (json.has("username"))
         {
             result.username = json.getString("username");
         }
     }
     return result;
 }
 public static Receipt Parse(string jsonData)
 {
     Receipt result = new Receipt();
     #if UNITY_ANDROID && !UNITY_EDITOR
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("identifier"))
         {
             result.identifier = json.getString("identifier");
         }
         if (json.has("purchaseDate"))
         {
             DateTime date;
             DateTime.TryParse(json.getString("purchaseDate"), out date);
             result.purchaseDate = date;
         }
         if (json.has("gamer"))
         {
             result.gamer = json.getString("gamer");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("uuid"))
         {
             result.uuid = json.getString("uuid");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("currency"))
         {
             result.currency = json.getString("currency");
         }
         if (json.has("generatedDate"))
         {
             DateTime date;
             DateTime.TryParse(json.getString("generatedDate"), out date);
             result.generatedDate = date;
         }
     }
     #endif
     return result;
 }
 public static Product Parse(string jsonData)
 {
     Product result = new Product();
     #if UNITY_ANDROID && !UNITY_EDITOR
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("currencyCode"))
         {
             result.currencyCode = json.getString("currencyCode");
         }
         if (json.has("description"))
         {
             result.description = json.getString("description");
         }
         if (json.has("identifier"))
         {
             result.identifier = json.getString("identifier");
         }
         if (json.has("localPrice"))
         {
             result.localPrice = (float) json.getDouble("localPrice");
         }
         if (json.has("name"))
         {
             result.name = json.getString("name");
         }
         if (json.has("originalPrice"))
         {
             result.originalPrice = (float) json.getDouble("originalPrice");
         }
         if (json.has("percentOff"))
         {
             result.percentOff = (float) json.getDouble("percentOff");
         }
         if (json.has("developerName"))
         {
             result.developerName = json.getString("developerName");
         }
     }
     #endif
     return result;
 }
 public static GamerInfo Parse(string jsonData)
 {
     GamerInfo result = new GamerInfo();
     #if UNITY_ANDROID && !UNITY_EDITOR
     //Debug.Log(jsonData);
     using (JSONObject json = new JSONObject(jsonData))
     {
         if (json.has("uuid"))
         {
             result.uuid = json.getString("uuid");
         }
         if (json.has("username"))
         {
             result.username = json.getString("username");
         }
     }
     #endif
     return result;
 }
 public void ContentUnpublishListenerOnError(string jsonData)
 {
     using (JSONObject jsonObject = new JSONObject(jsonData))
     {
         int code = 0;
         string reason = string.Empty;
         if (jsonObject.has("code"))
         {
             code = jsonObject.getInt("code");
         }
         if (jsonObject.has("reason"))
         {
             reason = jsonObject.getString("reason");
         }
         foreach (OuyaSDK.IContentUnpublishListener listener in OuyaSDK.getContentUnpublishListeners())
         {
             if (null != listener)
             {
                 listener.ContentUnpublishOnError(null, code, reason);
             }
         }
     }
 }