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


C# ChatLanguage类代码示例

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


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

示例1: DynamicGossipEntry

 public DynamicGossipEntry(uint id, ChatLanguage lang, params GossipStringFactory[] texts)
 {
     GossipId = id;
     GossipTexts = new DynamicGossipText[texts.Length];
     var chance = 1f / texts.Length;
     for (var i = 0; i < texts.Length; i++)
     {
         GossipTexts[i] = new DynamicGossipText(texts[i], chance, lang);
     }
 }
开发者ID:Zakkgard,项目名称:WCell,代码行数:10,代码来源:GossipEntry.cs

示例2: CreateChatPacket

        /// <summary>
        /// Creates a packet
        /// </summary>
        public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length);
            packet.WriteByte((byte)type);			// 1
            packet.WriteUInt((uint)language);		// 5
            packet.WriteUIntPascalString(msg);			// 22 + msg.Length
            packet.WriteByte((byte)tag);			// 23 + msg.Length

            return packet;
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:13,代码来源:ChatHandler.cs

示例3: ChatNotify

		/// <summary>
		/// Triggers a chat notification event.
		/// </summary>
		/// <param name="chatter">the person chatting</param>
		/// <param name="message">the chat message</param>
		/// <param name="language">the chat language</param>
		/// <param name="chatType">the type of chat</param>
		/// <param name="target">the target of the message (channel, whisper, etc)</param>
		public static void ChatNotify(IChatter chatter, string message, ChatLanguage language, ChatMsgType chatType, IGenericChatTarget target)
		{
			var chatNotify = MessageSent;

			if (chatNotify != null)
			{
				chatNotify(chatter, message, language, chatType, target);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:17,代码来源:ChatMgr.cs

示例4: SendMonsterMessage

		/// <summary>
		/// Sends a monster message.
		/// </summary>
		/// <param name="obj">the monster the message is being sent from</param>
		/// <param name="chatType">the type of message</param>
		/// <param name="language">the language to send the message in</param>
		/// <param name="message">the message to send</param>
		/// <param name="radius">The radius or -1 to be heard by everyone in the Map</param>
		public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius)
		{
			if (obj == null || !obj.IsAreaActive)
				return;

			using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None))
			{
				obj.SendPacketToArea(packetOut, radius, true);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:18,代码来源:ChatMgr.cs

示例5: CreateCharChatMessage

		/// <summary>
		/// Creates a chat message packet for a player.
		/// </summary>
		/// <param name="type">the type of chat message</param>
		/// <param name="language">the language the message is in</param>
		/// <param name="id1">the ID of the chatter</param>
		/// <param name="id2">the ID of the receiver</param>
		/// <param name="target">the target or null (if its an area message)</param>
		/// <param name="msg">the message itself</param>
		/// <param name="tag">the chat tag of the chatter</param>
		/// <returns>Might return null</returns>
		private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, EntityId id1, EntityId id2,
			string target, string msg, ChatTag tag)
		{
			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
			packet.Write((byte)type);
			packet.Write((uint)language);
			packet.Write(id1);
			packet.Write(0);
			if (target != null)
				packet.WriteUIntPascalString(target);
			packet.Write(id2);
			packet.WriteUIntPascalString(msg);
			packet.Write((byte)tag);

			return packet;
		}
开发者ID:remixod,项目名称:netServer,代码行数:27,代码来源:ChatMgr.cs

示例6: CreateObjectChatMessage

		/// <summary>
		/// Creates a chat message packet for a non-player object.
		/// </summary>
		/// <param name="type">the type of chat message</param>
		/// <param name="language">the language the message is in</param>
		/// <param name="obj">the object "saying" the message</param>
		/// <param name="msg">the message itself</param>
		/// <param name="tag">any chat tags for the object</param>
		/// <returns>the generated chat packet</returns>
		private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type,
			ChatLanguage language, INamedEntity obj, string msg, ChatTag tag)
		{
			var packet = CreateObjectChatMessage(type, language, obj);
			//packet.Write(obj.EntityId);	
			packet.WriteUIntPascalString(msg);														// 30 + nameLength + msg.Length
			packet.Write((byte)tag);															// 31 + ...

			return packet;
		}
开发者ID:remixod,项目名称:netServer,代码行数:19,代码来源:ChatMgr.cs

