Пример #1
0
        void OnRunSystemsGUI(EcsSystems systems)
        {
            var runList = _runList.Count > 0 ? _runList.Pop() : null;
            var count   = systems.GetRunSystems(ref runList);

            if (count > 0)
            {
                EditorGUI.indentLevel++;
                for (var i = 0; i < count; i++)
                {
                    var asSystems = runList[i] as EcsSystems;
                    var name      = asSystems != null ? asSystems.Name : runList[i].GetType().Name;
                    systems.DisabledInDebugSystems[i] = !EditorGUILayout.ToggleLeft(name, !systems.DisabledInDebugSystems[i]);
                    if (asSystems != null)
                    {
                        GUI.enabled = !systems.DisabledInDebugSystems[i];
                        OnRunSystemsGUI(asSystems);
                        if (systems.DisabledInDebugSystems[i])
                        {
                            GUI.enabled = true;
                        }
                    }
                    runList[i] = null;
                }
                EditorGUI.indentLevel--;
            }
            _runList.Push(runList);
        }
        void IEcsRunSystem.Run()
        {
            if (!_filter.IsEmpty())
            {
                return;
            }

            var runSystems = _systems.GetRunSystems();

            for (int i = 0; i < runSystems.Count; i++)
            {
                _systems.SetRunSystemState(i, false);
            }
        }
Пример #3
0
        void OnRunSystemsGUI(EcsSystems systemsGroup)
        {
            var systems = systemsGroup.GetRunSystems();

            EditorGUI.indentLevel++;
            for (var i = 0; i < systems.Count; i++)
            {
                var    runItem   = systems.Items[i];
                var    asSystems = runItem.System as EcsSystems;
                string systemName;
                var    type = runItem.System.GetType();
                if (asSystems != null)
                {
                    systemName = $"[{type.Name}]";
                }
                else
                {
                    systemName = type.Name;
                    if (type.IsGenericType)
                    {
                        var tilda = systemName.IndexOf('`');
                        if (tilda > 0)
                        {
                            systemName = systemName.Remove(tilda);
                        }
                        systemName += "<";
                        var args = type.GetGenericArguments();
                        for (var ii = 0; ii < args.Length; ii++)
                        {
                            // systemName += $",{args[ii].Name}";
                            systemName += ii == 0 ? args[ii].Name : $",{args[ii].Name}";
                        }
                        systemName += ">";
                    }
                }
                runItem.Active = EditorGUILayout.ToggleLeft(systemName, runItem.Active);
                if (asSystems != null && runItem.Active)
                {
                    OnRunSystemsGUI(asSystems);
                }
            }
            EditorGUI.indentLevel--;
        }