From d2d44766a9075cc41b1ac66ba6e8244802e28767 Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 12 Nov 2021 19:21:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=98=E3=83=83=E3=83=80=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E3=83=9F=E3=83=83=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=B8=E3=81=AE=E6=9B=B4=E6=96=B0=E3=82=BF=E3=82=A4=E3=83=9F?= =?UTF-8?q?=E3=83=B3=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=20/=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=B0=E7=94=A8=E3=81=AB=E3=83=9F=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/DebugOption/DebugOption.unity | 142 ++++++++++++++++++ .../DebugOption/Scripts/DebugOptionManager.cs | 7 + .../Scenes/Main/Scripts/MissionManager.cs | 20 ++- .../Assets/MyGame/Scripts/GameDataManager.cs | 10 ++ .../Assets/MyGame/Scripts/HeaderManager.cs | 19 ++- 5 files changed, 185 insertions(+), 13 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/DebugOption/DebugOption.unity b/popcorn/Assets/MyGame/Scenes/DebugOption/DebugOption.unity index 754a5337..efb0b181 100644 --- a/popcorn/Assets/MyGame/Scenes/DebugOption/DebugOption.unity +++ b/popcorn/Assets/MyGame/Scenes/DebugOption/DebugOption.unity @@ -1166,6 +1166,147 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &1001425728 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 785180939} + m_Modifications: + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_RootOrder + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063882079711355622, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5062447477614030396, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_Text + value: "\u30CE\u30FC\u30DE\u30EB\n\u30DF\u30C3\u30B7\u30E7\u30F3\n\u30EA\u30BB\u30C3\u30C8" + objectReference: {fileID: 0} + - target: {fileID: 5850834825256791800, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_Name + value: NormalMissionReset + objectReference: {fileID: 0} + - target: {fileID: 5850834825256791800, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: f19992fe2069b4e16b2f83277fb189cb, type: 3} +--- !u!114 &1001425729 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 502413859327355263, guid: f19992fe2069b4e16b2f83277fb189cb, + type: 3} + m_PrefabInstance: {fileID: 1001425728} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1074704275 PrefabInstance: m_ObjectHideFlags: 0 @@ -2287,6 +2428,7 @@ MonoBehaviour: bulkOrderResetButton: {fileID: 1344540256} shopLevelUpResetButton: {fileID: 1349073832} dailyMissionResetButton: {fileID: 297099900} + normalMissionResetButton: {fileID: 1001425729} alwaysVideoFailToLoadToggle: {fileID: 1076049186} fastGrowingToggle: {fileID: 1998240841} skipTutorialToggle: {fileID: 6551979} diff --git a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs index 395808d1..3602f66a 100644 --- a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs +++ b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs @@ -20,6 +20,7 @@ public class DebugOptionManager : MonoBehaviour [SerializeField] private Button bulkOrderResetButton; [SerializeField] private Button shopLevelUpResetButton; [SerializeField] private Button dailyMissionResetButton; + [SerializeField] private Button normalMissionResetButton; [SerializeField] private Toggle alwaysVideoFailToLoadToggle; [SerializeField] private Toggle fastGrowingToggle; [SerializeField] private Toggle skipTutorialToggle; @@ -133,6 +134,12 @@ public class DebugOptionManager : MonoBehaviour { gameData.lastDailyMissionSetTime = DateTime.MinValue.ToBinary(); }).AddTo(this); + + normalMissionResetButton.OnClickAsObservable().Subscribe(_ => + { + gameData.AchievedMission.Clear(); + gameData.ResetNormalTotalCount(); + }).AddTo(this); coinCount.text = $"{gameData.Coin}"; coinCount.OnValueChangedAsObservable().Subscribe(x => diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/MissionManager.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/MissionManager.cs index 431c430d..f4035a93 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/MissionManager.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/MissionManager.cs @@ -8,8 +8,8 @@ using UnityEngine.UI; public class MissionManager : MonoBehaviour { public static readonly string MissionDataTag = "MissionData"; - public static readonly string CallbackTag = "MissionManagerCallback"; - public static readonly string AchievedCallbackTag = "MissionManagerAchievedCallback"; + private static readonly string CallbackTag = "MissionManagerCallback"; + private static readonly string AchievedCallbackTag = "MissionManagerAchievedCallback"; private static readonly string TimeFormat = "更新まで:{0}時間{1}分{2}秒"; private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger"); private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger"); @@ -20,6 +20,10 @@ public class MissionManager : MonoBehaviour [SerializeField] private MissionListView listView; [SerializeField] private Text timeLimitText; + private int normalIndicateFlag; + private int dailyIndicateFlag; + private Action onAchieved; + private void Start() { closeButton.OnClickAsObservable().Take(1).Subscribe(_ => @@ -41,6 +45,7 @@ public class MissionManager : MonoBehaviour timeLimitText.gameObject.SetActive(category == MissionCategory.Daily); }).AddTo(this); + onAchieved = LocalCacheManager.Load>(AchievedCallbackTag, null); var gameData = GameDataManager.GameData; // デイリーカウントダウン @@ -67,7 +72,6 @@ public class MissionManager : MonoBehaviour // dailyMission // コンプリートミッション - int dailyIndicateFlag = 0; MissionView completeMissionView; { var missionView = listView.AddDailyCompleteItemView(); @@ -103,7 +107,7 @@ public class MissionManager : MonoBehaviour // 達成ID保存 gameData.dailyMissionCompleted = true; GameDataManager.SaveGameData(); - LocalCacheManager.Load(AchievedCallbackTag, null)?.Invoke(); + onAchieved?.Invoke(normalIndicateFlag + dailyIndicateFlag > 0); }))); TransitionManager.Instance.LoadSceneAdditive(GameScenes.MissionAchievement); }).AddTo(missionView); @@ -137,7 +141,7 @@ public class MissionManager : MonoBehaviour GameDataManager.SaveGameData(); completeMissionView.ChangeProgress(gameData.dailyMissionIdArray.Length, gameData.dailyMissionAchievedIdArray.Length); completeMissionView.SetButtonActive(gameData.dailyMissionIdArray.Length <= gameData.dailyMissionAchievedIdArray.Length); - LocalCacheManager.Load(AchievedCallbackTag, null)?.Invoke(); + onAchieved?.Invoke(normalIndicateFlag + dailyIndicateFlag > 0); }))); TransitionManager.Instance.LoadSceneAdditive(GameScenes.MissionAchievement); }).AddTo(missionView); @@ -149,7 +153,7 @@ public class MissionManager : MonoBehaviour private void GenerateNormalMission(List missionList) { // ミッション表示 - int normalIndicateFlag = 0; + normalIndicateFlag = 0; var latestMissionList = missionList .Where(data => data.Category == MissionCategory.Normal && data.shopLevel <= GameDataManager.GameData.ViewedShopLevel) .GroupBy(data => data.Condition, (cond, list) => @@ -185,7 +189,7 @@ public class MissionManager : MonoBehaviour GameDataManager.SaveGameData(); listView.ResetItemList(MissionCategory.Normal); GenerateNormalMission(missionList); - LocalCacheManager.Load(AchievedCallbackTag, null)?.Invoke(); + onAchieved?.Invoke(normalIndicateFlag + dailyIndicateFlag > 0); }))); TransitionManager.Instance.LoadSceneAdditive(GameScenes.MissionAchievement); }).AddTo(missionView); @@ -193,7 +197,7 @@ public class MissionManager : MonoBehaviour listView.SetIndicator(MissionCategory.Normal, normalIndicateFlag > 0); } - public static void ShowDialog(Action onClose = null, Action onAchieved = null) + public static void ShowDialog(Action onClose = null, Action onAchieved = null) { LocalCacheManager.Save(CallbackTag, onClose); LocalCacheManager.Save(AchievedCallbackTag, onAchieved); diff --git a/popcorn/Assets/MyGame/Scripts/GameDataManager.cs b/popcorn/Assets/MyGame/Scripts/GameDataManager.cs index cefe4b50..3023a23b 100644 --- a/popcorn/Assets/MyGame/Scripts/GameDataManager.cs +++ b/popcorn/Assets/MyGame/Scripts/GameDataManager.cs @@ -246,6 +246,16 @@ public sealed class GameData { return DailyTotalSalesList.Where(data => data.FlavorId == id && data.Rarity != ProductRarity.Normal).Sum(data => data.Stock); } + public void ResetNormalTotalCount() + { + TotalAddCoin = 0; + TotalSubCoin = 0; + TotalAddCornSeed = 0; + TotalCustomerCount = 0; + TotalSalesList.Clear(); + BulkOrderDeliveredCount = 0; + } + public void ResetDailyTotalCount() { DailyTotalAddCoin = 0; diff --git a/popcorn/Assets/MyGame/Scripts/HeaderManager.cs b/popcorn/Assets/MyGame/Scripts/HeaderManager.cs index ba596a1c..7c14862d 100644 --- a/popcorn/Assets/MyGame/Scripts/HeaderManager.cs +++ b/popcorn/Assets/MyGame/Scripts/HeaderManager.cs @@ -15,22 +15,31 @@ public class HeaderManager : MonoBehaviour private void Start() { + var isOpenMission = false; settingButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => { TransitionManager.Instance.LoadSceneAdditive(GameScenes.SettingsDialog); }); missionButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => { - MissionManager.ShowDialog(); + isOpenMission = true; + MissionManager.ShowDialog(() => + { + isOpenMission = false; + missionIndicator.SetActive(GameDataObserver.Instance.UpdateMissionAchieved.Value); + }, + active => missionIndicator.SetActive(active)); }); informationButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => { TransitionManager.Instance.LoadSceneAdditive(GameScenes.Information); }); // mission報酬通知 - GameDataObserver.Instance.UpdateMissionAchieved.Subscribe(x => - { - missionIndicator.SetActive(x); - }).AddTo(this); + GameDataObserver.Instance.UpdateMissionAchieved + .Where(_ => !isOpenMission).Subscribe(x => + { + Debug.Log($"mission achieved:{x}"); + missionIndicator.SetActive(x); + }).AddTo(this); } }