示例#1
0
        private string GetMessageForGroupComponent()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append($"	Missing group component={this.groupComponent.Name}
	"    );
            foreach (Entity entity in this.entitiesWithMissingGroupComponentByEntity)
            {
                builder.Append($"	Entity={EcsToStringUtil.ToString(entity)}");
                builder.Append("\n\t");
            }
            return(builder.ToString());
        }
示例#2
0
 protected string GetLogHeader() =>
 "\nSkipped: " + EcsToStringUtil.ToString(this.handler) + "\n";
示例#3
0
        public static string GetSkipReasonDetails(Handler handler, ArgumentNode fromArgumentNode, ArgumentNode toArgumentNode, Optional <JoinType> join)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("{0} was skiped, because {1} not found ", handler.Name, toArgumentNode.argument.ClassInstanceDescription.NodeClass.FullName);
            GroupComponent component = null;

            if (join.IsPresent() && (!(join.Get() is JoinAllType) && (fromArgumentNode.entityNodes.Count > 0)))
            {
                Entity entity = fromArgumentNode.entityNodes[0].entity;
                Type   type   = join.Get().ContextComponent.Get();
                if (entity.HasComponent(type))
                {
                    component = (GroupComponent)entity.GetComponent(type);
                }
            }
            Entity      entity2    = null;
            List <Type> components = new List <Type>();
            List <Type> list2      = new List <Type>();
            int         num        = 0;

            foreach (Entity entity3 in ((EngineServiceImpl)Engine).EntityRegistry.GetAllEntities())
            {
                int         num2       = 0;
                List <Type> collection = new List <Type>();
                List <Type> list4      = new List <Type>();
                collection.Clear();
                list4.Clear();
                foreach (Type type2 in toArgumentNode.argument.NodeDescription.Components)
                {
                    if (!entity3.HasComponent(type2))
                    {
                        list4.Add(type2);
                        continue;
                    }
                    Component component2 = entity3.GetComponent(type2);
                    if ((component != null) && ReferenceEquals(component2.GetType(), component.GetType()))
                    {
                        if (!((GroupComponent)component2).Key.Equals(component.Key))
                        {
                            continue;
                        }
                        num2++;
                    }
                    num2++;
                    collection.Add(type2);
                }
                if (num2 > num)
                {
                    num        = num2;
                    entity2    = entity3;
                    components = new List <Type>(collection);
                    list2      = new List <Type>(list4);
                }
            }
            if (entity2 != null)
            {
                builder.AppendFormat("\n Best node was {0} , presentComponents {1}, absentComponents {2} ", entity2, EcsToStringUtil.ToString(components), EcsToStringUtil.ToString(list2));
            }
            return(builder.ToString());
        }
示例#4
0
        public IllegalCombineException(Handler handler, ArgumentNode argumentNode) : base($"Expected one entity, but found more:
 handler {EcsToStringUtil.ToString(handler)}, argument {handler.Method.GetParameters()[argumentNode.argument.NodeNumber + 1].Name}, entities [{GetEntities(argumentNode)}]")
        {
        }