Exemplo n.º 1
0
    void onEventReportTalent(object data)
    {
        RoomEvent.sV2C_PlayerTalentList ptl = (RoomEvent.sV2C_PlayerTalentList)data;

        msgTalentList ot = new msgTalentList();

        ot.seat       = Room.Room.selfSeat;
        ot.talentList = "";
        //ot.talentList = string.Join(",",ptl.talentList);
        for (int i = 0; i < ptl.talentList.Count; i++)
        {
            if (i < ptl.talentList.Count - 1)
            {
                ot.talentList += ptl.talentList [i] + ",";
            }
            else
            {
                ot.talentList += ptl.talentList [i];
            }
        }

        if (ptl.talentList.Count == 0)
        {
            ot.talentList = "0,0,0,0";
        }

        ProtocolManager.getInstance().sendMsg(GameProtocol.P_GAME_REPORT_TALENT_LIST, ot, OnTalentList);
    }
Exemplo n.º 2
0
    //-----------------------------------以下是网络消息----------------------------------------------
    void OnTalentList(Message msg)
    {
        msgTalentList resp = msgTalentList.deserialize(msg);

        if (resp.seat == Room.Room.selfSeat)
        {
            //自己的天赋列表,原则上可以不用刷新了,因为本地知道

            //可刷新缓存,也可以不刷新
        }
        else
        {
            //别人的天赋列表,刷新别人天赋列表,并记录

            Room.Player?player = Room.Room.getPlayerBySeat(resp.seat);
            player.Value.talentList.Clear();

            string[] tl = resp.talentList.Split(',');

            for (int i = 0; i < tl.Length; i++)
            {
                player.Value.talentList.Add((CommonDefine.eTalentType)(Convert.ToInt32(tl[i])));
            }
        }

        //刷新天赋显示界面
    }
Exemplo n.º 3
0
    public void sendMsg(GameProtocol pID, msgTalentList msg, Action <Message> action)
    {
        JsonObject jsonMsg = new JsonObject();

        jsonMsg.Add("seat", msg.seat);
        jsonMsg.Add("talentList", msg.talentList);
        sendMsg(pID, jsonMsg, action);
    }