コード例 #1
0
 internal void HandleExchangeGift(ulong userGuid, string giftcode)
 {
     UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(userGuid);
     if (user == null)
     {
         return;
     }
     int giftId = 0;
     GeneralOperationResult ret = m_GiftCodeSystem.ExchangeGift(userGuid, giftcode, out giftId);
     JsonMessageWithGuid jsonMsg = new JsonMessageWithGuid(JsonMessageID.ExchangeGiftResult);
     jsonMsg.m_Guid = userGuid;
     ArkCrossEngineMessage.Msg_LC_ExchangeGiftResult protoData = new ArkCrossEngineMessage.Msg_LC_ExchangeGiftResult();
     protoData.m_GiftId = giftId;
     protoData.m_Result = (int)ret;
     jsonMsg.m_ProtoData = protoData;
     JsonMessageDispatcher.SendDcoreMessage(user.NodeName, jsonMsg);
 }
コード例 #2
0
        private void HandleExchangeGiftResult(JsonMessage lobbyMsg)
        {
            JsonData jsonData = lobbyMsg.m_JsonData;

            ArkCrossEngineMessage.Msg_LC_ExchangeGiftResult protoMsg = lobbyMsg.m_ProtoData as ArkCrossEngineMessage.Msg_LC_ExchangeGiftResult;
            if (null == protoMsg)
            {
                return;
            }
            int giftId = protoMsg.m_GiftId;
            GeneralOperationResult result = (GeneralOperationResult)protoMsg.m_Result;

            //礼品码兑换结果,通知UI显示提示信息
            //返回结果的含义:
            //GeneralOperationResult.LC_Succeed               //礼品兑换成功
            //GeneralOperationResult.LC_Failure_Unknown       //礼品码兑换失败
            //GeneralOperationResult.LC_Failure_Code_Used     //礼品码已经被使用,无效
            //GeneralOperationResult.LC_Failure_Code_Error    //礼品码错误
            //GeneralOperationResult.LC_Failure_Overflow      //礼品领取次数超过限制
            GfxSystem.PublishGfxEvent("ge_exchange_gift_result", "ui", result, giftId);
        }