リワード発動時の店舗レベルPop抑制追加

This commit is contained in:
kimura 2021-10-22 10:14:56 +09:00
parent e3bb5c1c67
commit 32381a2f09
2 changed files with 6 additions and 8 deletions

View File

@ -50,26 +50,21 @@ public class CornField : MonoBehaviour
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
private readonly Subject<int> resetFertilizerTimer = new Subject<int>(); private readonly Subject<int> resetFertilizerTimer = new Subject<int>();
private bool isFertilizing;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
compositeDisposable.AddTo(this); compositeDisposable.AddTo(this);
resetFertilizerTimer.AddTo(this); resetFertilizerTimer.AddTo(this);
#if UNITY_EDITOR
this.UpdateAsObservable()
.Where(_ => Input.GetKeyDown(KeyCode.R))
.Take(1)
.Subscribe(_ => TransitionManager.Instance.LoadScene(GameScenes.CornField)).AddTo(this);
#endif
SoundManager.Instance.PlayBGM("bgm_Main"); SoundManager.Instance.PlayBGM("bgm_Main");
// データ // データ
var gameData = GameDataManager.GameData; var gameData = GameDataManager.GameData;
CoinManager.Instance.ChangeCoin(gameData.Coin); CoinManager.Instance.ChangeCoin(gameData.Coin);
HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart); HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart);
GameDataObserver.Instance.ShopLevelUpdate GameDataObserver.Instance.ShopLevelUpdate
.Where(x => x) .Where(x => x && !isFertilizing)
.Subscribe(x => .Subscribe(x =>
{ {
LocalCacheManager.Save(ShopLevelUp.DataTag, gameData.ViewedShopLevel + 1); LocalCacheManager.Save(ShopLevelUp.DataTag, gameData.ViewedShopLevel + 1);
@ -102,6 +97,7 @@ public class CornField : MonoBehaviour
#endif #endif
GameDataManager.SaveGameData(); GameDataManager.SaveGameData();
isFertilizing = true;
SoundManager.Instance.PlayBGM("bgm_fertilizer"); SoundManager.Instance.PlayBGM("bgm_fertilizer");
brotherFertilizerAnimation.StartAnimation(); brotherFertilizerAnimation.StartAnimation();
// button非表示 // button非表示
@ -151,6 +147,7 @@ public class CornField : MonoBehaviour
this.CallWaitForSeconds(fertilizerFinishWaitTime, () => this.CallWaitForSeconds(fertilizerFinishWaitTime, () =>
{ {
isFertilizing = false;
// ボタン表示復活 // ボタン表示復活
fertilizerButtonView.gameObject.SetActive(true); fertilizerButtonView.gameObject.SetActive(true);
promoteGrowthButton.gameObject.SetActive(true); promoteGrowthButton.gameObject.SetActive(true);

View File

@ -38,6 +38,7 @@ public class GameDataObserver : SingletonMonoBehaviour<GameDataObserver>
Observable.Interval(TimeSpan.FromSeconds(x)) Observable.Interval(TimeSpan.FromSeconds(x))
.Select(_ => UnityEngine.SceneManagement.SceneManager.sceneCount) .Select(_ => UnityEngine.SceneManagement.SceneManager.sceneCount)
.DistinctUntilChanged() .DistinctUntilChanged()
.Delay(TimeSpan.FromSeconds(.4f))
// .Do(c => { Debug.Log($"sceneCount:{c}");}) // .Do(c => { Debug.Log($"sceneCount:{c}");})
) )
.Switch(); .Switch();