Ejemplo n.º 1
0
        private void HandleChatPacket(ChatPacket chatPacket)
        {
            if (chatPacket == null) { Debug.Log(new ArgumentNullException("ChatPacket was null.")); return; }
            if (chatPacket.Username == null) { Debug.Log(new NullReferenceException("Username was null.")); return; }
            if (chatPacket.Message == null) { Debug.Log(new NullReferenceException("Message was null.")); return; }
            if (chatPacket.ForeColor == null) { Debug.Log(new NullReferenceException("ForeColor was null.")); return; }
            if (chatPacket.BackColor == null) { Debug.Log(new NullReferenceException("BackColor was null.")); return; }

            AppendText("[" + chatPacket.Username + "]: " + chatPacket.Message, chatPacket.ForeColor, chatPacket.BackColor);
        }
Ejemplo n.º 2
0
        public void SendChatMessage(String username, String message, Color foreColor, Color backColor)
        {
            if (VideoSync != null && ChatArea != null)
            {
                ChatPacket chatPacket = new ChatPacket(username, message, foreColor, backColor);

                HandleChatPacket(chatPacket);

                if (VideoSync.HostedServer != null)
                {
                    if (VideoSync.HostedServer.Running)
                    {
                        VideoSync.HostedServer.sendAll(chatPacket);
                    }
                }

                if (VideoSync.WatchConnection != null)
                {
                    if (VideoSync.WatchConnection.isConnected())
                    {
                        VideoSync.WatchConnection.sendObject(chatPacket);
                    }
                }
            }
        }