コード例 #1
0
ファイル: Pregnancy.cs プロジェクト: thebuchanan3/Continents
 public Pregnancy(long date, IEntity mother, IEntity father)
 {
     _copulationDate = date;
     _age = 0;
     _mother = mother;
     _father = father;
 }
コード例 #2
0
        public override bool Remove(IEntity entity)
        {
            if (entity == null)
                return false;

            m_isChanging = true;
            lock (m_changeLock)
            {
                try
                {
                    if (entity is ISceneEntity)
                    {
                        //Remove all child entities
                        foreach (ISceneChildEntity part in (entity as ISceneEntity).ChildrenEntities())
                        {
                            m_child_2_parent_entities.Remove(part.UUID);
                            m_child_2_parent_entities.Remove(part.LocalId);
                        }
                        m_objectEntities.Remove(entity.UUID);
                        m_objectEntities.Remove(entity.LocalId);
                    }
                    else
                    {
                        m_presenceEntitiesList.Remove((IScenePresence) entity);
                        m_presenceEntities.Remove(entity.UUID);
                    }
                }
                catch (Exception e)
                {
                    MainConsole.Instance.ErrorFormat("Remove Entity failed for {0}", entity.UUID, e);
                }
            }
            m_isChanging = false;
            return true;
        }
コード例 #3
0
        public IEnumerable<ISpaceRouteElement> GetToNeighbour(IEntity entity, Tile currentTile, Tile targetTile)
        {
            var moveDirection = currentTile.Neighbours.Single(t => t.Item1 == targetTile).Item2;
            var currentSpace = entity.Location.Space; //currentTile.LayoutManager.FindCurrentSpace(entity);

            var curTileBridges = entity.GroupLayout.AllSpaces
                .Where(s => s.Sides.Contains(moveDirection))
                .Where(s => s == currentSpace || currentTile.LayoutManager.IsFree(s));

            var targetTileBridges = entity.GroupLayout.AllSpaces
                .Where(s => s.Sides.Contains(moveDirection.Opposite))
                .Where(s => targetTile.LayoutManager.IsFree(s));

            var bridges = curTileBridges.Join(targetTileBridges,
                ospace => ospace.Sides.First(s => s != moveDirection),
                ispace => ispace.Sides.First(s => s != moveDirection.Opposite),
                Tuple.Create);

            var bridgesRoutes = bridges
                .Select(b => GetToSpace(entity, currentTile, b.Item1)?.Concat(new FourthSpaceRouteElement(b.Item2, targetTile).ToEnumerable()).ToArray())
                .Where(r => r != null)
                .ToArray();

            if (bridgesRoutes.Any())
            {
                var minLen = bridgesRoutes.Min(x => x.Length);
                return bridgesRoutes.First(br => br.Length == minLen);
            }
            else
                return null;
        }
コード例 #4
0
ファイル: Messages.cs プロジェクト: laazer/cs_megaman
 public HitBoxMessage(IEntity source, List<CollisionBox> newboxes, HashSet<string> enable, bool clear)
 {
     Source = source;
     AddBoxes = newboxes;
     EnableBoxes = enable;
     Clear = clear;
 }
コード例 #5
0
ファイル: CSharpAmbience.cs プロジェクト: pusp/o2platform
		string GetModifier(IEntity decoration)
		{
			string ret = "";
			
			if (IncludeHtmlMarkup) {
				ret += "<i>";
			}
			
			if (decoration.IsStatic) {
				ret += "static ";
			} else if (decoration.IsSealed) {
				ret += "sealed ";
			} else if (decoration.IsVirtual) {
				ret += "virtual ";
			} else if (decoration.IsOverride) {
				ret += "override ";
			} else if (decoration.IsNew) {
				ret += "new ";
			}
			
			if (IncludeHtmlMarkup) {
				ret += "</i>";
			}
			
			return ret;
		}
