Пример #1
0
        //换桌
        public void SendUserSwitchDesk()
        {
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCommand.MDM_GF_FRAME, SubCommand.SUB_GF_USER_READY);
            Send(packet);
        }
Пример #2
0
 /// <summary>
 /// 下注
 /// </summary>
 public void DownBET(CBETItem _BetItem)
 {
     if (CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum > m_lCurrentChip)
     {
         if (m_bIsBetTime)
         {
             CMusicManger_JSYS._instance.PlaySound("InputScore");
             //获取游戏记录
             NPacket packet = NPacketPool.GetEnablePacket();
             packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_PLAY_BET);
             CMD_C_PlayBet playBet;
             playBet.nAnimalIndex = _BetItem.m_iBetID;
             playBet.lBetChip     = m_lCurrentChip;
             byte[] dataBuffer = GameConvert.StructToByteArray <CMD_C_PlayBet>(playBet);
             int    len        = Marshal.SizeOf(typeof(CMD_C_PlayBet));
             packet.AddBytes(dataBuffer, len);
             CGameEngine.Instance.Send(packet);
         }
         else
         {
             AddTiShi("非下注时间无法下注");
         }
     }
     else
     {
         AddTiShi("金币不足,请充值");
     }
 }
Пример #3
0
        /// <summary>
        /// 下注返回
        /// </summary>
        /// <param name="packet"></param>
        public void UserBetReturn(NPacket packet)
        {
            packet.BeginRead();

            //去掉包头
            byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
            int    len     = Marshal.SizeOf(typeof(CMD_S_PlayBet));

            packet.GetBytes(ref _buffer, len);

            CMD_S_PlayBet _cPlayBet;

            _cPlayBet = GameConvert.ByteToStruct <CMD_S_PlayBet>(_buffer);

            if (_cPlayBet.wChairID == CGameEngine.Instance.MySelf.DeskStation)
            {
                CBETManger._instance.BetReturnSet(_cPlayBet.nAnimalIndex, _cPlayBet.lBetChip, _cPlayBet.lBetChip);
                CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum -= _cPlayBet.lBetChip;
                if (CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum < 0)
                {
                    CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum = 0;
                }
                CBackGroundManger._instance.m_bIsGameStatus = true;
            }
            else
            {
                CBETManger._instance.BetReturnSet(_cPlayBet.nAnimalIndex, _cPlayBet.lBetChip, 0);
            }
        }
Пример #4
0
        //框架消息入口
        void OnFrameResp(ushort protocol, ushort subcmd, NPacket packet)
        {
            if (CUIManger.Instance.SceneType != enSceneType.SCENE_GAME)
            {
                return;
            }
            //if (_bReqQuit == true) return;

            switch (subcmd)
            {
            //游戏状态设置
            case SubCmd.SUB_GF_OPTION:
            {
                packet.BeginRead();
                CGameEngine.Instance.MySelf.GameStatus = packet.GetByte();
                break;
            }

            case SubCmd.SUB_GF_SCENE:
            {
                OnGameSceneResp(CGameEngine.Instance.MySelf.GameStatus, packet);
                break;
            }
            }
        }
Пример #5
0
        public void Send(NPacket pt)
        {
            GameApp.GameSrv.SendToGameSvr(pt.Buff, pt.DataSize);

            //TODO fix it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            NPacketPool.DropPacket(pt);
        }
Пример #6
0
        private void ReadyGo()
        {
            long boboScore = o_BoBoScore.GetComponent <cx_number>().m_iNum;

            scenegame.transform.GetComponent <UIGame>().currentBoboshu = boboScore;
            scenegame.transform.Find("repeat_boboshu").gameObject.SetActive(true);
            scenegame.transform.Find("repeat_boboshu").transform.Find("boboScore").GetComponent <cx_number>().m_iNum = boboScore;
            //合法性判断
            if (boboScore > MaxBoboNum)
            {
                boboScore = MaxBoboNum;
            }
            if (boboScore < MinBoboNum)
            {
                boboScore = MinBoboNum;
            }

            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_USER_INVEST);
            packet.AddLong(boboScore);
            UIGame.SendMsgToServer(packet);
            UIGame.o_player_allinvert.SetActive(true);
            gameObject.SetActive(false);
        }
