public static void UpdateQuality(IList <Item> items) { foreach (var item in items) { StoreItemFactory.Build(item).UpdateData(); } }
private void StartJsonDataTransforming(string json) { // completion handler stored locally to dereference within the callback StoreItemFactory.CompletionHandler taskCompletedHandler = transformedItems => { // loop through the generated items and assign the parent appropriately in the UI foreach (GameObject item in transformedItems) { item.transform.SetParent(_storeContentContainer.transform, false); } // all tasks are done, so invoke the appropriate event. OnStoreIsReady.Invoke(); }; // Attach the callback handler within a lamdba that dereferences the handler to save a minor amount of memory StoreItemFactory.OnTaskCompleted += items => { taskCompletedHandler(items); StoreItemFactory.OnTaskCompleted -= taskCompletedHandler; }; // actually start the background task StoreItemFactory.TransformJsonToModel(json, _storeItemPrefab); }