コード例 #6
0
        public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result )
        {
            Object obj = target.get( info.Name );

            Boolean isNull = false;
            if (info.Type == typeof( String )) {
                if (obj == null) {
                    isNull = true;
                }
                else if (strUtil.IsNullOrEmpty( obj.ToString() )) {
                    isNull = true;
                }
            }
            else if (obj == null) {
                isNull = true;
            }

            if (isNull) {
                if (strUtil.HasText( this.Message )) {
                    result.Add( this.Message );
                }
                else {
                    EntityInfo ei = Entity.GetInfo( target );
                    String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
                    result.Add( str + "can not be null" );
                }
            }
        }
コード例 #7
0
ファイル: HexagonSystem.cs プロジェクト: Magicolo/Isomorphage
    public override void OnEntityAdded(IEntity entity)
    {
        base.OnEntityAdded(entity);

        var polygon = entity.GetComponent<HexagonComponent>();
        var mesh = polygon.Renderer.Mesh;
        var vertices = mesh.vertices;
        polygon.Points = new List<PolygonPoint>(vertices.Length);
        polygon.Segments = new List<PolygonSegment>(vertices.Length);
        polygon.Contour = new PolygonContour();

        for (int i = 0; i < vertices.Length - 1; i++)
            polygon.Points.Add(new PolygonPoint { Shape = polygon, Index = i });

        for (int i = 0; i < polygon.Points.Count; i++)
        {
            var pointA = polygon.Points[i];
            var pointB = polygon.Points[(i + 1) % polygon.Points.Count];
            var segment = new PolygonSegment { Shape = polygon, Index = i, PointA = pointA, PointB = pointB };

            pointA.SegmentB = segment;
            pointB.SegmentA = segment;
            polygon.Segments.Add(segment);
            polygon.Contour.Segments.Add(segment);
        }
    }
コード例 #8
0
        public void SendHeaders(HttpResponseBase response, ResponseCompressionType compressionType, IEntity entity)
        {
            //Data must be in uncompressed format when responding partially
            if (entity.CompressionType != ResponseCompressionType.None)
            {
                //TODO: perhaps we could uncompress object, but for now we don't worry about it
                throw new Exception("Cannot do a partial response on compressed data");
            }

            HttpResponseHeaderHelper.SetContentEncoding(response, compressionType);

            switch (compressionType)
            {
                case ResponseCompressionType.None:
                    var contentLength = Range.EndRange - Range.StartRange + 1;
                    HttpResponseHeaderHelper.AppendHeader(response, HttpHeaderContentLength, contentLength.ToString());
                    break;
                case ResponseCompressionType.GZip:
                    response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
                    //This means that the output stream will be chunked, so we don't have to worry about content length
                    break;
                case ResponseCompressionType.Deflate:
                    response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
                    //This means that the output stream will be chunked, so we don't have to worry about content length
                    break;
            }

            response.ContentType = entity.ContentType;
            HttpResponseHeaderHelper.AppendHeader(response, HttpHeaderContentRange, Bytes + " " + Range.StartRange + "-" + Range.EndRange + "/" + entity.ContentLength);
        }
コード例 #9
0
        /// <summary>插入</summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual Int32 Insert(IEntity entity)
        {
            // 添加数据前,处理Guid
            SetGuid(entity);

            DbParameter[] dps = null;
            String sql = SQL(entity, DataObjectMethodType.Insert, ref dps);
            if (String.IsNullOrEmpty(sql)) return 0;

            Int32 rs = 0;
            IEntityOperate op = EntityFactory.CreateOperate(entity.GetType());

            //检查是否有标识列,标识列需要特殊处理
            FieldItem field = op.Table.Identity;
            if (field != null && field.IsIdentity)
            {
                Int64 res = dps != null && dps.Length > 0 ? op.InsertAndGetIdentity(sql, CommandType.Text, dps) : op.InsertAndGetIdentity(sql);
                if (res > 0) entity[field.Name] = res;
                rs = res > 0 ? 1 : 0;
            }
            else
            {

                rs = dps != null && dps.Length > 0 ? op.Execute(sql, CommandType.Text, dps) : op.Execute(sql);
            }

            //清除脏数据,避免连续两次调用Save造成重复提交
            if (entity.Dirtys != null) entity.Dirtys.Clear();

            return rs;
        }
