Example #1
0
 //--------------------------------------------------
 //
 //--------------------------------------------------
 void Start()
 {
     _main             = CMainManager.Get();
     _gameManager      = CGameManager.Get();
     _cnvHotspotScreen = GameObject.Find("hotspot_screen").GetComponent <Canvas>();
     _goPlayer         = GameObject.Find("Player");
     _bIsFirstTime     = true;
     transform.Find("hover").gameObject.SetActive(false);
 }
    IEnumerator DownloadOneTextureCoroutine(GameObject a_Places, Texture2D a_Textures, string a_URLs)
    {
        CMainManager _main = CMainManager.Get();

        ShowLoadingScreen();
        // _imgProgress = GameObject.Find("download_progress").GetComponent<Image>();
        // _imgDownload = GameObject.Find("icon_wait").GetComponent<Image>();
        //_textDownload = GameObject.Find("label_downloadTextures").GetComponent<Text>();
        _imgProgress.gameObject.SetActive(true);
        _imgDownload.gameObject.SetActive(true);
        _bIsDownloadingTextures = true;

        yield return(new WaitForSeconds(.1f));

        _imgDownload.color = Color.white;
        //_textDownload.text = "TÉLÉCHARGER DES TEXTURES ... 0 of 7";
        if (!a_Places.transform.Find("ProjectionMesh").GetComponent <Renderer>().material.mainTexture)
        {
            a_Textures = new Texture2D(4, 4, TextureFormat.DXT1, false);
            yield return(new WaitForSeconds(0.01f));

            //_textDownload.text = "TÉLÉCHARGER DES TEXTURES ... " + (i+1).ToString() +  " of " + a_Places.Length.ToString();
            using (WWW www = new WWW(a_URLs))
            {
                StartCoroutine(ShowProgress(www, _colors[0]));
                yield return(www);

                StopCoroutine(ShowProgress(www, _colors[0]));
                www.LoadImageIntoTexture(a_Textures);
                a_Places.transform.Find("ProjectionMesh").GetComponent <Renderer>().material.mainTexture = a_Textures;
                Debug.Log("Downloaded and changed Texture");
                yield return(new WaitForSeconds(0.01f));
            }
        }
        else
        {
            //_textDownload.text = "TÉLÉCHARGER DES TEXTURES ... " + (i + 1).ToString() + " of " + a_Places.Length.ToString();
            Debug.Log("<color=yellow>There's already a texture</color>");
        }

        _imgProgress.gameObject.SetActive(false);
        _bIsDownloadingTextures = false;
        HideLoadingScreen();
        _main.StartTheSpawn(a_Places);
    }