예제 #1
0
        public override void OnInspectorGUI()
        {
            var target = this.target as ME.ECS.Debug.EntityDebugComponent;

            if (target.world != null && target.world.isActive == true)
            {
                var currentEntity = GUILayoutExt.DrawEntitySelection(target.world, in target.entity, checkAlive: true, drawSelectButton: false);
                if (currentEntity.IsAlive() == true)
                {
                    if (EntityDebugComponentEditor.worldEditors.TryGetValue(target.world, out var worldEditor) == false)
                    {
                        worldEditor       = new WorldsViewerEditor.WorldEditor();
                        worldEditor.world = target.world;
                        EntityDebugComponentEditor.worldEditors.Add(target.world, worldEditor);
                    }

                    WorldsViewerEditor.DrawEntity(target.entity, worldEditor, worldEditor.GetEntitiesStorage(), worldEditor.GetStructComponentsStorage(), worldEditor.GetComponentsStorage(), worldEditor.GetModules());
                    this.Repaint();
                }
            }
            else
            {
                if (Worlds.currentWorld == null)
                {
                    GUILayout.Label("No running worlds found", EditorStyles.centeredGreyMiniLabel);
                }
                else
                {
                    GUILayoutExt.DrawAddEntityMenu(target);
                }
            }
        }
예제 #2
0
        public void DrawInspectorGUI(ME.ECS.Entity entity, bool drawDefaultInspector = false)
        {
            var    isMultiple = false;
            string output     = string.Empty;

            if (this.targets.Length > 1)
            {
                foreach (var t in this.targets)
                {
                    var str = t.ToString();
                    if (output != string.Empty && output != str)
                    {
                        isMultiple = true;
                    }

                    output = str;
                }
            }

            if (entity != ME.ECS.Entity.Empty)
            {
                GUILayoutExt.Box(2f, 2f, () => {
                    EditorGUILayout.HelpBox(isMultiple == true ? "-" : this.target.ToString(), MessageType.Info);

                    if (isMultiple == false)
                    {
                        GUILayoutExt.DrawEntitySelection(ME.ECS.Worlds.currentWorld, in entity, checkAlive: true);
                    }
                }, UnityEngine.GUIStyle.none);
                GUILayoutExt.Separator();
            }

            EditorGUILayout.BeginHorizontal();
            UnityEngine.GUILayout.FlexibleSpace();

            var style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.button);

            style.fontSize    = 12;
            style.fixedWidth  = 230;
            style.fixedHeight = 23;
            if (UnityEngine.GUILayout.Button("Refresh Data", style) == true)
            {
                var targets = this.targets;
                foreach (var target in targets)
                {
                    ((IDoValidate)target).DoValidate();
                    UnityEditor.EditorUtility.SetDirty(target);
                }
            }

            UnityEngine.GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            if (drawDefaultInspector == true)
            {
                EditorGUILayout.Space();

                this.DrawDefaultInspector();
            }
        }