コード例 #1
0
        /// <summary>
        /// Re-catigorize the entity to keep system entity collections up to date and organized.
        /// </summary>
        public void OnEntityChange(int eid)
        {
            Entity entity = this.caboodle.Entities.Get(eid);

            for (int i = 0; i < all_systems.Count; i++)
            {
                var systemMask = all_systems[i].mask;

                // match entity mask and system mask
                if (AspectMatcher.Match(all_systems[i].processor.Aspect, entity.mask, systemMask) && entity.Active)
                {
                    // If the system does not have the entity then add it
                    if (!entityCache.Get(i).Has(entity.Id))
                    {
                        entityCache.Get(i).Set(entity.Id, entity);
                        all_systems[i].entities.Add(entity.Id, entity);
                    }
                }
                // The entity does not belong in its collection of entities
                else
                {
                    // Check if there is an entry
                    if (entityCache.Has(i))
                    {
                        // Remove the entity from the systems collection if it exists
                        if (entityCache.Get(i).Has(entity.Id))
                        {
                            all_systems[i].entities.Remove(entity.Id);
                            entityCache.Get(i).Remove(entity.Id);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public TypeNode(Type type, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
            : base(type.FullName)
        {
            this.type            = type;
            this.model           = model;
            this.aspectMatcher   = aspectMatcher;
            this.pointcutMatcher = pointcutMatcher;

            this.ImageIndex         = 1;
            this.SelectedImageIndex = 1;

            ArrayList aspects = null;

            if (model != null)
            {
                aspects = (ArrayList)aspectMatcher.MatchAspectsForType(type, model.Aspects);

                foreach (PresentationAspect aspect in aspects)
                {
                    aspect.AppliedOnTypes.Add(type);
                }

                if (aspects.Count > 0)
                {
                    this.ImageIndex         = 9;
                    this.SelectedImageIndex = 9;
                }

                //Order is important....
                //aspects.Sort(new AspectComparer());
                foreach (IGenericAspect aspect in aspects)
                {
                    TreeNode aspectNode = new AspectNode(aspect);
                    this.Nodes.Add(aspectNode);
                }
            }

            ArrayList ctors = new ArrayList(type.GetConstructors());

            ctors.Sort(new MethodComparer());
            foreach (MethodBase method in ctors)
            {
                TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                this.Nodes.Add(methodNode);
            }

            ArrayList methods = new ArrayList(type.GetMethods());

            methods.Sort(new MethodComparer());
            foreach (MethodBase method in methods)
            {
                if (!method.IsStatic)
                {
                    TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                    this.Nodes.Add(methodNode);
                }
            }
        }
コード例 #3
0
        public AssemblyNode(Assembly assembly, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
            : base(assembly.GetName().Name)
        {
            this.Assembly = assembly;

            ArrayList types = new ArrayList(assembly.GetTypes());

            types.Sort(new TypeComparer());
            foreach (Type type in types)
            {
                if (type.IsClass)
                {
                    TreeNode node = new TypeNode(type, model, aspectMatcher, pointcutMatcher);
                    this.Nodes.Add(node);
                }
            }
        }
コード例 #4
0
        public AssemblyListNode(IList assemblies, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
            : base("Assemblies")
        {
            this.assemblies      = assemblies;
            this.model           = model;
            this.aspectMatcher   = aspectMatcher;
            this.pointcutMatcher = pointcutMatcher;

            this.ImageIndex         = 12;
            this.SelectedImageIndex = 12;

            ArrayList sortedAssemblies = new ArrayList(assemblies);

            sortedAssemblies.Sort(new AssemblyComparer());
            foreach (Assembly asm in sortedAssemblies)
            {
                this.Nodes.Add(new AssemblyNode(asm, model, aspectMatcher, pointcutMatcher));
            }
        }
コード例 #5
0
        public static void SetupAspectTreeView(TreeView treeView, IList assemblies, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
        {
            treeView.Nodes.Clear();

            treeView.Nodes.Add(new ConfigurationNode(model));
        }
コード例 #6
0
        public static void SetupProjectTreeView(TreeView treeView, IList assemblies, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
        {
            treeView.Nodes.Clear();

            AssemblyListNode node = new AssemblyListNode(assemblies, model, aspectMatcher, pointcutMatcher);

            treeView.Nodes.Add(node);
        }