Example #1
0
    /// <summary>
    /// 随机选庄
    /// </summary>
    /// <param name="seatId"></param>
    private IEnumerator StartRandomZhuang(int seatId, List <int> list)
    {
        mRandomZhuangDown = false;
        TenPlayerUI player = null;

        for (int k = 0; k < 4; k++)
        {
            for (int i = 0; i < list.Count; i++)
            {
                if (TryGetPlayer(list[i], out player))
                {
                    player.SetRandomZhuangAnimState(true);
                    yield return(new WaitForSeconds(0.15f));

                    player.SetRandomZhuangAnimState(false);
                }
            }
        }

        for (int i = 0; i < TenModel.Inst.mSeatList.Count; i++)
        {
            if (TryGetPlayer(TenModel.Inst.mSeatList[i], out player))
            {
                player.SetZhuangState(false);
                if (TenModel.Inst.mSeatList[i] != seatId)
                {
                    player.SetQiangZhuangResult(false, 0);
                }
            }
        }

        for (int i = 0; i < TenModel.Inst.mGameedSeatIdList.Count; i++)
        {
            if (TryGetPlayer(TenModel.Inst.mGameedSeatIdList[i], out player))
            {
                player.SetRandomZhuangAnimState(false);
            }
        }

        if (TryGetPlayer(seatId, out player))
        {
            mFlyZhuang.gameObject.SetActive(true);
            mFlyZhuang.gameObject.transform.position = mFlyZhuangPosition;
            Hashtable     args       = new Hashtable();
            List <object> finishargs = new List <object>();
            args.Add("easeType", iTween.EaseType.linear);
            args.Add("time", 0.4f);
            args.Add("oncomplete", "OnRandomZhuangFlyFinish");
            args.Add("oncompleteparams", seatId);
            args.Add("oncompletetarget", gameObject);
            args.Add("position", player.GetZhuangPosition());
            iTween.MoveTo(mFlyZhuang, args);
        }
        yield return(new WaitForSeconds(0.4f));

        mRandomZhuangDown = true;

        //开始声音
        SoundProcess.PlaySound("Ten/SDB_wrnn_start");
    }
Example #2
0
    /// <summary>
    /// 同步玩家抢庄
    /// </summary>
    /// <param name="data"></param>
    private void OnPlayerQiangZhuang(TenOnPlayerOptResult data)
    {
        if (data.seatId == TenModel.Inst.mMySeatId)
        {
            mSelfPlayer.SetBetBtnItemState(false);
        }

        TenPlayerUI player = null;

        if (TryGetPlayer(data.seatId, out player))
        {
            player.SetQiangZhuangResult(true, data.qzValue);
        }
    }
Example #3
0
    /// <summary>
    /// 清理抢庄状态,除了庄家
    /// </summary>
    /// <param name="SeatId"></param>
    private void CleanQzStateBut(int SeatId = 0)
    {
        TenPlayerUI player = null;

        for (int i = 0; i < TenModel.Inst.mGameedSeatIdList.Count; i++)
        {
            if (TenModel.Inst.mGameedSeatIdList[i] != SeatId)
            {
                if (TryGetPlayer(TenModel.Inst.mGameedSeatIdList[i], out player))
                {
                    player.SetQiangZhuangResult(false, 0);
                }
            }
        }
    }
Example #4
0
 /// <summary>
 /// 换庄
 /// </summary>
 /// <param name="seatId"></param>
 private void ChangZhuang(int seatId)
 {
     for (int i = 0; i < TenModel.Inst.mSeatList.Count; i++)
     {
         TenPlayerUI player = null;
         if (TryGetPlayer(TenModel.Inst.mSeatList[i], out player))
         {
             player.SetZhuangState(false);
             if (TenModel.Inst.mSeatList[i] == seatId)
             {
                 player.SetZhuangState(true);
             }
             else
             {
                 player.SetQiangZhuangResult(false, 0);
             }
         }
     }
 }
Example #5
0
    /// <summary>
    /// 加入游戏
    /// </summary>
    /// <param name="data"></param>
    public void ServerCreateJoinRoom(TenCreateJoinRoomData data)
    {
        CleanAllDesk();
        UpdateBaseScore(TenModel.Inst.mRoomRules.baseScore);
        if (data.roomInfo.pt)
        {
            mRoomId.text = "模式:自由场";
            mSelfPlayer.SetChangDeskBtnState(true);
            mSelfPlayer.SetInvateBtnState(false);
        }
        else
        {
            mRoomId.text = "房间号:" + data.roomInfo.roomId;
            mSelfPlayer.SetChangDeskBtnState(false);
            mSelfPlayer.SetInvateBtnState(true);
        }

        if (data.roomInfo.playerList != null)
        {//玩家坐下
            for (int i = 0; i < data.roomInfo.playerList.Count; i++)
            {
                PlayerSeatDown(data.roomInfo.playerList[i]);
            }
        }

        ChangZhuang(data.roomInfo.zhuangSeatId);

        if (data.roomInfo.roomState == 0 || (eTenGameState)data.roomInfo.gameState == eTenGameState.Ready)
        {
            if (TenModel.Inst.mPlayerInfoDic[data.roomInfo.mySeatId].isReady)
            {
                mSelfPlayer.SetReadybtnState(false);
            }
            else
            {
                mSelfPlayer.SetReadybtnState(true);
            }
        }
        else
        {
            TenPlayerUI player = null;
            mSelfPlayer.SetReadybtnState(false);
            mSelfPlayer.SetInvateBtnState(false);
            mSelfPlayer.SetChangDeskBtnState(false);

            if (data.roomInfo.handCardsList != null && data.roomInfo.handCardsList.myCardsInfo != null)
            {
                if (TryGetPlayer(data.roomInfo.mySeatId, out player))
                {
                    if (data.roomInfo.handCardsList.myCardsInfo.cards != null)
                    {
                        player.InstantiateCards(data.roomInfo.mySeatId, data.roomInfo.handCardsList.myCardsInfo.cards.cards, false, data.roomInfo.handCardsList.myCardsInfo.cards.mp);
                    }

                    player.UpdateCathecticCoin(data.roomInfo.handCardsList.myCardsInfo.xz + "");

                    if (data.roomInfo.handCardsList.myCardsInfo.isQz)
                    {
                        player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.myCardsInfo.qzbs);
                    }

                    if (data.roomInfo.handCardsList.myCardsInfo.cardsType != null)
                    {
                        player.SetCardsType(data.roomInfo.handCardsList.myCardsInfo.cardsType);
                    }


                    switch ((eTenGameState)data.roomInfo.gameState)
                    {
                    case eTenGameState.XiaZhu:
                        if (data.roomInfo.handCardsList.myCardsInfo.isXz)
                        {
                            player.UpdateCathecticCoin(data.roomInfo.handCardsList.myCardsInfo.xz + "");
                        }
                        else
                        {
                            if (data.roomInfo.zhuangSeatId != data.roomInfo.mySeatId)
                            {
                                mSelfPlayer.SetBetBtnItemState(true);
                                mSelfPlayer.InitOptItemList <float>(data.roomInfo.handCardsList.myCardsInfo.xzListValue);
                                mSelfPlayer.ShowBetBtnList(data.roomInfo.handCardsList.myCardsInfo.canXzList);
                            }
                        }
                        break;

                    case eTenGameState.QiangZhuang:
                        if (data.roomInfo.handCardsList.myCardsInfo.isQz)
                        {
                            player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.myCardsInfo.qzbs);
                        }
                        else
                        {
                            mSelfPlayer.SetBetBtnItemState(true);
                            Debug.Log(data.roomInfo);
                            if (data.roomInfo.handCardsList.myCardsInfo.qzListValue != null)
                            {
                                mSelfPlayer.InitOptItemList <int>(data.roomInfo.handCardsList.myCardsInfo.qzListValue);
                            }
                            if (data.roomInfo.handCardsList.myCardsInfo.canQzList != null)
                            {
                                mSelfPlayer.ShowBetBtnList(data.roomInfo.handCardsList.myCardsInfo.canQzList);
                            }
                        }
                        break;

                    case eTenGameState.LookCard:
                        if (data.roomInfo.handCardsList.myCardsInfo.isLp && data.roomInfo.handCardsList.myCardsInfo.cardsType != null)
                        {
                            player.SeparateCards(data.roomInfo.handCardsList.myCardsInfo.cardsType.order);
                            player.SetCardType(true, data.roomInfo.handCardsList.myCardsInfo.cardsType.point, data.roomInfo.handCardsList.myCardsInfo.cardsType.ratio);
                        }
                        else
                        {
                            TenModel.Inst.mLookCard = true;
                            //mSelfPlayer.SetLiangCardBtnState(true);
                            // mSelfPlayer.SetCuoBtnState(false);
                        }
                        break;
                    }
                }
            }


            if (data.roomInfo.handCardsList != null && data.roomInfo.handCardsList.otherCardsInfo != null)
            {
                for (int i = 0; i < data.roomInfo.handCardsList.otherCardsInfo.Count; i++)
                {
                    if (TryGetPlayer(data.roomInfo.handCardsList.otherCardsInfo[i].seatId, out player))
                    {
                        if (data.roomInfo.handCardsList.otherCardsInfo[i].cards != null)
                        {
                            player.InstantiateCards(data.roomInfo.handCardsList.otherCardsInfo[i].seatId,
                                                    data.roomInfo.handCardsList.otherCardsInfo[i].cards.cards, false, data.roomInfo.handCardsList.otherCardsInfo[i].cards.mp);
                        }

                        player.UpdateCathecticCoin(data.roomInfo.handCardsList.otherCardsInfo[i].xz + "");

                        if (data.roomInfo.handCardsList.otherCardsInfo[i].isQz)
                        {
                            player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.otherCardsInfo[i].qzbs);
                        }

                        switch ((eTenGameState)data.roomInfo.gameState)
                        {
                        case eTenGameState.XiaZhu:
                            if (data.roomInfo.handCardsList.otherCardsInfo[i].isXz)
                            {
                                player.UpdateCathecticCoin(data.roomInfo.handCardsList.otherCardsInfo[i].xz + "");
                            }
                            break;

                        case eTenGameState.QiangZhuang:
                            if (data.roomInfo.handCardsList.otherCardsInfo[i].isQz)
                            {
                                player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.otherCardsInfo[i].qzbs);
                            }
                            break;

                        case eTenGameState.LookCard:
                            if (data.roomInfo.handCardsList.otherCardsInfo[i].isLp && data.roomInfo.handCardsList.otherCardsInfo[i].cardsType != null)
                            {
                                List <string> cards = new List <string>();
                                cards.AddRange(data.roomInfo.handCardsList.otherCardsInfo[i].cards.mp);
                                cards.AddRange(data.roomInfo.handCardsList.otherCardsInfo[i].cards.cards);

                                player.TurnCards(cards);
                                player.SeparateCards(data.roomInfo.handCardsList.otherCardsInfo[i].cardsType.order);
                                player.SetCardType(true, data.roomInfo.handCardsList.myCardsInfo.cardsType.point, data.roomInfo.handCardsList.myCardsInfo.cardsType.ratio);
                            }
                            break;
                        }
                    }
                }
            }
        }

        if (data.roomInfo.zhuangSeatId > 0)
        {
            CleanQzStateBut(data.roomInfo.zhuangSeatId);
        }

        switch ((eTenGameState)data.roomInfo.gameState)
        {
        case eTenGameState.LookCard:
            ShowLastTime("看牌倒计时", data.roomInfo.timeDown);
            break;

        case eTenGameState.QiangZhuang:
            ShowLastTime("抢庄倒计时", data.roomInfo.timeDown);
            break;

        case eTenGameState.XiaZhu:
            ShowLastTime("下注倒计时", data.roomInfo.timeDown);
            break;
        }
    }