private async UniTaskVoid DownloadDreams() { // --- 変換元パンツテクスチャのリストをDL --- var dreamsData = await _gateway.GetDreamsData(); if (dreamsData == null) { Debug.LogError("Download Error: 変換元パンツ情報のダウンロードに失敗しました"); ClearGUIWaiting(); return; } // --- 変換元テクスチャを一括ダウンロード&保存 --- var existFiles = FilerOperator.getExistsTextures(); foreach (var imageName in dreamsData.images) { // 既にローカルにテクスチャが存在する場合はスキップ if (existFiles != null && existFiles.Contains(imageName)) { continue; } var tex = await _gateway.GetDreamTexture(imageName); // テクスチャデータの保存 var creator = new FilerOperator(); creator.Create(imageName, "Dreams", tex); } ClearGUIWaiting(); }
public async void Execute(Gateway gateway) { // 通信実装を毎フレーム呼び出し switch (State) { case GatewayState.GETTING_DREAMS_LIST: _existsFiles = FilerOperator.getExistsTextures(); _dream = await gateway.GetDreamsData(); if (_dream != null) { State = GatewayState.GETTING_DREAM_TEXTURE_INIT; } break; case GatewayState.GETTING_DREAM_TEXTURE_INIT: _image = _dream.images[_counter]; // 既にローカルにテクスチャが存在する場合はスキップ if (_existsFiles != null && _existsFiles.Contains(_image)) { State = GatewayState.GETTING_DREAM_TEXTURE_FINISHED; break; } //gateway.SetUrlFromFileName(_image); //State = gateway.GetDreamTexture(_image); break; case GatewayState.GETTING_DREAM_TEXTURE: //State = gateway.GetDreamTexture(_image); break; case GatewayState.GETTING_DREAM_TEXTURE_FINISHED: _counter++; if (_counter < _dream.images.Length) { State = GatewayState.GETTING_DREAM_TEXTURE_INIT; } else { State = GatewayState.GETTING_DREAM_TEXTURES_COMPLETED; } break; case GatewayState.GETTING_DREAM_TEXTURES_COMPLETED: break; } }