Esempio n. 1
0
        //游戏消息入口
        void OnGameResp(ushort protocol, ushort subcmd, NPacket packet)
        {
            if (CUIManger.Instance.SceneType != enSceneType.SCENE_GAME)
            {
                return;
            }

            //if (_bReqQuit == true) return;
            //游戏状态
            switch (subcmd)
            {
            //用户下注返回
            case SubCmd.SUB_S_PLAY_BET:
            {
                UserBetReturn(packet);
                break;
            }

            //游戏结果
            case SubCmd.SUB_S_GAME_END:
            {
                GameResualtReturn(packet);
                break;
            }

            //开始游戏
            case SubCmd.SUB_S_GAME_START:
            {
                GameStart(packet);
                break;
            }

            //清除下注
            case SubCmd.SUB_S_BET_CLEAR:
            {
                ClearBET(packet);
                break;
            }

            //续压失败
            case SubCmd.SUB_S_CONTINUE_BET_DEFEAT:
            {
                ContinueBETDefeat();
                break;
            }

            //彩金数据
            case SubCmd.SUB_S_SEND_PRIZE_DATA:
            {
                packet.BeginRead();
                CBETManger._instance.m_cBetTop.m_lPrzeNum = packet.GetLong();
                break;
            }

            //彩金获奖
            case SubCmd.SUB_S_SEND_PRIZE_REWARD:
            {
                packet.BeginRead();
                //去掉包头
                byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
                int    len     = Marshal.SizeOf(typeof(CMD_S_SendPrizePoolReward));
                packet.GetBytes(ref _buffer, len);
                CMD_S_SendPrizePoolReward _SendPrizePoolReward = GameConvert.ByteToStruct <CMD_S_SendPrizePoolReward>(_buffer);
                CBETManger._instance.m_cBetTop.m_bIsPrize   = true;
                CBETManger._instance.m_cBetTop.m_lPrize     = _SendPrizePoolReward.lRewardGold;
                CBETManger._instance.m_cBetTop.m_iChairID   = (ushort)_SendPrizePoolReward.wChairID;
                CBETManger._instance.m_cBetTop.m_iMyChairID = CGameEngine.Instance.MySelf.DeskStation;
                Debug.Log(_SendPrizePoolReward.wChairID.ToString());
                CBETManger._instance.m_cBetTop.m_strNickName = CGameEngine.Instance.GetTableUserItem((ushort)_SendPrizePoolReward.wChairID).NickName;
                break;
            }

            case SubCmd.SUB_S_PLAY_BET_DEAFEAT:
            {
                CBETManger._instance.AddTiShi("下注失败");
                break;
            }

            case SubCmd.SUB_S_GAME_END_REVENUE:
            {
                packet.BeginRead();
                Int64 temprevenue = packet.GetLong();
                CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum -= temprevenue;
                break;
            }

            case SubCmd.SUB_S_GAME_END_IDI:
            {
                break;
            }
            }
        }