コード例 #10
0
ファイル: DeleteOperation.cs プロジェクト: nust03/xcore
        public static int Delete( int id, IEntity obj, EntityInfo entityInfo )
        {
            List<IInterceptor> ilist = MappingClass.Instance.InterceptorList;
            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].BeforDelete( obj );
            }

            int rowAffected = 0;
            rowAffected += deleteSingle( id, entityInfo );
            if (entityInfo.ChildEntityList.Count > 0) {
                foreach (EntityInfo info in entityInfo.ChildEntityList) {
                    rowAffected += deleteSingle( id, MappingClass.Instance.ClassList[info.Type.FullName] as EntityInfo );
                }
            }
            if (entityInfo.Parent != null) {
                IEntity objP = Entity.New( entityInfo.Parent.Type.FullName );
                rowAffected += deleteSingle( id, Entity.GetInfo( objP ) );
            }

            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].AfterDelete( obj );
            }

            CacheUtil.CheckCountCache( "delete", obj, entityInfo );

            return rowAffected;
        }
コード例 #11
0
		/// <summary>
		/// Gets whether <paramref name="entity"/> is accessible in the current class.
		/// </summary>
		/// <param name="entity">The entity to test</param>
		/// <param name="allowProtectedAccess">Whether protected access is allowed.
		/// True if the type of the reference is derived from the current class.</param>
		public bool IsAccessible(IEntity entity, bool allowProtectedAccess)
		{
			if (entity == null)
				throw new ArgumentNullException("entity");
			// C# 4.0 spec, §3.5.2 Accessiblity domains
			switch (entity.Accessibility) {
				case Accessibility.None:
					return false;
				case Accessibility.Private:
					return entity.DeclaringTypeDefinition == currentTypeDefinition;
				case Accessibility.Public:
					return true;
				case Accessibility.Protected:
					return allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition);
				case Accessibility.Internal:
					return IsInternalAccessible(entity.ProjectContent);
				case Accessibility.ProtectedOrInternal:
					return (allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition))
						|| IsInternalAccessible(entity.ProjectContent);
				case Accessibility.ProtectedAndInternal:
					return (allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition))
						&& IsInternalAccessible(entity.ProjectContent);
				default:
					throw new Exception("Invalid value for Accessibility");
			}
		}
コード例 #12
0
ファイル: MemberCollector.cs プロジェクト: Bombadil77/boo
 private static bool IsHiddenBy(IEntity entity, IEnumerable<IEntity> members)
 {
     var m = entity as IMethod;
     if (m != null)
         return members.OfType<IMethod>().Any(existing => SameNameAndSignature(m, existing));
     return members.OfType<IEntity>().Any(existing => existing.Name == entity.Name);
 }
コード例 #13
0
		ICompletionData ICompletionDataFactory.CreateEntityCompletionData(IEntity entity, string text)
		{
			return new EntityCompletionData(entity) {
				CompletionText = text,
				DisplayText = text
			};
		}
コード例 #14
0
ファイル: Torch.cs プロジェクト: nathanvy/runuo
		public override void OnAdded(IEntity parent)
		{
			base.OnAdded( parent );

			if ( parent is Mobile && Burning )
				Mobiles.MeerMage.StopEffect( (Mobile)parent, true );
		}
コード例 #15
0
ファイル: GetIdForm.cs プロジェクト: steve-stanton/backsight
        internal GetIdForm(IEntity ent, IdHandle idh)
        {
            InitializeComponent();

            m_Entity = ent;
            m_IdHandle = idh;
        }
