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


C# Keeps.GameKeepComponent类代码示例

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


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

示例1: GameKeepHookPoint

		public GameKeepHookPoint(DBKeepHookPoint dbhookPoint, GameKeepComponent component)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			switch (component.ComponentHeading)
			{
				case 0:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					break;
				case 1:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					break;
				case 2:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					break;
				case 3:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					break;
			}
			this.Z = component.Z + dbhookPoint.Z;
			this.Heading = (ushort)(component.Heading + dbhookPoint.Heading);
			this.m_index = dbhookPoint.HookPointID;
			this.Component = component;
			m_hookpointTimer = new HookpointTimer(this, this.Component);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:28,代码来源:KeepHookPoint.cs

示例2: LoadFromPosition

		public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
		{
			if (component.Keep.DBKeep.BaseLevel < 50)
				return;
			m_component = component;
			PositionMgr.LoadKeepItemPosition(pos, this);
			this.m_component.Keep.TeleportStone = this;
			this.AddToWorld();
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:9,代码来源:FrontiersPortalStone.cs

示例3: LoadXY

		/// <summary>
		/// Calculates X and Y based on component rotation and offset
		/// </summary>
		/// <param name="component">The assigned component object</param>
		/// <param name="inX">The argument X</param>
		/// <param name="inY">The argument Y</param>
		/// <param name="outX">The result X</param>
		/// <param name="outY">The result Y</param>
		public static void LoadXY(GameKeepComponent component, int inX, int inY, out int outX, out int outY)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			double C = Math.Cos(angle);
			double S = Math.Sin(angle);
			switch (component.ComponentHeading)
			{
				case 0:
					{
						outX = (int)(component.X + C * inX + S * inY);
						outY = (int)(component.Y - C * inY + S * inX);
						break;
					}
				case 1:
					{
						outX = (int)(component.X + C * inY - S * inX);
						outY = (int)(component.Y + C * inX + S * inY);
						break;
					}
				case 2:
					{
						outX = (int)(component.X - C * inX - S * inY);
						outY = (int)(component.Y + C * inY - S * inX);
						break;
					}
				case 3:
					{
						outX = (int)(component.X - C * inY + S * inX);
						outY = (int)(component.Y - C * inX - S * inY);
						break;
					}
				default:
					{
						outX = 0;
						outY = 0;
						break;
					}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:47,代码来源:Position+Manager.cs

示例4: SendKeepComponentInfo

        public override void SendKeepComponentInfo(GameKeepComponent keepComponent)
        {
            GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentInfo));

            pak.WriteShort((ushort)keepComponent.Keep.KeepID);
            pak.WriteShort((ushort)keepComponent.ID);
            pak.WriteInt((uint)keepComponent.ObjectID);
            pak.WriteByte((byte)keepComponent.Skin);
            pak.WriteByte((byte)(keepComponent.ComponentX));//relative to keep
            pak.WriteByte((byte)(keepComponent.ComponentY));//relative to keep
            pak.WriteByte((byte)keepComponent.ComponentHeading);
            pak.WriteByte((byte)keepComponent.Height);
            pak.WriteByte(keepComponent.HealthPercent);
            byte flag = keepComponent.Status;
            if (keepComponent.IsRaized) // Only for towers
                flag |= 0x04;
            if (flag == 0x00 && keepComponent.Climbing)
                flag = 0x02;
            pak.WriteByte(flag);
            pak.WriteByte(0x00); //unk
            SendTCP(pak);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:22,代码来源:PacketLib170.cs

示例5: Load


//.........这里部分代码省略.........
                    {
                        if (dum.Skin >= 0 && dum.Skin <= 20) //these are the min/max ids for old keeps.
                            isOld = true;
                        if (dum.Skin > 20) //any skinID greater than this are ids for new keeps.
                            isNew = true;
                    }

                    //Now, consult server properties to decide our plan!

                    //Quote: ServerProperties.cs
                    //"use_new_keeps", "Keeps to load. 0 for Old Keeps, 1 for new keeps, 2 for both.", 2

                    if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && isNew)
                        continue;

                    if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && isOld)
                        continue;

                    //If we've got this far, we are permitted to load as per normal!

					AbstractGameKeep keep;
					if ((datakeep.KeepID >> 8) != 0)
					{
						keep = new GameKeepTower();
					}
					else
					{
						keep = new GameKeep();
					}

					keep.Load(datakeep);
					m_keeps.Add(datakeep.KeepID, keep);
				}

				// This adds owner keeps to towers / portal keeps
				foreach (AbstractGameKeep keep in m_keeps.Values)
				{
					GameKeepTower tower = keep as GameKeepTower;
					if (tower != null)
					{
						int index = tower.KeepID & 0xFF;
						GameKeep ownerKeep = getKeepByID(index) as GameKeep;
						if (ownerKeep != null)
						{
							ownerKeep.AddTower(tower);
						}
						tower.Keep = ownerKeep;
					}
				}

				bool missingKeeps = false;

				var keepcomponents = GameServer.Database.SelectAllObjects<DBKeepComponent>();
				foreach (DBKeepComponent component in keepcomponents)
				{
					// if use old keeps don't try to load new components
					if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && IsNewKeepComponent(component.Skin))
						continue;
					
					// if use new keeps don't try and load old components
					if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && !IsNewKeepComponent(component.Skin))
						continue;

					AbstractGameKeep keep = getKeepByID(component.KeepID);
					if (keep == null)
					{
						missingKeeps = true;
						continue;
					}
					GameKeepComponent gamecomponent = new GameKeepComponent();
					gamecomponent.LoadFromDatabase(component, keep);
					keep.KeepComponents.Add(gamecomponent);
				}

				if (missingKeeps && Logger.IsWarnEnabled)
				{
					Logger.WarnFormat("Some keeps not found while loading components, possibly old/new keeptype; see server properties");
				}

				if (m_keeps.Count != 0)
				{
					foreach (AbstractGameKeep keep in m_keeps.Values)
					{
						if (keep.KeepComponents.Count != 0)
							keep.KeepComponents.Sort();
					}
				}
				LoadHookPoints();

				Logger.Info("Loaded " + m_keeps.Count + " keeps successfully");
			}

			if (ServerProperties.Properties.USE_KEEP_BALANCING)
				UpdateBaseLevels();

			if (ServerProperties.Properties.USE_LIVE_KEEP_BONUSES)
				KeepBonusMgr.UpdateCounts();

			return true;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:KeepManager.cs

