Ejemplo n.º 1
0
    void ChattingGUI()
    {
        Rect commentRect = new Rect(220, 450, 300, 30);

        m_sendComment = GUI.TextField(commentRect, m_sendComment, 15);

        bool isSent = GUI.Button(new Rect(530, 450, 100, 30), "말하기");

        if (Event.current.isKey && Event.current.keyCode == KeyCode.Return)
        {
            if (m_sendComment == m_prevComment)
            {
                isSent        = true;
                m_prevComment = "";
            }
            else
            {
                m_prevComment = m_sendComment;
            }
        }

        if (isSent == true)
        {
            var requestPkt = new CSMsgPackPacket.ChatReqPkt();
            requestPkt.UserID = m_NickName;
            requestPkt.Msg    = m_sendComment;

            System.IO.MemoryStream reqStream = new System.IO.MemoryStream();
            var output = new Google.Protobuf.CodedOutputStream(reqStream);
            requestPkt.WriteTo(output);

            PostSendPacket(PACKET_ID.PACKET_ID_SIMPLE_CHAT, reqStream.ToArray());

            m_sendComment = "";
        }


        if (GUI.Button(new Rect(700, 560, 80, 30), "나가기"))
        {
            m_state = ChatState.LEAVE;
        }

        if (m_transport.IsConnected)
        {
            // 콩장수의(클라이언트 측) 메시지 표시.
            DispBalloon(ref m_message, new Vector2(600.0f, 200.0f), new Vector2(340.0f, 360.0f), Color.green, false);
            GUI.DrawTexture(new Rect(600.0f, 370.0f, 145.0f, 200.0f), this.texture_daizu);
        }
    }
Ejemplo n.º 2
0
    void ChattingGUI()
    {
        Rect commentRect = new Rect(220, 450, 300, 30);

        m_sendComment = GUI.TextField(commentRect, m_sendComment, 15);

        bool isSent = GUI.Button(new Rect(530, 450, 100, 30), "말하기");

        if (Event.current.isKey && Event.current.keyCode == KeyCode.Return)
        {
            if (m_sendComment == m_prevComment)
            {
                isSent        = true;
                m_prevComment = "";
            }
            else
            {
                m_prevComment = m_sendComment;
            }
        }

        if (isSent == true)
        {
            var requestPkt = new CSMsgPackPacket.ChatReqPkt();
            requestPkt.UserID = m_NickName;
            requestPkt.Msg    = m_sendComment;

            byte[] buffer = MessagePackSerializer.Serialize(requestPkt);
            PostSendPacket(PACKET_ID.PACKET_ID_CHAT_REQ, buffer);

            m_sendComment = "";
        }


        if (GUI.Button(new Rect(700, 560, 80, 30), "나가기"))
        {
            m_state = ChatState.LEAVE;
        }

        if (m_transport.IsConnected)
        {
            // 콩장수의(클라이언트 측) 메시지 표시.
            DispBalloon(ref m_message, new Vector2(600.0f, 200.0f), new Vector2(340.0f, 360.0f), Color.green, false);
            GUI.DrawTexture(new Rect(600.0f, 370.0f, 145.0f, 200.0f), this.texture_daizu);
        }
    }