コード例 #16
0
        private static SelectStatement CreateSelectFromLevelQuery(IEntity rootEntity, DbRelation recursiveRelation, SearchCondition leafFilter, int level, LevelQuerySelectList itemsToSelect)
        {
            if (level > Settings.GenericHierarchicalQueryExecutorMaxLevel)
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Messages.GenericHierarchicalQueryExecutor_MaxLevelReachedFormat, Settings.GenericHierarchicalQueryExecutorMaxLevel));

            // Target level table must be child table because that is the table which is used in leafFilter.
            // If leaf filter is used then the we must ensure that proper table name is used for target table.
            IDbTable targetLevelTable;
            if (leafFilter != null && !leafFilter.IsEmpty)
                targetLevelTable = recursiveRelation.Child;
            else
                targetLevelTable = rootEntity.Table.Clone("L" + level);

            SelectStatement selectFromTargetLevel = new SelectStatement(targetLevelTable);
            CreateSelectListItems(itemsToSelect, targetLevelTable, selectFromTargetLevel);

            if (leafFilter != null && !leafFilter.IsEmpty)
                selectFromTargetLevel.Where.Add(leafFilter);

            IDbTable prevLevel = targetLevelTable;
            for (int parentLevel = level - 1; parentLevel >= 0; parentLevel--)
            {
                IDbTable nextLevel = rootEntity.Table.Clone("L" + parentLevel);
                DbRelation joinLevels = JoinLevelsInSubTree(prevLevel, nextLevel, recursiveRelation);
                selectFromTargetLevel.Relations.Add(joinLevels, false, false);
                prevLevel = nextLevel;
            }

            IDbTable subTreeRoot = prevLevel;
            foreach (IDbColumn rootPkPart in subTreeRoot.PrimaryKey)
                selectFromTargetLevel.Where.Add(rootPkPart, rootEntity.GetField(rootPkPart));

            return selectFromTargetLevel;
        }
コード例 #17
0
        /// <summary>
        /// Deletes the provided entity.
        /// </summary>
        /// <param name="entity">The entity to delete.</param>
        public override void Delete(IEntity entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            using (LogGroup logGroup = LogGroup.StartDebug("Deleting provided '" + entity.ShortTypeName + "' entity."))
            {
                Db4oDataStore store = (Db4oDataStore)GetDataStore(entity);

                if (DataAccess.Data.IsStored(entity))
                {
                    using (Batch batch = BatchState.StartBatch())
                    {
                        IDataReader reader = Provider.InitializeDataReader();
                        reader.AutoRelease = false;

                        entity = reader.GetEntity(entity);

                        if (entity == null)
                            throw new Exception("The entity wasn't found.");

                        // PreDelete must be called to ensure all references are correctly managed
                        PreDelete(entity);

                        // Delete the entity
                        if (entity != null)
                        {
                            store.ObjectContainer.Delete(entity);

                            store.Commit();
                        }
                    }
                }
            }
        }
コード例 #18
0
        public void UpdateEntity(IEntity param)
        {
            SimpleEntity entity = param as SimpleEntity;

            if (entity.Name.Length == 0) return;
            if (entity == null) throw new Exception("Entity is null at refbooks IEntityDatabaseModel.cs");

            if (_connection.State != System.Data.ConnectionState.Closed)
            {
                throw new Exception("_connection is not in Closed state!!!");
            }

            _connection.Open();
            SqlCeCommand command = _connection.CreateCommand();

            if (entity.ID != 0)
            {
                command.CommandText = String.Format("UPDATE {0} SET Name = '{2}' WHERE ID = {1}",
                                                                   this.TableName, entity.ID, entity.Name);
            }
            else
            {
                command.CommandText = String.Format("INSERT INTO {0}(Name) VALUES('{1}')",
                                                                   this.TableName, entity.Name);
            }

            command.ExecuteNonQuery();
            _connection.Close();
        }
コード例 #19
0
 private CollisionEvent(object origin, IEntity triggeringEntity, IEntity affectedEntity, CollisionResult collisionResult)
     : base(origin, EventType.COLLISION_EVENT)
 {
     this.triggeringEntity = triggeringEntity;
     this.affectedEntity = affectedEntity;
     this.collisionResult = collisionResult;
 }
コード例 #20
0
		public static void Rename (IEntity entity, string newName)
		{
			if (newName == null) {
				var options = new RefactoringOptions () {
					SelectedItem = entity
				};
				new RenameRefactoring ().Run (options);
				return;
			}
			using (var monitor = new NullProgressMonitor ()) {
				var col = ReferenceFinder.FindReferences (entity, true, monitor);
				
				List<Change> result = new List<Change> ();
				foreach (var memberRef in col) {
					var change = new TextReplaceChange ();
					change.FileName = memberRef.FileName;
					change.Offset = memberRef.Offset;
					change.RemovedChars = memberRef.Length;
					change.InsertedText = newName;
					change.Description = string.Format (GettextCatalog.GetString ("Replace '{0}' with '{1}'"), memberRef.GetName (), newName);
					result.Add (change);
				}
				if (result.Count > 0) {
					RefactoringService.AcceptChanges (monitor, result);
				}
			}
		}
