public void FetchData() { UsersRepository.Login(UserSingleton.Instance.Email, UserSingleton.Instance.Password, () => { Debug.Log("start"); MapsRepository.GetAllAdminMapIds((list) => { foreach (var mapId in list) { mapConfigIds.Add(mapId); Debug.Log(mapId); } for (int i = 0; i < mapConfigIds.Count; i++) { GameObject button = Instantiate(mapButtonTemplate) as GameObject; button.SetActive(true); button.GetComponent <PlayerMapListMap>().SetId(i.ToString()); button.GetComponent <PlayerMapListMap>().DatabaseId = mapConfigIds[i]; //button.GetComponent<PlayerMapListMap>().SelectedMapConfig = maps[i]; mapButtons.Add(button); button.GetComponent <PlayerMapListMap>().SetText(); button.transform.SetParent(mapButtonTemplate.transform.parent, false); } }); }, () => { Debug.Log("Too heavy load"); }); }
private void FetchAdminMapIds() { UsersRepository.Login(UserSingleton.Instance.Email, UserSingleton.Instance.Password, () => { Debug.Log("FetchAdminMapIds is started"); MapsRepository.GetAllAdminMapIds((list) => { foreach (var mapId in list) { adminMapIds.Add(mapId); Debug.Log(mapId); } InstantiateButtons(adminMapIds); }); }, () => { Debug.Log("Too heavy load"); }); }