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