Beispiel #1
0
    void UpdateCanPutOut(LocalNotification e)
    {
        ArgsCanputOutCard msg = e.param as ArgsCanputOutCard;

        if (null != msg)
        {
            var curPlayerPosType = RoomInfo.Instance.GetPlayerPositionType(msg.playerId);
            if (curPlayerPosType == EPlayerPositionType.ESelf)
            {
                ClearPutOutingCard();
            }

            var lastPlayerPosType = RoomInfo.Instance.GetPlayerPositionType(msg.lastPlayerId);
            //验证自动刷新牌
            if (lastPlayerPosType == EPlayerPositionType.ESelf)
            {
                SetSelfPutOutSuc(e);
            }

            //检测清空游状态的最后一轮牌
            CheckClearCleanCard(lastPlayerPosType);

            Debug.Log("msg.DjCards:" + msg.DjCards.Count);
            CheckShowTeamerCards(msg.DjCards); //展示对家的牌
        }
    }
Beispiel #2
0
    //其他人出牌,刷新其他人出牌,依次三次,第三次(playerid为上家)为上家出牌,需要记录保存,
    void UpdateCanPutOut(LocalNotification e)
    {
        ArgsCanputOutCard msg = e.param as ArgsCanputOutCard;

        if (null != msg)
        {
            var curPlayerPosType = RoomInfo.Instance.GetPlayerPositionType(msg.playerId);

            //清空当前需要出牌的玩家的牌
            if (curPlayerPosType != EPlayerPositionType.ESelf)
            {
                ClearPutOutingCard(curPlayerPosType);
            }

            //显示刚刚出牌的玩家的牌
            var lastPlayerPosType = RoomInfo.Instance.GetPlayerPositionType(msg.lastPlayerId);
            Debug.Log("刚刚出牌玩家:" + lastPlayerPosType.ToString() + "类型" + msg.putOutType);
            if (lastPlayerPosType != EPlayerPositionType.ESelf)
            {
                SetOtherData(lastPlayerPosType, msg.cards, msg.putOutType);
            }
            //检测清空游状态最后一轮牌
            CheckClearCleanCard(lastPlayerPosType);
        }
    }
Beispiel #3
0
    void RecevCardTypeChoose(MsgGlobal msg)
    {
        MsgAction         data = msg.action;
        ArgsCanputOutCard args = new ArgsCanputOutCard();

        args.msgCardGroup = data.cardGroup;
        NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EChooseCardType, args);
    }
Beispiel #4
0
    void SetChoseCardType(LocalNotification e)
    {
        ArgsCanputOutCard args = e.param as ArgsCanputOutCard;

        if (args.msgCardGroup != null) //判断是否有两种重复类型需要选择
        {
            ShowCardCTSelect(args.msgCardGroup);
        }
    }
Beispiel #5
0
    void SetSelfPutOutSuc(LocalNotification e)
    {
        ArgsCanputOutCard args = e.param as ArgsCanputOutCard;

        if (args.msgCardGroup != null) //判断是否有两种重复类型需要选择
        {
            ShowCardCTSelect(args.msgCardGroup);
            return;
        }


        //不要和其他显示效果不同
        bool isBuyao = args.putOutType == TGuanDanCT.CT_BUCHU;
        var  manager = SelfCardsManager.Instance;

        if (!isBuyao)
        {
            manager.mCurSelectCardIds = args.cards;
            AudioManager.Instance.PlayEffectAudio(manager.GetCardAudioFileName(args.putOutType, args.cards[0], AudioManager.Instance.mAudioStyle));
            //存储当前的卡牌
            //页面动画打出及显示
            for (int i = 0; i < args.cards.Count; i++)
            {
                SingleCard singleCard = manager.GetSingleCardById(args.cards[i]);
                if (singleCard == null)
                {
                    Debug.LogError("item为null,idx:" + args.cards[i]);
                    return;
                }
                singleCard.SwitchStatus(ECardStatus.EOuted);
            }
            //Play Tween 根据服务器发送过来的牌的类型播放动画
            TweenManager.Instance.PlayCardTween(args.putOutType, outTargetPos);
        }
        else
        {
            AudioManager.Instance.PlayEffectAudio(manager.GetCardAudioFileName(args.putOutType, 0, AudioManager.Instance.mAudioStyle));
            GameObject item = Instantiate(singleCardPrefab, cardItemContainer);
            item.transform.localPosition = Vector3.zero;              //GlobalData.mSelectCardToTargetPos;
                                                                      //item.transform.localScale = Vector3.one;
            SingleCard singleCard = item.GetComponent <SingleCard>(); //将多余的牌拿出来
            singleCard.SetCardData(GlobalData.mRefuseCardNumId);
            singleCard.SwitchStatus(ECardStatus.EOuted);
        }
        //刷新Controller层数据
        for (int i = 0; i < args.cards.Count; i++)
        {
            manager.UpdatePutOutInCardList(args.cards[i]); //更新了isIn状态
        }
        manager.ClearAllSelectCards();                     //清空所有被选中的打出的牌
        manager.SendShakeNormalCards();
        manager.RefreshRealDic();                          //刷新isIn
        SetCardPosAndDepth(manager.mRealCardDic);          // 刷新底部牌
    }