コード例 #21
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _characterName = entity.ID;
     _emitter.Translate = entity.GetComponent<ITranslateComponent>();
     _emitter.HasRoom = entity.GetComponent<IHasRoom>();
 }
コード例 #22
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _transform = entity.GetComponent<ITranslateComponent>();
     _uiEvents = entity.GetComponent<IUIEvents>();
     _uiEvents.MouseDown.Subscribe(onMouseDown);
 }
コード例 #23
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     DropDownPanel = _uiFactory.GetPanel(entity.ID + "_Panel", new EmptyImage(1f, 1f), 0f, 0f);
     DropDownPanel.Visible = false;
     _tree = entity.GetComponent<IInObjectTree>();
 }
コード例 #24
0
ファイル: TowerEntity.cs プロジェクト: milesgray/resatiate
        public TowerEntity(ITile location, Texture2D texture, Color color,
            bool isBlocked, float layerDepth, IEntity owner)
            : base(location)
        {
            this.destinationRectangle = new Rectangle
            {
                X = location.Rectangle.X,
                Y = location.Rectangle.Y,
                Height = location.Rectangle.Height,
                Width = location.Rectangle.Width
            };
            this.enabled = true;
            this.isBlocked = true;
            this.texture = texture;
            this.color = color;
            this.layerDepth = layerDepth;

            this.owner = owner;

            this.timer = 5.0f;

            this.IsEnemy = false;
            this.Intensity = 70.0f;
            this.HP = 150;
            this.Damage = 100;
            this.attackRate = 50;
        }
コード例 #25
0
		string GetModifier(IEntity decoration)
		{
			StringBuilder builder = new StringBuilder();
			
			if (IncludeHtmlMarkup) {
				builder.Append("<i>");
			}
			
			if (decoration.IsStatic) {
				builder.Append("Shared ");
			}
			if (decoration.IsAbstract) {
				builder.Append("MustOverride ");
			} else if (decoration.IsSealed) {
				builder.Append("NotOverridable ");
			}
			if (decoration.IsVirtual) {
				builder.Append("Overridable ");
			} else if (decoration.IsOverride) {
				builder.Append("Overrides ");
			}
			if (decoration.IsNew) {
				builder.Append("Shadows ");
			}
			
			if (IncludeHtmlMarkup) {
				builder.Append("</i>");
			}
			
			return builder.ToString();
		}
コード例 #26
0
		/// <summary>
		/// Finds all references to the specified entity.
		/// The results are reported using the callback.
		/// FindReferences may internally use parallelism, and may invoke the callback on multiple
		/// threads in parallel.
		/// </summary>
		public static async Task FindReferencesAsync(IEntity entity, IProgressMonitor progressMonitor, Action<SearchedFile> callback)
		{
			if (entity == null)
				throw new ArgumentNullException("entity");
			if (progressMonitor == null)
				throw new ArgumentNullException("progressMonitor");
			if (callback == null)
				throw new ArgumentNullException("callback");
			SD.MainThread.VerifyAccess();
			if (SD.ParserService.LoadSolutionProjectsThread.IsRunning) {
				progressMonitor.ShowingDialog = true;
				MessageService.ShowMessage("${res:SharpDevelop.Refactoring.LoadSolutionProjectsThreadRunning}");
				progressMonitor.ShowingDialog = false;
				return;
			}
			double totalWorkAmount;
			List<ISymbolSearch> symbolSearches = PrepareSymbolSearch(entity, progressMonitor.CancellationToken, out totalWorkAmount);
			double workDone = 0;
			ParseableFileContentFinder parseableFileContentFinder = new ParseableFileContentFinder();
			foreach (ISymbolSearch s in symbolSearches) {
				progressMonitor.CancellationToken.ThrowIfCancellationRequested();
				using (var childProgressMonitor = progressMonitor.CreateSubTask(s.WorkAmount / totalWorkAmount)) {
					await s.FindReferencesAsync(new SymbolSearchArgs(childProgressMonitor, parseableFileContentFinder), callback);
				}
				
				workDone += s.WorkAmount;
				progressMonitor.Progress = workDone / totalWorkAmount;
			}
		}
