From a278bd16c38e2a4eecc5d06cc0c19019878f045e Mon Sep 17 00:00:00 2001 From: kimura Date: Wed, 2 Feb 2022 11:17:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=8A=E5=BA=97=E3=81=AE=E6=AD=A9=E3=81=BF?= =?UTF-8?q?=E3=80=81=E3=83=81=E3=83=A5=E3=83=BC=E3=83=88=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=83=AB=E8=A1=A8=E7=A4=BA=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/Main/Scripts/Information.cs | 57 ++++++++++++++----- .../Main/Scripts/ShopHistoryItemView.cs | 11 +++- popcorn/Assets/MyGame/Scripts/Const.cs | 4 ++ 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/Information.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/Information.cs index 9c727753..abb01490 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/Information.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/Information.cs @@ -91,7 +91,17 @@ public class Information : MonoBehaviour // shopLevel historyTarget.DestroyAllChildrens(); - SetHistory(shopLevelList[0], new List(), false); + + var tutorialDataList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.TutorialScriptDataSheet); + var mainList = tutorialDataList.Where(data => Const.MainTutorial.Contains(data.id)).OrderBy(data => Array.IndexOf(Const.MainTutorial, data.id)).ToList(); + var fieldList = tutorialDataList.Where(data => Const.FieldTutorial.Contains(data.id)).OrderBy(data => Array.IndexOf(Const.FieldTutorial, data.id)).ToList(); + var shoppingList = tutorialDataList.Where(data => Const.ShoppingTutorial.Contains(data.id)).OrderBy(data => Array.IndexOf(Const.ShoppingTutorial, data.id)).ToList(); + var managementList = tutorialDataList.Where(data => Const.ManagementTutorial.Contains(data.id)).OrderBy(data => Array.IndexOf(Const.ManagementTutorial, data.id)).ToList(); + SetHistory(shopLevelList[0], mainList, false); + // tutorial用のSetHistoryが必要 + SetHistory(ScriptLocalization.Item.ShopHistoryText0001, fieldList); + SetHistory(ScriptLocalization.Item.ShopHistoryText0002, shoppingList); + SetHistory(ScriptLocalization.Item.ShopHistoryText0003, managementList); for (var index = 1; index < shopLevelList.Count; index++) { @@ -151,29 +161,46 @@ public class Information : MonoBehaviour shopInfoButton.onClick.Invoke(); } - private void SetHistory(ShopLevelData levelData, List scriptList, bool unreleased, bool withoutLevelText = false) + private void SetHistory(ShopLevelData levelData, List scriptList, bool unreleased) { - var view = Instantiate(historyPrefab, historyTarget); - isOdd = !isOdd; - view.SetOddBG(isOdd); + var view = CreateItemView(); if (unreleased) { view.SetUnreleased(true); return; } - view.SetData(levelData, withoutLevelText); - if (scriptList.Count > 0) - { - view.PlayButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => - { - LocalCacheManager.Save(BrotherConversation.ScriptDataTag, scriptList); - TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation); - }).AddTo(view); - } - else + view.SetData(levelData); + SetScript(view, scriptList); + } + + private void SetHistory(string text, List scriptList) + { + var view = CreateItemView(); + view.SetAchievementText(text); + SetScript(view, scriptList); + } + + private ShopHistoryItemView CreateItemView() + { + var view = Instantiate(historyPrefab, historyTarget); + isOdd = !isOdd; + view.SetOddBG(isOdd); + return view; + } + + private static void SetScript(ShopHistoryItemView view, List scriptList) + { + if (scriptList.Count <= 0) { view.SetButtonAcive(false); + return; } + + view.PlayButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => + { + LocalCacheManager.Save(BrotherConversation.ScriptDataTag, scriptList); + TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation); + }).AddTo(view); } } diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/ShopHistoryItemView.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/ShopHistoryItemView.cs index 62f9149f..97718e0e 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/ShopHistoryItemView.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/ShopHistoryItemView.cs @@ -5,16 +5,21 @@ using UnityEngine.UI; public class ShopHistoryItemView : MonoBehaviour { - private static readonly string levelTextFormat = "Lv.{0} "; + private static readonly string levelTextFormat = "Lv.{0} {1}"; [SerializeField] private Text achievementText; [SerializeField] private Button playButton; [SerializeField] private GameObject oddColorBG; [SerializeField] private GameObject viewObject; [SerializeField] private GameObject unreleasedObject; public IObservable PlayButton => playButton.OnClickAsObservable().TakeUntilDestroy(this); - public void SetData(ShopLevelData levelData, bool withoutLevelText) + public void SetData(ShopLevelData levelData) { - achievementText.text = (withoutLevelText ? "" : String.Format(levelTextFormat, levelData.shopLevel)) + levelData.Achievement; + SetAchievementText(String.Format(levelTextFormat, levelData.shopLevel, levelData.Achievement)); + } + + public void SetAchievementText(string text) + { + achievementText.text = $"  {text}"; } public void SetUnreleased(bool active) diff --git a/popcorn/Assets/MyGame/Scripts/Const.cs b/popcorn/Assets/MyGame/Scripts/Const.cs index 0484af00..3c8bea68 100644 --- a/popcorn/Assets/MyGame/Scripts/Const.cs +++ b/popcorn/Assets/MyGame/Scripts/Const.cs @@ -18,6 +18,10 @@ public static class Const { public static readonly int NotSetMaterialId = 0; public static readonly string RedColorString = "#fb6346"; public static readonly int DailyMissionResetOffset = 0; + public static readonly int[] MainTutorial = { 1, 10, 3, 11, 4 }; + public static readonly int[] FieldTutorial = { 5, 12, 6 }; + public static readonly int[] ShoppingTutorial = { 7, 13, 8}; + public static readonly int[] ManagementTutorial = { 9 }; // tag public static readonly string GameDataTag = "GameData";