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


C# GameClient.GetTranslation方法代码示例

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


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

示例1: HandlePacket


//.........这里部分代码省略.........
					(ushort)client.Player.BindRegion,
					client.Player.BindXpos,
					client.Player.BindYpos,
					(ushort)client.Player.BindZpos,
					(ushort)client.Player.BindHeading
				);
				return;
			}

			int realX = newZone.XOffset + xOffsetInZone;
			int realY = newZone.YOffset + yOffsetInZone;

			bool zoneChange = newZone != client.Player.LastPositionUpdateZone;
			if (zoneChange)
			{
				//If the region changes -> make sure we don't take any falling damage
				if (client.Player.LastPositionUpdateZone != null && newZone.ZoneRegion.ID != client.Player.LastPositionUpdateZone.ZoneRegion.ID)
					client.Player.MaxLastZ = int.MinValue;

				// Update water level and diving flag for the new zone
				client.Out.SendPlayerPositionAndObjectID();
				zoneChange = true;

				/*
				 * "You have entered Burial Tomb."
				 * "Burial Tomb"
				 * "Current area is adjusted for one level 1 player."
				 * "Current area has a 50% instance bonus."
				 */

                string description = newZone.Description;
                string screenDescription = description;

                var translation = client.GetTranslation(newZone) as DBLanguageZone;
                if (translation != null)
                {
                    if (!Util.IsEmpty(translation.Description))
                        description = translation.Description;

                    if (!Util.IsEmpty(translation.ScreenDescription))
                        screenDescription = translation.ScreenDescription;
                }

                client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "PlayerPositionUpdateHandler.Entered", description),
				                       eChatType.CT_System, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(screenDescription, eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow);

				client.Player.LastPositionUpdateZone = newZone;
			}

			int coordsPerSec = 0;
			int jumpDetect = 0;
			int timediff = Environment.TickCount - client.Player.LastPositionUpdateTick;
			int distance = 0;

			if (timediff > 0)
			{
				distance = client.Player.LastPositionUpdatePoint.GetDistanceTo(new Point3D(realX, realY, realZ));
				coordsPerSec = distance * 1000 / timediff;

				if (distance < 100 && client.Player.LastPositionUpdatePoint.Z > 0)
				{
					jumpDetect = realZ - client.Player.LastPositionUpdatePoint.Z;
				}
			}
开发者ID:NetDwarf,项目名称:DOLSharp,代码行数:66,代码来源:PlayerPositionUpdateHandler.cs

示例2: GetTranslatedSpotDescription

		/// <summary>
		/// Get Spot Description Checking Any Area with Description or Zone Description and Try Translating it
		/// </summary>
		/// <param name="reg"></param>
		/// <param name="client"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <param name="z"></param>
		/// <returns></returns>
		public static string GetTranslatedSpotDescription(this Region reg, GameClient client, int x, int y, int z)
		{
			if (reg != null)
			{
				var area = reg.GetAreasOfSpot(x, y, z).OfType<AbstractArea>().FirstOrDefault(a => a.DisplayMessage);
				
				// Try Translate Area First
				if (area != null)
				{
					var lng = client.GetTranslation(area) as DBLanguageArea;
					
					if (lng != null && !Util.IsEmpty(lng.ScreenDescription))
						return lng.ScreenDescription;
							
					return area.Description;
				}
				
				var zone = reg.GetZone(x, y);
				
				// Try Translate Zone
				if (zone != null)
				{
					var lng = client.GetTranslation(zone) as DBLanguageZone;
					if (lng != null)
						return lng.ScreenDescription;
					
					return zone.Description;
				}
				
				return reg.Description;
			}
			
			return string.Empty;			
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:43,代码来源:GamePlayerUtils.cs


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