private IEnumerator LoadImageFile(string path, int request_index)
{
lockLoadImageFile++;
var request = CriFsUtility.LoadFile(path);
yield return request.WaitForDone(this);
lockLoadImageFile--;
if (request.error == null) {
this.textures[request_index] = new Texture2D(0, 0);
this.textures[request_index].LoadImage(request.bytes);
} else {
Debug.LogWarning("Failed to load image file.");
}
}
...
if (GUI.Button(new Rect(Screen.width - 280, 90, 240, 40), "Load Image File (Local)")) {
requestLoadImage = true;
}
...
if (requestLoadImage) {
int i = 0;
StartCoroutine(this.LoadImageFile(Path.Combine(dir, "criware.png"), i++));
StartCoroutine(this.LoadImageFile(Path.Combine(dir, "sample_image1.png"), i++));
StartCoroutine(this.LoadImageFile(Path.Combine(dir, "sample_image2.png"), i++));
}