Пример #7
0
        public void SendUserReadyReq()
        {
            //用户准备
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCommand.MDM_GF_FRAME, SubCommand.SUB_GF_USER_READY);
            Send(packet);
        }
Пример #8
0
        /// <summary>
        /// 比倍得分
        /// </summary>
        public void CompareGetScore_Onclick()
        {
            //圧大
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_COMPARE_GS);
            packet.AddInt(0);
            GameEngine.Instance.Send(packet);
        }
Пример #9
0
        public void SendNoticeMessage(string strMsg)
        {
            //发送消息
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCommand.MDM_GR_SYSTEM, SubCommand.SUB_GR_MESSAGE);
            packet.AddUShort((ushort)0);
            packet.AddUShort((ushort)strMsg.Length);
            packet.AddString(strMsg, StringHelper.GetStringLength(strMsg));
            Send(packet);
        }
Пример #10
0
        public void SendUserSetting()
        {
            //是否允许旁观设置
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCommand.MDM_GF_FRAME, SubCommand.SUB_GF_INFO);
            packet.Addbyte(0);
            packet.AddUInt(0);
            packet.AddUInt(0);
            Send(packet);
        }
Пример #11
0
        public void BigBT_Onclick()
        {
            //圧大
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_COMPARE_XZ);
            packet.AddInt(2);

            GameEngine.Instance.Send(packet);
            SetButtonBt(m_gBigBT, true);
            SetButtonBt(m_gLittleBT, true);
        }
Пример #12
0
        /// <summary>
        /// 游戏结果返回
        /// </summary>
        /// <param name="packet"></param>
        public void GameResualtReturn(NPacket packet)
        {
            packet.BeginRead();

            //去掉包头
            byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
            int    len     = Marshal.SizeOf(typeof(CMD_S_GameEnd));

            packet.GetBytes(ref _buffer, len);

            for (int i = 0; i < CUIManger.Instance.m_cGameResualt.lPlayWin.Length; i++)
            {
                CUIManger.Instance.m_cGameResualt.lPlayWin[i] = 0;
            }
            CMD_S_GameEnd _sGameEnd = GameConvert.ByteToStruct <CMD_S_GameEnd>(_buffer);

            for (int i = 0; i < CUIManger.Instance.m_cGameResualt.bTurnTwoTime.Length; i++)
            {
                CUIManger.Instance.m_cGameResualt.bTurnTwoTime[i] = _sGameEnd.bTurnTwoTime[i];
            }

            CUIManger.Instance.m_cGameResualt.cbTimeLeave     = _sGameEnd.cbTimeLeave;
            CUIManger.Instance.m_cGameResualt.lPlayPrizes     = _sGameEnd.lPlayPrizes;
            CUIManger.Instance.m_cGameResualt.lPlayShowPrizes = _sGameEnd.lPlayShowPrizes;

            for (int i = 0; i < CUIManger.Instance.m_cGameResualt.lPlayWin.Length; i++)
            {
                CUIManger.Instance.m_cGameResualt.lPlayWin[i] = _sGameEnd.lPlayWin[i];
            }

            CUIManger.Instance.m_cGameResualt.nPrizesMultiple = _sGameEnd.nPrizesMultiple;

            for (int i = 0; i < CUIManger.Instance.m_cGameResualt.nTurnTableTarget.Length; i++)
            {
                CUIManger.Instance.m_cGameResualt.nTurnTableTarget[i] = _sGameEnd.nTurnTableTarget[i];
            }

            CTurnManger._instance.OpenAniamation(CUIManger.Instance.m_cGameResualt.nTurnTableTarget[0]);
            CBETManger._instance.m_cMoveBet.PackDown_Onclick();
            CMusicManger_JSYS._instance.PlayBgSound("Turn");
            CTurnManger._instance.m_lWinScore = CUIManger.Instance.m_cGameResualt.lPlayWin[0];

            //转两圈
            if (CUIManger.Instance.m_cGameResualt.bTurnTwoTime[0] == 1)
            {
                StartCoroutine(OpenSharkWaitTimeSecond(25));
            }

            CBETManger._instance.m_cTimer.transform.parent.gameObject.SetActive(false);
            CBETManger._instance.m_bIsBetTime = false;
            CBETManger._instance.m_cBetTop.m_bIsRandomPraize = true;
        }
