public void OnItemBuy(NetConnection <NetSession> sender, ItemBuyRequest request) { Character character = sender.Session.Character; Log.InfoFormat("OnItemBuy(:character:[0];shop:{2} ShopItem:{2}", character.Id, request.shopId, request.shopItemId); var result = ShopManager.Instance.BuyItem(sender, request.shopId, request.shopItemId); sender.Session.Response.itemBuy = new ItemBuyResponse(); sender.Session.Response.itemBuy.Result = result; sender.SendResponse(); }
private void OnItemBuy(NetConnection <NetSession> sender, ItemBuyRequest message) { Character character = sender.Session.Character;//取当前会话的角色 Log.InfoFormat("OnItemBuy::Character:{0} shop:{1} shopItem:{2}", character.Id, message.shopId, message.shopItemId); var result = ShopManager.Instance.BuyItem(sender, message.shopId, message.shopItemId);//扣钱添加物品 sender.Session.Response.itemBuy = new ItemBuyResponse(); sender.Session.Response.itemBuy.Result = result; sender.SendResponse(); }
private void OnItemBuy(NetConnection <NetSession> sender, ItemBuyRequest message) { sender.Session.Response.itemBuyResponse = new ItemBuyResponse(); Result result = StoreManager.Instance.BuyItem(sender, message.nGoodsInfo); if (result == Result.Success) { DBService.Instance.Save(); } sender.Session.Response.itemBuyResponse.Result = result; sender.SendResponse(); }
private void btnBuy_Click(object sender, EventArgs e) { try { ItemBuyRequest buyReq = new ItemBuyRequest(_buySelectedItemName, _buySelectedItemCost, Player.Name, _buyItemType); ChatboxMessages.PlayerRequestPurchase(Player.Name, _buySelectedItemName); } catch (Exception) { throw; } }