private void Awake() { Input.multiTouchEnabled = false; Debug.Log("Started"); SceneManager.LoadScene("Loading", LoadSceneMode.Additive); dex = this; DontDestroyOnLoad(this.gameObject); GetAllPokemon(); foreach (PokemonData poke in pokemon) { GameObject go = Instantiate(CardPrefab, transform.position, Quaternion.identity); GetComponent <CardPooling>().AddToPool(go); DrawCard(go, poke); go.GetComponent <Button>().onClick.AddListener(() => LoadDexPage()); go.GetComponent <Mask>().showMaskGraphic = true; } DexArea.GetComponent <UI_ScrollRectOcclusion>().Init(); GetComponent <queryDex>().MountFilterDrop(); fullyLoaded = true; }
public void DrawReorderedDex(IEnumerable <PokemonData> query) { Destroy(DexArea.GetComponent <UI_ScrollRectOcclusion>()); DexList.GetComponent <VerticalLayoutGroup>().enabled = true; DexList.GetComponent <ContentSizeFitter>().enabled = true; content.position = new Vector3(content.position.x, 0, content.position.z); currentList.Clear(); int cardsInList = DexList.transform.childCount; if (query.Count() != cardsInList) { for (int i = 0; i < cardsInList; i++) { GetComponent <CardPooling>().AddToPool(DexList.transform.GetChild(0).gameObject); } foreach (PokemonData poke in query) { DrawCard(GetComponent <CardPooling>().InstantiateFromPool(), poke); } } else { int count = 0; foreach (PokemonData poke in query) { DrawCard(dex.DexList.transform.GetChild(count).gameObject, poke); count++; } } DexArea.AddComponent <UI_ScrollRectOcclusion>(); Canvas.ForceUpdateCanvases(); }