Exemplo n.º 1
0
        private void showTestDrive()
        {
            if (Util.Helper.isEditorMode)
            {
                if (BWFManager.isReady)
                {
                    scrollPosTD = EditorGUILayout.BeginScrollView(scrollPosTD, false, false);
                    {
                        GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                        inputText = EditorGUILayout.TextField(new GUIContent("Input Text", "Text to check."), inputText);

                        EditorHelper.ReadOnlyTextField("Output Text", outputText);
                    }
                    EditorGUILayout.EndScrollView();

                    EditorHelper.SeparatorUI();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button(new GUIContent(" Contains", EditorHelper.Icon_Contains, "Contains any bad words?")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.Contains(inputText).ToString();
                        }

                        if (GUILayout.Button(new GUIContent(" Get", EditorHelper.Icon_Get, "Get all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = string.Join(", ", BWFManager.GetAll(inputText).ToArray());
                        }

                        if (GUILayout.Button(new GUIContent(" Replace", EditorHelper.Icon_Replace, "Check and replace all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.ReplaceAll(inputText);
                        }

                        if (GUILayout.Button(new GUIContent(" Mark", EditorHelper.Icon_Mark, "Mark all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.Mark(inputText, BWFManager.GetAll(inputText));
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    EditorHelper.BWFUnavailable();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info);
            }
        }