通知用ミッションの達成チェック時にデイリーミッション達成後に更新が走っていなかったのを解消
This commit is contained in:
parent
466dfa1717
commit
4869c55956
|
|
@ -6,7 +6,7 @@ using UnityEngine;
|
|||
|
||||
public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
|
||||
{
|
||||
[SerializeField] private FloatReactiveProperty checkInterval = new FloatReactiveProperty(.1f);
|
||||
[SerializeField] private FloatReactiveProperty checkInterval = new FloatReactiveProperty(.2f);
|
||||
private readonly Subject<int> heartObserver = new Subject<int>();
|
||||
private readonly Subject<int> sceneCounter = new Subject<int>();
|
||||
private readonly Subject<int> shopLevelObserver = new Subject<int>();
|
||||
|
|
@ -19,6 +19,7 @@ public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
|
|||
private readonly Subject<int> addRareSalesObserver = new Subject<int>();
|
||||
private readonly Subject<int> hasRecipeObserver = new Subject<int>();
|
||||
private readonly Subject<int> deliveredBulkOrderObserver = new Subject<int>();
|
||||
private readonly Subject<Unit> updateMissionProgress = new Subject<Unit>();
|
||||
private readonly BoolReactiveProperty updateMissionAchieved = new BoolReactiveProperty();
|
||||
public IReadOnlyReactiveProperty<bool> UpdateMissionAchieved => updateMissionAchieved;
|
||||
|
||||
|
|
@ -30,7 +31,9 @@ public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
|
|||
updateMissionAchieved.AddTo(this);
|
||||
var levelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
||||
levelList = levelList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList();
|
||||
checkInterval.Select(x => Observable.Interval(TimeSpan.FromSeconds(x))).Switch().Subscribe(_ =>
|
||||
checkInterval
|
||||
.Select(x => Observable.Interval(TimeSpan.FromSeconds(x))).Switch()
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
heartObserver.OnNext(gameData.Heart);
|
||||
|
|
@ -79,13 +82,32 @@ public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
|
|||
// 店舗レベルアップorミッション達成でリスト更新して達成チェック
|
||||
Observable.Merge(
|
||||
shopLevelObserver.DistinctUntilChanged(),
|
||||
achievedMissionObserver.DistinctUntilChanged())
|
||||
achievedMissionObserver.DistinctUntilChanged(),
|
||||
updateMissionProgress.Select(_ => 0))
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
latestMissionList = GetLatestMissionList();
|
||||
// ここで達成を再確認
|
||||
updateMissionAchieved.Value = latestMissionList
|
||||
.Any(data => data.count <= MissionManager.GetProgressValue(data));
|
||||
if (latestMissionList.FirstOrDefault(
|
||||
data => data.count <= MissionManager.GetProgressValue(data)) is MissionData debugMissionData)
|
||||
{
|
||||
Debug.Log($@"update normal:{debugMissionData.text} {MissionManager.GetProgressValue(debugMissionData)}/{debugMissionData.count}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"normal no progress");
|
||||
}
|
||||
|
||||
// dailyMission
|
||||
var ids = GameDataManager.GameData.dailyMissionIdArray.Except(GameDataManager.GameData.dailyMissionAchievedIdArray);
|
||||
if (missionList
|
||||
.Where(data => ids.Contains(data.id))
|
||||
.Any(missionData => missionData.count <= MissionManager.GetDailyProgressValue(missionData)))
|
||||
{
|
||||
updateMissionAchieved.Value = true;
|
||||
}
|
||||
|
||||
// CheckDailyCompleteMission
|
||||
if (!GameDataManager.GameData.dailyMissionCompleted)
|
||||
|
|
@ -189,4 +211,8 @@ public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
|
|||
GameDataManager.SaveGameData();
|
||||
});
|
||||
}
|
||||
|
||||
public void CheckMissionProgress(){
|
||||
updateMissionProgress.OnNext(Unit.Default);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class HeaderManager : MonoBehaviour
|
|||
MissionManager.ShowDialog(() =>
|
||||
{
|
||||
isOpenMission = false;
|
||||
GameDataObserver.Instance.CheckMissionProgress();
|
||||
missionIndicator.SetActive(GameDataObserver.Instance.UpdateMissionAchieved.Value);
|
||||
},
|
||||
active => missionIndicator.SetActive(active));
|
||||
|
|
|
|||
Loading…
Reference in New Issue