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