Beispiel #1
0
    void RecevTotalBureau(MsgGlobal msg)
    {
        if (RoomInfo.Instance.mRoom == null)
        {
            Debug.Log("Room 为null");
            return;
        }

        MsgGuandanRoom data = msg.guandan_room;

        Debug.Log("总结算");

        ArgsMsgTotalScore scoreArgs = new ArgsMsgTotalScore();

        scoreArgs.List = data.game_totalScore;
        NotificationCenter.Instance().PostDispatchEvent((uint)ENotificationMsgType.ETotalBureauOverGame, scoreArgs);
    }
Beispiel #2
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);
    }