Пример #1
0
        public void Listen(SecondLifeHostChatEventArgs e)
        {
            // Translate the incomming messages a bit so it looks like SL.
            string strHow = ": ";

            if (e.How == CommunicationType.Shout)
            {
                strHow = " shout: ";
            }

            if (e.How == CommunicationType.Whisper)
            {
                strHow = " whispers: ";
            }

            string strWho     = e.Name;
            string strMessage = e.Message;

            if (e.Name == Properties.Settings.Default.AvatarName)
            {
                strWho = "You";
            }

            if (e.Message.ToString().StartsWith("/me"))
            {
                strWho     = e.Name;
                strHow     = " ";
                strMessage = e.Message.ToString().Substring(3).Trim();
            }

            if (e.Channel == 0)
            {
                TalkToSimulatorConsole(strWho + strHow + strMessage);
            }
        }
Пример #2
0
        private void SecondLifeHost_OnChat(object sender, SecondLifeHostChatEventArgs e)
        {
            this.Listen(e);

            // talk only to the owner
            if (e.How != CommunicationType.OwnerSay)
            {
                foreach (Form form in this.Children)
                {
                    EditForm editForm = form as EditForm;
                    if (editForm == null || editForm.IsDisposed)
                    {
                        continue;
                    }

                    if (editForm.runtime == null)
                    {
                        continue;
                    }

                    if (editForm.runtime.SecondLifeHost == null)
                    {
                        continue;
                    }

                    // prevent loops loops loops loops, dont talk to myself
                    if (sender != editForm.runtime.SecondLifeHost)
                    {
                        editForm.runtime.SecondLifeHost.Listen(e);
                    }
                }
            }
        }