コード例 #27
0
		public bool NavigateToEntity(IEntity entity)
		{
			if (entity == null)
				throw new ArgumentNullException("entity");
			
			// Get the underlying entity for generic instance members
			while ((entity is IMember) && ((IMember)entity).GenericMember != null)
				entity = ((IMember)entity).GenericMember;
			
			IClass declaringType = (entity as IClass) ?? entity.DeclaringType;
			if (declaringType == null)
				return false;
			// get the top-level type
			while (declaringType.DeclaringType != null)
				declaringType = declaringType.DeclaringType;
			
			ReflectionProjectContent rpc = entity.ProjectContent as ReflectionProjectContent;
			if (rpc != null) {
				string assemblyLocation = ILSpyController.GetAssemblyLocation(rpc);
				if (!string.IsNullOrEmpty(assemblyLocation) && File.Exists(assemblyLocation)) {
					NavigateTo(assemblyLocation, declaringType.DotNetName, ((AbstractEntity)entity).DocumentationTag);
					return true;
				}
			}
			return false;
		}
コード例 #28
0
    public EntityError Resolve(EntityManager em) {
      IsServerError = true;
      try {
        EntityType entityType = null;
        if (EntityTypeName != null) {
          var stName = StructuralType.ClrTypeNameToStructuralTypeName(EntityTypeName);
          entityType = MetadataStore.Instance.GetEntityType(stName);
          var ek = new EntityKey(entityType, KeyValues);
          Entity = em.FindEntityByKey(ek);
        }

        if (PropertyName != null) {
          PropertyName = MetadataStore.Instance.NamingConvention.ServerPropertyNameToClient(PropertyName);
        }
        if (Entity != null) {
          Property = entityType.GetProperty(PropertyName);
          var vc = new ValidationContext(this.Entity);
          vc.Property = this.Property;
          var veKey = (ErrorName ?? ErrorMessage) + (PropertyName ?? "");
          var ve = new ValidationError(null, vc, ErrorMessage, veKey);
          ve.IsServerError = true;
          this.Entity.EntityAspect.ValidationErrors.Add(ve);
        }
      } catch (Exception e) {
        ErrorMessage = ( ErrorMessage ?? "") + ":  Unable to Resolve this error: " + e.Message;
      }
      return this;
    }
コード例 #29
0
ファイル: Template.cs プロジェクト: BravoSierra/2sxc
        public Template(IEntity templateEntity)
        {
            if(templateEntity == null)
                throw new Exception("Template entity is null");

            _templateEntity = templateEntity;
        }
コード例 #30
0
		public override void OnAdded(IEntity parent)
		{
			if ( Burning && parent is Container )
				Douse();

			base.OnAdded( parent );
		}
コード例 #31
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendTargetEffect(IEntity target, int itemID, int duration, int hue, int renderMode)
 {
     SendTargetEffect(target, itemID, 10, duration, hue, renderMode);
 }
コード例 #32
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendBoltEffect(IEntity e, bool sound)
 {
     SendBoltEffect(e, sound, 0);
 }
コード例 #33
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendBoltEffect(IEntity e)
 {
     SendBoltEffect(e, true, 0);
 }
コード例 #34
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendMovingParticles(IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, int unknown)
 {
     SendMovingParticles(from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, (EffectLayer)255, unknown);
 }
コード例 #35
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendMovingParticles(IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int effect, int explodeEffect, int explodeSound, int unknown)
 {
     SendMovingParticles(from, to, itemID, speed, duration, fixedDirection, explodes, 0, 0, effect, explodeEffect, explodeSound, unknown);
 }
コード例 #36
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendMovingEffect(IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes)
 {
     SendMovingEffect(from, to, itemID, speed, duration, fixedDirection, explodes, 0, 0);
 }
