Beispiel #1
0
        public void OnEnable()
        {
            var container = new VisualElement();

            container.styleSheets.Add(EditorUtilities.Load <StyleSheet>("Editor/Tools/Styles.uss", isRequired: true));

            var view = new TestsView(() => {
                var collectedComponents = new List <TestItem>();
                var asms = System.AppDomain.CurrentDomain.GetAssemblies();
                foreach (var asm in asms)
                {
                    var types = asm.GetTypes();
                    foreach (var type in types)
                    {
                        if (type.IsValueType == true &&
                            typeof(ME.ECS.IStructComponent).IsAssignableFrom(type) == true &&
                            typeof(ME.ECS.ICopyableBase).IsAssignableFrom(type) == false &&
                            typeof(ME.ECS.IComponentStatic).IsAssignableFrom(type) == false &&
                            type.IsGenericType == false &&
                            type.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).Length > 0)
                        {
                            collectedComponents.Add(new TestItem()
                            {
                                type  = type,
                                tests = new [] {
                                    new TestInfo(TestMethod.DirectCopy),
                                },
                            });
                        }
                    }
                }

                return(collectedComponents.OrderBy(x => x.type.Name).ToList());
            }, true);

            this.view = view;
            container.Add(view);

            this.rootVisualElement.Add(container);
        }
        public void OnEnable()
        {
            var container = new VisualElement();

            container.styleSheets.Add(EditorUtilities.Load <StyleSheet>("Editor/Tools/Styles.uss", isRequired: true));

            var view = new TestsView(() => {
                var collectedComponents = new List <TestItem>();
                var asms = System.AppDomain.CurrentDomain.GetAssemblies();
                foreach (var asm in asms)
                {
                    var types = asm.GetTypes();
                    foreach (var type in types)
                    {
                        if (type.IsValueType == true && typeof(ME.ECS.ICopyableBase).IsAssignableFrom(type) == true)
                        {
                            collectedComponents.Add(new TestItem()
                            {
                                type  = type,
                                tests = new [] {
                                    new TestInfo(TestMethod.CopyFrom),
                                    new TestInfo(TestMethod.Recycle),
                                },
                            });
                        }
                    }
                }

                return(collectedComponents.OrderBy(x => x.type.Name).ToList());
            }, true);

            this.view = view;
            container.Add(view);

            this.rootVisualElement.Add(container);
        }
        public void OnEnable()
        {
            var container = new VisualElement();

            container.styleSheets.Add(EditorUtilities.Load <StyleSheet>("Editor/Tools/Styles.uss", isRequired: true));

            var view = new TestsView(() => {
                var collectedComponents = new List <TestItem>();
                collectedComponents.Add(new TestItem()
                {
                    type  = typeof(ME.ECS.StructComponentsContainer),
                    tests = new [] {
                        new TestInfo(TestMethod.CopyFrom),
                        new TestInfo(TestMethod.Recycle),
                    },
                });
                #if FILTERS_STORAGE_LEGACY
                collectedComponents.Add(new TestItem()
                {
                    type  = typeof(ME.ECS.Storage),
                    tests = new [] {
                        new TestInfo(TestMethod.CopyFrom),
                        new TestInfo(TestMethod.Recycle),
                    },
                });
                collectedComponents.Add(new TestItem()
                {
                    type  = typeof(ME.ECS.FilterBurstData),
                    tests = new [] {
                        new TestInfo(TestMethod.CopyFrom),
                    },
                });
                collectedComponents.Add(new TestItem()
                {
                    type  = typeof(ME.ECS.FiltersStorage),
                    tests = new [] {
                        new TestInfo(TestMethod.CopyFrom),
                        new TestInfo(TestMethod.Recycle),
                    },
                });
                #else
                collectedComponents.Add(new TestItem()
                {
                    type  = typeof(ME.ECS.FiltersArchetype.FiltersArchetypeStorage),
                    tests = new [] {
                        new TestInfo(TestMethod.CopyFrom),
                        new TestInfo(TestMethod.Recycle),
                    },
                });
                #endif
                collectedComponents.Add(new TestItem()
                {
                    type  = this.FindType(typeof(ME.ECS.World)),
                    tests = new [] {
                        new TestInfo(TestMethod.Recycle),
                    },
                });
                var states = this.FindTypes(typeof(ME.ECS.State));
                foreach (var state in states)
                {
                    collectedComponents.Add(new TestItem()
                    {
                        type  = state,
                        tests = new [] {
                            new TestInfo(TestMethod.CopyFrom),
                            new TestInfo(TestMethod.Recycle),
                        },
                    });
                }

                return(collectedComponents);
            }, false);

            this.view = view;
            container.Add(view);

            this.rootVisualElement.Add(container);
        }