Bake() публичный Метод

public Bake ( ) : void
Результат void
Пример #1
0
 public void AuthorizeUser(Action <JSONObject> onComplete)
 {
     if (_token == null)
     {
         _token = GetToken();
     }
     if (_token == "")
     {
         String     response     = "{\"error\": \"no token found\"}";
         JSONObject jsonResponse = new JSONObject(response);
         jsonResponse.Bake();
         onComplete(jsonResponse);
         return;
     }
     if (_userId == null)
     {
         _userId = GetUserid();
     }
     if (_userId == "")
     {
         String     response     = "{\"error\": \"no userid found\"}";
         JSONObject jsonResponse = new JSONObject(response);
         jsonResponse.Bake();
         onComplete(jsonResponse);
         return;
     }
     POST("user/authorize", new Dictionary <string, string> {
         { "token", _token }, { "uuid", _userId }
     }, onComplete);
 }
Пример #2
0
 private StringResources()
 {
     TextAsset strings = Resources.Load(Key) as TextAsset;
     if (strings != null)
     {
         _stringsJsonObject = new JSONObject(strings.text);
         _stringsJsonObject.Bake();
     }
     else
     {
         _stringsJsonObject = new JSONObject();
     }
 }
Пример #3
0
    private StringResources()
    {
        TextAsset strings = Resources.Load(Key) as TextAsset;

        if (strings != null)
        {
            _stringsJsonObject = new JSONObject(strings.text);
            _stringsJsonObject.Bake();
        }
        else
        {
            _stringsJsonObject = new JSONObject();
        }
    }
Пример #4
0
 public static JSONObject GetConfig()
 {
     if (_config == null)
     {
         TextAsset config = Resources.Load("config") as TextAsset;
         if (config != null)
         {
             _config = new JSONObject(config.text);
             _config.Bake();
         }
         else
         {
             _config = new JSONObject();
         }
     }
     return(_config);
 }
Пример #5
0
    private IEnumerator WaitForRequest(WWW www, System.Action <JSONObject> onComplete)
    {
        yield return(www);

        // check for errors
        if (www.error == null)
        {
            JSONObject result = new JSONObject(www.text);
            result.Bake();
            onComplete(result);
        }
        else
        {
            Debug.Log(www.error);
            JSONObject result = new JSONObject();
            result.AddField("error", www.error);
            result.Bake();
            onComplete(result);
        }
        www.Dispose();
    }
Пример #6
0
 public static JSONObject GetConfig()
 {
     if (_config == null)
     {
         if (IsLocalConfigAvailable())
         {
             _config = new JSONObject(PlayerPrefs.GetString(ConfigKey));
         }
         else
         {
             TextAsset config = Resources.Load("config") as TextAsset;
             if (config != null)
             {
                 _config = new JSONObject(config.text);
                 _config.Bake();
             }
             else
             {
                 _config = new JSONObject();
             }
         }
     }
     return _config;
 }
Пример #7
0
 public void AuthorizeUser(Action<JSONObject> onComplete)
 {
     if(_token == null) {
         _token = GetToken ();
     }
     if(_token == "") {
         String response = "{\"error\": \"no token found\"}";
         JSONObject jsonResponse = new JSONObject (response);
         jsonResponse.Bake ();
         onComplete (jsonResponse);
         return;
     }
     if (_userId == null) {
         _userId = GetUserid ();
     }
     if(_userId == "") {
         String response = "{\"error\": \"no userid found\"}";
         JSONObject jsonResponse = new JSONObject (response);
         jsonResponse.Bake ();
         onComplete (jsonResponse);
         return;
     }
     POST ("user/authorize", new Dictionary<string, string> { { "token", _token }, { "uuid", _userId } }, onComplete);
 }
Пример #8
0
 public static JSONObject GetConfig()
 {
     if (_config == null)
     {
         if (IsLocalConfigAvailable())
         {
             _config = new JSONObject(PlayerPrefs.GetString(ConfigKey));
         }
         else
         {
             TextAsset config = Resources.Load("config") as TextAsset;
             if (config != null)
             {
                 _config = new JSONObject(config.text);
                 _config.Bake();
             }
             else
             {
                 _config = new JSONObject();
             }
         }
     }
     return(_config);
 }
Пример #9
0
 private IEnumerator WaitForRequest(WWW www, System.Action<JSONObject> onComplete)
 {
     yield return www;
     // check for errors
     if (www.error == null)
     {
         JSONObject result = new JSONObject(www.text);
         result.Bake();
         onComplete(result);
     }
     else {
         Debug.Log(www.error);
         JSONObject result = new JSONObject();
         result.AddField("error", www.error);
         result.Bake();
         onComplete(result);
     }
     www.Dispose ();
 }