コード例 #1
0
ファイル: SkipLog.cs プロジェクト: radiomonter/Tanki_X
 private void PrintContextEntities(StringBuilder o)
 {
     o.Append("\tContext entities:");
     foreach (Entity entity in this.contextEntities)
     {
         NewLine(o);
         o.Append("\t" + EcsToStringUtil.ToStringWithComponents((EntityInternal)entity));
     }
 }
コード例 #2
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());
        }
コード例 #3
0
        public static string Build(bool detailInfo = false)
        {
            StringBuilder builder = new StringBuilder();

            foreach (Entity entity in (EngineService == null) ? new List <Entity>() : EngineService.EntityRegistry.GetAllEntities())
            {
                if (!EngineService.EntityStub.Equals(entity))
                {
                    builder.Append($"[Entity: Id={entity.Id}, Name={entity.Name}]
");
                    EntityInternal internal2 = (EntityInternal)entity;
                    foreach (Component component in !(internal2 is EntityStub) ? internal2.Components : new List <Component>())
                    {
                        builder.Append("[Component: ");
                        builder.Append(!detailInfo ? component.GetType().Name : EcsToStringUtil.ToStringWithProperties(component, ", "));
                        builder.Append("]\n");
                    }
                }
            }
            return(builder.ToString());
        }
コード例 #4
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());
        }
コード例 #5
0
ファイル: SkipLog.cs プロジェクト: radiomonter/Tanki_X
 protected string GetLogHeader() =>
 "\nSkipped: " + EcsToStringUtil.ToString(this.handler) + "\n";
コード例 #6
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)}]")
        {
        }