Beispiel #1
0
    public void SetDissData(ArgsMsgGameOverMsg args)
    {
        bool IsWin = false;

        //打二
        if (RoomInfo.Instance.IsZhuandanGameType || RoomInfo.Instance.IsGuandan2GameType)
        {
        }
        else //非打二
        {
            var        list            = args.mGameOverList;
            GameObject totalPrefabItem = ResourceManager.Instance.LoadAsset <GameObject>(UIType.TotalBureauOverItem.Path);
            bool       isTie           = PlayerInfo.Instance.mTeamEnemyIndex == PlayerInfo.Instance.mTeamSelfIndex;//平局
            for (int i = 0; i < list.Count; i++)
            {
                GameObject item = GameObject.Instantiate(totalPrefabItem);
                item.transform.SetParent(itemParent);
                //item.transform.localPosition = new Vector3(0, 60 - 55 * i, 0);
                item.transform.localScale    = Vector3.one;
                item.transform.localPosition = Vector3.zero;
                EPlayersTeam team = (EPlayersTeam)RoomInfo.Instance.GetPlayerInfoById(list[i].player_id).teamType;
                if (winTeam == EPlayersTeam.ENull)
                {
                    winTeam = list[i].rank == MsgGuandanGameRank.MsgGuandanGameRankFirst ? team : EPlayersTeam.ENull;
                }

                item.GetComponent <UITotalBureauOverItem>().SetData(list[i], winTeam);

                if (list[i].player_id == PlayerInfo.Instance.mPlayerPid)
                {
                    IsWin = team == winTeam;
                }
            }
        }
    }
Beispiel #2
0
    void UpdateGameBureauOver(LocalNotification e)
    {
        //展示最后出牌的玩家
        ArgsMsgGameOverMsg args = e.param as ArgsMsgGameOverMsg;

        if (args != null)
        {
            Debug.Log("展示最后出牌玩家剩余的牌的玩家数量:" + args.mShowLastCard.Count);
            if (args.mShowLastCard.Count > 0)
            {
                IEnumerator <MsgSendCardInfo> iPlayersLastCard = args.mShowLastCard.GetEnumerator();
                while (iPlayersLastCard.MoveNext())
                {
                    var posType = RoomInfo.Instance.GetPlayerPosById(iPlayersLastCard.Current.player_id);
                    if (posType != EPlayerPositionType.ENull && posType != EPlayerPositionType.ESelf)
                    {
                        if (iPlayersLastCard.Current.card.Count > 0)
                        {
                            RefreshPlayerCards(posType, iPlayersLastCard.Current.card, true);
                        }
                    }
                }
            }
        }
    }
Beispiel #3
0
    IEnumerator LoadGameBureauOver(LocalNotification e)
    {
        yield return(new WaitForSeconds(GlobalData.mLoadGameBreauOverWaitTime));

        ArgsMsgGameOverMsg msg = e.param as ArgsMsgGameOverMsg;

        if (msg != null)
        {
            bool isOver = false;
            #region  局打几 和加载总结算还是小结算
            //当前玩家的队
            EPlayersTeam mTeamtype       = (EPlayersTeam)RoomInfo.Instance.GetPlayerInfoById(PlayerInfo.Instance.mPlayerPid).teamType;
            bool         isGuandanNotTwo = !RoomInfo.Instance.IsZhuandanGameType && !RoomInfo.Instance.IsGuandan2GameType; //是否是掼蛋非打二
                                                                                                                           //组别是为了结算显示的打到几的 颜色相同
            for (int i = 0; i < msg.mGameOverList.Count; i++)
            {
                //当前id判断是否是己方
                ulong pid = msg.mGameOverList[i].player_id;

                var          nowPlayerInfo = RoomInfo.Instance.GetPlayerInfoById(pid);
                EPlayersTeam pt            = (EPlayersTeam)nowPlayerInfo.teamType;
                if (isGuandanNotTwo)
                {
                    //头游
                    if (pid == PlayerInfo.Instance.mPlayerPid)                                             //是当前的玩家id
                    {
                        PlayerInfo.Instance.mTeamSelfIndex = msg.mGameOverList[i].upgrade_card.ToString(); //己方打几
                    }
                    else if (pt != mTeamtype)
                    {
                        PlayerInfo.Instance.mTeamEnemyIndex = msg.mGameOverList[i].upgrade_card.ToString();//对方打几
                    }

                    if (msg.mGameOverList[i].rank == MsgGuandanGameRank.MsgGuandanGameRankFirst)//头游打几 决定下一局打几
                    {
                        RoomInfo.Instance.mNextIndex = msg.mGameOverList[i].upgrade_card.ToString();
                    }
                }
                isOver = msg.mGameOverList[i].over == 1;
            }

            #endregion
            //——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
            if (isOver && isGuandanNotTwo)//掼蛋的情况
            {
                Debug.Log("加载掼蛋非打二总结算");
                UpdateTotalBureauOverGame(e);
            }
            else
            {
                Debug.Log("加载打二情况小结算");
                ContextManager.Instance.Push(new BureauOverContext());
                GameObject gameBureau = UIManagers.Instance.GetSingleUI(UIType.BureauOverView);
                gameBureau.GetComponent <UIBureauOverView>().SetItems(msg.mGameOverList, msg.mIsTotalOver);
            }
        }

        SelfCardsManager.Instance.ClearInfo();
        PlayingGameInfo.Instance.ClearCurGameInfo();
    }
Beispiel #4
0
    public void SetData(LocalNotification e)
    {
        if (itemParent.childCount == 4)
        {
            return;
        }                                           //屏蔽之后传过来的消息
        bool IsWin = false;

        //打二
        if (RoomInfo.Instance.IsZhuandanGameType || RoomInfo.Instance.IsGuandan2GameType)
        {
            ArgsMsgTotalScore args = e.param as ArgsMsgTotalScore;
            var list = args.List;
            Debug.Log("TotalBureauView:" + args.List.Count);
            GameObject totalPrefabItem = ResourceManager.Instance.LoadAsset <GameObject>(UIType.TotalBureauOverItem.Path);
            for (int i = 0; i < list.Count; i++)
            {
                GameObject item = GameObject.Instantiate(totalPrefabItem);
                item.transform.SetParent(itemParent);
                //item.transform.localPosition = new Vector3(0, 225 - 130 * i, 0);
                item.transform.localScale    = Vector3.one;
                item.transform.localPosition = Vector3.zero;
                item.GetComponent <UITotalBureauOverItem>().SetData(list[i].player_id, list[i].play_goal);
                if (list[i].player_id == PlayerInfo.Instance.mPlayerPid)
                {
                    //图片的显示,和输赢有关系
                    IsWin = list[i].play_goal >= 0;
                }
            }
        }
        else //非打二
        {
            ArgsMsgGameOverMsg args    = e.param as ArgsMsgGameOverMsg;
            var        list            = args.mGameOverList;
            bool       isTie           = PlayerInfo.Instance.mTeamEnemyIndex == PlayerInfo.Instance.mTeamSelfIndex;//平局
            GameObject totalPrefabItem = ResourceManager.Instance.LoadAsset <GameObject>(UIType.TotalBureauOverItem.Path);
            for (int i = 0; i < list.Count; i++)
            {
                GameObject item = GameObject.Instantiate(totalPrefabItem);
                item.transform.SetParent(itemParent);
                //item.transform.localPosition = new Vector3(0, 225 - 130 * i, 0);
                item.transform.localScale    = Vector3.one;
                item.transform.localPosition = Vector3.zero;
                EPlayersTeam team = (EPlayersTeam)RoomInfo.Instance.GetPlayerInfoById(list[i].player_id).teamType;
                if (winTeam == EPlayersTeam.ENull)
                {
                    winTeam = list[i].rank == MsgGuandanGameRank.MsgGuandanGameRankFirst ? team : EPlayersTeam.ENull;
                }
                if (isTie)
                {
                    winTeam = team;
                }
                item.GetComponent <UITotalBureauOverItem>().SetData(list[i], winTeam);

                if (list[i].player_id == PlayerInfo.Instance.mPlayerPid)
                {
                    IsWin = team == winTeam;//平局
                }
                if (isTie)
                {
                    IsWin = true;
                }
            }
        }
        CheckPlayerAudio(IsWin);
    }
Beispiel #5
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);
        }
    }