예제 #1
0
    public static void Send_Invitation_Notify_Friend(bool accepted)
    {
        Friend_resInvNotify xmsg = new Friend_resInvNotify();

        xmsg.m_iOptID1 = Network.playerid;
        xmsg.m_iOptID2 = Network.Invitation_id;
        xmsg.accept    = accepted;

        byte[] msgBytes;
        using (MemoryStream stream = new MemoryStream())
        {
            ProtoBuf.Serializer.Serialize(stream, xmsg);
            msgBytes = stream.ToArray();
        }

        ClientHeader header = new ClientHeader();

        header = GetHeader(MessageID.MSG_FRIEND_OPT_INV, msgBytes.Length);
        connector.SendMsg(header, msgBytes);
    }
예제 #2
0
    public static void MSG_FRIEND_OPT_INV(NetworkMsg msg)
    {
        Friend_resInvNotify res = new Friend_resInvNotify();

        using (MemoryStream stream = new MemoryStream(msg.data))
        {
            res = ProtoBuf.Serializer.Deserialize <Friend_resInvNotify>(stream);
        }

        if (res.resultID == (int)ResultID.result_id_success && res.accept == true)
        {
            //准备界面
            //Network.gamemode = BattleType.NORMAL_PVP;
            //EventDispatcher.DispatchEvent("EventShowPrepareUI", null, null);
        }
        else if (res.resultID == (int)ResultID.result_id_success && res.accept == false)   //拒绝
        {
            if (Network.playerid == res.m_iOptID2)
            {
                //弹窗被拒绝
                EventDispatcher.DispatchEvent("EventShowMessageUIwithRefuseInvitation", null, null);
            }
        }
    }