• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ChatTypeEnum类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ChatTypeEnum的典型用法代码示例。如果您正苦于以下问题:C# ChatTypeEnum类的具体用法?C# ChatTypeEnum怎么用?C# ChatTypeEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChatTypeEnum类属于命名空间,在下文中一共展示了ChatTypeEnum类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SimChat

        protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                               UUID fromID, bool fromAgent, bool broadcast)
        {
            OSChatMessage args = new OSChatMessage();

            args.Message = Utils.BytesToString(message);
            args.Channel = channel;
            args.Type = type;
            args.Position = fromPos;
            args.SenderUUID = fromID;
            args.Scene = this;

            if (fromAgent)
            {
                ScenePresence user = GetScenePresence(fromID);
                if (user != null)
                    args.Sender = user.ControllingClient;
            }
            else
            {
                SceneObjectPart obj = GetSceneObjectPart(fromID);
                args.SenderObject = obj;
            }

            args.From = fromName;
            //args.

            if (broadcast)
                EventManager.TriggerOnChatBroadcast(this, args);
            else
                EventManager.TriggerOnChatFromWorld(this, args);
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:32,代码来源:Scene.PacketHandlers.cs


示例2: UserChatEvent

 public UserChatEvent(
     UUID userId, string userName, Vector3 origin, ChatTypeEnum chatType, string text, int channel, string gridId, string regionName, DateTime datetime)
     : base(userId, userName, "chat", gridId, regionName, datetime)
 {
     Origin = origin;
     ChatType = chatType;
     Text = text;
     Channel = channel;
 }
开发者ID:justinccdev,项目名称:EventRecordingModule,代码行数:9,代码来源:UserChatEvent.cs


示例3: SimChat

        /// <summary>
        /// Send chat to listeners.
        /// </summary>
        /// <param name='message'></param>
        /// <param name='type'>/param>
        /// <param name='channel'></param>
        /// <param name='fromPos'></param>
        /// <param name='fromName'></param>
        /// <param name='fromID'></param>
        /// <param name='targetID'></param>
        /// <param name='fromAgent'></param>
        /// <param name='broadcast'></param>
        public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                               UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
        {
            OSChatMessage args = new OSChatMessage();

            args.Message = Utils.BytesToString(message);
            args.Channel = channel;
            args.Type = type;
            args.Position = fromPos;
            args.SenderUUID = fromID;
            args.Scene = this;
            args.Destination = targetID;

            if (fromAgent)
            {
                ScenePresence user = GetScenePresence(fromID);
                if (user != null)
                    args.Sender = user.ControllingClient;
            }
            else
            {
                SceneObjectPart obj = GetSceneObjectPart(fromID);
                args.SenderObject = obj;
            }

            args.From = fromName;
            //args.

//            m_log.DebugFormat(
//                "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}",
//                args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast);

            if (broadcast)
                EventManager.TriggerOnChatBroadcast(this, args);
            else
                EventManager.TriggerOnChatFromWorld(this, args);
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:49,代码来源:Scene.PacketHandlers.cs


示例4: SimChat

 /// <summary>
 /// Sends a chat message to clients in the region
 /// </summary>
 /// <param name="message">The message to send to users</param>
 /// <param name="type">The type of message (say, shout, whisper, owner say, etc)</param>
 /// <param name="channel">The channel to speak the message on</param>
 /// <param name="presence">The ScenePresence that is sending this chat message</param>
 public void SimChat(string message, ChatTypeEnum type, int channel, ScenePresence presence)
 {
     SimChat(message, type, channel, presence.AbsolutePosition, presence.Name, presence.UUID, UUID.Zero, presence.UUID, false);
 }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:11,代码来源:Scene.PacketHandlers.cs


示例5: DeliverMessage

        /// <summary>
        ///     This method scans over the objects which registered an interest in listen callbacks.
        ///     For everyone it finds, it checks if it fits the given filter. If it does,  then
        ///     enqueue the message for delivery to the objects listen event handler.
        ///     The enqueued ListenerInfo no longer has filter values, but the actually trigged values.
        ///     Objects that do an llSay have their messages delivered here and for nearby avatars,
        ///     the OnChatFromClient event is used.
        /// </summary>
        /// <param name="type">type of delivery (whisper,say,shout or regionwide)</param>
        /// <param name="channel">channel to sent on</param>
        /// <param name="name">name of sender (object or avatar)</param>
        /// <param name="fromID">key of sender (object or avatar)</param>
        /// <param name="msg">msg to sent</param>
        /// <param name="position"></param>
        /// <param name="range"></param>
        /// <param name="toID"></param>
        public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID fromID, string msg,
            Vector3 position,
            float range, UUID toID)
        {
            //Make sure that the cmd handler thread is running
            m_scriptModule.PokeThreads(UUID.Zero);
            if (BlockedChannels.Contains(channel))
                return;
            // MainConsole.Instance.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}",
            //                   type, channel, name, id, msg);

            // Determine which listen event filters match the given set of arguments, this results
            // in a limited set of listeners, each belonging a host. If the host is in range, add them
            // to the pending queue.
            foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, fromID, msg))
            {
                // Dont process if this message is from yourself!
                if (li.GetHostID().Equals(fromID))
                    continue;

                ISceneChildEntity sPart = m_scene.GetSceneObjectPart(li.GetHostID());
                if (sPart == null)
                    continue;

                if (toID != UUID.Zero)
                    if (sPart.UUID != toID &&
                        sPart.AttachedAvatar != toID)
                        continue;
                //Only allow the message to go on if it is an attachment with the given avatars ID or the part ID is right

                double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position);
                switch (type)
                {
                    case ChatTypeEnum.Whisper:
                        if (dis < m_whisperdistance)
                            QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;

                    case ChatTypeEnum.Say:
                        if (dis < m_saydistance)
                            QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;

                    case ChatTypeEnum.ObsoleteSay:
                        if (dis < m_saydistance)
                            QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;

                    case ChatTypeEnum.Shout:
                        if (dis < m_shoutdistance)
                            QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;

                    case ChatTypeEnum.Custom:
                        if (dis < range)
                            QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;

                    case ChatTypeEnum.Region:
                        QueueMessage(new ListenerInfo(li, name, fromID, msg));
                        break;
                }
            }
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:80,代码来源:WorldCommModule.cs


