public void CreateFertilizerList() { ClearList(); List <WPData_Fertilizer> fertilizerData = WPGameDataManager.instance.GetData <WPData_Fertilizer>(WPEnum.GameData.eFertilizer); for (int index = 0; index < fertilizerData.Count; ++index) { WPScrollViewItem_Book newItem = Instantiate(ui_Book).AddComponent <WPScrollViewItem_Book>(); newItem.SetName(index.ToString()); newItem.SetSprite(fertilizerSpriteData[index]); newItem.AddEvent(delegate { OnClick_Fertilizer(System.Convert.ToInt32(newItem.name)); }); AddItem(newItem); } SortItemToItem(); }
public void CreateSeedList() { ClearList(); List <WPData_Seed> seedData = WPGameDataManager.instance.GetData <WPData_Seed>(WPEnum.GameData.eSeed); for (int index = 0; index < seedData.Count; ++index) { WPScrollViewItem_Book newItem = Instantiate(ui_Book).AddComponent <WPScrollViewItem_Book>(); newItem.SetName(index.ToString()); if (WPUserDataManager.instance.Level >= seedData[index].UnlockLevel) { newItem.SetSprite(seedSpriteData[index]); newItem.AddEvent(delegate { OnClick_Seed(System.Convert.ToInt32(newItem.name)); }); } else { newItem.SetSprite(lockSprite); } AddItem(newItem); } SortItemToItem(); }