void AddLogsToPanel() { currentLayoutGroup = Instantiate(layoutGroupPrefab); GameObject pag = Instantiate(paginationPrefab); pag.transform.SetParent(paginationParent, false); currentLayoutGroup.transform.SetParent(contentParent, false); scrollSnap.AddToBack(currentLayoutGroup.gameObject); // NewItemsPanel panel = Instantiate(diseasedNewItemsPanel); // Item diseasedItem = ItemManager.instance.itemsData.GetItemByName(newItemsList.diseasedItemName); // GameObject pag = Instantiate(pagination); // pag.transform.SetParent(paginationParent, false); // panel.transform.SetParent(contentParent, false); // scrollSnap.AddToBack(panel.gameObject); // panel.Init(newItemsList.diseasedGoldLoss, diseasedItem, itemCounts); foreach (var unlockLog in unlockLogs) { var instantiatedObject = Instantiate(itemSmallUI); Unlockable unlockable; if (UnlockablesManager.instance.Unlockables.ContainsKey(unlockLog.UnlockableName)) { unlockable = UnlockablesManager.instance.Unlockables[unlockLog.UnlockableName]; } else { Debug.LogWarning(string.Format("Unlockable {0} not found", unlockLog.UnlockableName)); continue; } instantiatedObject.transform.SetParent(currentLayoutGroup.transform, false); instantiatedObject.Init(unlockable.UnlockableName, unlockable.UnlockableIcon); currentItemAmount++; if (currentItemAmount == maxItemsPerPage) { currentLayoutGroup = Instantiate(layoutGroupPrefab); pag = Instantiate(paginationPrefab); pag.transform.SetParent(paginationParent, false); currentLayoutGroup.transform.SetParent(contentParent, false); scrollSnap.AddToBack(currentLayoutGroup.gameObject); currentItemAmount = 0; } } }
public void ShowOracleInfo() { oracleTitleImage.sprite = oracleTitleSprites[Localisation.currentLanguage]; foreach (Transform child in pageParent.transform) { Destroy(child.gameObject); } // destroy childs of paginationParent foreach (Transform child in paginationParent.transform) { Destroy(child.gameObject); } List <OracleData> oracleDataLog = OracleManager.Instance.OracleDataLog; foreach (OracleData oracleData in oracleDataLog) { OracleInfo info = Instantiate(oracleInfoPrefab); GameObject pag = Instantiate(paginationPrefab); pag.transform.SetParent(paginationParent, false); info.transform.SetParent(pageParent, false); scrollSnap.AddToBack(info.gameObject); var item = ItemManager.instance.itemsData.GetItemByName(oracleData.itemName); info.InitUI(item.sprite, oracleData.bestPriceIndex); } }