示例6: SimChat

 public void SimChat(string message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                     UUID fromID, bool fromAgent, IScene scene)
 {
     SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, false, -1, UUID.Zero, scene);
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:5,代码来源:AuroraChatModule.cs


示例7: TrySendChatMessage

        public virtual void TrySendChatMessage(IScenePresence presence, Vector3 fromPos, Vector3 regionPos,
                                               UUID fromAgentID, string fromName, ChatTypeEnum type,
                                               string message, ChatSourceType src, float Range)
        {
            if (type == ChatTypeEnum.Custom)
            {
                Vector3 fromRegionPos = fromPos + regionPos;
                Vector3 toRegionPos = presence.AbsolutePosition +
                                      new Vector3(presence.Scene.RegionInfo.RegionLocX,
                                                  presence.Scene.RegionInfo.RegionLocY, 0);

                int dis = (int) Util.GetDistanceTo(toRegionPos, fromRegionPos);
                //Set the best fitting setting for custom
                if (dis < m_whisperdistance)
                    type = ChatTypeEnum.Whisper;
                else if (dis > m_saydistance)
                    type = ChatTypeEnum.Shout;
                else if (dis > m_whisperdistance && dis < m_saydistance)
                    type = ChatTypeEnum.Say;
            }

            // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
            presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
                                                       fromAgentID, (byte) src, (byte) ChatAudibleLevel.Fully);
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:25,代码来源:AuroraChatModule.cs


示例8: DeliverMessage

        public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg)
        {
            Vector3 position;
            SceneObjectPart source;
            ScenePresence avatar;

            if ((source = m_scene.GetSceneObjectPart(id)) != null)
                position = source.AbsolutePosition;
            else if ((avatar = m_scene.GetScenePresence(id)) != null)
                position = avatar.AbsolutePosition;
            else if (ChatTypeEnum.Region == type)
                position = CenterOfRegion;
            else
                return;

            DeliverMessage(type, channel, name, id, msg, position);
        }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:17,代码来源:WorldCommModule.cs


示例9: SendOnChatFromClient

        private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
        {
            OSChatMessage chatFromClient = new OSChatMessage();
            chatFromClient.Channel = 0;
            chatFromClient.From = Name;
            chatFromClient.Message = message;
            chatFromClient.Position = StartPos;
            chatFromClient.Scene = m_scene;
            chatFromClient.Sender = this;
            chatFromClient.SenderUUID = AgentId;
            chatFromClient.Type = chatType;

            OnChatFromClient(this, chatFromClient);
        }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:14,代码来源:NPCAvatar.cs


