protected override void DrawOnlyForPrabInScene()
        {
            base.DrawOnlyForPrabInScene();

            EditorLayout.BeginVerticalBox();
            {
                EditorGUILayout.LabelField("Transition status", EditorStyles.boldLabel);

                EditorLayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Total transitions: " + CallObject.TransitionCount);
                }
                EditorLayout.EndHorizontal();

                /*
                 * if (CallObject.InTransition)
                 * {
                 *  string status =
                 *      "RUNNING (" +
                 *      (CallObject.Fading ? "Fading" : "Brightening") +
                 *      ") - " +
                 *      Mathf.RoundToInt(CallObject.TransitionPercent * 100) +
                 *      "%"
                 *  ;
                 *  EditorLayout.BeginHorizontal();
                 *  {
                 *      EditorGUILayout.LabelField(status);
                 *  }
                 *  EditorLayout.EndHorizontal();
                 * }
                 */
            }
            EditorLayout.EndVertical();
        }
コード例 #2
0
        protected override void DrawOnlyForPrabInScene()
        {
            base.DrawOnlyForPrabInScene();

            EditorLayout.BeginVerticalBox();
            {
                EditorLayout.BeginHorizontal();
                {
                    string status      = CallObject.Pause ? "Resume" : "Pause";
                    var    buttonStyle = new GUIStyle(GUI.skin.button);

                    if (GUILayout.Button(status, buttonStyle, GUILayout.Width(50)))
                    {
                        CallObject.Pause = !CallObject.Pause;
                    }

                    if (GUILayout.Button("Restart", buttonStyle, GUILayout.Width(50)))
                    {
                        CallObject.RestartCurrentLevel();
                    }
                }
                EditorLayout.EndHorizontal();
            }
            EditorLayout.EndVertical();
        }
コード例 #3
0
        public static void DrawComponents(IEntity entity)
        {
            var unfoldedComponents    = getUnfoldedComponents(entity);
            var componentMemberSearch = getComponentMemberSearch(entity);

            EditorLayout.BeginVerticalBox();
            {
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Components (" + entity.GetComponents().Length + ")", EditorStyles.boldLabel);
                    if (EditorLayout.MiniButtonLeft("▸"))
                    {
                        for (int i = 0; i < unfoldedComponents.Length; i++)
                        {
                            unfoldedComponents[i] = false;
                        }
                    }

                    if (EditorLayout.MiniButtonRight("▾"))
                    {
                        for (int i = 0; i < unfoldedComponents.Length; i++)
                        {
                            unfoldedComponents[i] = true;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                var index = drawAddComponentMenu(entity);
                if (index >= 0)
                {
                    var componentType = entity.contextInfo.componentTypes[index];
                    var component     = entity.CreateComponent(index, componentType);
                    entity.AddComponent(index, component);
                }

                EditorGUILayout.Space();

                componentNameSearchString = EditorLayout.SearchTextField(componentNameSearchString);

                EditorGUILayout.Space();

                var indices    = entity.GetComponentIndices();
                var components = entity.GetComponents();
                for (int i = 0; i < components.Length; i++)
                {
                    DrawComponent(unfoldedComponents, componentMemberSearch, entity, indices[i], components[i]);
                }
            }
            EditorLayout.EndVerticalBox();
        }
コード例 #4
0
        protected override void DrawOnlyForPrabInScene()
        {
            base.DrawOnlyForPrabInScene();

            AudioClip currentAudioClip = CallObject.CurrentAudioClip;

            EditorLayout.BeginVerticalBox();
            {
                EditorGUILayout.LabelField("Music manager", EditorStyles.boldLabel);

                EditorLayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Total songs: " + CallObject.MusicPlaylistList.Count);
                }
                EditorLayout.EndHorizontal();

                EditorLayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Current song: " + currentAudioClip.name);
                }
                EditorLayout.EndHorizontal();

                EditorLayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField(Utility.ConvertTimeToString(CallObject.AudioSource.time) + " / " + Utility.ConvertTimeToString(currentAudioClip.length));
                }
                EditorLayout.EndHorizontal();

                EditorLayout.BeginHorizontal();
                {
                    var buttonStyle = new GUIStyle(GUI.skin.button);
                    if (GUILayout.Button("Play", buttonStyle, GUILayout.Width(50)))
                    {
                        CallObject.Play();
                    }
                    if (GUILayout.Button(CallObject.IsPaused() ? "UnPause" : "Pause", buttonStyle, GUILayout.Width(60)))
                    {
                        CallObject.Pause();
                    }
                    if (GUILayout.Button("Next", buttonStyle, GUILayout.Width(50)))
                    {
                        CallObject.Next();
                    }
                    if (GUILayout.Button("Stop", buttonStyle, GUILayout.Width(50)))
                    {
                        CallObject.Stop();
                    }
                }
                EditorLayout.EndHorizontal();
            }
            EditorLayout.EndVertical();
        }
