示例#1
0
        private void DrawEditableList(List <string> list, ref Vector2 scroll, ref string newValue, string title)
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField(title, EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            // == BEGIN SCROLL ==
            scroll = EditorGUILayout.BeginScrollView(scroll);
            for (var i = 0; i < list.Count; i++)
            {
                DrawEditableListValue(list, i);
            }
            EditorGUILayout.EndScrollView();
            // == END SCROLL ==

            KLEditorUtils.DrawUILine();
            if (DrawInputFieldWithButton(ref newValue, "Add"))
            {
                m_isDirty = true;

                if (!string.IsNullOrEmpty(newValue))
                {
                    list.Add(newValue);
                    newValue = "";
                }
            }
            EditorGUILayout.EndVertical();
        }
        private void OnGUI()
        {
            KLEditorUtils.DrawKrillHeader();

            DrawTags();
            DrawVariables();
        }
        private void OnGUI()
        {
            m_scroll = EditorGUILayout.BeginScrollView(m_scroll);
            KLEditorUtils.DrawKrillHeader();

            Draw(m_contractCache);

            EditorGUILayout.EndScrollView();
        }
示例#4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                EditorGUI.BeginProperty(position, label, property);

                int currentIndex = -1;
                currentIndex = KLEditorCore.AvailableTagsString.ToList().IndexOf(property.stringValue);

                // The current tag is unavailable, show a custom enum with the current value
                if (currentIndex < 0)
                {
                    GUI.backgroundColor = Color.red;
                    GUIContent c = new GUIContent();
                    c.text = property.stringValue;

                    EditorGUI.BeginChangeCheck();
                    currentIndex = EditorGUI.Popup(position, label.text, 0, GetTagsAddingCustom(property.stringValue));
                    if (EditorGUI.EndChangeCheck() && currentIndex > 0)
                    {
                        property.stringValue = KLEditorCore.AvailableTagsString[currentIndex - 1];
                    }
                }
                // The current tag is correct, show the tags loaded from JSON
                else
                {
                    var lastColor = GUI.backgroundColor;
                    GUI.backgroundColor = KLEditorUtils.GetTagColor(KLEditorCore.AvailableTags[currentIndex], lastColor);

                    EditorGUI.BeginChangeCheck();
                    currentIndex = EditorGUI.Popup(position, label.text, currentIndex, KLEditorCore.AvailableTagsString);
                    if (EditorGUI.EndChangeCheck())
                    {
                        property.stringValue = KLEditorCore.AvailableTagsString[currentIndex];
                    }

                    GUI.backgroundColor = lastColor;
                }

                EditorGUI.EndProperty();
            }
            else
            {
                EditorGUI.BeginProperty(position, label, property);

                GUI.backgroundColor = Color.red;
                EditorGUI.LabelField(position, label.text, "Use [KLTag] with strings.", EditorStyles.helpBox);

                EditorGUI.EndProperty();
            }
        }
示例#5
0
        private void OnGUI()
        {
            KLEditorUtils.DrawKrillHeader();

            GUI.enabled = m_isDirty;
            if (GUILayout.Button("Refresh"))
            {
                RefreshCore();
            }
            GUI.enabled = true;

            DrawEditableList(KLSettings.Instance.placeholderContract.tags, ref m_tagScroll,
                             ref m_tagName, string.Format("Tags [{0}]", KLSettings.Instance.placeholderContract.tags.Count));

            DrawEditableList(KLSettings.Instance.placeholderContract.variables, ref m_variableScroll,
                             ref m_variableName, string.Format("Variables [{0}]", KLSettings.Instance.placeholderContract.variables.Count));
        }
        private void DrawVariables()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUILayout.LabelField("Available variables", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            m_variableScrollPosition = GUILayout.BeginScrollView(m_variableScrollPosition);
            foreach (var variable in KLEditorCore.AvailableVariables)
            {
                KLEditorUtils.DrawVariable(variable);
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();
        }
        private void DrawTags()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUILayout.LabelField("Available tags", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            m_tagScrollPosition = EditorGUILayout.BeginScrollView(m_tagScrollPosition);
            foreach (var tag in KLEditorCore.AvailableTags)
            {
                KLEditorUtils.DrawTag(tag);
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            // KLEditorUtility.DrawWindowDebug(this);
        }
        private void Draw(KLContractDefinition contract)
        {
            // ===== BEGIN TAGS =====
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Tags", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            contract.tags.ForEach(x => Draw(x));

            EditorGUILayout.EndVertical();
            // ===== END TAGS =====

            // ===== BEGIN VARIABLES =====
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Variables", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            contract.variables.ForEach(x => Draw(x));

            EditorGUILayout.EndVertical();
            // ===== END VARIABLES =====

            // ===== BEGIN SOUNDBANKS =====
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Soundbank files", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            contract.soundbank_files.ForEach(x => Draw(x));
            EditorGUILayout.EndVertical();
            // ===== END SOUNDBANKS =====

            // ===== BEGIN CHANNELS =====
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Channels", EditorStyles.boldLabel);
            KLEditorUtils.DrawUILine();

            contract.channels.ForEach(x => Draw(x));

            EditorGUILayout.EndVertical();
            // ===== END CHANNELS =====
        }
 private void Draw(KLChannelDefinition channel)
 {
     KLEditorUtils.DrawChannel(channel);
 }
示例#10
0
 private void Draw(KLSoundbankFileDefinition soundbank)
 {
     KLEditorUtils.DrawSoundbank(soundbank);
 }
示例#11
0
 private void Draw(KLVariableDefinition variable)
 {
     KLEditorUtils.DrawVariable(variable);
 }
示例#12
0
 private void Draw(KLTagDefinition tag)
 {
     KLEditorUtils.DrawTag(tag);
 }