Exemple #1
0
        public static void GetTables(Action <Objects.Table[]> callback)
        {
            if (cachedTables != null)
            {
                if (callback != null)
                {
                    callback(cachedTables);
                }
            }
            else
            {
                Core.Request.Get(Constants.API_SCORES_TABLES_FETCH, null, (Core.Response response) => {
                    Objects.Table[] tables;
                    if (response.success)
                    {
                        int count = response.json["tables"].AsArray.Count;
                        tables    = new Objects.Table[count];

                        for (int i = 0; i < count; ++i)
                        {
                            tables[i] = new Objects.Table(response.json["tables"][i].AsObject);
                        }
                    }
                    else
                    {
                        tables = null;
                    }

                    if (Manager.Instance.UseCaching)
                    {
                        cachedTables = tables;
                    }

                    if (callback != null)
                    {
                        callback(tables);
                    }
                }, false);
            }
        }
Exemple #2
0
		public static void GetTables(Action<Objects.Table[]> callback)
		{
			if (cachedTables != null)
			{
				if (callback != null)
				{
					callback(cachedTables);
				}
			}
			else
			{
				Core.Request.Get(Constants.API_SCORES_TABLES_FETCH, null, (Core.Response response) => {
					Objects.Table[] tables;
					if(response.success)
					{
						int count = response.json["tables"].AsArray.Count;
						tables = new Objects.Table[count];
						
						for (int i = 0; i < count; ++i)
						{
							tables[i] = new Objects.Table(response.json["tables"][i].AsObject);
						}
					}
					else
					{
						tables = null;
					}

					if (Manager.Instance.UseCaching)
					{
						cachedTables = tables;
					}
					
					if (callback != null)
					{
						callback(tables);
					}
				}, false);
			}
		}