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,13 +202,11 @@ 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);
depressFlag = true;
slider.DOValue(process, 1);
canvasGroup.blocksRaycasts = false; StartGame();
depressFlag = true; }
slider.DOValue(process, 1);
StartGame();
}
protected virtual void Cancel(BaseEventData baseEvent) protected virtual void Cancel(BaseEventData baseEvent)
{ {
SceneManager.LoadScene("MainScene"); SceneManager.LoadScene("MainScene");
@ -207,12 +216,18 @@ 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) =>
{ {
AddProcess(40); tileHeightProcessed = true;
};
visualizer.OnMapVisualizerStateChanged += (s) =>
{
if(s == ModuleState.Finished)
AddProcess(40);
}; };
} }
} }