コード例 #37
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int effect, EffectLayer layer, int unknown)
 {
     SendTargetParticles(target, itemID, speed, duration, 0, 0, effect, layer, unknown);
 }
コード例 #38
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendLocationParticles(IEntity e, int itemID, int speed, int duration, int effect, int unknown)
 {
     SendLocationParticles(e, itemID, speed, duration, 0, 0, effect, unknown);
 }
コード例 #39
0
 public ExitReachedEvent(IEntity exit, IEntity player)
 {
     Exit   = exit;
     Player = player;
 }
コード例 #40
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
 public static void SendTargetEffect(IEntity target, int itemID, int speed, int duration)
 {
     SendTargetEffect(target, itemID, speed, duration, 0, 0);
 }
コード例 #41
0
 public bool Remove(IEntity item)
 {
     throw new NotImplementedException();
 }
コード例 #42
0
ファイル: Effects.cs プロジェクト: cookiehhh/Cshape
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            if (e is Item)
            {
                ((Item)e).ProcessDelta();
            }
            else if (e is Mobile)
            {
                ((Mobile)e).ProcessDelta();
            }

            Packet preEffect = null, boltEffect = null, playSound = null;

            IPooledEnumerable eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    if (SendParticlesTo(state))
                    {
                        if (preEffect == null)
                        {
                            preEffect = Packet.Acquire(new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0));
                        }

                        state.Send(preEffect);
                    }

                    if (boltEffect == null)
                    {
                        boltEffect = Packet.Acquire(new BoltEffect(e, hue));
                    }

                    state.Send(boltEffect);

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = Packet.Acquire(new PlaySound(0x29, e));
                        }

                        state.Send(playSound);
                    }
                }
            }

            Packet.Release(preEffect);
            Packet.Release(boltEffect);
            Packet.Release(playSound);

            eable.Free();
        }
コード例 #43
0
 public void Add(IEntity item)
 {
     this.entities.Add(item);
 }
コード例 #44
0
        /// <summary>
        /// 从实体类填充数据到页面控件
        /// </summary>
        /// <param name="Controls"></param>
        /// <param name="entity"></param>
        public void AutoSelectIBForm(System.Windows.Forms.Form.ControlCollection Controls, IEntity entity)
        {
            List <IDataControl> IBControls = new List <IDataControl>();

            findIBControls(IBControls, Controls);

            AutoSelectIBFormInner(IBControls, entity);
        }
コード例 #45
0
 public void Delete(IEntity entity)
 {
     this.repository.Delete((ShootingLocation)entity);
     this.repository.Save();
 }
コード例 #46
0
 public bool Contains(IEntity item)
 {
     throw new NotSupportedException();
 }
コード例 #47
0
 /// <summary>
 /// 解除所有子实体。
 /// </summary>
 /// <param name="parentEntity">被解除的父实体。</param>
 public void DetachChildEntities(IEntity parentEntity)
 {
     DetachChildEntities(parentEntity, null);
 }
コード例 #48
0
 public OffsetTargetEffect(IEntity e, Point3D loc, int itemID, int speed, int duration, int hue, int renderMode)
     : base(EffectType.FixedFrom, e.Serial, Serial.Zero, itemID, loc, loc, speed, duration, true, false, hue, renderMode)
 {
 }
コード例 #49
0
 /// <summary>
 /// 附加子实体。
 /// </summary>
 /// <param name="childEntity">要附加的子实体。</param>
 /// <param name="parentEntity">被附加的父实体。</param>
 public void AttachEntity(IEntity childEntity, IEntity parentEntity)
 {
     AttachEntity(childEntity, parentEntity, null);
 }
コード例 #50
0
 public void Edit(IEntity entity)
 {
     this.repository.Edit((ShootingLocation)entity);
     this.repository.Save();
 }
コード例 #51
0
 /// <summary>
 /// 附加子实体。
 /// </summary>
 /// <param name="childEntityId">要附加的子实体的实体编号。</param>
 /// <param name="parentEntity">被附加的父实体。</param>
 public void AttachEntity(int childEntityId, IEntity parentEntity)
 {
     AttachEntity(childEntityId, parentEntity, null);
 }
