public bool consume(int cabinetId, bool doGame = true, uint amount = 0) { if (amount == 0) { amount = _game; } if (_amount < amount) { return(false); } _amount -= amount; Cabinet cabinet = Cabinet.GetById(cabinetId); int goodId = cabinet.GoodsId; Mod.Purchase purchase = new Mod.Purchase { dateTime = System.DateTime.Now, doGame = true, amount = amount, cabinetId = cabinetId, goodsId = goodId }; purchase.insert(); if (_gameTimeCallback != null) { _gameTimeCallback(_amount); } return(true); }
// Use this for initialization void Start() { list = transform.FindChild("GoodsList").GetComponent <ContainerListView>(); if (list != null) { list.setCallback(x => { GameObject go = UIManager.OpenUI(Config.UI.UIPath.GoodsSelectPanel); GoodsSelectView gsv = go.GetComponent <GoodsSelectView>(); gsv.SetId(Cabinet.GetById(x).GoodsId); gsv.setCallback((retid) => { Cabinet cabinet = Cabinet.GetById(x); cabinet.GoodsId = retid; cabinet.update(); Destroy(go); Refresh(); }); }); } }