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


C# ChatTypeEnum类代码示例

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


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


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