コード例 #1
0
        /// <summary>
        ///   Draws the entity configuration inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            this.entityConfigurationBehaviour = (EntityConfigurationBehaviour)this.target;

            if (EditorApplication.isPlaying)
            {
                // Show entity data.
                EditorGUILayout.LabelField(
                    new GUIContent("Entity Id"),
                    new GUIContent(this.entityConfigurationBehaviour.EntityId.ToString(CultureInfo.InvariantCulture)));
                EditorGUILayout.LabelField(
                    new GUIContent("Blueprint Id"),
                    new GUIContent(this.entityConfigurationBehaviour.BlueprintId));
            }
            else
            {
                if (hierarchicalBlueprintManager == null)
                {
                    // Load project blueprint data.
                    this.LoadBlueprints();
                }

                this.entityConfigurationBehaviour.BlueprintId =
                    EditorGUIUtils.BlueprintIdSelection(
                        new GUIContent("Blueprint"),
                        this.entityConfigurationBehaviour.BlueprintId,
                        inspectorComponentTypes,
                        hierarchicalBlueprintManager);

                if (this.entityConfigurationBehaviour.Configuration == null)
                {
                    // Create initial configuration.
                    this.entityConfigurationBehaviour.Configuration = new AttributeTable();
                }

                Blueprint selectedBlueprint =
                    hierarchicalBlueprintManager.GetBlueprint(this.entityConfigurationBehaviour.BlueprintId);
                if (selectedBlueprint != null)
                {
                    EditorGUIUtils.BlueprintComponentsField(
                        selectedBlueprint,
                        this.entityConfigurationBehaviour.Configuration,
                        inspectorComponentTypes,
                        hierarchicalBlueprintManager);
                }

                if (GUILayout.Button("Reload Blueprints"))
                {
                    this.LoadBlueprints();
                }
            }
        }