Пример #13
0
        public void SendChatMessage(uint dwTargetID, string strMsg, uint emotion)
        {
            //发送消息
            NPacket packet = NPacketPool.GetEnablePacket();

            packet.CreateHead(MainCommand.MDM_GF_FRAME, SubCommand.SUB_GF_USER_CHAT);
            packet.AddUShort((ushort)StringHelper.GetStringLength(strMsg));
            packet.AddUInt(emotion);
            packet.AddUInt(MySelf.ID);
            packet.AddUInt(dwTargetID);
            packet.AddString(strMsg, StringHelper.GetStringLength(strMsg));
            Send(packet);
        }
Пример #14
0
 /// <summary>
 /// 游戏记录
 /// </summary>
 public void RecordBT_Onclick()
 {
     if (m_bIsGetRecord)
     {
         //获取游戏记录
         NPacket packet = NPacketPool.GetEnablePacket();
         packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_GET_RECORD);
         GameEngine.Instance.Send(packet);
         m_fWorkTime    = 0;
         m_bIsGetRecord = false;
     }
     SetRecordShowHide(m_iCurrentIndex + 1);
 }
Пример #15
0
        /// <summary>
        /// 启动比倍
        /// </summary>
        public void Compare_Onclick()
        {
            CMusicManger._instance.PlaySound("CompareBT");
            m_gCompare.SetActive(true);
            m_bIsOpenComPare = true;
            CCompareManger._instance.ShowWindow();
            UIManger.Instance.m_bIsGetscore = false;
            if (!m_bIsCompareFree)
            {
                int tempIndex = 10 - UIManger.Instance.m_cUpdateCard.bCardType;
                int tempType  = UIManger.Instance.m_iPeiLvType;
                if (CPlayerInfo._instance.m_iRoomTimes == 0)
                {
                    CPlayerInfo._instance.m_iRoomTimes = 1;
                }
                int tempscore = (int)((UIManger.Instance.m_lAllScore - CPlayerInfo._instance.m_iGold) / (long)CPlayerInfo._instance.m_iRoomTimes);
                CCompareManger._instance.SetCompareCard(tempscore);
                CCompareManger._instance.SetCurrentCompare(0);
                CCompareManger._instance.SetHistoryCard();
                SetAllBTFalse();
                SetButtonBt(m_gBigBT, false);
                SetButtonBt(m_gLittleBT, false);
                SetButtonBt(m_gMoreThanBT, true);
            }
            else
            {
                if (CPlayerInfo._instance.m_iCreditNum >= CPokerPointsManger._instance.m_iBasePointBK && CPlayerInfo._instance.m_iCreditNum > 0)
                {
                    //空闲状态请求比倍
                    NPacket packet = NPacketPool.GetEnablePacket();
                    packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_COMPARE_FREE);
                    packet.AddInt(CPokerPointsManger._instance.m_iBasePointBK);
                    GameEngine.Instance.Send(packet);

                    SetAllBTFalse();
                    CPlayerInfo._instance.m_iGold     -= CPokerPointsManger._instance.m_iBasePointBK * CPlayerInfo._instance.m_iRoomTimes;
                    CPlayerInfo._instance.m_iCreditNum = (int)(CPlayerInfo._instance.m_iGold / CPlayerInfo._instance.m_iRoomTimes);
                }
                else
                {
                    CNomaney._instance.ShowWindow();
                }
            }
            CCompareManger._instance.m_gBig.SetActive(true);
            CCompareManger._instance.m_gBig.GetComponent <CBigSmallAnimation>().RectAnimarion();
            CCompareManger._instance.m_gSmall.SetActive(true);
            CCompareManger._instance.m_gSmall.GetComponent <CBigSmallAnimation>().RectAnimarion();
            CPushAnimation._instance.gameObject.SetActive(false);
            CCompareManger._instance.m_bIsWinPushDouble = false;
            UIManger.Instance.m_bIsPlayingGame          = true;
        }
