fix result

This commit is contained in:
kimura 2022-06-24 14:07:42 +09:00
parent 61b6f17673
commit d75e696864
1 changed files with 4 additions and 9 deletions

View File

@ -31,11 +31,6 @@ namespace MyGame.Scenes.MiniGame.Scripts
public void ShowResult(int score, ScrollGamePlaceData[] placeList, ScrollGameStageData stageData) public void ShowResult(int score, ScrollGamePlaceData[] placeList, ScrollGameStageData stageData)
{ {
/*
* result view
*
*
*/
var gameData = GameDataManager.GameData; var gameData = GameDataManager.GameData;
var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet); var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(Const.ShopDataSheet);
@ -60,7 +55,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
} }
// スコア更新 // スコア更新
stageScoreData.Score = Math.Min(stageScoreData.Score, score); stageScoreData.Score = Math.Max(stageScoreData.Score, score);
var prevPlaceScore = placeScoreData.Score; var prevPlaceScore = placeScoreData.Score;
placeScoreData.Score += score; placeScoreData.Score += score;
@ -89,7 +84,6 @@ namespace MyGame.Scenes.MiniGame.Scripts
GameDataManager.SaveGameData(); GameDataManager.SaveGameData();
// view // view
gameObject.SetActive(true); gameObject.SetActive(true);
titleObject.SetActive(true); titleObject.SetActive(true);
detailObject.SetActive(true); detailObject.SetActive(true);
@ -129,11 +123,12 @@ namespace MyGame.Scenes.MiniGame.Scripts
private void SetProgress(float newValue, bool animated = true, Action onComplete = null) private void SetProgress(float newValue, bool animated = true, Action onComplete = null)
{ {
var prevProgress = progressValue; var prevValue = progressValue;
newValue = Mathf.Clamp01(newValue);
progressValue = newValue; progressValue = newValue;
this.CallLerp(animated ? progressDuration : 0f, f => this.CallLerp(animated ? progressDuration : 0f, f =>
{ {
var value = Mathf.Lerp(prevProgress, newValue, f.EaseOutQuadratic()); var value = Mathf.Lerp(prevValue, newValue, f.EaseOutQuadratic());
meterProgressText.text = $"{value * 100:0}%"; meterProgressText.text = $"{value * 100:0}%";
meterProgressImage.fillAmount = value; meterProgressImage.fillAmount = value;
}, () => onComplete?.Invoke()); }, () => onComplete?.Invoke());