Exemplo n.º 1
0
    public void OnGameDealCards(bs.gameddz.deal_cards rsp)
    {
        //初始化手牌
        for (int i = 0; i < 13; i++)
        {
            Vector3 wide = new Vector3(0, 0, (mahjong_cube.transform.localScale.z + (float)0.05) * i);                                                   //宽度
            m_my_hand_pai[i]       = Instantiate(mahjong_cube, my_hand_pai_place.position + wide, my_hand_pai_place.rotation) as GameObject;             //自己的手牌
            m_opposite_hand_pai[i] = Instantiate(mahjong_cube, opposite_hand_pai_place.position + wide, opposite_hand_pai_place.rotation) as GameObject; //对家的手牌
        }


        m_pai_value = rsp.cards;


        int current_index = 0;  //用于计数

        for (int i = 0; i < m_pai_value.Length; i++)
        {
            if (m_pai_value[i] == 0 || m_pai_value[i] == 255)
            {
                continue;
            }

            int    value    = m_pai_value[i];
            string pai_text = value.ToString();
            m_my_hand_pai[current_index].GetComponentInChildren <TextMesh>().text = pai_text;
            current_index++;
            if (current_index >= 13)
            {
                break;
            }
        }
    }
Exemplo n.º 2
0
    public void ProcessGameData(byte[] buff, uint data_id)
    {
        System.IO.Stream stream = new System.IO.MemoryStream(buff);
        switch (data_id)
        {
        case (uint)bs.gameddz.CMDID_Gameddz.IDGameBegin:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameDealCards:
        {
            bs.gameddz.deal_cards rsp = Serializer.Deserialize <bs.gameddz.deal_cards>(stream);
            OnGameDealCards(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameTurnToPlayer:
        {
            bs.gameddz.turn_to_player rsp = Serializer.Deserialize <bs.gameddz.turn_to_player>(stream);
            OnGameTurnToPlayer(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameBidScore:

            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameBidScoreEnd:
        {
            bs.gameddz.bid_socre_end rsp = Serializer.Deserialize <bs.gameddz.bid_socre_end>(stream);
            OnGameBidScoreEnd(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameOutCardsReq:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameOutCardsReply:
        {
            bs.gameddz.out_cards_reply rsp = Serializer.Deserialize <bs.gameddz.out_cards_reply>(stream);
            OnGameOutCardsReply(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameSeenDataReq:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameEnd:
        {
            bs.gameddz.game_end rsp = Serializer.Deserialize <bs.gameddz.game_end>(stream);
            OnGameEnd(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameDataReq:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameSetAuto:
        {
            bs.gameddz.set_auto rsp = Serializer.Deserialize <bs.gameddz.set_auto>(stream);
            OnGameSetAuto(rsp);
        }
        break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameExpression:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDGameScoreChage:
            break;

        case (uint)bs.gameddz.CMDID_Gameddz.IDCardsForRobots:
            break;

        default:
            break;
        }
    }