public override void Execute(object data) { BuyToolsArgs e = data as BuyToolsArgs; UIBuyTools tool = MVC.GetView <UIBuyTools>(); GameModel gm = Game.M_Instance.M_GM; switch (e.M_ItemKind) { case ItemKind.ItemMagnet: if (gm.GetMoney(e.M_Coin)) { gm.M_Magnet++; } break; case ItemKind.ItemMultiply: if (gm.GetMoney(e.M_Coin)) { gm.M_Multiply++; } break; case ItemKind.ItemInvincible: if (gm.GetMoney(e.M_Coin)) { gm.M_Invincible++; } break; } tool.InitUI(); }
public override void Execute(object data = null) { BuyToolsArgs e = data as BuyToolsArgs; GameModel gm = GetModel <GameModel>(); UIBuyTools buyTools = GetView <UIBuyTools>(); if (gm.GetMoney(e.CoinCount)) { switch (e.itemType) { case ItemType.ItemInvincible: gm.Invincible += e.CoinCount > 0 ? 1:-1; break; case ItemType.ItemMultiply: gm.Multiply += e.CoinCount > 0 ? 1 : -1; break; case ItemType.ItemMagnet: gm.Magnet += e.CoinCount > 0 ? 1 : -1; break; } } else { buyTools.TipMessage("金币不足!"); } buyTools.UpdateUI(); }
public override void Execute(object data) { GameModel gm = GetModel <GameModel>(); UIBuyTools tools = GetView <UIBuyTools>(); BuyToolsArgs e = data as BuyToolsArgs; switch (e.kind) { case ItemKind.InvincibleItem: if (gm.PayCoin(e.Coin)) { gm.Invincible++; } break; case ItemKind.MagnetItem: if (gm.PayCoin(e.Coin)) { gm.Magnet++; } break; case ItemKind.MultiplyItem: if (gm.PayCoin(e.Coin)) { gm.Multiply++; } break; default: break; } tools.Init(); }
public override void Execute(object data) { GameModel gm = GetModel <GameModel>(); UIBuyTools ui = GetView <UIBuyTools>(); ToolsArgs e = data as ToolsArgs; bool isBought = gm.BuyGoods(e.money); Debug.Log(isBought); if (isBought) { switch (e.kind) { case ItemKind.InvincibleItem: gm.Invincible++; break; case ItemKind.MultiplyItem: gm.Multiply++; break; case ItemKind.MagnetItem: gm.Magnet++; break; } ui.UpdateUI(); } }