Beispiel #6
0
    void RevcCanPutOutCard(MsgGlobal msg)
    {
        SelfCardsManager.Instance.initTonghuashunTip();
        MsgGuandanRoom data = msg.guandan_room;

        NotificaPlayerPut(data.action.action_id, data.action.last_operation_pid, data.action.action_type, data.ybq); //玩家出牌箭头指示 (更新玩家出牌状态)
        //游戏中胜利是否判断
        var gameOverInfo = data.game_over_info;

        bool isGameOver = gameOverInfo.Count > 0;

        if (isGameOver)
        {
            PlayingGameInfo.Instance.mGameOverInfoList = gameOverInfo; //用于记录 ,临时退出
        }
        PlayingGameInfo.Instance.mPlayingStatus = EPlayingStatus.EBureau;
        var selfId = PlayerInfo.Instance.mPlayerPid;

        ArgsCanputOutCard args = new ArgsCanputOutCard();

        args.playerId         = (uint)data.action.action_id;    //当前出牌玩家id
        args.cards            = data.action.last_card;          //出牌信息
        args.putOutType       = data.action.last_ct;            //玩家出牌类型
        args.lastPlayerId     = (uint)data.action.last_action_id;
        args.actionType       = data.action.action_type;        //玩家是否是借风之类
        args.lastOperationPId = data.action.last_operation_pid; // 上一次打出牌的玩家id(非不出)
        args.sendCardInfo     = data.send_card_info;            // 每个玩家都要对比手牌数量
        args.DjCards          = data.djCards;
        SelfCardsManager.Instance.mIsRecevCardTip = false;
        SelfCardsManager.Instance.mMsgAction      = data.action;
        NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ECanPutOutCard, args);


        //结算(出头游)
        var gameCleanInfo = data.player_clean_info;

        if (gameCleanInfo != null)
        {
            Debug.Log("=========玩家" + gameCleanInfo.player_id + "胜利" + gameCleanInfo.rank + "游");
            var posType = RoomInfo.Instance.GetPlayerPositionType(gameCleanInfo.player_id);
            PlayingGameInfo.Instance.AddLastCleanPlayerDic(posType);

            ArgsGameCleanInfo e = new ArgsGameCleanInfo();
            e.playerId = gameCleanInfo.player_id;
            e.rank     = gameCleanInfo.rank;
            NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EGameClean, e);
        }



        if (isGameOver)
        {
            ArgsMsgGameOverMsg argsGameOver = new ArgsMsgGameOverMsg();
            for (int i = 0; i < gameOverInfo.Count; i++)
            {
                var itemInfo = gameOverInfo[i];
                argsGameOver.mGameOverList.Add(itemInfo);
                if (itemInfo.player_id == selfId) //是自己的情况,计算加分
                {
                    PlayingGameInfo.Instance.mScore += (int)itemInfo.goal;
                }
                else
                {
                    RoomInfo.Instance.GetPlayerInfoById(itemInfo.player_id).goal += (int)itemInfo.goal;
                }
            }

            //展示最后出的手牌
            if (data.game_over_card != null)
            {
                var lastCard = data.game_over_card.send_card_info;

                if (lastCard != null && lastCard.Count > 0)
                {
                    for (int i = 0; i < lastCard.Count; i++)
                    {
                        argsGameOver.mShowLastCard.Add(lastCard[i]);
                    }
                }
            }
            argsGameOver.mIsTotalOver = PlayingGameInfo.Instance.mGameInfo.game_index == RoomInfo.Instance.mRoom.game_num;
            NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.EGameBureauOver, argsGameOver);
        }
    }