public void ConstructViewModel() { var model = new ScreenMarketModel(playerInventory.model.maxInventoryContainAmount, marketManager.model.maxMarketContainAmount); model.cashAmount = playerInventory.GetCashAmount(); for (int i = 0; i < marketManager.model.itemCollection.Count; i++) { model.shopInventoryScroll.gridItems.Add(new ItemContainerModel() { item = marketManager.model.itemCollection[i] }); } for (int i = 0; i < playerInventory.model.itemCollection.Count; i++) { model.localInventoryScroll.gridItems.Add(new ItemContainerModel() { item = playerInventory.model.itemCollection[i] }); } view.ApplyModel(model); //needs unsubscription on close? sub = new Subscriber(); sub.Subscribe(ScreenSignals.ScrollList_Changed, (ItemContainer item) => { this.ScrollListChanged(item); }); }
public void ApplyModel(iComponentModel data) { model = data as ScreenMarketModel; localScrollList.ApplyModel(model.localInventoryScroll); shopScrollList.ApplyModel(model.shopInventoryScroll); UpdateModel(); }