public override ConsumeState Consume(Resource.PriceType priceType, Int64 priceValue, string walletaddr, UserStateType userStateType, ShopSlot shopSlot) { if (!CheckConsume(priceType, priceValue)) { return(ConsumeState.ConsumeState_Falied); } if (priceValue == 0) { return(ConsumeState.ConsumeState_Done); } user.stateType = userStateType; user.processShopSlot = shopSlot; if (fungibleType == Resource.FungibleType.Fungible) { user.WithdrawFungible(TokenType(), (int)priceValue); } else if (fungibleType == Resource.FungibleType.ServiceToken) { user.WithdrawServiceToken((int)priceValue); } return(ConsumeState.ConsumeState_Request_Burn); }
public TCurrency(User user, Resource.FungibleType fungibleType, string tokenType, Resource.PriceType priceType, Int64 priceValue) { currencyType = Currency.CurrencyType.Currency_token; this.user = user; this.fungibleType = fungibleType; this.tokenType = tokenType; this.priceType = priceType; this.priceValue = priceValue; }
public Currency GetCurrency(Resource.PriceType priceType) { if (currencies == null) { return(null); } if (!currencies.ContainsKey(priceType)) { return(null); } return(currencies[priceType]); }
public override ConsumeState Consume(Resource.PriceType priceType, Int64 priceValue, string walletaddr, UserStateType userStateType, ShopSlot shopSlot) { if (!CheckConsume(priceType, priceValue)) { return(ConsumeState.ConsumeState_Falied); } if (priceValue == 0) { return(ConsumeState.ConsumeState_Done); } SetPrice("", -priceValue); return(ConsumeState.ConsumeState_Done); }
public override bool CheckConsume(Resource.PriceType priceType, Int64 priceValue) { if (priceType != this.priceType) { logger.Error($"priceType != tblCurrency.priceType UserID={user.UID} priceType={priceType} data_shop.priceValue={priceValue} priceType={priceType} priceValue={priceValue}"); return(false); } if (priceValue > this.priceValue) { logger.Error($"priceValue > tblCurrency.priceValue UserID={user.UID} priceType={priceType} data_shop.priceValue={priceValue} priceType={priceType} priceValue={priceValue}"); return(false); } return(true); }
public TcpMsg.Error OperatorFungibleMint(Resource.PriceType priceType, Int32 amount) { var result = TcpMsg.Error.None; var tokenTypeInfo = LBD.LBDApiManager.Instance.GetFungibleTypeToMeta(((Int32)priceType).ToString()); if (null == tokenTypeInfo) { return(TcpMsg.Error.NotFoundTokenType); } LBD.LBDApiManager.Instance.AddLBDCmd(new LBD.Msg.LBDMsg_MintFungible() { uid = UID, guid = Id.ToString(), toAddr = string.Empty, toUserId = lineUID, tokenType = tokenTypeInfo.tokenType, amount = amount }); /* TODO : belldan * Operator Addr 에 Mint 후 User에게 지급 할때 사용 * LBD.LBDApiManager.Instance.AddLBDCmd(new LBD.Msg.LBDMsg_Wallet_Fungible_Transfer() * { * uid = UID, * guid = Id.ToString(), * fromAddr = Setting.ProgramSetting.Instance.lbdInfo.operatorAddr, * fromSecret = Setting.ProgramSetting.Instance.lbdInfo.secretKey, * toAddr = string.Empty, * toUserId = lineUID, * tokenType = tokenTypeInfo.tokenType, * amount = amount * }); */ return(result); }
public abstract ConsumeState Consume(Resource.PriceType priceType, Int64 priceValue, string walletaddr, UserStateType userStateType, ShopSlot shopSlot);
public abstract bool CheckConsume(Resource.PriceType priceType, Int64 priceValue);