Пример #16
0
        /// <summary>
        /// 启动按钮响应
        /// </summary>
        public void StartBT_OnClick()
        {
            //第一次请求发牌
            if (!UIManger.Instance.m_bIsUpdateCard)
            {
                if (CPokerPointsManger._instance.m_iBasePointBK == 0 && CPokerPointsManger._instance.m_iBasePoints == 0)
                {
                    return;
                }
                if (CPokerPointsManger._instance.m_iBasePoints == UIManger.Instance.m_iGameStartPoint)
                {
                    CPokerPointsManger._instance.m_iBasePoints = CPokerPointsManger._instance.m_iBasePointBK;
                }

                CPlayerInfo._instance.m_iBet = CPokerPointsManger._instance.m_iBasePoints;
                CPokerPointsManger._instance.m_iBasePointBK = CPokerPointsManger._instance.m_iBasePoints;
                m_bIsFirstInput = true;
                //请求发牌
                NPacket packet = NPacketPool.GetEnablePacket();
                packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_START_DEAL_JX);

                //压分
                packet.AddLong(CPokerPointsManger._instance.m_iBasePoints);
                //此数据无效
                packet.AddInt(0);

                GameEngine.Instance.Send(packet);
                SetButtonBt(m_gStartBT, true);
                SetButtonBt(m_gInputScoreBT, true);
            }
            //第二次请求发牌
            else
            {
                NPacket packet = NPacketPool.GetEnablePacket();
                packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_UPDATE_CARD_JX);
                packet.AddBytes(UIManger.Instance.m_cUpdateCard.cCard.cbCard, UIManger.Instance.m_cUpdateCard.cCard.cbCard.Length);
                for (int i = 0; i < UIManger.Instance.m_cUpdateCard.cCard.bBarter.Length; i++)
                {
                    //牌的值
                    packet.AddBool(UIManger.Instance.m_cUpdateCard.cCard.bBarter[i]);
                }
                GameEngine.Instance.Send(packet);
                SetButtonBt(m_gStartBT, true);
            }
            SetButtonBt(m_gRecordBT, true);
            CBottomBTOnclick._instance.SetButtonBt(CBottomBTOnclick._instance.m_gMoreThanBT, true);
            CBottomBTOnclick._instance.m_bIsCompareFree = false;
            UIManger.Instance.m_bIsPlayingGame          = true;
        }
Пример #17
0
 //清除
 public void ClearBT_OnClick()
 {
     if (m_bIsBetTime)
     {
         //获取游戏记录
         NPacket packet = NPacketPool.GetEnablePacket();
         packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_BET_CLEAR);
         packet.AddInt(0);
         CGameEngine.Instance.Send(packet);
     }
     else
     {
         AddTiShi("非下注时间无法下注");
     }
 }
Пример #18
0
 private void Instance_GameMessageEvent(Packet packet)
 {
     if (PacketHandles2.ContainsKey((ushort)packet.MainCmd))
     {
         PacketHandles2[(ushort)packet.MainCmd]((ushort)packet.MainCmd, (ushort)packet.SubCmd, packet);
     }
     else
     {
         NPacket np = ConvertToNPacket(packet);
         if (PacketHandles.ContainsKey(np.PacketId))
         {
             PacketHandles[np.PacketId](np.PacketId, np.SubCmd, np);
         }
         NPacketPool.DropPacket(np);
     }
 }
Пример #19
0
 /// <summary>
 /// 续压
 /// </summary>
 public void ContinueBET()
 {
     if (CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum > 0)
     {
         if (m_bIsBetTime)
         {
             CMusicManger_JSYS._instance.PlaySound("InputScore");
             //发送续压
             NPacket packet = NPacketPool.GetEnablePacket();
             packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_CONTINUE_BET);
             CGameEngine.Instance.Send(packet);
         }
         else
         {
             AddTiShi("非下注时间无法下注");
         }
     }
     else
     {
         AddTiShi("金币不足,请充值");
     }
 }
