リワード発動時の店舗レベル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 Subject<int> resetFertilizerTimer = new Subject<int>();
private bool isFertilizing;
// Start is called before the first frame update
void Start()
{
compositeDisposable.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");
// データ
var gameData = GameDataManager.GameData;
CoinManager.Instance.ChangeCoin(gameData.Coin);
HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart);
GameDataObserver.Instance.ShopLevelUpdate
.Where(x => x)
.Where(x => x && !isFertilizing)
.Subscribe(x =>
{
LocalCacheManager.Save(ShopLevelUp.DataTag, gameData.ViewedShopLevel + 1);
@ -102,6 +97,7 @@ public class CornField : MonoBehaviour
#endif
GameDataManager.SaveGameData();
isFertilizing = true;
SoundManager.Instance.PlayBGM("bgm_fertilizer");
brotherFertilizerAnimation.StartAnimation();
// button非表示
@ -151,6 +147,7 @@ public class CornField : MonoBehaviour
this.CallWaitForSeconds(fertilizerFinishWaitTime, () =>
{
isFertilizing = false;
// ボタン表示復活
fertilizerButtonView.gameObject.SetActive(true);
promoteGrowthButton.gameObject.SetActive(true);

View File

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