Exemple #1
0
        public void DrawVimeoConfig(VimeoSettings settings)
        {
            var so = serializedObject;

            // Help Nav
            GUILayout.BeginHorizontal();
            var style = new GUIStyle();

            style.border = new RectOffset(0, 0, 0, 0);
            GUILayout.Box("", style);

            GUIManageVideosButton();
            GUIHelpButton();
            GUISignOutButton();

            GUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            if (settings.Authenticated() && settings.vimeoSignIn)
            {
                bool updated;
                updated = GUISelectFolderType();
                GUISelectFolder(updated);
                GUISelectVideo(); // don't fill videos unless explicitly requested via button
            }

            DrawVimeoAuth(settings);
            so.ApplyModifiedProperties();
        }
        public void DrawVimeoAuth(VimeoSettings auth)
        {
            var so = serializedObject;

            if (!auth.Authenticated() || !auth.vimeoSignIn)
            {
                GUILayout.BeginHorizontal();

                EditorGUILayout.PropertyField(so.FindProperty("vimeoToken"));

                if (GUILayout.Button("Get token", GUILayout.Width(80)))
                {
                    if (auth is VimeoPlayer)
                    {
                        Application.OpenURL("https://authy.vimeo.com/auth/vimeo/unity?scope=public%20private%20video_files");
                    }
                    else
                    {
                        Application.OpenURL("https://authy.vimeo.com/auth/vimeo/unity");
                    }
                }
                GUILayout.EndHorizontal();

                if (auth.vimeoToken != null && auth.vimeoToken != "")
                {
                    if (auth is VimeoPlayer)
                    {
                        EditorGUILayout.HelpBox("Reminder: Streaming videos is limited to Vimeo Pro and Business customers.", MessageType.Warning);
                    }

                    GUI.backgroundColor = Color.green;
                    if (GUILayout.Button("Sign into Vimeo", GUILayout.Height(30)))
                    {
                        auth.SetVimeoToken(auth.vimeoToken);
                        auth.vimeoSignIn = true;
                        GUI.FocusControl(null);
                    }
                }
                GUI.backgroundColor = Color.white;
            }
        }