Пример #20
0
        /// <summary>
        /// 清除下注
        /// </summary>
        /// <param name="packet"></param>
        public void ClearBET(NPacket packet)
        {
            packet.BeginRead();

            //去掉包头
            byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
            int    len     = Marshal.SizeOf(typeof(CMD_S_BetClear));

            packet.GetBytes(ref _buffer, len);

            CMD_S_BetClear _BetClear;

            _BetClear = GameConvert.ByteToStruct <CMD_S_BetClear>(_buffer);
            for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
            {
                CBETManger._instance.m_listBetItem[i].m_lAllBet -= _BetClear.lPlayBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                if (_BetClear.wChairID == CGameEngine.Instance.MySelf.DeskStation)
                {
                    CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum += _BetClear.lPlayBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                    CBETManger._instance.m_listBetItem[i].m_lMyBet    -= _BetClear.lPlayBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                }
            }
        }
Пример #21
0
        /// <summary>
        /// 游戏开始
        /// </summary>
        /// <param name="packet"></param>
        public void GameStart(NPacket packet)
        {
            packet.BeginRead();
            CBETManger._instance.RectBet();

            //去掉包头
            byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
            int    len     = Marshal.SizeOf(typeof(CMD_S_GameStart));

            packet.GetBytes(ref _buffer, len);

            CMD_S_GameStart _cGameResualt;

            _cGameResualt = GameConvert.ByteToStruct <CMD_S_GameStart>(_buffer);

            CBETManger._instance.m_cMoveBet.PackUp_Onclick();
            CTurnManger._instance.m_CenterAnimal.HideWindow();
            CBETManger._instance.m_bIsBetTime = true;
            CBETManger._instance.m_cTimer.transform.parent.gameObject.SetActive(true);
            CBETManger._instance.m_cTimer.SetGameTimer(_cGameResualt.cbTimeLeave, null);
            CBackGroundManger._instance.SetBackGround(0);
            //CTurnManger._instance.m_lTurnList[CTurnManger._instance.m_iCurrentIndex].m_gAnimation.SetActive(false);
            CTurnManger._instance.m_lTurnList[CTurnManger._instance.m_iCurrentIndex].m_gTexture.SetActive(true);
            CTurnManger._instance.m_lTurnList[CTurnManger._instance.m_iCurrentIndex].m_gAnimationBK.GetComponent <CAnimation>().Stop();
            CUIManger.Instance.m_cGamePlayState.HideWindow();
            for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
            {
                CBETManger._instance.m_listBetItem[i].m_cMulitTimes.m_iNum = _cGameResualt.nAnimalMultiple[CBETManger._instance.m_listBetItem[i].m_iBetID];
            }

            string str = "BETBg" + UnityEngine.Random.Range(1, 3).ToString();

            CMusicManger_JSYS._instance.PlayBgSound(str);
            Debug.Log("999游戏开始:" + CBETManger._instance.m_cBetTop.m_cGetscore.m_iNum.ToString());
            CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum += CBETManger._instance.m_cBetTop.m_cGetscore.m_iNum;
            CBETManger._instance.m_cBetTop.m_cGetscore.m_iNum  = 0;
        }
