Bake() public method

public Bake ( ) : void
return void
Exemplo n.º 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);
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
        }
    }
Exemplo n.º 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);
 }
Exemplo n.º 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();
    }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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 ();
 }