예제 #1
0
        void DrawSystemInfo(int index, EntitySystemInfo info)
        {
            var defaultColor  = GUI.color;
            var disabledColor = GUI.color;

            disabledColor.a = .5f;

            if (info == null || info.System == null)
            {
                refreshSearch = true;
                return;
            }

            if (!info.System.isActiveAndEnabled)
            {
                GUI.color = disabledColor;
            }

            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox, GUILayout.Width(Screen.width - 48f));

            info.ShowInfo = EditorGUI.Foldout(GUILayoutUtility.GetRect(8f, 16f), info.ShowInfo, "");

            // var buttonStyle = new GUIStyle("label");
            //buttonStyle.contentOffset = new Vector2(0, -2f);

            var content = new GUIContent(string.Format("{0} : {1}", index, DisplayStringWithSpaces(info.System.GetType().ToString())), info.System.Tooltip());            // "Execution Order and Name of System\nClick to Hightlight System in Heirachy");

            info.System.enabled = EditorGUILayout.Toggle(info.System.enabled);
            if (GUILayout.Button(content, GUI.skin.label, GUILayout.Width(Screen.width - 160f), GUILayout.Height(16f)))
            {
                EditorGUIUtility.PingObject(info.System);
            }

            if (info.isUpdateSystem || info.isFixedUpdateSystem)
            {
                EditorGUILayout.LabelField(new GUIContent(string.Format("| {0:F2} ms", info.UpdateTime + info.FixedUpdateTime), "How long it system takes to complete all update and fixed updates"), GUILayout.MaxWidth(72f));
            }
            else
            {
                EditorGUILayout.LabelField("", GUILayout.MaxWidth(72f));
            }

            EditorGUILayout.EndHorizontal();
            EditorGUI.indentLevel++;
            if (info.ShowInfo)
            {
                if (info.isUpdateSystem)
                {
                    info.showUpdate = EditorGUILayout.Foldout(info.showUpdate, new GUIContent(string.Format("Update Groups: {0:F2} ms", info.UpdateTime), "List of all Groups currently updated by system and how long it takes to update"));
                }
                if (info.showUpdate)
                {
                    foreach (var type in info.UpdateTypes)
                    {
                        EditorGUILayout.LabelField(new GUIContent(string.Format("{0} Entities : {1}", manager.groupLookup[type].Count, type.ToString().Remove(0, 19)), "Entities Currently in Group and Group Type"));
                    }
                }

                if (info.isFixedUpdateSystem)
                {
                    info.showFixedUpdate = EditorGUILayout.Foldout(info.showFixedUpdate, new GUIContent(string.Format("Fixed Update Groups: {0:F2} ms", info.FixedUpdateTime), "List of all Groups currently fixed updated by system and how long it takes to update"));
                }
                if (info.showFixedUpdate)
                {
                    foreach (var type in info.FixedUpdateTypes)
                    {
                        EditorGUILayout.LabelField(new GUIContent(string.Format("{0} Entities : {1}", manager.groupLookup[type].Count, type.ToString().Remove(0, 19)), "Entities Currently in Group and Group Type"));
                    }
                }
                if (info.EntityEvents.Count > 0)
                {
                    info.showEntityEvents = EditorGUILayout.Foldout(info.showEntityEvents, new GUIContent("Entity Events", "List of Entity Event callbacks implemented by this system"));
                }
                if (info.showEntityEvents)
                {
                    foreach (var type in info.EntityEvents)
                    {
                        EditorGUILayout.LabelField(string.Format("{0}", type.ToString()));
                    }
                }
                if (info.SystemEvents.Count > 0)
                {
                    info.showSystemEvents = EditorGUILayout.Foldout(info.showSystemEvents, new GUIContent("System Events", "List of System Event callbacks implement by this system"));
                }
                if (info.showSystemEvents)
                {
                    foreach (var type in info.SystemEvents)
                    {
                        EditorGUILayout.LabelField(string.Format("{0}", type.ToString()));
                    }
                }
                if (info.AddGroupEvents.Count > 0)
                {
                    info.showAddGroupEvents = EditorGUILayout.Foldout(info.showAddGroupEvents, new GUIContent("Enable Group Events", "List of all add group events implemented by this system"));
                }
                if (info.showAddGroupEvents)
                {
                    foreach (var type in info.AddGroupEvents)
                    {
                        EditorGUILayout.LabelField(type.ToString().Remove(0, 19));
                    }
                }
                if (info.RemoveGroupEvents.Count > 0)
                {
                    info.showRemoveGroupEvents = EditorGUILayout.Foldout(info.showRemoveGroupEvents, new GUIContent("Disable Group Events", "List of all remove group events implemented by this system"));
                }
                if (info.showRemoveGroupEvents)
                {
                    foreach (var type in info.RemoveGroupEvents)
                    {
                        EditorGUILayout.LabelField(type.ToString().Remove(0, 19));
                    }
                }
            }

            EditorGUI.indentLevel--;
            GUI.color = defaultColor;
        }
예제 #2
0
 public SearchFilter(int order, EntitySystemInfo info)
 {
     this.order = order;
     this.info  = info;
 }