ヘッダーのミッションバッジの更新タイミングを修正 /デバッグ用にミッションリセットボタンを追加

This commit is contained in:
kimura 2021-11-12 19:21:53 +09:00
parent e0367a3c9a
commit d2d44766a9
5 changed files with 185 additions and 13 deletions

View File

@ -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}

View File

@ -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 =>

View File

@ -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<bool> 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<Action<bool>>(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<Action>(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<Action>(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<MissionData> 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<Action>(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<bool> onAchieved = null)
{
LocalCacheManager.Save(CallbackTag, onClose);
LocalCacheManager.Save(AchievedCallbackTag, onAchieved);

View File

@ -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;

View File

@ -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);
}
}