Exemplo n.º 1
0
        public void SystemInclusionList_IgnoresSubtractedComponents()
        {
            World.Active.GetOrCreateSystem <ExcludeSystem>();

            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            var matchList = new List <Tuple <ComponentSystemBase, List <EntityQuery> > >();

            WorldDebuggingTools.MatchEntityInEntityQueries(World.Active, entity, matchList);

            Assert.AreEqual(0, matchList.Count);
        }
Exemplo n.º 2
0
        public void SystemInclusionList_IgnoresSubtractedComponents()
        {
            var system = World.Active.GetOrCreateManager <SubtractiveSystem>();

            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            var matchList = new List <Tuple <ScriptBehaviourManager, List <ComponentGroup> > >();

            WorldDebuggingTools.MatchEntityInComponentGroups(World.Active, entity, matchList);

            Assert.AreEqual(0, matchList.Count);
        }
Exemplo n.º 3
0
        public void OnGUI(World world, Entity entity)
        {
            ++EditorGUI.indentLevel;
            GUILayout.BeginVertical(GUI.skin.box);
            showSystems = EditorGUILayout.Foldout(showSystems, "Used by Systems");

            if (showSystems)
            {
                if (repainted == true)
                {
                    cachedMatches.Clear();
                    WorldDebuggingTools.MatchEntityInComponentGroups(world, entity, cachedMatches);
                    foreach (var pair in cachedMatches)
                    {
                        foreach (var componentGroup in pair.Item2)
                        {
                            if (!cachedControls.ContainsKey(componentGroup))
                            {
                                cachedControls.Add(componentGroup, new ComponentGroupGUIControl(componentGroup.Types, false));
                            }
                        }
                    }
                    repainted = false;
                }

                foreach (var pair in cachedMatches)
                {
                    var type = pair.Item1.GetType();
                    GUILayout.Label(new GUIContent(type.Name, type.AssemblyQualifiedName));
                    ++EditorGUI.indentLevel;
                    foreach (var componentGroup in pair.Item2)
                    {
                        cachedControls[componentGroup].OnGUILayout(EditorGUIUtility.currentViewWidth - 60f);
                        if (GUILayout.Button("Show", GUILayout.ExpandWidth(false)))
                        {
                            EntityDebugger.SetAllSelections(world, pair.Item1 as ComponentSystemBase, new EntityListQuery(componentGroup), entity);
                        }
                    }

                    --EditorGUI.indentLevel;
                }

                if (Event.current.type == EventType.Repaint)
                {
                    repainted = true;
                }
            }
            GUILayout.EndVertical();

            --EditorGUI.indentLevel;
        }
Exemplo n.º 4
0
        public void SystemInclusionList_MatchesComponents()
        {
            var system = World.Active.GetOrCreateManager <RegularSystem>();

            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            var matchList = new List <Tuple <ScriptBehaviourManager, List <ComponentGroup> > >();

            WorldDebuggingTools.MatchEntityInComponentGroups(World.Active, entity, matchList);

            Assert.AreEqual(1, matchList.Count);
            Assert.AreEqual(system, matchList[0].Item1);
            Assert.AreEqual(system.ComponentGroups[0], matchList[0].Item2[0]);
        }
Exemplo n.º 5
0
        public void SystemInclusionList_MatchesComponents()
        {
            var system = World.GetOrCreateSystem <RegularSystem>();

            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            var matchList = new List <Tuple <ComponentSystemBase, List <EntityQuery> > >();

            WorldDebuggingTools.MatchEntityInEntityQueries(World.DefaultGameObjectInjectionWorld, entity, matchList);

            Assert.AreEqual(1, matchList.Count);
            Assert.AreEqual(system, matchList[0].Item1);
            Assert.AreEqual(system.EntityQueries[0], matchList[0].Item2[0]);
        }