チュートリアル分割対応
This commit is contained in:
parent
677fd578ae
commit
27c72d2854
|
|
@ -45,7 +45,7 @@ public class CookingResult : MonoBehaviour
|
||||||
result.Value = resultData;
|
result.Value = resultData;
|
||||||
SetData(productData, rarityData, viewType);
|
SetData(productData, rarityData, viewType);
|
||||||
|
|
||||||
if (GameDataManager.GameData.isFirstPlay)
|
if (!GameDataManager.GameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
{
|
||||||
// ボタン非表示
|
// ボタン非表示
|
||||||
SetUI(resultData, viewType, CheckMakeOne(resultData, productData), true);
|
SetUI(resultData, viewType, CheckMakeOne(resultData, productData), true);
|
||||||
|
|
@ -53,12 +53,15 @@ public class CookingResult : MonoBehaviour
|
||||||
// 失敗したら再チャレンジ
|
// 失敗したら再チャレンジ
|
||||||
if (resultData == CornResult.Failure)
|
if (resultData == CornResult.Failure)
|
||||||
{
|
{
|
||||||
TutorialManager.Instance.ShowTutorialConversation(9, () =>
|
Observable.Timer(TimeSpan.FromSeconds(1.25f)).Subscribe(_ =>
|
||||||
|
{
|
||||||
|
TutorialManager.Instance.ShowTutorialConversation(2, () =>
|
||||||
{
|
{
|
||||||
SoundManager.Instance.ChangeVolumeUniqueBGM(1f);
|
SoundManager.Instance.ChangeVolumeUniqueBGM(1f);
|
||||||
TransitionManager.Instance.UnloadScene(GameScenes.CookingResults);
|
TransitionManager.Instance.UnloadScene(GameScenes.CookingResults);
|
||||||
LocalCacheManager.Load<Action>(PopcornGameManager.RestartCallbackTag, null)?.Invoke();
|
LocalCacheManager.Load<Action>(PopcornGameManager.RestartCallbackTag, null)?.Invoke();
|
||||||
});
|
});
|
||||||
|
}).AddTo(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
successAction?.Invoke();
|
successAction?.Invoke();
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class PopcornGameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
case GameState.TutorialBeforeGuide:
|
case GameState.TutorialBeforeGuide:
|
||||||
case GameState.Guide:
|
case GameState.Guide:
|
||||||
thermalControl.ResetMeter(GameDataManager.GameData.isFirstPlay);
|
thermalControl.ResetMeter(!GameDataManager.GameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay));
|
||||||
thermoMeter.gameObject.SetActive(false);
|
thermoMeter.gameObject.SetActive(false);
|
||||||
cornManager.RespawnCorn();
|
cornManager.RespawnCorn();
|
||||||
break;
|
break;
|
||||||
|
|
@ -76,21 +76,15 @@ public class PopcornGameManager : MonoBehaviour
|
||||||
|
|
||||||
ResetGame();
|
ResetGame();
|
||||||
|
|
||||||
if (GameDataManager.GameData.isFirstPlay)
|
if (!GameDataManager.GameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
|
||||||
if (TutorialManager.Instance.Index == 7)
|
|
||||||
{
|
{
|
||||||
cornManager.SetCornsActive(false);
|
cornManager.SetCornsActive(false);
|
||||||
state.SetValueAndForceNotify(GameState.TutorialBeforeGuide);
|
state.SetValueAndForceNotify(GameState.TutorialBeforeGuide);
|
||||||
TutorialManager.Instance.ShowTutorialConversation(8, () =>
|
|
||||||
{
|
|
||||||
GameGuideDialog.ShowDialog(() =>
|
GameGuideDialog.ShowDialog(() =>
|
||||||
{
|
{
|
||||||
state.SetValueAndForceNotify(GameState.Guide);
|
state.SetValueAndForceNotify(GameState.Guide);
|
||||||
cornManager.SetCornsActive(true);
|
cornManager.SetCornsActive(true);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEVELOPMENT_BUILD || UNITY_EDITOR
|
#if DEVELOPMENT_BUILD || UNITY_EDITOR
|
||||||
|
|
|
||||||
|
|
@ -30,29 +30,25 @@ public class KitchenManager : MonoBehaviour
|
||||||
// レシピの表示
|
// レシピの表示
|
||||||
cookingButton.OnClickAsObservable().Subscribe(_ =>
|
cookingButton.OnClickAsObservable().Subscribe(_ =>
|
||||||
{
|
{
|
||||||
RecipeSelectDialog.ShowDialog(ProductViewType.Default, () =>
|
RecipeSelectDialog.ShowDialog(ProductViewType.Default);
|
||||||
{
|
|
||||||
if (gameData.isFirstPlay && TutorialManager.Instance.Index == 2)
|
|
||||||
{
|
|
||||||
var go = FindObjectOfType<FooterManager>().transform;
|
|
||||||
go.transform.FindChildByName("Button_field", t =>
|
|
||||||
{
|
|
||||||
TutorialManager.Instance.ShowTutorialMask(go.parent, t as RectTransform, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// tutorial
|
// tutorial
|
||||||
#if UNITY_EDITOR
|
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
Debug.Log($"isFirstPlay:{gameData.isFirstPlay}");
|
|
||||||
#endif
|
|
||||||
if (gameData.isFirstPlay)
|
|
||||||
{
|
{
|
||||||
if (TutorialManager.Instance.Index == 1)
|
if (TutorialManager.Instance.Index == 0)
|
||||||
{
|
{
|
||||||
gameData.CornSeed = 90;
|
gameData.ViewedShopLevel = 0;
|
||||||
gameData.Coin = 10;
|
// アイテム付与
|
||||||
|
gameData.CornSeed = 100;
|
||||||
|
gameData.Coin = 0;
|
||||||
|
if (!(gameData.Material.FirstOrDefault(x => x.Id == 2) is MaterialData materialData))
|
||||||
|
{
|
||||||
|
materialData = new MaterialData {Id = 2};
|
||||||
|
gameData.Material.Add(materialData);
|
||||||
|
}
|
||||||
|
materialData.Amount++;
|
||||||
|
|
||||||
// 店舗レベル1達成表示
|
// 店舗レベル1達成表示
|
||||||
ShopLevelUp.ShowDialog(1, () =>
|
ShopLevelUp.ShowDialog(1, () =>
|
||||||
{
|
{
|
||||||
|
|
@ -68,24 +64,10 @@ public class KitchenManager : MonoBehaviour
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (TutorialManager.Instance.Index == 6)
|
else
|
||||||
{
|
{
|
||||||
gameData.CornSeed = 150;
|
// チュートリアル調理終了後
|
||||||
gameData.Material.First(m => m.Id == 2).Amount = 1;
|
TutorialManager.Instance.ShowTutorialConversation(3, () =>
|
||||||
TutorialManager.Instance.ShowTutorialConversation(7, () =>
|
|
||||||
{
|
|
||||||
// マスク表示
|
|
||||||
var buttonRectTransform = cookingButton.transform as RectTransform;
|
|
||||||
var go = TutorialManager.Instance.ShowTutorialMask(buttonRectTransform.parent, buttonRectTransform);
|
|
||||||
cookingButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
|
||||||
{
|
|
||||||
DestroyImmediate(go);
|
|
||||||
}).AddTo(this);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (TutorialManager.Instance.Index > 7)
|
|
||||||
{
|
|
||||||
TutorialManager.Instance.ShowTutorialConversation(10, () =>
|
|
||||||
{
|
{
|
||||||
var go = FindObjectOfType<FooterManager>().transform;
|
var go = FindObjectOfType<FooterManager>().transform;
|
||||||
go.transform.FindChildByName("Button_shop", t =>
|
go.transform.FindChildByName("Button_shop", t =>
|
||||||
|
|
@ -101,13 +83,10 @@ public class KitchenManager : MonoBehaviour
|
||||||
|
|
||||||
// ハートゲージがフルかつダイアログが開いていない場合レベルアップ
|
// ハートゲージがフルかつダイアログが開いていない場合レベルアップ
|
||||||
HeartMeter.Instance.FulledHeart
|
HeartMeter.Instance.FulledHeart
|
||||||
|
.SkipWhile(_ => !gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
.DelaySubscription(TimeSpan.FromSeconds(.4f))
|
.DelaySubscription(TimeSpan.FromSeconds(.4f))
|
||||||
.Subscribe(_ =>
|
.Subscribe(_ =>
|
||||||
{
|
{
|
||||||
if (gameData.isFirstPlay)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ShopLevelUp.ShowDialog(gameData.ViewedShopLevel + 1);
|
ShopLevelUp.ShowDialog(gameData.ViewedShopLevel + 1);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
||||||
|
|
@ -155,7 +134,7 @@ public class KitchenManager : MonoBehaviour
|
||||||
kitchenView.SetTiredAnimation();
|
kitchenView.SetTiredAnimation();
|
||||||
showAdDialogSubject.OnNext(Unit.Default);
|
showAdDialogSubject.OnNext(Unit.Default);
|
||||||
}
|
}
|
||||||
else if (remaining > 0 || gameData.isFirstPlay)
|
else if (remaining > 0 || !gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
{
|
||||||
adButton.gameObject.SetActive(false);
|
adButton.gameObject.SetActive(false);
|
||||||
kitchenView.SetNormalAnimation();
|
kitchenView.SetNormalAnimation();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MyGame.Scenes.marketing.Scripts;
|
using MyGame.Scenes.marketing.Scripts;
|
||||||
|
using MyGame.Scripts;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UniRx.Triggers;
|
using UniRx.Triggers;
|
||||||
|
|
@ -288,7 +289,8 @@ public class Market : SingletonMonoBehaviour<Market>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameData.isFirstPlay)
|
// チュートリアル中は抑制
|
||||||
|
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ public class MarketManager : MonoBehaviour
|
||||||
SoundManager.Instance.PlayBGM("bgm_marketing");
|
SoundManager.Instance.PlayBGM("bgm_marketing");
|
||||||
var gameData = GameDataManager.GameData;
|
var gameData = GameDataManager.GameData;
|
||||||
|
|
||||||
if (gameData.isFirstPlay)
|
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
{
|
||||||
if (TutorialManager.Instance.Index == 10)
|
if (TutorialManager.Instance.Index == 3)
|
||||||
{
|
{
|
||||||
// SetShopViewを使わず表示構築
|
// SetShopViewを使わず表示構築
|
||||||
rewardButtonView.gameObject.SetActive(false);
|
rewardButtonView.gameObject.SetActive(false);
|
||||||
|
|
@ -66,10 +66,7 @@ public class MarketManager : MonoBehaviour
|
||||||
GameDataManager.SaveGameData();
|
GameDataManager.SaveGameData();
|
||||||
walkerMask.gameObject.SetActive(false);
|
walkerMask.gameObject.SetActive(false);
|
||||||
resetRefreshTimer.OnNext((int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds);
|
resetRefreshTimer.OnNext((int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds);
|
||||||
TutorialManager.Instance.ShowTutorialConversation(12, () =>
|
|
||||||
{
|
|
||||||
SetShopView(market.CurrentShopState.Value);
|
SetShopView(market.CurrentShopState.Value);
|
||||||
});
|
|
||||||
}).AddTo(controller).AddTo(this);
|
}).AddTo(controller).AddTo(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -225,9 +222,10 @@ public class MarketManager : MonoBehaviour
|
||||||
|
|
||||||
// 開閉店
|
// 開閉店
|
||||||
market.CurrentShopState
|
market.CurrentShopState
|
||||||
.Where(_ => !gameData.isFirstPlay)
|
.SkipWhile(_ => !gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
.Subscribe(state =>
|
.Subscribe(state =>
|
||||||
{
|
{
|
||||||
|
Debug.Log($"SetShopView");
|
||||||
SetShopView(state);
|
SetShopView(state);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,18 +43,7 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
var data = LocalCacheManager.Load<ProductData>(PopcornGameManager.CookingDataTag);
|
var data = LocalCacheManager.Load<ProductData>(PopcornGameManager.CookingDataTag);
|
||||||
var gameData = GameDataManager.GameData;
|
var gameData = GameDataManager.GameData;
|
||||||
|
|
||||||
if (gameData.isFirstPlay)
|
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
|
||||||
if (TutorialManager.Instance.Index == 1)
|
|
||||||
{
|
|
||||||
TutorialManager.Instance.ShowTutorialConversation(2, () =>
|
|
||||||
{
|
|
||||||
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
|
||||||
TransitionManager.Instance.UnloadScene(GameScenes.RecipeChoice);
|
|
||||||
TransitionManager.Instance.UnloadScene(GameScenes.Recipe);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (TutorialManager.Instance.Index == 7)
|
|
||||||
{
|
{
|
||||||
// マスク表示
|
// マスク表示
|
||||||
var go = TutorialManager.Instance.ShowTutorialMask(transform.parent.parent, nextButton.transform as RectTransform);
|
var go = TutorialManager.Instance.ShowTutorialMask(transform.parent.parent, nextButton.transform as RectTransform);
|
||||||
|
|
@ -63,7 +52,6 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
DestroyImmediate(go);
|
DestroyImmediate(go);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cancelButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
cancelButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,7 @@ public class RecipeSelectDialog : MonoBehaviour
|
||||||
view.RecipeClickObservable.ThrottleFirst(TimeSpan.FromSeconds(.3f)).Subscribe(_ =>
|
view.RecipeClickObservable.ThrottleFirst(TimeSpan.FromSeconds(.3f)).Subscribe(_ =>
|
||||||
{
|
{
|
||||||
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData);
|
||||||
RecipeDetailView.ShowDialog(() =>
|
RecipeDetailView.ShowDialog();
|
||||||
{
|
|
||||||
if (gameData.isFirstPlay)
|
|
||||||
{
|
|
||||||
LocalCacheManager.Load<Action>(CallbackTag, null)?.Invoke();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -80,7 +74,7 @@ public class RecipeSelectDialog : MonoBehaviour
|
||||||
LayoutRebuilder.ForceRebuildLayoutImmediate(content);
|
LayoutRebuilder.ForceRebuildLayoutImmediate(content);
|
||||||
scrollRect.verticalNormalizedPosition = 1;
|
scrollRect.verticalNormalizedPosition = 1;
|
||||||
|
|
||||||
if (gameData.isFirstPlay)
|
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
|
||||||
{
|
{
|
||||||
scrollRect.vertical = false;
|
scrollRect.vertical = false;
|
||||||
// マスク表示
|
// マスク表示
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
using MyGame.Scripts;
|
||||||
|
|
||||||
public enum AdRewardType {
|
public enum AdRewardType {
|
||||||
GachaCoin = 1,
|
GachaCoin = 1,
|
||||||
|
|
@ -130,7 +131,7 @@ public sealed class GameData {
|
||||||
|
|
||||||
// tutorial
|
// tutorial
|
||||||
[DataMember(Name = "Data38")]
|
[DataMember(Name = "Data38")]
|
||||||
public bool isFirstPlay = true;
|
public TutorialFlag FinishedFlags = TutorialFlag.None;
|
||||||
|
|
||||||
// フライパン
|
// フライパン
|
||||||
[DataMember(Name = "Data39")]
|
[DataMember(Name = "Data39")]
|
||||||
|
|
@ -291,7 +292,7 @@ public sealed class GameData {
|
||||||
|
|
||||||
public void FinishTutorial()
|
public void FinishTutorial()
|
||||||
{
|
{
|
||||||
isFirstPlay = false;
|
FinishedFlags |= TutorialFlag.FirstPlay;
|
||||||
fertilizerTime = DateTime.UtcNow.ToBinary();
|
fertilizerTime = DateTime.UtcNow.ToBinary();
|
||||||
increaseCustomerTime = DateTime.UtcNow.ToBinary();
|
increaseCustomerTime = DateTime.UtcNow.ToBinary();
|
||||||
kitchenRefreshTime = DateTime.UtcNow.ToBinary();
|
kitchenRefreshTime = DateTime.UtcNow.ToBinary();
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,16 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace MyGame.Scripts
|
namespace MyGame.Scripts
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum TutorialFlag
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
FirstPlay = 1,
|
||||||
|
CornField = 1 << 1,
|
||||||
|
Shopping = 1 << 2,
|
||||||
|
Management = 1 << 3,
|
||||||
|
}
|
||||||
public class TutorialManager : SingletonMonoBehaviour<TutorialManager>
|
public class TutorialManager : SingletonMonoBehaviour<TutorialManager>
|
||||||
{
|
{
|
||||||
[SerializeField] private TutorialObjectMask maskPrefab;
|
[SerializeField] private TutorialObjectMask maskPrefab;
|
||||||
|
|
@ -19,7 +29,7 @@ namespace MyGame.Scripts
|
||||||
|
|
||||||
public void ResetTutorial()
|
public void ResetTutorial()
|
||||||
{
|
{
|
||||||
index = 1;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowTutorialConversation(int id, Action onComplete = null)
|
public void ShowTutorialConversation(int id, Action onComplete = null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue