void OnGUI()
        {
            //Init components
            Styles.Load();
            if (drawer == null)
            {
                drawer = new Text_Editor(text, OnEditCallback, OnRepaintCallback);
            }
            windowSize = new Vector2(Screen.width, Screen.height);

            //Toolbar
            EditorGUI.BeginDisabledGroup(!Settings.haveProject);
            DrawToolbar();
            EditorGUI.EndDisabledGroup();

            switch (tab)
            {
            case Tab.OneShot:
                DrawOneShotGUI();
                break;

            case Tab.Pool:
                DrawPoolGUI();
                break;
            }
            Repaint();
        }
 private void InitComponents()
 {
     Styles.Load();
     clip = target as Clip;
     if (clip.text == null)
     {
         clip.text = new Text();
     }
     if (drawer == null)
     {
         drawer = new Text_Editor(clip.text, SetDirty, Repaint);
     }
 }
Esempio n. 3
0
        public void DrawOneShotGUI()
        {
            //Check connection
            if (!Settings.haveProject)
            {
                Utils.ConnectionRequireMessage();
            }
            EditorGUI.BeginDisabledGroup(!Settings.haveProject);

            //Update progress bar if exist
            if (drawProgressBar)
            {
                EditorUtility.DisplayProgressBar("Resemble", "Download clip...", preview.download.progress);
                if (preview.download.isDone)
                {
                    drawProgressBar = false;
                    EditorUtility.ClearProgressBar();
                }
            }

            //Init components
            if (Resources.instance.oneShotText == null)
            {
                Resources.instance.oneShotText = new Text();
            }
            if (drawer == null)
            {
                drawer = new Text_Editor(Resources.instance.oneShotText, SetDirty, Repaint);
            }

            //Tags
            drawer.DrawTagsBtnsLayout(!Settings.haveProject);

            //Draw text area
            Rect rect = GUILayoutUtility.GetRect(Screen.width, 300).Shrink(10);

            drawer.DrawTextArea(rect, Settings.haveProject);

            //Draw char count progress bar
            rect.Set(rect.x, rect.y + rect.height, rect.width, 16);
            drawer.DrawCharCountBar(rect);
            GUILayout.Space(20);


            //Bot commands
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);

            //Voice field
            DrawVoiceField();

            //Generate button
            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(voiceUUID) || string.IsNullOrEmpty(text.userString));
            if (GUILayout.Button("Generate audio", GUILayout.ExpandWidth(false)))
            {
                Generate();
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(7);
            GUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();


            //Footer
            GUILayout.FlexibleSpace();
            Utils.DrawSeparator();
            GUILayout.Label("The audio files generated here will not be saved in the Resemble project.", Styles.settingsBody);
        }