public void Initialize(ManagedExecutionSystem system)
        {
            int groupCount = system.ExecutionGroups.Count;

            _executionGroups   = new ManagedExecutionGroup[groupCount];
            _updateGroups      = new RuntimeGroup[groupCount];
            _fixedUpdateGroups = new RuntimeGroup[groupCount];

            for (int i = 0; i < groupCount; i++)
            {
                List <ManagedUpdatesBehaviour> updateList      = new List <ManagedUpdatesBehaviour>();
                List <ManagedUpdatesBehaviour> fixedUpdateList = new List <ManagedUpdatesBehaviour>();

                ManagedExecutionGroup currentGroup = system.ExecutionGroups[i];

                currentGroup.TraverseForType(
                    UpdateType.Normal,
                    (c) => { updateList.Add(c); }
                    );

                currentGroup.TraverseForType(
                    UpdateType.Fixed,
                    (c) => { fixedUpdateList.Add(c); }
                    );

                _executionGroups[i]   = currentGroup;
                _updateGroups[i]      = new RuntimeGroup(updateList.ToArray());
                _fixedUpdateGroups[i] = new RuntimeGroup(fixedUpdateList.ToArray());
            }
        }
        public FakeEnvironment(params string[] executionGroupNames)
        {
            int groupCount = executionGroupNames.Length;

            if (groupCount == 0)
            {
                throw new System.ArgumentException($"{nameof(FakeEnvironment)} must have at least one execution group.");
            }

            var executionGroups = new ManagedExecutionGroup[groupCount];
            var groupLookup     = new Dictionary <string, ManagedExecutionGroup>(groupCount);

            for (int i = 0; i < groupCount; i++)
            {
                var currentGroup = executionGroups[i] = ScriptableObject.CreateInstance <ManagedExecutionGroup>();
                groupLookup.Add(executionGroupNames[i], currentGroup);
            }
            this.executionGroups = new ReadOnlyDictionary <string, ManagedExecutionGroup>(groupLookup);

            system = ScriptableObject.CreateInstance <ManagedExecutionSystem>();
            system.SetExecutionGroups(executionGroups);

            _runtimeController         = new GameObject("Runtime Controller").AddComponent <TestManagedUpdatesSceneController>();
            _runtimeController.enabled = false;
        }
        private void OnEnable()
        {
            _target          = (ManagedExecutionSystem)target;
            _executionGroups = new ReorderableList(
                serializedObject,
                serializedObject.FindProperty(nameof(_executionGroups)),
                true,
                true,
                true,
                true
                );

            _executionGroups.drawHeaderCallback = (
                rect =>
            {
                EditorGUI.LabelField(rect, "Execution Order", EditorStyles.boldLabel);
            }
                );

            _executionGroups.drawElementCallback = (
                (Rect rect, int index, bool isActive, bool isFocused) =>
            {
                var element = _executionGroups.serializedProperty.GetArrayElementAtIndex(index);
                EditorGUI.ObjectField(
                    new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight),
                    element,
                    GUIContent.none
                    );
            }
                );

            _executionGroups.onChangedCallback = (
                rect =>
            {
                _isDirty = true;
            }
                );

            SetLastSavedExecutionOrderToCurrent();

            _runtimeGroupVisibility      = new bool[_executionGroups.count];
            _runtimeGroupScrollPositions = new Vector2[_executionGroups.count];

            _latestData = ScriptableObject.CreateInstance <ManagedExecutionSystem_RuntimeDisplayData>();

            EditorApplication.update += OnUpdate;
        }
 public void TearDown()
 {
     Object.Destroy(_system);
     _system = null;
 }
 public void SetUp()
 {
     _system = ScriptableObject.CreateInstance <ManagedExecutionSystem>();
 }