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


C# ChatType.ToString方法代码示例

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


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

示例1: ChatToDebug

        public void ChatToDebug(ChatType type, Character sender, string message, GameReader packet, GameData gameData, ExtensionHandler extensions)
        {
            if (type == ChatType.Announcement)
                sender.Name = "";
            Debug.Information(type.ToString() + ":" + sender.Name + ": " + message);

            if (type == ChatType.Private && sender.Name == "Reporter")
            {
                gameData.commands.SendMessage(ChatType.Private, sender, "ECHO: " + message);
            }
        }
开发者ID:neo1106,项目名称:l2script,代码行数:11,代码来源:R4000.cs

示例2: Add

        public void Add(string _message, ChatAudibleLevel _audible, ChatType _type, ChatSourceType _sourcetype, string _fromName, UUID _id, UUID _ownerid, Vector3 _position)
        {
            Reference.Log.Debug(_message + " ChatAudibleLevel:" + _audible.ToString() + " ChatType:" + _type.ToString() + " ChatSourceType:" + _sourcetype.ToString() + " FromName:" + _fromName);

            // name.
            string fromName = _fromName + ":";
            lock (messageHistory)
            {
                messageHistory.Add(fromName);
                Reference.Viewer.GuiManager.ChatAddMessage(fromName);
            }

            // message.
            string msg = _message;
            if (_message.Length > maxMessageLength)
            {
                string tail = "・・・";

                msg = _message.Substring(0, maxMessageLength - tail.Length);
                msg += tail;
            }

            // wide-char space -> 2 char space.
            msg = msg.Replace(" ", "  ");

            // trim space.
            msg = msg.Trim();

            List<int> colLen = new List<int>();
            int colMaxLen = 16 * 2;
            int lenCounter = 0;
            for (int i = 0; i < msg.Length; i++)
            {
                char c = msg[i];
                if (c < '!' || '~' < c)
                {
                    lenCounter += 2;
                }
                else
                {
                    lenCounter += 1;
                }

                if ((lenCounter >= colMaxLen) || ((i + 1) == msg.Length))
                {
                    colLen.Add(i + 1);
                    lenCounter = 0;
                }
            }

            List<string> msgList = new List<string>();
            for (int i = 0; i < colLen.Count; i++)
            {
                int start = (i > 0 ? colLen[i - 1] : 0);
                int length = (i > 0 ? colLen[i] - colLen[i - 1] : colLen[i]);

                string text = msg.Substring(start, length);
                msgList.Add(text);
            }

            for (int i = 0; i < msgList.Count; i++)
            {
                // message.
                string addMessage = "  " + msgList[i];
                lock (messageHistory)
                {
                    messageHistory.Add(addMessage);
                    Reference.Viewer.GuiManager.ChatAddMessage(addMessage);
                }
            }

            Reference.Viewer.Adapter.CallReceiveMessaged(_id.ToString(), _fromName, _message);
        }
开发者ID:caocao,项目名称:3di-viewer-rei,代码行数:73,代码来源:ChatManager.cs

示例3: Self_OnChat

        void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position)
        {
            if (type == ChatType.StartTyping || type == ChatType.StopTyping || audible != ChatAudibleLevel.Fully) return;

            if (!Session.Settings.DisplayChat) return;

            char[] splitChar = { ' ' };
            string[] msg = message.Split(splitChar);

            bool action;
            if (msg[0].ToLower() == "/me")
            {
                action = true;
                message = String.Join(" ", msg, 1, msg.Length - 1);
            }
            else action = false;

            Display.Chat(Session.SessionNumber, fromName, message, action, type, sourceType);

            if (id == Session.Client.Self.AgentID) return;

            Dictionary<string, string> identifiers = new Dictionary<string, string>();
            identifiers.Add("$name", fromName);
            identifiers.Add("$message", message);
            identifiers.Add("$id", id.ToString());
            identifiers.Add("$ownerid", ownerid.ToString());
            identifiers.Add("$ctype", type.ToString());
            identifiers.Add("$stype", sourceType.ToString());
            identifiers.Add("$pos", position.ToString());

            for (int i = 0; i < msg.Length; i++)
                identifiers.Add("$" + (i + 1), msg[i]);

            ScriptSystem.TriggerEvents(Session.SessionNumber, ScriptSystem.EventTypes.Chat, identifiers);
        }
开发者ID:cobain861,项目名称:ghettosl,代码行数:35,代码来源:Callbacks.cs

示例4: Chat

        /// <summary>
        /// Displayed when objects or avatars chat in public
        /// </summary>
        public static void Chat(uint sessionNum, string fromName, string message, bool meAction, ChatType type, ChatSourceType sourceType)
        {
            string volume = "";
            if (type == ChatType.Whisper) volume = "whisper";
            else if (type == ChatType.Shout) volume = "shout";
            else if (type != ChatType.Normal) volume = type.ToString();

            ConsoleColor nameColor;
            ConsoleColor textColor;

            if (sourceType == ChatSourceType.Agent)
            {
                nameColor = ConsoleColor.Cyan;
                textColor = ConsoleColor.Gray;
            }
            else if (sourceType == ChatSourceType.Object)
            {
                nameColor = ConsoleColor.Green;
                textColor = ConsoleColor.DarkCyan;
            }
            else
            {
                nameColor = ConsoleColor.Magenta;
                textColor = ConsoleColor.DarkMagenta;
            }

            SetColor(ConsoleColor.DarkCyan); Console.Write("({0}) ", sessionNum);
            SetColor(nameColor); 

            if (meAction)
            {
                Console.WriteLine(fromName + " " + message);
            }
            else
            {
                if (volume == "") Console.Write(fromName);
                else Console.Write("{0} {1}s", fromName, volume);
                SetColor(ConsoleColor.DarkCyan); Console.Write(": ", sessionNum);
                SetColor(textColor); Console.Write(message + Environment.NewLine);
            }

            SetColor(ConsoleColor.Gray);
        }
开发者ID:cobain861,项目名称:ghettosl,代码行数:46,代码来源:Display.cs

示例5: EQ2Echo

 /// <summary>
 /// Echoes a message directly to your chat window(s).
 /// </summary>
 /// <param name="message">message</param>
 /// <param name="type">chat type</param>
 /// <returns></returns>
 public static int EQ2Echo(string message, ChatType type = ChatType.None)
 {
     Trace.WriteLine((type != ChatType.None) ? String.Format("Extension:EQ2Echo({0}, {1})", message, type)
         : String.Format("Extension:EQ2Echo({0})", message));
     return
         LavishScript.ExecuteCommand((type != ChatType.None) ?
         String.Format("EQ2Echo {0} -chattype {1}", message, type.ToString().ToLower())
         : String.Format("EQ2Echo {0}", message));
 }
开发者ID:rlane187,项目名称:ISXEQ2Wrapper,代码行数:15,代码来源:Extension.cs

示例6: InitializeChatRoom

 private List<Message> InitializeChatRoom(List<Message> messages, ChatType chatType)
 {
     client = new ChatServiceClient(chatType.ToString());
     messages = client.GetChats(chatType).ToList();
     currentChatType = chatType;
     return messages;
 }
开发者ID:bazizten,项目名称:WCF_Chat,代码行数:7,代码来源:ChatForm.cs


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