コード例 #5
0
        public static void DrawEntity(IEntity entity)
        {
            var bgColor = GUI.backgroundColor;

            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("Destroy Entity"))
            {
                entity.Destroy();
            }

            GUI.backgroundColor = bgColor;

            DrawComponents(entity);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Retained by (" + entity.retainCount + ")", EditorStyles.boldLabel);

            var safeAerc = entity.aerc as SafeAERC;

            if (safeAerc != null)
            {
                EditorLayout.BeginVerticalBox();
                {
                    foreach (var owner in safeAerc.owners.OrderBy(o => o.GetType().Name))
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.LabelField(owner.ToString());
                            if (EditorLayout.MiniButton("Release"))
                            {
                                entity.Release(owner);
                            }

                            EditorGUILayout.EndHorizontal();
                        }
                    }
                }
                EditorLayout.EndVerticalBox();
            }
        }
        protected override void DrawOnlyForPrabInScene()
        {
            base.DrawOnlyForPrabInScene();

            if (this.CallObject.InTransitionSafe())
            {
                EditorLayout.BeginVerticalBox();
                {
                    string status =
                        "RUNNING (" +
                        (CallObject.GetTransitionStatus().TransitionFading ? "Fading" : "Brightening") +
                        ") - " +
                        Mathf.RoundToInt(CallObject.GetTransitionStatus().TransitionPercent * 100) +
                        "%"
                    ;
                    EditorLayout.BeginHorizontal();
                    {
                        EditorGUILayout.LabelField(status);
                    }
                    EditorLayout.EndHorizontal();
                }
                EditorLayout.EndVertical();
            }
        }
コード例 #7
0
        public override void OnInspectorGUI()
        {
            var contextObserver = ((ContextObserverBehaviour)target).contextObserver;

            EditorLayout.BeginVerticalBox();
            {
                EditorGUILayout.LabelField(contextObserver.context.contextInfo.name, EditorStyles.boldLabel);
                EditorGUILayout.LabelField("Entities", contextObserver.context.count.ToString());
                EditorGUILayout.LabelField("Reusable entities", contextObserver.context.reusableEntitiesCount.ToString());

                var retainedEntitiesCount = contextObserver.context.retainedEntitiesCount;
                if (retainedEntitiesCount != 0)
                {
                    var c = GUI.color;
                    GUI.color = Color.red;
                    EditorGUILayout.LabelField("Retained entities", retainedEntitiesCount.ToString());
                    GUI.color = c;
                    EditorGUILayout.HelpBox("WARNING: There are retained entities.\nDid you call entity.Retain(owner) and forgot to call entity.Release(owner)?", MessageType.Warning);
                }

                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Create Entity"))
                    {
                        var entity          = contextObserver.context.CreateEntity();
                        var entityBehaviour = Object.FindObjectsOfType <EntityBehaviour>()
                                              .Single(eb => eb.entity == entity);

                        Selection.activeGameObject = entityBehaviour.gameObject;
                    }

                    var bgColor = GUI.backgroundColor;
                    GUI.backgroundColor = Color.red;
                    if (GUILayout.Button("Destroy All Entities"))
                    {
                        contextObserver.context.DestroyAllEntities();
                    }
                    GUI.backgroundColor = bgColor;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorLayout.EndVerticalBox();

            var groups = contextObserver.groups;

            if (groups.Length != 0)
            {
                EditorLayout.BeginVerticalBox();
                {
                    EditorGUILayout.LabelField("Groups (" + groups.Length + ")", EditorStyles.boldLabel);
                    foreach (var group in groups.OrderByDescending(g => g.count))
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.LabelField(group.ToString());
                            EditorGUILayout.LabelField(group.count.ToString(), GUILayout.Width(48));
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorLayout.EndVerticalBox();
            }

            EditorUtility.SetDirty(target);
        }