当前位置: 首页>>代码示例>>C#>>正文


C# OSChatMessage.Copy方法代码示例

本文整理汇总了C#中OpenSim.Framework.OSChatMessage.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# OSChatMessage.Copy方法的具体用法?C# OSChatMessage.Copy怎么用?C# OSChatMessage.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Framework.OSChatMessage的用法示例。


在下文中一共展示了OSChatMessage.Copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnChatFromWorld

        /// <summary>
        /// Send the message from the prim to the avatars in the regions
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="c"></param>
        public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
        {
            // early return if not on public or debug channel
            if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;

            bool Sent = false;

            if(c.Range > m_maxChatDistance) //Check for max distance
                c.Range = m_maxChatDistance;

            //Send the message into neighboring regions if possible

            if (c.Type == ChatTypeEnum.Say ||
                c.Type == ChatTypeEnum.Whisper ||
                c.Type == ChatTypeEnum.Shout ||
                c.Type == ChatTypeEnum.Custom)
            {
                int distance = c.Type == ChatTypeEnum.Say ? m_saydistance :
                    (c.Type == ChatTypeEnum.Whisper) ? m_whisperdistance :
                    (c.Type == ChatTypeEnum.Custom) ? (int)c.Range : m_shoutdistance;

                if (((Scene)c.Scene).TestBorderCross(new Vector3(c.Position.X + distance,
                    c.Position.Y,
                    c.Position.Z), Cardinals.E))
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (((Scene)c.Scene).TestBorderCross(new Vector3(c.Position.X,
                    c.Position.Y + distance,
                    c.Position.Z), Cardinals.N))
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX, c.Scene.RegionInfo.RegionLocY + 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.Y -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (((Scene)c.Scene).TestBorderCross(new Vector3(c.Position.X + distance,
                    c.Position.Y + distance,
                    c.Position.Z), Cardinals.E) &&
                    ((Scene)c.Scene).TestBorderCross(new Vector3(c.Position.X + distance,
                    c.Position.Y + distance,
                    c.Position.Z), Cardinals.N))
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY + 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        Position.Y -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (((Scene)c.Scene).TestBorderCross(new Vector3(c.Position.X + distance,
                    c.Position.Y,
                    c.Position.Z), Cardinals.E) && c.Position.Y - distance < 0)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY - 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        Position.Y += Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.Y - distance < 0)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX, c.Scene.RegionInfo.RegionLocY - 1);
                    if (scene != null)
                    {
//.........这里部分代码省略.........
开发者ID:NickyPerian,项目名称:Aurora,代码行数:101,代码来源:AuroraChatModule.cs

示例2: OnChatFromWorld

        public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
        {
            // early return if not on public or debug channel
            if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;

            bool Sent = false;

            if(c.Range > m_maxChatDistance)
                c.Range = m_maxChatDistance;

            if (c.Type == ChatTypeEnum.Say)
            {
                if (c.Position.X + m_saydistance > 256)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.Y + m_saydistance > 256)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX, c.Scene.RegionInfo.RegionLocY + 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.Y -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.X + m_saydistance > 256 && c.Position.Y + m_saydistance > 256)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY + 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        Position.Y -= Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.X + m_saydistance > 256 && c.Position.Y - m_saydistance < 0)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX + 1, c.Scene.RegionInfo.RegionLocY - 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X -= Constants.RegionSize;
                        Position.Y += Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.Y - m_saydistance < 0)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX, c.Scene.RegionInfo.RegionLocY - 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.Y += Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.X - m_saydistance < 0 && c.Position.Y - m_saydistance < 0)
                {
                    Scene scene = FindScene(c.Scene.RegionInfo.RegionLocX - 1, c.Scene.RegionInfo.RegionLocY - 1);
                    if (scene != null)
                    {
                        OSChatMessage newC = c.Copy();
                        newC.Scene = scene;
                        Vector3 Position = newC.Position;
                        Position.X += Constants.RegionSize;
                        Position.Y += Constants.RegionSize;
                        newC.Position = Position;
                        DeliverChatToAvatars(ChatSourceType.Object, newC);
                        Sent = true;
                    }
                }
                if (c.Position.X - m_saydistance < 0)
//.........这里部分代码省略.........
开发者ID:shangcheng,项目名称:Aurora,代码行数:101,代码来源:AuroraChatModule.cs


注:本文中的OpenSim.Framework.OSChatMessage.Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。