using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using System;
|
|
public class MapAssetDownLoadProgress : MonoBehaviour
|
{
|
|
[SerializeField] Image m_SliderProgress;
|
[SerializeField] Text m_Progress;
|
public int mapId = 0;
|
|
Action onComplete;
|
public void OnComplete(Action onComplete)
|
{
|
this.onComplete = onComplete;
|
}
|
|
void Update()
|
{
|
var progress = InGameDownLoad.Instance.GetMapAssetDownLoadProgress(mapId);
|
if (progress > 0.9999f)
|
{
|
if (this.onComplete != null)
|
{
|
this.onComplete();
|
}
|
|
this.onComplete = null;
|
Destroy(this.gameObject);
|
}
|
else
|
{
|
var amendProgress = (progress + 0.1f) * 0.91f;
|
m_Progress.text = StringUtility.Contact(Language.Get("LoadMap"), Mathf.Clamp((int)(amendProgress * 100f), 0, 100), "%");
|
m_SliderProgress.fillAmount = Mathf.Clamp01(amendProgress);
|
}
|
}
|
|
}
|