예제 #1
0
    void MusicListDownloadSuccess(WebRequestHandler context)
    {
        AudioButtonItem[] audioButtons = JsonHelper.FromJson <AudioButtonItem>(MusicListRequester.downloadedText);

        foreach (AudioButtonItem audioButton in audioButtons)
        {
            WebRequestHandler temp = gameObject.AddComponent <WebRequestHandler>();

            temp.requesterName = audioButton.caption;

            temp.OnRequestSuccessful.AddListener(MusicItemDownloadSuccess);
            temp.OnRequestFailed.AddListener(MusicItemDownloadFail);

            temp.AudioRequest(audioButton.audio);
            temp.ImageRequest(audioButton.bg);
        }

        Destroy(context);
    }
예제 #2
0
    void MusicListDownloadSuccess(WebRequestHandler context)
    {
        AudioButtonItem[] audioButtons = JsonHelper.FromJson <AudioButtonItem>(MusicListRequester.downloadedText);

        for (int i = 0; i < DesiredAmount; ++i)
        {
            AudioButtonItem audioButton = audioButtons[Random.Range(0, audioButtons.Length - 1)];

            WebRequestHandler temp = gameObject.AddComponent <WebRequestHandler>();

            temp.requesterName = audioButton.caption;

            temp.OnRequestSuccessful.AddListener(MusicItemDownloadSuccess);
            temp.OnRequestFailed.AddListener(MusicItemDownloadFail);

            temp.AudioRequest(audioButton.audio);
            temp.ImageRequest(audioButton.bg);
        }

        Destroy(context);
    }