ボーナス取得処理を変更/ ボーナス更新処理を追加
This commit is contained in:
parent
c13c5ee529
commit
cb0f354301
|
|
@ -87,6 +87,7 @@ namespace MyGame.Scenes.marketing.Scripts
|
||||||
ShopCustomizePurchaseDialog.ShowDialog(customizeData, false, () =>
|
ShopCustomizePurchaseDialog.ShowDialog(customizeData, false, () =>
|
||||||
{
|
{
|
||||||
PurchaseItem(customizeData);
|
PurchaseItem(customizeData);
|
||||||
|
Market.Instance.UpdateBonus(GetBonusList(gameData.ShopCustomizeLevel));
|
||||||
selectSubject.OnNext(Unit.Default);
|
selectSubject.OnNext(Unit.Default);
|
||||||
});
|
});
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
@ -112,28 +113,24 @@ namespace MyGame.Scenes.marketing.Scripts
|
||||||
var level = customizeLevelList.LastOrDefault(data => data.point <= gameData.ShopCustomizePoint)?.level ?? 1;
|
var level = customizeLevelList.LastOrDefault(data => data.point <= gameData.ShopCustomizePoint)?.level ?? 1;
|
||||||
gameData.ShopCustomizeLevel = level;
|
gameData.ShopCustomizeLevel = level;
|
||||||
GameDataManager.SaveGameData();
|
GameDataManager.SaveGameData();
|
||||||
// update bonus
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 現在のボーナスレベルと値
|
* 現在のボーナスレベルと値
|
||||||
*/
|
*/
|
||||||
public static List<(ShopCustomizeBonusCategory category, (int bonusLevel, int value) bonusData)> GetBonusList(int level)
|
public static Dictionary<ShopCustomizeBonusCategory, (int bonusLevel, int value)> GetBonusList(int level)
|
||||||
{
|
{
|
||||||
var customizeBonusList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeBonusData>(Const.ShopCustomizeBonusDataSheet);
|
var customizeBonusList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeBonusData>(Const.ShopCustomizeBonusDataSheet);
|
||||||
var categories = (ShopCustomizeBonusCategory[])Enum.GetValues(typeof(ShopCustomizeBonusCategory));
|
var categories = (ShopCustomizeBonusCategory[])Enum.GetValues(typeof(ShopCustomizeBonusCategory));
|
||||||
var list = new List<(ShopCustomizeBonusCategory, (int, int))>();
|
var list = new Dictionary<ShopCustomizeBonusCategory, (int bonusLevel, int value)>();
|
||||||
foreach (var category in categories)
|
foreach (var category in categories)
|
||||||
{
|
{
|
||||||
if (!(customizeBonusList.LastOrDefault(data => data.level <= level) is ShopCustomizeBonusData bonusData))
|
if (customizeBonusList.LastOrDefault(data => data.level <= level) is ShopCustomizeBonusData bonusData)
|
||||||
{
|
{
|
||||||
bonusData = new ShopCustomizeBonusData()
|
list.Add(category, (bonusData.bonusLevel, bonusData.value));
|
||||||
{
|
continue;
|
||||||
bonusLevel = 0,
|
|
||||||
value = 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
list.Add((category, (bonusData.bonusLevel, bonusData.value)));
|
list.Add(category, (0, 0));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ namespace MyGame.Scenes.marketing.Scripts
|
||||||
pointText.text = "--";
|
pointText.text = "--";
|
||||||
}
|
}
|
||||||
var list = ShopCustomize.GetBonusList(gameData.ShopCustomizeLevel);
|
var list = ShopCustomize.GetBonusList(gameData.ShopCustomizeLevel);
|
||||||
var sales = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Sales).bonusData.value;
|
var sales = list[ShopCustomizeBonusCategory.Sales].value;
|
||||||
var customer = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Customer).bonusData.bonusLevel;
|
var customer = list[ShopCustomizeBonusCategory.Customer].bonusLevel;
|
||||||
var adWalker = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.AdWalker).bonusData.bonusLevel;
|
var adWalker = list[ShopCustomizeBonusCategory.AdWalker].bonusLevel;
|
||||||
salesBonusText.text = sales == 0 ? "--" : $"+{sales}";
|
salesBonusText.text = sales == 0 ? "--" : $"+{sales}";
|
||||||
customerBonusText.text = customer == 0 ? "--" : $"Lv.{customer}";
|
customerBonusText.text = customer == 0 ? "--" : $"Lv.{customer}";
|
||||||
adWalkerBonusText.text = adWalker == 0 ? "--" : $"Lv.{adWalker}";
|
adWalkerBonusText.text = adWalker == 0 ? "--" : $"Lv.{adWalker}";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue