어드레서블 다운로드 % 정상적으로 나오게 수정
This commit is contained in:
parent
58866cb339
commit
b2de1d473e
Binary file not shown.
|
|
@ -34,11 +34,9 @@ public class MainToTitle : MonoBehaviour
|
|||
|
||||
IEnumerator Co_CheckDownload()
|
||||
{
|
||||
//yield return Addressables.InitializeAsync();
|
||||
|
||||
label_slider.text = "";
|
||||
long downloadSize = 0;
|
||||
int completedDownloads = 0;
|
||||
long totalDownloadSize = 0;
|
||||
long currentDownloadedSize = 0; // 현재까지 다운로드된 용량
|
||||
int totalLabels = addr_Labels.Count;
|
||||
|
||||
var labels = new List<string>();
|
||||
|
|
@ -51,7 +49,7 @@ public class MainToTitle : MonoBehaviour
|
|||
bool calcSuccess = false;
|
||||
for (int retry = 0; retry < retryLimit; retry++)
|
||||
{
|
||||
downloadSize = 0;
|
||||
totalDownloadSize = 0;
|
||||
calcSuccess = true;
|
||||
foreach (var label in labels)
|
||||
{
|
||||
|
|
@ -60,7 +58,7 @@ public class MainToTitle : MonoBehaviour
|
|||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
downloadSize += handle.Result;
|
||||
totalDownloadSize += handle.Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -86,9 +84,9 @@ public class MainToTitle : MonoBehaviour
|
|||
}
|
||||
|
||||
// 다운로드 크기 출력
|
||||
if (downloadSize > 0)
|
||||
if (totalDownloadSize > 0)
|
||||
{
|
||||
label_popup.text = $"다운로드 안내\n\n최신 패치 파일을 받아야 합니다.\n총 {FormatSize(downloadSize)}를 다운로드 합니다.\n\nWifi로 다운로드 하는 것을 권장합니다.";
|
||||
label_popup.text = $"다운로드 안내\n\n최신 패치 파일을 받아야 합니다.\n총 {FormatSize(totalDownloadSize)}를 다운로드 합니다.\n\nWifi로 다운로드 하는 것을 권장합니다.";
|
||||
go_popup.SetActive(true);
|
||||
|
||||
while (!startDownload) yield return null; // 팝업에서 OK 누를 때까지 대기
|
||||
|
|
@ -98,7 +96,6 @@ public class MainToTitle : MonoBehaviour
|
|||
// 다운로드 시작
|
||||
foreach (var label in labels)
|
||||
{
|
||||
// 다운로드 크기 계산
|
||||
var handle = Addressables.GetDownloadSizeAsync(label);
|
||||
yield return handle;
|
||||
|
||||
|
|
@ -110,15 +107,16 @@ public class MainToTitle : MonoBehaviour
|
|||
|
||||
while (!downHandle.IsDone)
|
||||
{
|
||||
slider_download.value = (float)(completedDownloads + downHandle.PercentComplete) / totalLabels;
|
||||
label_slider.text = $"{(slider_download.value * 100f).ToString("N2")}%";
|
||||
float progress = (float)currentDownloadedSize / totalDownloadSize;
|
||||
slider_download.value = progress;
|
||||
label_slider.text = $"{progress * 100f:N2}%";
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (downHandle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
++completedDownloads;
|
||||
slider_download.value = (float)completedDownloads / totalLabels;
|
||||
// 다운로드 완료 후 currentDownloadedSize에 추가
|
||||
currentDownloadedSize += handle.Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,15 +93,15 @@ public class table_missionbase : MonoBehaviour
|
|||
//json = $"{{\"table_abilityconfig\":{json}}}";
|
||||
}
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
protected void Set_lastjson2()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
// TODO 정인호 : 임의로 만든 json 파일 오류 처리 (정식에선 지워야함)
|
||||
int startIndex = json_last.IndexOf(","); // 첫 번째 객체 시작
|
||||
int endIndex = json_last.IndexOf(",") + 1; // 첫 번째 객체 끝
|
||||
json_last = json_last.Remove(startIndex, endIndex - startIndex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
protected virtual void Start() { LoadComplete = true; }
|
||||
public bool Get_LoadComplete() { return LoadComplete; }
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"EnvironmentName": "production",
|
||||
"EnvironmentId": "aed3f247-7248-4a9e-a859-b52f7aaae216"
|
||||
}
|
||||
Loading…
Reference in New Issue