示例6: LoadFromPosition

        public virtual void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
        {
            m_templateID = pos.TemplateID;
            m_component = component;

            PositionMgr.LoadKeepItemPosition(pos, this);
            component.Keep.Doors[m_templateID] = this;

            m_oldMaxHealth = MaxHealth;
            m_health = MaxHealth;
            m_name = "Keep Door";
            m_oldHealthPercent = HealthPercent;
            m_doorID = GenerateDoorID();
            this.m_model = 0xFFFF;
            m_state = eDoorState.Closed;
            this.AddToWorld();
            StartHealthRegeneration();
            DoorMgr.RegisterDoor(this);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:19,代码来源:GameKeepDoor.cs

示例7: SendKeepComponentInfo

		public virtual void SendKeepComponentInfo(GameKeepComponent keepComponent)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs

示例8: LoadFromPosition

		/// <summary>
		/// Load the guard from a position
		/// </summary>
		/// <param name="pos">The position for the guard</param>
		/// <param name="component">The component it is being spawned on</param>
		public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
		{
			m_templateID = pos.TemplateID;
			m_component = component;
			component.AbstractKeep.Guards[m_templateID] = this;
			PositionMgr.LoadGuardPosition(pos, this);
			if (Component != null && Component.AbstractKeep != null)
			{
				Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this });
			}
			else
			{
				TemplateMgr.RefreshTemplate(this);
			}
			this.AddToWorld();
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:21,代码来源:GameKeepGuard.cs

