Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp

This commit is contained in:
CaiYanPeng 2022-02-24 14:48:50 +08:00
commit 0c42fbe2cd

View File

@ -42,7 +42,8 @@ namespace Assets.Scenes.Ride.Scripts
protected CyclingController cyclingController { get; set; } protected CyclingController cyclingController { get; set; }
#endregion #endregion
private float _timer = 15f;
private bool _forceUpdate = false;
protected virtual void Start() protected virtual void Start()
{ {
App.TextureCache.Clear(); App.TextureCache.Clear();
@ -57,8 +58,9 @@ namespace Assets.Scenes.Ride.Scripts
return; return;
} }
if (targetAlpha != canvasGroup.alpha && depressFlag && slider.value >= 100) if (targetAlpha != canvasGroup.alpha && depressFlag && slider.value >= 100 || _forceUpdate)
{ {
canvasGroup.blocksRaycasts = false;
canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime); canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime);
if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f) if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f)
{ {
@ -70,6 +72,15 @@ namespace Assets.Scenes.Ride.Scripts
transform.gameObject.SetActive(false); transform.gameObject.SetActive(false);
} }
} }
if (depressFlag)
{
_timer -= Time.deltaTime;
if (_timer < 0 && tileHeightProcessed)
{
_forceUpdate = true;
}
}
} }
//显示loading动画 //显示loading动画
protected virtual void ShowLoading() protected virtual void ShowLoading()
@ -191,8 +202,6 @@ namespace Assets.Scenes.Ride.Scripts
rideNow.interactable = false; rideNow.interactable = false;
processText.gameObject.SetActive(true); processText.gameObject.SetActive(true);
slider.gameObject.SetActive(true); slider.gameObject.SetActive(true);
canvasGroup.blocksRaycasts = false;
depressFlag = true; depressFlag = true;
slider.DOValue(process, 1); slider.DOValue(process, 1);
@ -207,11 +216,17 @@ namespace Assets.Scenes.Ride.Scripts
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
loadingPanel.SetActive(false); loadingPanel.SetActive(false);
} }
private bool tileHeightProcessed = false;
protected void _map_OnInitialized() protected void _map_OnInitialized()
{ {
var visualizer = _map.MapVisualizer; var visualizer = _map.MapVisualizer;
visualizer.OnTileHeightProcessingFinished += (s) => visualizer.OnTileHeightProcessingFinished += (s) =>
{ {
tileHeightProcessed = true;
};
visualizer.OnMapVisualizerStateChanged += (s) =>
{
if(s == ModuleState.Finished)
AddProcess(40); AddProcess(40);
}; };
} }