示例7: AFKParser

		private static void AFKParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var reason = packet.ReadCString();

			if (type == ChatMsgType.AFK)
			{
				// flip their AFK flag
				sender.IsAFK = !sender.IsAFK;

				sender.AFKReason = (sender.IsAFK ? reason : "");
			}

			if (type == ChatMsgType.DND)
			{
				// flip their DND flag
				sender.IsDND = !sender.IsDND;

				sender.DNDReason = (sender.IsDND ? reason : "");
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:20,代码来源:ChatMgr.cs

示例8: WhisperParser

		/// <summary>
		/// Parses any incoming whispers.
		/// </summary>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void WhisperParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var recipient = packet.ReadCString();
			var msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			var targetChr = World.GetCharacter(recipient, false);
			if (targetChr == null)
			{
				SendChatPlayerNotFoundReply(sender.Client, recipient);
				return;
			}

			if (targetChr.Faction.Group != sender.Faction.Group)
			{
				SendChatPlayerWrongTeamReply(sender.Client);
				return;
			}

			if (targetChr.IsIgnoring(sender))
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.Ignored, ChatLanguage.Universal, targetChr, sender, null, msg))
				{
					sender.Send(packetOut);
				}
			}
			else
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.Whisper, ChatLanguage.Universal, sender, targetChr, null, msg))
				{
					targetChr.Send(packetOut);
				}
			}

			using (var packetOut = CreateCharChatMessage(ChatMsgType.MsgReply, ChatLanguage.Universal, targetChr, targetChr, null, msg, sender.ChatTag))
			{
				sender.Send(packetOut);
			}

			// handle afk/dnd situations
			if (targetChr.IsAFK)
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.AFK, ChatLanguage.Universal, targetChr, sender, null, targetChr.AFKReason, targetChr.ChatTag))
				{
					sender.Send(packetOut);
				}
			}

			if (targetChr.IsDND)
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.DND, ChatLanguage.Universal, targetChr, sender, null, string.Empty, targetChr.ChatTag))
				{
					sender.Send(packetOut);
				}
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:67,代码来源:ChatMgr.cs

示例9: DynamicGossipText

		public DynamicGossipText(GossipStringFactory stringGetter, float probability = 1f, ChatLanguage lang = ChatLanguage.Universal)
			: base(probability, lang)
		{
			StringGetter = stringGetter;
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:5,代码来源:GossipEntry.cs

示例10: StaticGossipText

		public StaticGossipText(string text, float probability, ChatLanguage lang = ChatLanguage.Universal) :
			base(probability, lang)
		{
			TextMale = TextFemale = text;
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:5,代码来源:GossipEntry.cs

示例11: StaticGossipEntry

		public StaticGossipEntry(uint id, ChatLanguage lang, params string[] texts)
		{
			GossipId = id;
			GossipTexts = new StaticGossipText[texts.Length];
			var chance = 1f / texts.Length;
			for (var i = 0; i < texts.Length; i++)
			{
				var text = texts[i];
				GossipTexts[i] = new StaticGossipText(text, chance, lang);
			}
			FinalizeDataHolder();
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:12,代码来源:GossipEntry.cs

示例12: LanguageDescription

 public LanguageDescription(ChatLanguage lang, SpellId spell, SkillId skill)
 {
     Language = lang;
     SpellId = spell;
     SkillId = skill;
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:6,代码来源:LangHandler.cs

示例13: GetLanguageDescByType

 /// <summary>
 /// Get language description by Type
 /// </summary>
 /// <param name="language">the Language type</param>
 /// <returns></returns>
 public static LanguageDescription GetLanguageDescByType(ChatLanguage language)
 {
     return ByLang.Get((uint)language);
 }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:9,代码来源:LangHandler.cs

示例14: GossipText

		public GossipText(string text, float probability, ChatLanguage lang)
		{
			TextMale = TextFemale = text;
			Probability = probability;
			Language = lang;
		}
开发者ID:MeaNone,项目名称:WCell,代码行数:6,代码来源:GossipEntry.cs

示例15: SubGroupParser

		/// <summary>
		/// Parses any incoming party or raid messages.
		/// </summary>
		/// <param name="sender">The character sending the message</param>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void SubGroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			string msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			var group = sender.SubGroup;
			if (group != null)
			{
				using (var packetOut = CreateCharChatMessage(type, ChatLanguage.Universal, sender, sender, null, msg))
				{
					group.Send(packetOut, null);
				}
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:26,代码来源:ChatMgr.cs


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