示例9: IsEnemy

		/// <summary>
		/// Checks if a keep component is an enemy of the player
		/// </summary>
		/// <param name="checker">The component checker</param>
		/// <param name="target">The player target</param>
		/// <returns>true if the player is an enemy of the component</returns>
		public virtual bool IsEnemy(GameKeepComponent checker, GamePlayer target)
		{
			return IsEnemy(checker.AbstractKeep, target);
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:10,代码来源:KeepManager.cs

示例10: SendKeepComponentHookPoint

		public override void SendKeepComponentHookPoint(GameKeepComponent component, int selectedHookPointIndex)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentHookpointUpdate));
			pak.WriteShort((ushort)component.Keep.KeepID);
			pak.WriteShort((ushort)component.ID);
			ArrayList freeHookpoints = new ArrayList();
			foreach (GameKeepHookPoint hookPt in component.HookPoints.Values)
			{
				if (hookPt.IsFree) freeHookpoints.Add(hookPt);
			}
			pak.WriteByte((byte)freeHookpoints.Count);
			pak.WriteByte((byte)selectedHookPointIndex);
			foreach (GameKeepHookPoint hookPt in freeHookpoints)//have to sort by index?
			{
				pak.WriteByte((byte)hookPt.ID);
			}
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:18,代码来源:PacketLib170.cs

示例11: HookpointTimer

		public HookpointTimer(GameKeepHookPoint hookpoint, GameKeepComponent component)
			: base(component)
		{
			m_hookpoint = hookpoint;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:5,代码来源:KeepHookPoint.cs

示例12: CreatePosition

		/// <summary>
		/// Creates a position
		/// </summary>
		/// <param name="templateID">The template ID</param>
		/// <param name="component">The component object</param>
		/// <param name="player">The creating player object</param>
		/// <returns>The position object</returns>
		public static DBKeepPosition CreatePosition(string templateID, GameKeepComponent component, GamePlayer player)
		{
			DBKeepPosition pos = new DBKeepPosition();
			pos.ComponentSkin = component.Skin;
			pos.ComponentRotation = component.ComponentHeading;
			pos.TemplateID = templateID;
			int x, y;

			SaveXY(component, player.X, player.Y, out x, out y);
			pos.XOff = x;
			pos.YOff = y;

			pos.ZOff = player.Z - component.Z;

			pos.HOff = player.Heading - component.Heading;
			return pos;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:24,代码来源:Position+Manager.cs

示例13: CreatePatrolPosition

		/// <summary>
		/// Creates a guard patrol position
		/// </summary>
		/// <param name="guardID">The guard ID</param>
		/// <param name="component">The component object</param>
		/// <param name="player">The player object</param>
		/// <returns>The position object</returns>
		public static DBKeepPosition CreatePatrolPosition(string guardID, GameKeepComponent component, GamePlayer player, AbstractGameKeep.eKeepType keepType)
		{
			DBKeepPosition pos = CreatePosition(guardID, component, player);
			pos.Height = 0;
			pos.ClassType = "DOL.GS.Keeps.Patrol";
			pos.KeepType = (int)keepType;
			GameServer.Database.AddObject(pos);
			return pos;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:16,代码来源:Position+Manager.cs

示例14: SaveXY

		/// <summary>
		/// Saves X and Y offsets
		/// </summary>
		/// <param name="component">The assigned component object</param>
		/// <param name="inX">The argument X</param>
		/// <param name="inY">The argument Y</param>
		/// <param name="outX">The result X</param>
		/// <param name="outY">The result Y</param>
		public static void SaveXY(GameKeepComponent component, int inX, int inY, out int outX, out int outY)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			int gx = inX - component.X;
			int gy = inY - component.Y;
			double C = Math.Cos(angle);
			double S = Math.Sin(angle);
			switch (component.ComponentHeading)
			{
				case 0:
					{
						outX = (int)(gx * C + gy * S);
						outY = (int)(gx * S - gy * C);
						break;
					}
				case 1:
					{
						outX = (int)(gy * C - gx * S);
						outY = (int)(gx * C + gy * S);
						break;
					}
				case 2:
					{
						outX = (int)((gx * C + gy * S) / (-C * C - S * S));
						outY = (int)(gy * C - gx * S);
						break;
					}
				case 3:
					{
						outX = (int)(gx * S - gy * C);
						outY = (int)((gx * C + gy * S) / (-C * C - S * S));
						break;
					}
				default:
					{
						outX = 0;
						outY = 0;
						break;
					}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:49,代码来源:Position+Manager.cs

示例15: SendClearKeepComponentHookPoint

		public virtual void SendClearKeepComponentHookPoint(GameKeepComponent component, int selectedHookPointIndex)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs


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