示例10: TrySendChatMessage

        /// <summary>
        /// Try to send a message to the given presence
        /// </summary>
        /// <param name="presence">The receiver</param>
        /// <param name="fromPos"></param>
        /// <param name="regionPos">/param>
        /// <param name="fromAgentID"></param>
        /// <param name='ownerID'>
        /// Owner of the message.  For at least some messages from objects, this has to be correctly filled with the owner's UUID.
        /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762
        /// </param>
        /// <param name="fromName"></param>
        /// <param name="type"></param>
        /// <param name="message"></param>
        /// <param name="src"></param>
        /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a 
        /// precondition</returns>
        protected virtual bool TrySendChatMessage(
            ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
            UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type,
            string message, ChatSourceType src, bool ignoreDistance)
        {
            if (presence.LifecycleState != ScenePresenceState.Running)
                return false;

            if (!ignoreDistance)
            {
                Vector3 fromRegionPos = fromPos + regionPos;
                Vector3 toRegionPos = presence.AbsolutePosition +
                    new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize,
                                presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);

                int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);

                if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
                    type == ChatTypeEnum.Say && dis > m_saydistance ||
                    type == ChatTypeEnum.Shout && dis > m_shoutdistance)
                {
                    return false;
                }
            }

            // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
            presence.ControllingClient.SendChatMessage(
                message, (byte) type, fromPos, fromName,
                fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully);
            
            return true;
        }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:49,代码来源:ChatModule.cs


示例11: TrySendChatMessage

        protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
                                                  UUID fromAgentID, string fromName, ChatTypeEnum type,
                                                  string message, ChatSourceType src)
        {
            if ((presence.Scene.RegionInfo.RegionLocX != ((uint)regionPos.X) / Constants.RegionSize) ||
                (presence.Scene.RegionInfo.RegionLocY != ((uint)regionPos.Y) / Constants.RegionSize))
            {   // Different region?
                if (!ShouldChatCrossRegions(type))
                    return;
            }

            Vector3 fromRegionPos = fromPos + regionPos;
            Vector3 toRegionPos = presence.AbsolutePosition +
                new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize,
                            presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);

            // fix the exception that happens if 
            double fdist = Util.GetDistanceTo(toRegionPos, fromRegionPos);
            if (fdist > (double)Int32.MaxValue)
                return;
            if (fdist < -(double)Int32.MaxValue)
                return;
            int dis = Math.Abs((int) fdist);    // throws an exception on the cast if out of range
            if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
                type == ChatTypeEnum.Say && dis > m_saydistance ||
                type == ChatTypeEnum.Shout && dis > m_shoutdistance)
            {
                return;
            }

            presence.Scene.EventManager.TriggerOnChatToClient(message, fromAgentID,
                presence.UUID, presence.Scene.RegionInfo.RegionID, (uint)Util.UnixTimeSinceEpoch(), 
                ChatToClientType.InworldChat);
            // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
            presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
                                                       fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
        }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:37,代码来源:ChatModule.cs


示例12: ShouldChatCrossRegions

 public bool ShouldChatCrossRegions(ChatTypeEnum type)
 {
     switch (type)
     {
         case ChatTypeEnum.Whisper:      return true;
         case ChatTypeEnum.Say:          return true;
         case ChatTypeEnum.Shout:        return true;
         case (ChatTypeEnum)3:           return true;    // 3 is an obsolete version of Say
         case ChatTypeEnum.StartTyping:  return false;
         case ChatTypeEnum.StopTyping:   return false;
         case ChatTypeEnum.DebugChannel: return false;
         case ChatTypeEnum.Region:       return false;
         case ChatTypeEnum.Owner:        return false;
         case ChatTypeEnum.Direct:       return false;   // llRegionSayTo
         case ChatTypeEnum.Broadcast:    return true;
     }
     return false;   // by default, new types will stay within the region
 }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:18,代码来源:ChatModule.cs


示例13: BotChat

        public bool BotChat(UUID botID, int channel, string message, ChatTypeEnum sourceType, UUID attemptingUser)
        {
            IBot bot;
            if ((bot = GetBotWithPermission(botID, attemptingUser)) == null)
                return false;

            bot.Say(channel, message, sourceType);
            return true;
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:9,代码来源:BotManager.cs


示例14: SimChat

 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 /// <param name="type"></param>
 /// <param name="fromPos"></param>
 /// <param name="fromName"></param>
 /// <param name="fromAgentID"></param>
 /// 
 public void SimChat(string message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                     UUID fromID, bool fromAgent, float range)
 {
     SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, false, range, UUID.Zero);
 }
开发者ID:shangcheng,项目名称:Aurora,代码行数:14,代码来源:Scene.PacketHandlers.cs