コード例 #52
0
 /// <summary>
 /// 解除子实体。
 /// </summary>
 /// <param name="childEntity">要解除的子实体。</param>
 public void DetachEntity(IEntity childEntity)
 {
     DetachEntity(childEntity, null);
 }
コード例 #53
0
 public DropItemEventArgs(Item item, IEntity owner)
 {
     this.Item  = item;
     this.Owner = owner;
 }
コード例 #54
0
 /// <summary>
 /// 附加子实体。
 /// </summary>
 /// <param name="childEntity">要附加的子实体。</param>
 /// <param name="parentEntityId">被附加的父实体的实体编号。</param>
 public void AttachEntity(IEntity childEntity, int parentEntityId)
 {
     AttachEntity(childEntity, parentEntityId, null);
 }
コード例 #55
0
 public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot)
 {
     User = user;
     Slot = slot;
 }
コード例 #56
0
 /// <summary>
 /// 隐藏实体。
 /// </summary>
 /// <param name="entity">实体。</param>
 public void HideEntity(IEntity entity)
 {
     HideEntity(entity, null);
 }
コード例 #57
0
        public void DrawFieldOfView(IEntity entity, bool discoverUnexploredTiles = false)
        {
            // Check if there is a lightsource nearby, then explore all cells enlighted by it automatically
            var prevFov = entity.FieldOfViewRadius;

            entity.FieldOfViewRadius = Constants.Player.DiscoverLightsRadius;
            EntityManager.RecalculatFieldOfView(entity, false);

            // Get cells that emit light
            var cellsThatEmitLight = GridManager.Grid.GetCellsInFov(entity)
                                     .Where(a => a.LightProperties.EmitsLight && !a.CellProperties.IsExplored)
                                     .ToList();

            // Actual cells we see
            foreach (var lightCell in cellsThatEmitLight)
            {
                var cell = GetNonClonedCell(lightCell.Position.X, lightCell.Position.Y);
                cell.CellProperties.IsExplored = true;
                cell.IsVisible = true;
            }

            // Reset entity fov
            if (prevFov != entity.FieldOfViewRadius)
            {
                entity.FieldOfViewRadius = prevFov;
                EntityManager.RecalculatFieldOfView(entity, false);
            }

            for (int x = 0; x < GridSizeX; x++)
            {
                for (int y = 0; y < GridSizeY; y++)
                {
                    var cell = GetNonClonedCell(x, y);

                    if (discoverUnexploredTiles && !cell.CellProperties.IsExplored)
                    {
                        if (entity.FieldOfView.BooleanFOV[x, y])
                        {
                            cell.CellProperties.IsExplored = true;
                        }
                    }

                    // Cells near light sources are automatically visible
                    if (cell.LightProperties.Brightness > 0f && !cell.LightProperties.EmitsLight && !cell.CellProperties.IsExplored &&
                        cell.LightProperties.LightSources.Any(a => a.CellProperties.IsExplored))
                    {
                        cell.CellProperties.IsExplored = true;
                    }

                    cell.IsVisible = cell.CellProperties.IsExplored;

                    SetCellColors(cell);
                    SetCell(cell);
                }
            }

            // Redraw the map
            if (Map != null)
            {
                Map.Update();
            }
        }
コード例 #58
0
 public EquippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
 {
     User     = user;
     Equipped = equipped;
     Slot     = slot;
 }
コード例 #59
0
 public IEnumerable <EmberCell> GetExploredCellsInFov(IEntity entity, int fovRadius)
 {
     return(GetCellsInFov(entity, fovRadius).Where(cell => cell.CellProperties.IsExplored));
 }
コード例 #60
0
 /// <summary>
 /// 初始化 <see cref="EntityLazyloadException"/> 类的新实例。
 /// </summary>
 /// <param name="message">指定此异常的信息。</param>
 /// <param name="entity">当前的实体对象。</param>
 /// <param name="property">当前加载的属性。</param>
 public EntityLazyloadException(string message, IEntity entity, IProperty property)
     : base(message)
 {
     Entity = entity;
     Property = property;
 }