Ejemplo n.º 1
0
    //사람이 4명이 차면 자동으로 바로 게임이 시작된다.
    //public void StartGameRes(Protocol.StartGameResp res)
    //{
    //    playerSize = res.CurrentActivePlayer;
    //    m_players = res.models.player;

    //    StartCoroutine(TichuRoutine());
    //}
    #endregion

    #region 1차 분배 응답 함수
    //게임 시작이 되면 바로 1차 분배를 한다.?
    public void RoomInitRes(Protocol.RoomInitResp res)
    {
        //int teamidx = res.team;

        m_player.TeamID = res.team.teamNumber;

        if (m_player.TeamID == 0)
        {
            //0이면 A
            //1이면 B로 하자
            m_nTeamAPoint = res.team.TotalScore;
        }

        m_player.PlayerIdx = res.player.index;

        for (int i = 0; i < res.player.CardList.Count; ++i)
        {
            m_player.AddCard(m_cardDeck.GetCard((CARD_TYPE)res.player.CardList[i].m_eCardType,
                                                (CARD_COLOR)res.player.CardList[i].m_eCardColor,
                                                res.player.CardList[i].m_nCardValue));
        }

        StartCoroutine(TichuRoutine());
        //StartCoroutine(ChooseLargeTichu());
    }
Ejemplo n.º 2
0
    //게임 시작이 되면 바로 1차 분배를 한다.?
    public void RoomInitRes(Protocol.RoomInitResp res)
    {
        m_wiatUserPopup.gameObject.SetActive(false);
        m_CreateRoomPopup.gameObject.SetActive(false);
        m_JoinRoomPopup.gameObject.SetActive(false);

        //난 무조건 player 0가 되어야 된다.
        m_players[0].TeamID    = res.team.teamNumber;
        m_players[0].PlayerIdx = res.player.index;

        m_player = m_players[0];

        //숫자에 따라서 playerIndex를 지정해주자.
        switch (res.player.index)
        {
        case 0:
            m_players[1].TeamID    = 1;
            m_players[2].TeamID    = 0;
            m_players[3].TeamID    = 1;
            m_players[1].PlayerIdx = 1;
            m_players[2].PlayerIdx = 2;
            m_players[3].PlayerIdx = 3;
            break;

        case 1:
            m_players[1].TeamID    = 0;
            m_players[2].TeamID    = 1;
            m_players[3].TeamID    = 0;
            m_players[1].PlayerIdx = 2;
            m_players[2].PlayerIdx = 3;
            m_players[3].PlayerIdx = 0;
            break;

        case 2:
            m_players[1].TeamID    = 1;
            m_players[2].TeamID    = 0;
            m_players[3].TeamID    = 1;
            m_players[1].PlayerIdx = 3;
            m_players[2].PlayerIdx = 0;
            m_players[3].PlayerIdx = 1;
            break;

        case 3:
            m_players[1].TeamID    = 0;
            m_players[2].TeamID    = 1;
            m_players[3].TeamID    = 0;
            m_players[1].PlayerIdx = 0;
            m_players[2].PlayerIdx = 1;
            m_players[3].PlayerIdx = 2;
            break;
        }

        if (m_player.TeamID == 0)
        {
            //0이면 A
            //1이면 B로 하자
            m_nTeamAPoint = res.team.TotalScore;
        }
        else
        {
            m_nTeamBPoint = res.team.TotalScore;
        }

        m_player.PlayerIdx = res.player.index;

        for (int i = 0; i < res.player.CardList.Count; ++i)
        {
            m_player.AddCard(m_cardDeck.GetCard((CARD_TYPE)res.player.CardList[i].m_eCardType,
                                                (CARD_COLOR)res.player.CardList[i].m_eCardColor,
                                                res.player.CardList[i].m_nCardValue));
        }

        m_players[1].SetCardCount(8);
        m_players[2].SetCardCount(8);
        m_players[3].SetCardCount(8);

        StartCoroutine(TichuRoutine());
        //StartCoroutine(ChooseLargeTichu());
    }