示例15: Say

        public void Say(int channel, string message, ChatTypeEnum sourceType)
        {
            if (m_frozenUser)
                return;

            if (channel == 0 && sourceType != ChatTypeEnum.StartTyping && sourceType != ChatTypeEnum.StopTyping)
            {
                message = message.Trim();
                if (string.IsNullOrEmpty(message))
                {
                    return;
                }
            }

            if (sourceType == ChatTypeEnum.StartTyping)
            {
                StartAnimation(UUID.Zero, "TYPE", UUID.Zero);
            }
            else if (sourceType == ChatTypeEnum.StopTyping)
            {
                StopAnimation(UUID.Zero, "TYPE");
            }

            OSChatMessage chatFromClient = new OSChatMessage();
            chatFromClient.Channel = channel;
            chatFromClient.From = Name;
            chatFromClient.Message = message;
            chatFromClient.Position = StartPos;
            chatFromClient.Scene = m_scene;
            chatFromClient.SenderUUID = AgentId;
            chatFromClient.Type = sourceType;

            // Force avatar position to be server-known avatar position. (Former contents of FixPositionOfChatMessage.)
            ScenePresence avatar;
            if (m_scene.TryGetAvatar(m_UUID, out avatar))
                chatFromClient.Position = avatar.AbsolutePosition;

            OnChatFromClient(this, chatFromClient);
        }
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:39,代码来源:BotClient.cs


示例16: SendOnChatFromClient

        private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
        {
            if (channel == 0)
            {
                message = message.Trim();
                if (string.IsNullOrEmpty(message))
                {
                    return;
                }
            }
            OSChatMessage chatFromClient = new OSChatMessage();
            chatFromClient.Channel = channel;
            chatFromClient.From = Name;
            chatFromClient.Message = message;
            chatFromClient.Position = StartPos;
            chatFromClient.Scene = m_scene;
            chatFromClient.Sender = this;
            chatFromClient.SenderUUID = AgentId;
            chatFromClient.Type = chatType;

            OnChatFromClient(this, chatFromClient);
        }
开发者ID:JeffCost,项目名称:opensim,代码行数:22,代码来源:NPCAvatar.cs


示例17: SimChat

 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                        UUID fromID, bool fromAgent, bool broadcast)
 {
     SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
 }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:5,代码来源:Scene.PacketHandlers.cs


示例18: TrySendChatMessage

        public virtual void TrySendChatMessage(IScenePresence presence, Vector3 fromPos,
            UUID fromAgentID, string fromName, ChatTypeEnum type,
            string message, ChatSourceType src, float Range)
        {
            if (type == ChatTypeEnum.Custom)
            {
                int dis = (int)Util.GetDistanceTo(fromPos, presence.AbsolutePosition);
                //Set the best fitting setting for custom
                if (dis < m_whisperdistance)
                    type = ChatTypeEnum.Whisper;
                else if (dis > m_saydistance)
                    type = ChatTypeEnum.Shout;
                else if (dis > m_whisperdistance && dis < m_saydistance)
                    type = ChatTypeEnum.Say;
            }

            presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
                                                       fromAgentID, (byte) src, (byte) ChatAudibleLevel.Fully);
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:19,代码来源:AuroraChatModule.cs


示例19: SimChatBroadcast

 /// <summary>
 ///   Say this message directly to a single person
 /// </summary>
 /// <param name = "message"></param>
 /// <param name = "type"></param>
 /// <param name = "fromPos"></param>
 /// <param name = "fromName"></param>
 /// <param name = "fromAgentID"></param>
 public void SimChatBroadcast(string message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                              UUID fromID, bool fromAgent, UUID ToAgentID, IScene scene)
 {
     SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true, -1, ToAgentID, scene);
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:13,代码来源:AuroraChatModule.cs


示例20: TrySendChatMessage

        protected virtual void TrySendChatMessage(IScenePresence presence, Vector3 fromPos, Vector3 regionPos,
                                                  UUID fromAgentID, string fromName, ChatTypeEnum type,
                                                  string message, ChatSourceType src)
        {
            // don't send stuff to child agents
            if (presence.IsChildAgent) return;

            Vector3 fromRegionPos = fromPos + regionPos;
            Vector3 toRegionPos = presence.AbsolutePosition +
                                  new Vector3(presence.Scene.RegionInfo.RegionLocX,
                                              presence.Scene.RegionInfo.RegionLocY, 0);

            int dis = (int) Util.GetDistanceTo(toRegionPos, fromRegionPos);

            if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
                type == ChatTypeEnum.Say && dis > m_saydistance ||
                type == ChatTypeEnum.Shout && dis > m_shoutdistance)
            {
                return;
            }

            presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
                                                       fromAgentID, (byte) src, (byte) ChatAudibleLevel.Fully);
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:24,代码来源:ChatModule.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Check类代码示例发布时间:2022-05-24
下一篇:
C# ChatType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap