From 32381a2f0933469bd660f95615fb59578794b777 Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 22 Oct 2021 10:14:56 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=AF=E3=83=BC=E3=83=89=E7=99=BA?= =?UTF-8?q?=E5=8B=95=E6=99=82=E3=81=AE=E5=BA=97=E8=88=97=E3=83=AC=E3=83=99?= =?UTF-8?q?=E3=83=ABPop=E6=8A=91=E5=88=B6=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/CornField/Scripts/CornField.cs | 13 +++++-------- popcorn/Assets/MyGame/Scripts/GameDataObserver.cs | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs index 77b571f1..1cf56902 100644 --- a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs +++ b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs @@ -50,26 +50,21 @@ public class CornField : MonoBehaviour private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly Subject resetFertilizerTimer = new Subject(); + 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); diff --git a/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs b/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs index cce00c8a..6afccd84 100644 --- a/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs +++ b/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs @@ -38,6 +38,7 @@ public class GameDataObserver : SingletonMonoBehaviour Observable.Interval(TimeSpan.FromSeconds(x)) .Select(_ => UnityEngine.SceneManagement.SceneManager.sceneCount) .DistinctUntilChanged() + .Delay(TimeSpan.FromSeconds(.4f)) // .Do(c => { Debug.Log($"sceneCount:{c}");}) ) .Switch();