Esempio n. 1
0
        public void                                    Execute(  )
        {
            var entities = _contexts.main.GetGroup(MainMatcher.AllOf(MainMatcher.Comp, MainMatcher.PublicFieldsComp)).GetEntities(  );

            var entityIndexData = new List <EntityIndexData>(  );

            foreach (var ent in entities)
            {
                foreach (var field in ent.publicFieldsComp.Values)
                {
                    if (field.EntityIndexInfo == null)
                    {
                        continue;
                    }

                    entityIndexData.Add(field.EntityIndexInfo.EntityIndexData);
                }
            }

            var entsCustomIndex = _contexts.main.GetGroup(MainMatcher.CustomEntityIndexComp).GetEntities(  );

            foreach (var ent in entsCustomIndex)
            {
                entityIndexData.Add(ent.customEntityIndexComp.EntityIndexData);
            }

            if (entityIndexData.Count == 0)
            {
                return;
            }

            entityIndexData.Sort((a, b) => a.GetEntityIndexName(  ).CompareTo(b.GetEntityIndexName(  )));
            generateEntityIndices(entityIndexData.ToArray(  ));
        }
 protected override ICollector <Ent> GetTrigger(IContext <Ent> context)
 {
     return(context.CreateCollector(MainMatcher.AllOf(MainMatcher.Comp).NoneOf(MainMatcher.DontGenerateComp, MainMatcher.AlreadyImplementedComp, MainMatcher.EventListenerComp)));
 }
Esempio n. 3
0
 protected override ICollector <Ent> GetTrigger(IContext <Ent> context)
 {
     return(context.CreateCollector(MainMatcher.AllOf(MainMatcher.GeneratedFileComp).NoneOf(MainMatcher.Destroy)));
 }
Esempio n. 4
0
 protected override ICollector <Ent> GetTrigger(IContext <Ent> context)
 {
     return(context.CreateCollector(MainMatcher.AllOf(MainMatcher.Comp, MainMatcher.EventComp)));
 }
 protected override ICollector <Ent> GetTrigger(IContext <Ent> context)
 {
     return(context.CreateCollector(MainMatcher.AllOf(MainMatcher.ContextNamesComp).NoneOf(MainMatcher.DontGenerateComp)));
 }
 public PostProcWriteGenPathsToCsprojSystem(Contexts contexts) : base(contexts.settings)
 {
     _contexts       = contexts;
     _generatedGroup = contexts.main.GetGroup(MainMatcher.AllOf(MainMatcher.GeneratedFileComp).NoneOf(MainMatcher.Destroy));
 }
Esempio n. 7
0
        protected override void                                    Execute(List <Ent> entities)
        {
            var types = _contexts.main.reflectionLoadableTypes.Values;

            var typeTodEntIndexData = new Dictionary <String, List <EntityIndexData> >(  );
            var entityIndexDatas    = GetData(types);

            foreach (var data in entityIndexDatas)
            {
                var key = data.GetComponentType(  );
                if (!typeTodEntIndexData.ContainsKey(key))
                {
                    typeTodEntIndexData[key] = new List <EntityIndexData>(  );
                }
                typeTodEntIndexData[key].Add(data);
            }

            var compEnts = _contexts.main.GetGroup(MainMatcher.AllOf(MainMatcher.Comp, MainMatcher.PublicFieldsComp)).GetEntities(  );

            foreach (var ent in compEnts)
            {
                var compTypeName = ent.comp.FullTypeName;
                if (!typeTodEntIndexData.ContainsKey(compTypeName))
                {
                    continue;
                }

                var entIndexDatas = typeTodEntIndexData[ent.typeComp.Value.ToCompilableString(  )];
                var publicFields  = ent.publicFieldsComp.Values;

                foreach (var entityIndexData in entIndexDatas)
                {
                    foreach (var field in publicFields)
                    {
                        if (entityIndexData.GetMemberName(  ) != field.FieldName)
                        {
                            continue;
                        }
                        var entIndexInfo = new EntityIndexInfo(  );
                        field.EntityIndexInfo = entIndexInfo;
                        var isCustom = entityIndexData.IsCustom(  );

                        entIndexInfo.EntityIndexData = entityIndexData;
                        entIndexInfo.Type            = entityIndexData.GetEntityIndexType(  );
                        entIndexInfo.IsCustom        = isCustom;
                        entIndexInfo.CustomMethods   = isCustom ? entityIndexData.GetCustomMethods(  ) : null;
                        entIndexInfo.Name            = entityIndexData.GetEntityIndexName(  );
                        entIndexInfo.ContextNames    = entityIndexData.GetContextNames(  );
                        entIndexInfo.ComponentType   = entityIndexData.GetComponentType(  );
                        entIndexInfo.MemberType      = entityIndexData.GetKeyType(  );
                        entIndexInfo.MemberName      = entityIndexData.GetMemberName(  );
                        entIndexInfo.HasMultple      = entityIndexData.GetHasMultiple(  );
                    }
                }

                ent.ReplacePublicFieldsComp(publicFields);
            }

            var customEntityIndexDatas = GetCustomData(types);

            foreach (var data in customEntityIndexDatas)
            {
                var ent = _contexts.main.CreateEntity(  );
                ent.AddCustomEntityIndexComp(data);
            }
        }