コード例 #1
0
ファイル: LoginGUI.cs プロジェクト: SimoHayha/ProjectStream
 void DrawLoginWindow(int windowID)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("Username :"******"Password :"******"*"[0]);
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Login"))
     {
         StartCoroutine(_GroovesharkAPI.Authenticate(LoginCallback, _Login, _Pass));
         _DrawRoundProgressBar = true;
         ProgressBar.SetActive(true);
     }
     if (GUILayout.Button("Pass"))
     {
         Application.LoadLevel("0");
     }
     GUILayout.EndHorizontal();
     if (_DrawRoundProgressBar)
     {
         ProgressBar.transform.Rotate(Vector3.up, _ProgressBarRotation * Time.deltaTime);
     }
     else
     {
         ProgressBar.SetActive(false);
     }
 }
コード例 #2
0
    private void OnSearchArea()
    {
        GUILayout.BeginHorizontal();
        if (!_Grooveshark.IsLogged)
        {
            _Login    = GUILayout.TextField(_Login);
            _Password = GUILayout.PasswordField(_Password, "*"[0]);
            if (GUILayout.Button("Login"))
            {
                StartCoroutine(_Grooveshark.Authenticate(LogginCallback, _Login, _Password));
            }
        }
        else
        {
            GUILayout.Label("Logged as " + _Grooveshark.Login + " (" + _Login + ")");
            if (GUILayout.Button("Disconnect"))
            {
                StartCoroutine(_Grooveshark.Logout(LogoutCallback));
            }
        }
        GUILayout.EndHorizontal();

        _DebugMenuIndex = GUILayout.SelectionGrid(_DebugMenuIndex, _DebugMenu, 2);

        if (_DebugMenuIndex == 0)
        {
            _Search        = GUILayout.TextField(_Search);
            _SearchByIndex = GUILayout.SelectionGrid(_SearchByIndex, _SearchBy, 3);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Search"))
            {
                if (_SearchByIndex == 0)
                {
                    StartCoroutine(_Grooveshark.GetSongSearchResults(FillSearchResultCallback, _Search));
                }
                else if (_SearchByIndex == 1)
                {
                    StartCoroutine(_Grooveshark.GetArtistSearchResults(FillSearchResultCallback, _Search));
                }
                else if (_SearchByIndex == 2)
                {
                    StartCoroutine(_Grooveshark.GetAlbumSearchResults(FillSearchResultCallback, _Search));
                }
            }
            if (GUILayout.Button("Clear"))
            {
                _results.Clear();
            }
            GUILayout.EndHorizontal();

            if (_results.Count > 0 && _results[0].Others.Count > 0)
            {
                GUILayout.BeginHorizontal();
                foreach (var entry in _results[0].Others)
                {
                    GUILayout.Label(entry.Key);
                }
                GUILayout.EndHorizontal();
            }
            for (int i = _ResultIndex; i < _results.Count && i < _ResultIndex + 10; ++i)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(_results[i].Name);
                foreach (var entry in _results[i].Others)
                {
                    GUILayout.Label(entry.Value);
                }
                if (_SearchByIndex == 0 && GUILayout.Button("Play"))
                {
                    StartCoroutine(_Grooveshark.GetStreamKeyStreamServer(_BassManager.StartGroovesharkStream, _results[i].ID));
                }
                if (_SearchByIndex == 1 && GUILayout.Button("OK"))
                {
                    StartCoroutine(_Grooveshark.GetSongSearchResults(FillSearchResultCallback, _results[i].Name));
                }
                if (_SearchByIndex == 2 && GUILayout.Button("OK"))
                {
                    StartCoroutine(_Grooveshark.GetAlbumSongs(FillSearchResultCallback, _results[i].ID));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginHorizontal();
            if (_ResultIndex >= 10 && GUILayout.Button("Previous"))
            {
                _ResultIndex -= 10;
            }
            if (_ResultIndex <= _results.Count - 10 && GUILayout.Button("Next"))
            {
                _ResultIndex += 10;
            }
            GUILayout.EndHorizontal();
        }
        else if (_DebugMenuIndex == 1)
        {
            _PlaylistScrollPosition = GUILayout.BeginScrollView(_PlaylistScrollPosition);
            foreach (var playlist in _UserPlaylists)
            {
                if (GUILayout.Button(playlist.Name))
                {
                    StartCoroutine(_Grooveshark.GetPlaylist(GetPlaylistCallback, playlist.ID));
                }
            }
            GUILayout.EndScrollView();
        }
    }