示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (downloadEnabled && downloader != null)
        {
            if (!downloader.isDone)
            {
                progressAmount = downloader.progress;
                //Debug.Log(string.Format("FILE: Downloading: {0}%", progressAmount*100));
                //DrawProgress();
            }
            else
            {
                // Switch on download type to determine what sort of file
                // we're working with (audio, image, etc.)
                switch (downloadType)
                {
                case DownloadType.Audio:
                    // Attach it to the audio source on this gameobject
                    //audio.clip = audioClipHolder;

                    // Actually, add it to the audio manager's clip list to be
                    // maintained by the existing system.
                    audioMgrComp.AddAudioClip(audioClipHolder);
                    Debug.Log("FILE: AudioClip downloaded and assigned to audio clip set.");

                    var oldSongIndex = audioMgrComp.currentSongIndex;

                    // Play from audio manager (should happen automatically)
                    audioMgrComp.PlayNext();

                    Debug.Log(string.Format("FILE: Audio clip index changed from {0} to {1}", oldSongIndex, audioMgrComp.currentSongIndex));

                    break;

                case DownloadType.Image:

                    // Assign new texture to test block
                    testBlock.renderer.material.mainTexture = downloader.texture;

                    break;

                default:

                    break;
                }

                // Turn off the progress display
                drawProgress = false;

                // And zero out the progress indicator
                progressAmount = 0.0f;

                // Null out the downloader so Update knows to stop coming here
                downloader = null;
            }
        }
    }
示例#2
0
 void Start()
 {
     mAudioManager = FindObjectOfType(typeof(AudioManager)) as AudioManager;
     mLevelHUD     = FindObjectOfType(typeof(LevelHUD)) as LevelHUD;
     if (mAudioManager)
     {
         int index = 0;
         foreach (AudioClip clip in mAudioClips)
         {
             string title = mTextBoxId;
             title = title + index;
             mAudioManager.AddAudioClip(title, clip);
             index++;
         }
     }
     mIndex = 0;
     Assets.CustomeScripts.InformationManager.SetCurrentLevel(Application.loadedLevelName);
     Assets.CustomeScripts.InformationManager.AddTextBoxSummoner(mTextBoxId);
 }