public BitData(ushort w, ushort h, EImageMode mode) { Mode = mode; Width = w; Height = h; switch (mode) { case EImageMode.BlackAndWhite: { DataBN = new List <byte[]>(); for (int y = 0; y < h; y++) { DataBN.Add(new byte[w]); } break; } case EImageMode.RGB: { DataRGB = new List <RGB[]>(); for (int y = 0; y < h; y++) { DataRGB.Add(new RGB[w]); } break; } } }
//IEnumerator LoadMediaElements() //{ // Debug.Log("Loading medias...!!!"); // UnityWebRequest www = UnityWebRequest.Get("https://lexicomix.com/Slideshow/GetMedias?start=0&nb=25"); // yield return new WaitForSeconds(2f); // //foreach(KeyValuePair<string,string> pair in sessionCookies) // //{ // // www.SetRequestHeader(pair.Key, pair.Value); // //} // yield return null; // www.certificateHandler = new AcceptAllCertificates(); // To remove before going to production because certificate is valid // yield return www.SendWebRequest(); // if (www.isNetworkError) // { // Debug.Log("Network error while loading"); // Debug.Log(www.error); // } // else if (www.isHttpError) // { // Debug.Log("Http error while loading"); // Debug.Log(www.error); // } // else // { // manager.UpdateLoadingBar(0.1f); // // Show results as text // Debug.Log("Media Data received from webservice"); // Debug.Log(www.downloadHandler.text); // // Deserialize result // //string jsonString = JsonHelper.fixJson(www.downloadHandler.data); // byte[] is received to get images for instance // string jsonString = JsonHelper.fixJson(www.downloadHandler.text); // Debug.Log(jsonString); // MediaElement[] mediaElements = JsonHelper.FromJson<MediaElement>(jsonString); // Debug.Log(" Medias received with " + mediaElements.Length + " MediaElements"); // string prefixPictures = "https://dicoadmin20181018034609.blob.core.windows.net/images/"; // string prefixAudios = "https://dicoadmin20181018034609.blob.core.windows.net/sounds/"; // foreach (MediaElement element in mediaElements) // { // manager.UpdateLoadingBar(0.23f / mediaElements.Length); // mediaList.Add(element.WordID); // if (!mediaDictionary.ContainsKey(element.WordID)) // { // element.AudioURL = string.Concat(prefixAudios, element.AudioURL); // element.PictureURL = string.Concat(prefixPictures, element.PictureURL); // mediaDictionary.Add(element.WordID, element); // } // Debug.Log("*** " + element.WordID + ": " + element.Text.ToUpper() + " added ***"); // Debug.Log(element.Syllables.Count + " Syllables"); // foreach(SyllableElement syllable in element.Syllables) // { // syllable.AudioURL = string.Concat(prefixAudios, syllable.AudioURL); // Debug.Log("### Syllables: " + syllable.Text); // } // Debug.Log(element.PhonoSyllables.Count + " SyllablesPhono"); // foreach (SyllableElement syllableP in element.PhonoSyllables) // { // syllableP.AudioURL = string.Concat(prefixAudios, syllableP.AudioURL); // Debug.Log("### SyllablesPhono: " + syllableP.Text); // } // } // // Start next coroutine // StartNextCoRoutine(); // } //} #region Providing medias to GameManager public Texture GetImage(string wordID, EImageMode imageMode) { // Get texture for this word if (retrievedTextures.ContainsKey(wordID)) { //Debug.Log(mediaDictionary[wordID].PictureURL); return(retrievedTextures[wordID]); } Debug.Log(UnknownImage); return(UnknownImage); }