util追加
This commit is contained in:
parent
6bd67a89d2
commit
b98f2aeadc
|
|
@ -10,29 +10,30 @@ namespace MyGame.Scripts
|
|||
/// <param name="cityId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetPartTimerHeart(int cityId)
|
||||
{
|
||||
// 都市開放時のハート取得
|
||||
var baseBrotherHeart = GameDataManager.GetCityGameData(cityId).BrotherHeart;
|
||||
return GetTotalHeart() - baseBrotherHeart;
|
||||
}
|
||||
|
||||
public static int GetTotalHeart()
|
||||
{
|
||||
var cityDataList = GameDataManager.GameData.CityGameDataDict.Values;
|
||||
var fundedList = cityDataList.Where(data => data.IsFundingCompleted).ToList();
|
||||
|
||||
// 初期店舗の場合リスト内で1店舗解放済みであればOK
|
||||
if (cityId == Const.DefaultCityId && fundedList.Count == 1)
|
||||
switch (fundedList.Count)
|
||||
{
|
||||
return fundedList[0].Heart;
|
||||
case < 1:
|
||||
return GameDataManager.GameData.Heart;
|
||||
case 1:
|
||||
return fundedList[0].Heart;
|
||||
}
|
||||
|
||||
// バイト開放には店舗が2つ以上必要
|
||||
if (fundedList.Count < 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 最新の店舗ハート数+1つ前の店舗のBrotherHeart
|
||||
// 最新の店舗ハート数+1つ前の店舗のBrotherHeartで総ハート数
|
||||
var cities = fundedList.TakeLast(2).ToArray();
|
||||
var prevCityBrotherHeart = cities[0].BrotherHeart;
|
||||
var latestCityHeart = cities[1].Heart;
|
||||
// 都市開放時のハート取得
|
||||
var baseBrotherHeart = GameDataManager.GetCityGameData(cityId).BrotherHeart;
|
||||
return prevCityBrotherHeart + latestCityHeart - baseBrotherHeart;
|
||||
return prevCityBrotherHeart + latestCityHeart;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -41,13 +42,13 @@ namespace MyGame.Scripts
|
|||
/// </summary>
|
||||
/// <param name="cityId"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckLatestCity(int cityId)
|
||||
public static bool CheckLatestCity(int cityId) => cityId == GetLatestCityId();
|
||||
|
||||
public static int GetLatestCityId()
|
||||
{
|
||||
if (cityId == Const.DefaultCityId)
|
||||
{
|
||||
return !GameDataManager.GameData.CityGameDataDict.Values.Any(data => data.IsFundingCompleted);
|
||||
}
|
||||
return GameDataManager.GameData.CityGameDataDict.LastOrDefault(pair => pair.Value.IsFundingCompleted).Key == cityId;
|
||||
var cityId = GameDataManager.GameData.CityGameDataDict
|
||||
.LastOrDefault(pair => pair.Value.IsFundingCompleted).Key;
|
||||
return cityId == 0 ? Const.DefaultCityId : cityId;
|
||||
}
|
||||
|
||||
public static GameData CreateCityData(int cityId)
|
||||
|
|
@ -64,5 +65,6 @@ namespace MyGame.Scripts
|
|||
}
|
||||
|
||||
public static bool IsPartTimerCurrentCity() => !CheckLatestCity(GameDataManager.GameData.CurrentCityId);
|
||||
public static bool IsPartTimerCity(int cityId) => !CheckLatestCity(cityId);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue