void MultNonFungibleUserStateProcess(string eventType, string fromAddr, string toAddr, List <LBD.TokenInfo> tokenInfos) { if (eventType == "mint_nft") { user.NonFungibleToken_Add(tokenInfos); if (user.stateType == UserStateType.NewUserConnect) { // In Consloe, the currency to be used in advance in the operating wallet must be minted. user.OperatorFungibleMint(Resource.PriceType.Coin, 1000); } else if (user.stateType == UserStateType.BuyNonFungible) { if (tokenInfos.Count > 0) { user.OnMintBuyShopSlot(tokenInfos); } } } else if (eventType == "transfer_nft" || eventType == "transfer_nft_from") { if (user.stateType == UserStateType.BuyerGiveGoods) { var buyerData = TradingManager.Instance.GetBuyerDataAndRemove(user.UID); var goods = buyerData.goods; TradingManager.Instance.InsertTradeHistory(goods, TcpMsg.TradeStatus.Soldout, buyerData.uuid, buyerData.nickName); var fromUser = NetServer.WalletAddressToFindUser(fromAddr); if (null != fromUser) { NetServer.InternalHandleMessageByUid(new InternalMsg.IntlMsg_BuyerGiveGoods() { uid = fromUser.UID, guid = fromUser.Id.ToString(), goodsSeq = goods.seq, touuid = user.UID }); } user.NonFungibleToken_Add(tokenInfos); var ackData = new TcpMsg.AckTradeBuyerGiveGoods() { goodsSeq = goods.seq, fromuuid = goods.uuid, touuid = user.UID, cardInfo = User.TokenInfoToCardInfo(tokenInfos[0]), currencyinfos = user.ToCurrencyInfoList() }; user.Send(new Packet(ackData)); } } }
public void IntlMsg_BuyerGiveGoods(InternalMsg.InternalBaseMsg msg) { var intlMsg = msg as InternalMsg.IntlMsg_BuyerGiveGoods; if (null != user) { var tblTrade = user.GetTblTrade(intlMsg.goodsSeq); if (null != tblTrade) { var tokenId = $"{tblTrade.tokentype}{tblTrade.tokenidx}"; var tokenInfo = user.NonFungibleToken_Remove(tokenId); if (null != tokenInfo) { user.TblTradeRemove(tblTrade.seq); var ackData = new TcpMsg.AckTradeBuyerGiveGoods() { goodsSeq = tblTrade.seq, fromuuid = user.UID, touuid = intlMsg.touuid, cardInfo = User.TokenInfoToCardInfo(tokenInfo), currencyinfos = user.ToCurrencyInfoList() }; user.Send(new Packet(ackData)); } else { logger.Warn($"NonFungibleToken_Remove fail TokenID={tokenId}"); } } else { logger.Warn($"TableTrade Not Found GoodsSeq={intlMsg.goodsSeq}"); } } else { logger.Warn($"Is User Null~~~"); } }