データ構造変更
This commit is contained in:
parent
33e508d403
commit
1e8e4afe1f
|
|
@ -85,7 +85,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
var placeScore = gameData.ScrollGamePlaceScoreList.FirstOrDefault(data => data.Id == placeId)?.Score ?? 0;
|
var placeScore = gameData.ScrollGamePlaceScoreList.FirstOrDefault(data => data.Id == placeId)?.Score ?? 0;
|
||||||
stageSelectView.SetScore(placeScore);
|
stageSelectView.SetScore(placeScore);
|
||||||
// 達成報酬更新
|
// 達成報酬更新
|
||||||
stageSelectView.SetRecipeActive(placeScore < levelPlaceList[1].needScore);
|
stageSelectView.SetRecipeActive(placeScore < levelPlaceList[1].NeedScore);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
for (var i = 0; i < levelStageList.Length; i++)
|
for (var i = 0; i < levelStageList.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -69,26 +69,26 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
var prevPlaceScore = placeScoreData.Score;
|
var prevPlaceScore = placeScoreData.Score;
|
||||||
placeScoreData.Score += score;
|
placeScoreData.Score += score;
|
||||||
|
|
||||||
|
// 素材獲得
|
||||||
foreach (var placeData in placeList.Where(data => data.itemId != 0))
|
foreach (var placeData in placeList.Where(data => data.itemId != 0))
|
||||||
{
|
{
|
||||||
var amount = Mathf.FloorToInt((float)score / placeData.needScore);
|
|
||||||
var shopData = shopDataList.FirstOrDefault(data => data.itemId == placeData.itemId && data.Category == ItemCategory.Material);
|
var shopData = shopDataList.FirstOrDefault(data => data.itemId == placeData.itemId && data.Category == ItemCategory.Material);
|
||||||
// materialNameText.text = shopData.Name;
|
|
||||||
materialImageTarget.DestroyAllChildrens();
|
materialImageTarget.DestroyAllChildrens();
|
||||||
Instantiate(shopData.GetIconPrefab(), materialImageTarget);
|
Instantiate(shopData.GetIconPrefab(), materialImageTarget);
|
||||||
materialAmountText.text = $"x{amount}";
|
materialAmountText.text = $"x{amount}";
|
||||||
Shopping.AddItem(shopData, amount);
|
Shopping.AddItem(shopData, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// レシピ獲得
|
||||||
var recipePlaceData = placeList
|
var recipePlaceData = placeList
|
||||||
.OrderBy(data => data.needScore)
|
.OrderBy(data => data.NeedScore)
|
||||||
// .Where(data => !gameData.MyRecipes.Contains(data.recipeId))
|
// .Where(data => !gameData.MyRecipes.Contains(data.recipeId))
|
||||||
.FirstOrDefault(data => data.recipeId != 0);
|
.FirstOrDefault(data => data.recipeId != 0);
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
recipePlaceData = prevPlaceScore < recipePlaceData.needScore ? recipePlaceData : null;
|
recipePlaceData = prevPlaceScore < recipePlaceData.NeedScore ? recipePlaceData : null;
|
||||||
#endif
|
#endif
|
||||||
var hasRecipeData = recipePlaceData != null;
|
var hasRecipeData = recipePlaceData != null;
|
||||||
var achievedRecipe = hasRecipeData && placeScoreData.Score >= recipePlaceData.needScore;
|
var achievedRecipe = hasRecipeData && placeScoreData.Score >= recipePlaceData.NeedScore;
|
||||||
if (achievedRecipe)
|
if (achievedRecipe)
|
||||||
{
|
{
|
||||||
if (!gameData.MyRecipes.Contains(recipePlaceData.recipeId))
|
if (!gameData.MyRecipes.Contains(recipePlaceData.recipeId))
|
||||||
|
|
@ -109,11 +109,11 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
if (hasRecipeData)
|
if (hasRecipeData)
|
||||||
{
|
{
|
||||||
meterObject.SetActive(true);
|
meterObject.SetActive(true);
|
||||||
SetProgress((float)prevPlaceScore / recipePlaceData.needScore, false);
|
SetProgress((float)prevPlaceScore / recipePlaceData.NeedScore, false);
|
||||||
this.CallWaitForSeconds(waitProgress, () =>
|
this.CallWaitForSeconds(waitProgress, () =>
|
||||||
{
|
{
|
||||||
SoundManager.Instance.PlaySE("se_minigame_meter");
|
SoundManager.Instance.PlaySE("se_minigame_meter");
|
||||||
SetProgress((float)placeScoreData.Score / recipePlaceData.needScore, true, () =>
|
SetProgress((float)placeScoreData.Score / recipePlaceData.NeedScore, true, () =>
|
||||||
{
|
{
|
||||||
if (achievedRecipe)
|
if (achievedRecipe)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
{
|
{
|
||||||
var productData = productDataList.FirstOrDefault(data => data.id == placeData.recipeId);
|
var productData = productDataList.FirstOrDefault(data => data.id == placeData.recipeId);
|
||||||
recipeText.text = $"{LocalizationManager.GetTranslation("UI/RewardItem")}{productData.Name}";
|
recipeText.text = $"{LocalizationManager.GetTranslation("UI/RewardItem")}{productData.Name}";
|
||||||
recipeNeedScoreText.text = $"{LocalizationManager.GetTranslation("UI/NeedScore")}{placeData.needScore}";
|
recipeNeedScoreText.text = $"{LocalizationManager.GetTranslation("UI/NeedScore")}{placeData.NeedScore}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -540,7 +540,10 @@ public sealed class ScrollGamePlaceData
|
||||||
{
|
{
|
||||||
public int id;
|
public int id;
|
||||||
public int placeId;
|
public int placeId;
|
||||||
public int needScore;
|
public string needScore;
|
||||||
|
public int NeedScore => NeedScores.Length > 0 ? NeedScores[0] : default;
|
||||||
|
private string[] NeedScoreStrings => needScore.Split(',');
|
||||||
|
public int[] NeedScores => NeedScoreStrings.Length >= 2 ? NeedScoreStrings.Select(int.Parse).ToArray() : Enumerable.Repeat(NeedScoreStrings[0].ToInt(), 2).ToArray();
|
||||||
public int itemId;
|
public int itemId;
|
||||||
public int recipeId;
|
public int recipeId;
|
||||||
public int customizeId;
|
public int customizeId;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue