Beispiel #1
0
        public IEnumerator LoadFolderImages()
        {
            var listOfDio = _dioManager.sphereControllers.Count > _dioManager.planeControllers.Count ? _dioManager.sphereControllers.SelectMany(sc => sc.dioControllerList).ToList() : _dioManager.planeControllers.SelectMany(sc => sc.dioControllerList).ToList();
            var tuple     = _loadImageBehaviour.TextureFormatGetter(); //tuple < "jpg o Png", "TextureFormat.DXT1">

            string        fileSuffix    = tuple.First;
            TextureFormat textureFormat = tuple.Second;

            string          indexSuffix;
            string          fullFilename;
            WWW             www;
            Texture2D       texTmp;
            PitchGrabObject pitchGrabObject;

            while (true)
            {
                if (_imagesLoaded == images)
                {
                    break;
                }

                indexSuffix = _loadImageBehaviour.FormattedIndex();

                if (!_loadImageBehaviour.ValidationOfIndex(indexSuffix))
                {
                    continue;
                }

                fullFilename = _loadImageBehaviour.pathPrefix +
                               _loadImageBehaviour.pathImageAssets +
                               _loadImageBehaviour.pathSmall +
                               _loadImageBehaviour.filename + indexSuffix + fileSuffix;

                www    = new WWW(fullFilename);
                texTmp = new Texture2D(1024, 1024, textureFormat, false);
                www.LoadImageIntoTexture(texTmp);

                pitchGrabObject = listOfDio[_imagesLoaded].pitchGrabObject;
                pitchGrabObject.InitializeMaterial(texTmp);
                pitchGrabObject.SetId(_loadImageBehaviour.filename
                                      + indexSuffix + fileSuffix);

                _imagesLoaded++;

                yield return(new WaitForEndOfFrame());
            }

            _loadImageBehaviour.EndAction();
        }
Beispiel #2
0
        public IEnumerator LoadFolderImages(List <DIOController> listOfDio)
        {
            var tuple = _loadImageBehaviour.TextureFormatGetter();

            string        fileSuffix    = tuple.First;
            TextureFormat textureFormat = tuple.Second;

            string          indexSuffix;
            string          fullFilename;
            WWW             www;
            Texture2D       texTmp;
            PitchGrabObject pitchGrabObject;

            while (true)
            {
                if (_imagesLoaded == images)
                {
                    break;
                }
                //DELETE THIS
                if (!GLPlayerPrefs.GetBool(ProfileManager.Instance.currentEvaluationScope, "BGIIESMode"))
                {
                    indexSuffix = _loadImageBehaviour.FormattedIndex();
                }
                else
                {
                    if (_imagesLoaded.ToString().Length == 1)
                    {
                        indexSuffix = "00" + _imagesLoaded.ToString();
                    }
                    else if (_imagesLoaded.ToString().Length == 2)
                    {
                        indexSuffix = "0" + _imagesLoaded.ToString();
                    }
                    else
                    {
                        indexSuffix = _imagesLoaded.ToString();
                    }
                }
                if (!_loadImageBehaviour.ValidationOfIndex(indexSuffix))
                {
                    continue;
                }

                fullFilename = _loadImageBehaviour.pathPrefix +
                               _loadImageBehaviour.pathImageAssets +
                               _loadImageBehaviour.filename + indexSuffix + fileSuffix;

                www    = new WWW(fullFilename);
                texTmp = new Texture2D(1024, 1024, textureFormat, false);
                www.LoadImageIntoTexture(texTmp);

                pitchGrabObject = listOfDio[_imagesLoaded].pitchGrabObject;
                pitchGrabObject.InitializeMaterial(texTmp);
                pitchGrabObject.SetId(_loadImageBehaviour.filename
                                      + indexSuffix + fileSuffix);

                _imagesLoaded++;

                yield return(new WaitForEndOfFrame());
            }

            _loadImageBehaviour.EndAction();
        }