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

C# ChatLanguage类代码示例

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

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



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


示例16: GossipTextBase

		protected GossipTextBase(float probability, ChatLanguage lang = ChatLanguage.Universal)
		{
			Probability = probability;
			Language = lang;
		}
开发者ID:Jeroz,项目名称:WCell,代码行数:5,代码来源:GossipEntry.cs


示例17: OfficerParser

		/// <summary>
		/// Parses any incoming officer message.
		/// </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 OfficerParser(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 guild = Guild.CheckPrivs(sender, GuildCommandId.MEMBER, GuildPrivileges.GCHATSPEAK);
			if (guild != null)
			{
				SendGuildOfficerMessage(sender, guild, msg);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:23,代码来源:ChatMgr.cs


示例18: AddLanguage

		/// <summary>
		/// Adds the given language
		/// </summary>
		public void AddLanguage(ChatLanguage lang)
		{
			var desc = LanguageHandler.GetLanguageDescByType(lang);
			AddLanguage(desc);
		}
开发者ID:remixod,项目名称:netServer,代码行数:8,代码来源:Character.cs


示例19: ChannelParser

		/// <summary>
		/// Parses any incoming channel messages.
		/// </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 ChannelParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var channel = packet.ReadCString();
			var message = packet.ReadCString();

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

			var chan = ChatChannelGroup.RetrieveChannel(sender, channel);
			if (chan == null)
				return;

			chan.SendMessage(sender, message);
		}
开发者ID:remixod,项目名称:netServer,代码行数:20,代码来源:ChatMgr.cs


示例20: CanSpeak

		/// <summary>
		/// Returns whether the given language can be understood by this Character
		/// </summary>
		public bool CanSpeak(ChatLanguage language)
		{
			return KnownLanguages.Contains(language);
		}
开发者ID:remixod,项目名称:netServer,代码行数:7,代码来源:Character.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ChatMessage类代码示例发布时间:2022-05-24
下一篇:
C# ChatEvent类代码示例发布时间: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