|
|
|
@ -31,16 +31,26 @@ public abstract class ShopView : MonoBehaviour, IShopModelObserver<Item> |
|
|
|
protected ShopModel other; // Other model in MVC pattern (our own inventory)
|
|
|
|
private ShopController shopController; //Controller in MVC pattern
|
|
|
|
|
|
|
|
protected virtual void Start() |
|
|
|
// Set up the view's necessary stuff before the view is enabled
|
|
|
|
protected virtual void Awake() |
|
|
|
{ |
|
|
|
model = new BuyModel(2f, 16, 500); //Right now use magic values to set up the shop
|
|
|
|
shopController = gameObject.AddComponent<MouseController>().Initialize(model);//Set the default controller to be the mouse controller
|
|
|
|
SetupItemIconView(); //Setup the grid view's properties
|
|
|
|
PopulateItemIconView(); //Display items
|
|
|
|
InitializeButtons(); //Connect the buttons to the controller
|
|
|
|
//model.Subscribe(this);
|
|
|
|
} |
|
|
|
|
|
|
|
private void OnEnable() |
|
|
|
{ |
|
|
|
PopulateItemIconView(); //Display items
|
|
|
|
} |
|
|
|
|
|
|
|
private void OnDisable() |
|
|
|
{ |
|
|
|
ClearIconView(); |
|
|
|
} |
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// SetupItemIconView()
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|