Пример #22
0
        //游戏场景消息处理函数
        void OnGameSceneResp(byte bGameStatus, NPacket packet)
        {
            //Debuger.LogError(bGameStatus);
            switch (bGameStatus)
            {
            case (byte)SubCmd.GAME_SCENE_FREE:
            {
                CMD_S_StatusFree _mdata = GameConvert.ByteToStruct <CMD_S_StatusFree>(packet.Buff);


                CBETManger._instance.m_cBetTop.m_cMulitly.m_iNum = _mdata.lCellScore;

                CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum = CGameEngine.Instance.MySelf.Money / _mdata.lCellScore;

                for (int i = 0; i < CBETManger._instance.m_cChipManger.m_lChipList.Count; i++)
                {
                    CBETManger._instance.m_cChipManger.m_lChipList[i] = _mdata.lBetNum[i];
                }
                CBETManger._instance.SetCurrentChip(0);

                CBETManger._instance.RectBet();
                //设置计时器
                CBETManger._instance.m_cTimer.SetGameTimer(_mdata.cbTimeLeave, null);
                //游戏记录
                for (int i = 0; i < _mdata.nTurnTableRecord.Length; i++)
                {
                    CRecordManger._instance.AddRecord(_mdata.nTurnTableRecord[i] + 1);
                }

                string str = "BETBg" + UnityEngine.Random.Range(1, 3).ToString();
                CMusicManger_JSYS._instance.PlayBgSound(str);

                CBETManger._instance.RectBet();
                CBETManger._instance.m_bIsBetTime = false;
                CUIManger.Instance.m_cGamePlayState.ShowWindow();
                StartCoroutine(WaitSetm_bIsRandomPraize());
                break;
            }

            case (byte)SubCmd.GAME_SCENE_BET:
            {
                packet.BeginRead();

                //去掉包头
                byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
                int    len     = Marshal.SizeOf(typeof(CMD_S_StatusPlay));
                packet.GetBytes(ref _buffer, len);

                CMD_S_StatusPlay _StatusPlay = GameConvert.ByteToStruct <CMD_S_StatusPlay>(_buffer);
                CUIManger.Instance.m_cStatusPlay.cbTimeLeave = _StatusPlay.cbTimeLeave;

                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.lAllBet.Length; i++)
                {
                    CUIManger.Instance.m_cStatusPlay.lAllBet[i] = _StatusPlay.lAllBet[i];
                }

                CUIManger.Instance.m_cStatusPlay.lAreaLimitScore = _StatusPlay.lAreaLimitScore;

                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.lBetNum.Length; i++)
                {
                    CUIManger.Instance.m_cStatusPlay.lBetNum[i] = _StatusPlay.lBetNum[i];
                }

                CUIManger.Instance.m_cStatusPlay.lCellScore = _StatusPlay.lCellScore;

                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.lPlayBet.Length; i++)
                {
                    CUIManger.Instance.m_cStatusPlay.lPlayBet[i] = _StatusPlay.lPlayBet[i];
                }

                CUIManger.Instance.m_cStatusPlay.lPlayChip       = _StatusPlay.lPlayChip;
                CUIManger.Instance.m_cStatusPlay.lPlayLimitScore = _StatusPlay.lPlayLimitScore;
                CUIManger.Instance.m_cStatusPlay.lPlayScore      = _StatusPlay.lPlayScore;
                CUIManger.Instance.m_cStatusPlay.lStorageStart   = _StatusPlay.lStorageStart;

                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.nAnimalMultiple.Length; i++)
                {
                    CUIManger.Instance.m_cStatusPlay.nAnimalMultiple[i] = _StatusPlay.nAnimalMultiple[i];
                }

                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.nTurnTableRecord.Length; i++)
                {
                    CUIManger.Instance.m_cStatusPlay.nTurnTableRecord[i] = _StatusPlay.nTurnTableRecord[i];
                }

                string str = "BETBg" + UnityEngine.Random.Range(1, 3).ToString();
                CMusicManger_JSYS._instance.PlayBgSound(str);
                CBETManger._instance.m_cBetTop.m_cMulitly.m_iNum = CUIManger.Instance.m_cStatusPlay.lCellScore;

                CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum = CGameEngine.Instance.MySelf.Money / CUIManger.Instance.m_cStatusPlay.lCellScore;

                for (int i = 0; i < CBETManger._instance.m_cChipManger.m_lChipList.Count; i++)
                {
                    CBETManger._instance.m_cChipManger.m_lChipList[i] = CUIManger.Instance.m_cStatusPlay.lBetNum[i];
                }
                CBETManger._instance.SetCurrentChip(0);

                CBETManger._instance.RectBet();
                for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
                {
                    CBETManger._instance.m_listBetItem[i].m_lAllBet = CUIManger.Instance.m_cStatusPlay.lAllBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                    CBETManger._instance.m_listBetItem[i].m_lMyBet  = CUIManger.Instance.m_cStatusPlay.lPlayBet[CBETManger._instance.m_listBetItem[i].m_iBetID];

                    if (CBETManger._instance.m_listBetItem[i].m_lMyBet > 0)
                    {
                        CBackGroundManger._instance.m_bIsGameStatus = true;
                    }
                }
                //设置计时器
                CBETManger._instance.m_cTimer.SetGameTimer(CUIManger.Instance.m_cStatusPlay.cbTimeLeave, null);
                for (int i = 0; i < CUIManger.Instance.m_cStatusPlay.nTurnTableRecord.Length; i++)
                {
                    CRecordManger._instance.AddRecord(CUIManger.Instance.m_cStatusPlay.nTurnTableRecord[i] + 1);
                }
                //游戏倍数
                for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
                {
                    CBETManger._instance.m_listBetItem[i].m_cMulitTimes.m_iNum =
                        CUIManger.Instance.m_cStatusPlay.nAnimalMultiple[CBETManger._instance.m_listBetItem[i].m_iBetID];
                }
                CBETManger._instance.m_cMoveBet.PackUp_Onclick();
                StartCoroutine(WaitSetm_bIsRandomPraize());
                break;
            }

            case (byte)SubCmd.GAME_SCENE_END:
            {
                packet.BeginRead();

                //去掉包头
                byte[] _buffer = new byte[SocketSetting.SOCKET_PACKAGE];
                int    len     = Marshal.SizeOf(typeof(CMD_S_StatusEnd));
                packet.GetBytes(ref _buffer, len);

                CMD_S_StatusEnd _StatusEnd = GameConvert.ByteToStruct <CMD_S_StatusEnd>(_buffer);

                CBETManger._instance.m_cBetTop.m_cMulitly.m_iNum = _StatusEnd.lCellScore;

                CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum = CGameEngine.Instance.MySelf.Money / _StatusEnd.lCellScore;
                //设置筹码
                for (int i = 0; i < CBETManger._instance.m_cChipManger.m_lChipList.Count; i++)
                {
                    CBETManger._instance.m_cChipManger.m_lChipList[i] = _StatusEnd.lBetNum[i];
                }
                CBETManger._instance.SetCurrentChip(0);
                CBackGroundManger._instance.m_bIsGameStatus = false;
                CBETManger._instance.RectBet();
                //设置计时器
                CBETManger._instance.m_cTimer.SetGameTimer(_StatusEnd.cbTimeLeave, null);
                //游戏记录
                for (int i = 0; i < _StatusEnd.nTurnTableRecord.Length; i++)
                {
                    CRecordManger._instance.AddRecord(_StatusEnd.nTurnTableRecord[i] + 1);
                }
                for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
                {
                    CBETManger._instance.m_listBetItem[i].m_lAllBet = _StatusEnd.lAllBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                    CBETManger._instance.m_listBetItem[i].m_lMyBet  = _StatusEnd.lPlayBet[CBETManger._instance.m_listBetItem[i].m_iBetID];
                }
                //游戏倍数
                for (int i = 0; i < CBETManger._instance.m_listBetItem.Count; i++)
                {
                    CBETManger._instance.m_listBetItem[i].m_cMulitTimes.m_iNum = _StatusEnd.nAnimalMultiple[CBETManger._instance.m_listBetItem[i].m_iBetID];
                }
                CBETManger._instance.m_bIsBetTime = false;
                foreach (Transform child in CUIManger.Instance.m_cGamePlayState.transform)
                {
                    if (child != null)
                    {
                        Debug.Log("child999:" + child.name.ToString() + "---pos:" + child.localPosition.ToString() + "---scale:" + child.lossyScale.ToString());
                    }
                }
                CUIManger.Instance.m_cGamePlayState.ShowWindow();
                StartCoroutine(WaitSetm_bIsRandomPraize());
                break;
            }
            }
        }
Пример #23
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;
            }
            }
        }