From 558d3f5e2c2b0a9b6b7c0a415072a14d7fc5563d Mon Sep 17 00:00:00 2001 From: kimura Date: Mon, 13 Dec 2021 15:54:21 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E8=A9=A6=E9=A3=9F=E4=B8=AD=E8=A1=A8?= =?UTF-8?q?=E7=A4=BAUI=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../marketing/Scripts/MarketSignBoardView.cs | 19 ++++++++++++ .../Scripts/MarketSignBoardView.cs.meta | 3 ++ .../MyGame/Scenes/marketing/marketing.unity | 29 +++++++++++++++---- 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs.meta diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs new file mode 100644 index 00000000..cae8e889 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace MyGame.Scenes.marketing.Scripts +{ + public class MarketSignBoardView : MonoBehaviour + { + private static readonly string remainTimeFormat = "残り{0:D2}:{1:D2}"; + [SerializeField] private Text remainTimeText; + [SerializeField] private GameObject normalBoardObject; + [SerializeField] private GameObject tastingBoardObject; + + public void SetTime(int seconds) + { + seconds = Mathf.Max(0, seconds); + remainTimeText.text = string.Format(remainTimeFormat, Mathf.Min(seconds / 60, 99), seconds % 60); + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs.meta new file mode 100644 index 00000000..59f81dfb --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7a19dcec25224a75a8f3635153cef5c9 +timeCreated: 1639378152 \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity index 48d1b694..c8c418bc 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity @@ -3622,7 +3622,7 @@ PrefabInstance: - target: {fileID: 4293843007976718249, guid: 1c993e9707f1a4fada56020be27dde28, type: 3} propertyPath: m_AnchoredPosition.y - value: 66.25009 + value: 66.25 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1c993e9707f1a4fada56020be27dde28, type: 3} @@ -5582,6 +5582,7 @@ MonoBehaviour: cartView: {fileID: 2048621276} blueView: {fileID: 1506158581} rewardButtonView: {fileID: 820175261} + signBoardView: {fileID: 0} pinkTarget: {fileID: 1749782974} coinPrefab: {fileID: 8159396421809467538, guid: 9fc8076f17c26ff4d9be53b90a7dad4c, type: 3} @@ -6172,7 +6173,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1165998904 Transform: m_ObjectHideFlags: 0 @@ -6720,7 +6721,7 @@ GameObject: - component: {fileID: 1265140452} - component: {fileID: 1265140451} - component: {fileID: 1265140450} - m_Layer: 0 + m_Layer: 5 m_Name: Canvas m_TagString: Untagged m_Icon: {fileID: 0} @@ -7057,7 +7058,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &1423968762 Transform: m_ObjectHideFlags: 0 @@ -13072,7 +13073,7 @@ GameObject: - component: {fileID: 1629640653} - component: {fileID: 1629640655} - component: {fileID: 1629640654} - m_Layer: 0 + m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} @@ -13418,6 +13419,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1732899480} + - component: {fileID: 1732899481} m_Layer: 0 m_Name: Signboard m_TagString: Untagged @@ -13441,6 +13443,21 @@ Transform: m_Father: {fileID: 1102296790} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1732899481 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1732899479} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a19dcec25224a75a8f3635153cef5c9, type: 3} + m_Name: + m_EditorClassIdentifier: + remainTimeText: {fileID: 1629640654} + normalBoardObject: {fileID: 1165998903} + tastingBoardObject: {fileID: 1423968761} --- !u!1 &1749782973 GameObject: m_ObjectHideFlags: 0 @@ -13466,7 +13483,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1749782973} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 4.96, y: -0.26, z: 0} + m_LocalPosition: {x: 3.46, y: -0.26, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1189290113} From 922d9b898d10285393e45d9ddf157613856b5b2c Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:37:46 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E3=83=90=E3=82=B9=E3=82=B1=E3=83=83?= =?UTF-8?q?=E3=83=88=E5=86=85=E3=81=AE=E6=AE=8B=E9=87=8F=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../marketing/Prefabs/Brother_pink.prefab | 19 +++++++++++- .../marketing/Scripts/TastingBasketView.cs | 31 +++++++++++++++++++ .../Scripts/TastingBasketView.cs.meta | 3 ++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs.meta diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab index 500b2f33..ee18f110 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab @@ -1012,7 +1012,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &8458098820248002959 Transform: m_ObjectHideFlags: 0 @@ -1576,6 +1576,7 @@ GameObject: - component: {fileID: 7854448232971748899} - component: {fileID: 7854448232971748898} - component: {fileID: 7854448232971748956} + - component: {fileID: 3285748382438269010} m_Layer: 0 m_Name: Brother_pink m_TagString: Untagged @@ -1633,6 +1634,22 @@ SortingGroup: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 23 +--- !u!114 &3285748382438269010 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7854448232971748896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: acf2a111dab748379c60a37b887bd20c, type: 3} + m_Name: + m_EditorClassIdentifier: + itemMany: {fileID: 7527088936072372818} + itemFew: {fileID: 3577262440827808746} + manyCount: 8 + fewCount: 4 --- !u!1 &7854448233088646087 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs new file mode 100644 index 00000000..2a3dd51c --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace MyGame.Scenes.marketing.Scripts +{ + public class TastingBasketView : MonoBehaviour + { + [SerializeField] private GameObject itemMany; + [SerializeField] private GameObject itemFew; + [SerializeField] private int manyCount; + [SerializeField] private int fewCount; + + public void SetItem(int count) + { + if (count >= manyCount) + { + itemMany.SetActive(true); + itemFew.SetActive(false); + } + else if (count >= fewCount) + { + itemMany.SetActive(false); + itemFew.SetActive(true); + } + else + { + itemMany.SetActive(false); + itemFew.SetActive(false); + } + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs.meta new file mode 100644 index 00000000..53395743 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingBasketView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: acf2a111dab748379c60a37b887bd20c +timeCreated: 1639454549 \ No newline at end of file From 9a3089a4f6507fb31838ce780a9a12ab4ab32fc4 Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:38:45 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E8=A9=A6=E9=A3=9F=E3=81=A8=E5=AE=A3?= =?UTF-8?q?=E4=BC=9D=E3=81=AE=E6=8E=92=E4=BB=96=E5=88=B6=E5=BE=A1=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Scripts/CustomerFlow.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs index f123b44a..60b95341 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs @@ -23,6 +23,9 @@ public class CustomerFlow : MonoBehaviour [Header("試食のお客さん出現間隔(秒)")] [SerializeField] private float tastingCustomerInterval = 5f; + public float TastingCustomerInterval => tastingCustomerInterval; + private int adActiveCount = 0; + public IObservable Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, tastingCustomerObservable); private void Awake() @@ -66,8 +69,11 @@ public class CustomerFlow : MonoBehaviour } #endif // 試食 + // tastingCustomerInterval毎にTastingCountを確認 var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval)) - .Where(_ => GameDataManager.GameData.TastingCount > 0) + .Where(_ => adActiveCount <= 0) // 宣伝中判定 + .Where(_ => GameDataManager.GameData.ShopStock.Count > 0) // 在庫ゼロ判定 + .Where(_ => GameDataManager.GameData.TastingCount > 0) // 試食残り判定 .Publish() .RefCount(); // 試食残りカウントを減らす @@ -84,8 +90,10 @@ public class CustomerFlow : MonoBehaviour { var timerObservable = AdWalkerTimer().Publish().RefCount(); adStartObservable.OnNext(timerObservable); + adActiveCount++; timerObservable.Subscribe(_ => { }, () => { + adActiveCount--; onComplete?.Invoke(); }).AddTo(this); } From d7e917263533e6a3f2bde4025f7c3b1b2b6e2a8b Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:40:36 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=E5=AE=A3=E4=BC=9D=E5=BE=85=E3=81=A1?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=9E=E3=83=BC=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/MarketManager.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs index e3d1d266..24a1a9bc 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs @@ -24,7 +24,7 @@ public class MarketManager : MonoBehaviour private Market market; List productDataList; - private readonly Subject resetRefreshTimer = new Subject(); + private readonly Subject resetRefreshTimer = new Subject(); private readonly CompositeDisposable ShopClosedCompositeDisposable = new CompositeDisposable(); private void Start() @@ -67,7 +67,7 @@ public class MarketManager : MonoBehaviour gameData.FinishTutorial(); GameDataManager.SaveGameData(); walkerMask.gameObject.SetActive(false); - resetRefreshTimer.OnNext((int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds); + resetRefreshTimer.OnNext(Unit.Default); SetShopView(market.CurrentShopState.Value); }).AddTo(controller).AddTo(this); }); @@ -118,14 +118,17 @@ public class MarketManager : MonoBehaviour gameData.increaseCustomerTime = DateTime.UtcNow.AddSeconds(10).ToBinary(); #endif GameDataManager.SaveGameData(); - resetRefreshTimer.OnNext((int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds); + resetRefreshTimer.OnNext(Unit.Default); }); }).AddTo(this); + // onNextをトリガーに実行 IDisposable timerDisposable = null; resetRefreshTimer + .Select(_ => (int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds) .Subscribe(time => { + // タイマーの更新処理 timerDisposable?.Dispose(); rewardButtonView.SetButtonActive(time <= 0); rewardButtonView.SetTime(time); @@ -141,14 +144,14 @@ public class MarketManager : MonoBehaviour }).AddTo(this); }).AddTo(this); - var remaining = (int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds; - resetRefreshTimer.OnNext(remaining); + resetRefreshTimer.OnNext(Unit.Default); + // アプリ復帰時に残り時間更新 Observable.EveryApplicationPause() .Where(pause => !pause) .Subscribe(_ => { - resetRefreshTimer.OnNext((int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds); + resetRefreshTimer.OnNext(Unit.Default); }).AddTo(this); market.IsPromotion.Subscribe(active => From f9ceb4bde8b09767d650f421a55716fd834ff786 Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:44:23 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=E8=B2=A9=E5=A3=B2=E3=82=B7=E3=83=BC?= =?UTF-8?q?=E3=83=B3=E8=A9=A6=E9=A3=9F=E4=B8=AD=E5=88=B6=E5=BE=A1=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Animation/Brother/Brother_pink.controller | 72 +++++++++- .../marketing/Scripts/BrotherPinkView.cs | 129 +++++++++++++----- 2 files changed, 164 insertions(+), 37 deletions(-) diff --git a/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller b/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller index fc11917a..09421063 100644 --- a/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller +++ b/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller @@ -91,6 +91,8 @@ AnimatorStateMachine: - {fileID: 51081042415013300} - {fileID: 4394378192515912696} - {fileID: -4201787685094799525} + - {fileID: 1938256483501769669} + - {fileID: 265964369079198928} m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] @@ -242,25 +244,37 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Promotion m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Sleepy m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Walk m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} + - m_Name: Tasting + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: TastingWalk + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -299,6 +313,56 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 0 +--- !u!1101 &265964369079198928 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: TastingWalk + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7730918100354297461} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1938256483501769669 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Tasting + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -6388531656861423336} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &4390197982913342166 AnimatorState: serializedVersion: 5 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs index ad5bf563..9ee208f5 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs @@ -1,4 +1,5 @@ using System; +using MyGame.Scenes.marketing.Scripts; using UniRx; using UniRx.Triggers; using UnityEngine; @@ -9,6 +10,8 @@ public class BrotherPinkView : SingletonMonoBehaviour private static readonly int Promotion = Animator.StringToHash("Promotion"); private static readonly int Sleepy = Animator.StringToHash("Sleepy"); private static readonly int Walk = Animator.StringToHash("Walk"); + private static readonly int Tasting = Animator.StringToHash("Tasting"); + private static readonly int TastingWalk = Animator.StringToHash("TastingWalk"); private static readonly Vector2 RightPos = new Vector2(4.96f, -0.26f); private static readonly Vector2 LeftPos = new Vector2(-4.96f, -0.26f); @@ -22,9 +25,12 @@ public class BrotherPinkView : SingletonMonoBehaviour public int FewerBorder => fewerBorder; private Animator animator; - private bool isManyCustomer; - private bool isLocked; + private TastingBasketView basketView; + private bool waitMove; + private bool isMoveLocked; private bool isPromotion; + private bool isEndingPromotion; + private bool isTasting; private int nextId; private readonly (int trigger, Vector2 wayPoint, float wait)[] pinkMoves = { @@ -33,23 +39,48 @@ public class BrotherPinkView : SingletonMonoBehaviour (Walk, RightPos, 0f), (Promotion, RightPos + Vector2.left * .03f, 5.35f), }; + private readonly (int trigger, Vector2 wayPoint, float wait)[] pinkTastingMoves = + { + (TastingWalk, LeftPos, 0f), + (Tasting, LeftPos + Vector2.right * .03f, 5.35f), + (TastingWalk, RightPos, 0f), + (Tasting, RightPos + Vector2.left * .03f, 5.35f), + }; private int moveIndex; private Vector2 wayPoint; private float durationDelta; private float completedDuration; + private (int trigger, Vector2 wayPoint, float wait)[] selectedMoves; + private IDisposable moveLockDispose; + private Subject setTrigger = new Subject(); private void Awake() { + setTrigger.AddTo(this); nextId = Normal; - isManyCustomer = true; + waitMove = true; + selectedMoves = pinkMoves; } private void Start() { pinkTransform.localPosition = RightPos; + /* + * 1フレーム内で最後に受け取った値をSetする + * アニメーター挙動考慮 + */ + setTrigger + .ThrottleFrame(1) + .Subscribe(x => + { + if (animator != null) + { + animator.SetTrigger(x); + } + }).AddTo(this); this.UpdateAsObservable().Subscribe(_ => { - if (isManyCustomer || isLocked || isPromotion) + if (waitMove || isMoveLocked || isPromotion) { return; } @@ -66,14 +97,16 @@ public class BrotherPinkView : SingletonMonoBehaviour } durationDelta = 0; moveIndex++; - if (moveIndex == pinkMoves.Length) + if (moveIndex == selectedMoves.Length) { - ResetMove(); - isLocked = true; - this.CallWaitForSeconds(coolTime, () => + if (isTasting) { - isLocked = false; - }); + moveIndex = 0; + SetPinkMove(); + return; + } + ResetMove(); + LockMove(coolTime); return; } SetPinkMove(); @@ -81,10 +114,21 @@ public class BrotherPinkView : SingletonMonoBehaviour }).AddTo(this); } + private void LockMove(float time) + { + isMoveLocked = true; + moveLockDispose?.Dispose(); + moveLockDispose = Observable.Timer(TimeSpan.FromSeconds(time)) + .Subscribe(l => { }, () => + { + isMoveLocked = false; + }).AddTo(this); + } + private void ResetMove() { + waitMove = true; moveIndex = 0; - isManyCustomer = true; if (animator != null) animator.SetTrigger(nextId); } @@ -92,12 +136,13 @@ public class BrotherPinkView : SingletonMonoBehaviour { target.DestroyAllChildrens(); animator = Instantiate(animatorPrefab, target); + basketView = animator.GetComponent(); this.UpdateAsObservable().Subscribe(_ => { target.localPosition = pinkTransform.localPosition; target.localRotation = pinkTransform.localRotation; }).AddTo(animator); - if (isManyCustomer || isPromotion) + if (waitMove || isPromotion || isTasting) { return; } @@ -106,13 +151,14 @@ public class BrotherPinkView : SingletonMonoBehaviour private void SetPinkMove() { - var move = pinkMoves[moveIndex]; + var move = selectedMoves[moveIndex]; wayPoint = move.wayPoint; completedDuration = move.wait; if (animator != null) { animator.ResetTrigger(Normal); - animator.SetTrigger(move.trigger); + // animator.SetTrigger(move.trigger); + setTrigger.OnNext(move.trigger); } if (Vector2.Distance(wayPoint, pinkTransform.localPosition.ToVector2()) < .01f) { @@ -127,10 +173,11 @@ public class BrotherPinkView : SingletonMonoBehaviour } } + // お客さんが多い場合に使用するアニメーション切替え private void SetTrigger(int id) { nextId = id; - if (isManyCustomer) + if (waitMove) { animator.SetTrigger(id); } @@ -161,34 +208,50 @@ public class BrotherPinkView : SingletonMonoBehaviour { if (animator != null) { - var stateInfo = animator.GetCurrentAnimatorStateInfo(0); - if (stateInfo.IsName("Brother_pink_promotion")) - { - var length = stateInfo.length; - var time = stateInfo.normalizedTime; - this.CallWaitForSeconds((1 - time % 1) * length - .3f, () => - { - animator.ResetTrigger(Promotion); - ResetMove(); - isPromotion = false; - }); - return; - } + animator.ResetTrigger(Promotion); } ResetMove(); isPromotion = false; } - public void SetWalk() + public void StartTasting() { - if (isLocked || isPromotion) + // tasting発動 + moveLockDispose?.Dispose(); + isMoveLocked = false; + waitMove = false; + + isTasting = true; + selectedMoves = pinkTastingMoves; + SetPinkMove(); + } + + public void StopTasting() + { + if (!isTasting) { return; } - if (isManyCustomer) + isTasting = false; + selectedMoves = pinkMoves; + SetPinkMove(); + } + + public void SetTastingCount(int count) + { + if (basketView != null) { - isManyCustomer = false; - SetPinkMove(); + basketView.SetItem(count); } } + + public void SetWalk() + { + if (!waitMove || isMoveLocked || isPromotion || isTasting) + { + return; + } + waitMove = false; + SetPinkMove(); + } } From 9c9120fe4ca96635d2dd2cd601bda46bb34609c1 Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:46:58 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E8=A9=A6=E9=A3=9F=E4=B8=AD=E3=82=A2?= =?UTF-8?q?=E3=83=8B=E3=83=A1=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E5=86=85?= =?UTF-8?q?=E9=83=A8=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Scripts/Market.cs | 24 ++++++- .../Scenes/marketing/Scripts/MarketManager.cs | 71 ++++++++++++++----- .../marketing/Scripts/MarketSignBoardView.cs | 30 +++++++- 3 files changed, 104 insertions(+), 21 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index cee24653..70d6017c 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -31,6 +31,9 @@ public class Market : SingletonMonoBehaviour [SerializeField] private CustomerSetting customerSetting; [SerializeField] private CustomerController customerControllerPrefab; + // 暫定 + public float TastingCustomerInterval => customerFlow.TastingCustomerInterval; + public List DisplayFlavors => displayFlavors; private List displayFlavors = new List(); public List ShuffledOrder => shuffledOrder; @@ -59,7 +62,7 @@ public class Market : SingletonMonoBehaviour private int orderIndex; private int oneByOneIndex = 0; private GameData gameData; - + // Start is called before the first frame update void Start() { @@ -333,6 +336,22 @@ public class Market : SingletonMonoBehaviour BrotherPinkView.Instance.SetWalk(); } }).AddTo(this); + + isPromotion.Subscribe(x => + { + if (x) + { + BrotherPinkView.Instance.StartPromotion(); + } + else + { + BrotherPinkView.Instance.StopPromotion(); + if (gameData.TastingCount > 0 && shopState.Value == ShopState.Open) + { + BrotherPinkView.Instance.StartTasting(); + } + } + }).AddTo(this); } @@ -517,8 +536,7 @@ public class Market : SingletonMonoBehaviour isPromotion.Value = true; customerFlow.StartAdWalker(() => { - isPromotion.Value = false; - BrotherPinkView.Instance.StopPromotion(); + isPromotion.Value = false; }); } diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs index 24a1a9bc..8924bc89 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs @@ -17,6 +17,7 @@ public class MarketManager : MonoBehaviour [SerializeField] private MarketCartView cartView; [SerializeField] private BrotherBlueView blueView; [SerializeField] private IncreaseCustomerButtonView rewardButtonView; + [SerializeField] private MarketSignBoardView signBoardView; [SerializeField] private Transform pinkTarget; [SerializeField] private Transform coinPrefab; [SerializeField] private Transform rootTransform; @@ -108,6 +109,7 @@ public class MarketManager : MonoBehaviour cartView.SetStock(startStocks, false); BrotherPinkView.Instance.SetBrotherView(pinkTarget); + // 宣伝ボタン rewardButtonView.RewardButton.ThrottleFirst(TimeSpan.FromSeconds(.3f)).Subscribe(_ => { GetRewardDialog.ShowIncreaseCustomerDialog(() => @@ -153,21 +155,12 @@ public class MarketManager : MonoBehaviour { resetRefreshTimer.OnNext(Unit.Default); }).AddTo(this); - + market.IsPromotion.Subscribe(active => { - if (active) - { - SoundManager.Instance.PlayBGM("bgm_publicity"); - BrotherPinkView.Instance.StartPromotion(); - } - else - { - SoundManager.Instance.PlayBGM("bgm_marketing"); - } + SoundManager.Instance.PlayBGM(active ? "bgm_publicity" : "bgm_marketing"); }).AddTo(this); - // Customerの各アニメーション設定 foreach (var controller in market.CustomerControllerList) { @@ -230,19 +223,67 @@ public class MarketManager : MonoBehaviour .SkipWhile(_ => !gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay)) .Subscribe(state => { - Debug.Log($"SetShopView"); SetShopView(state); }).AddTo(this); + + // 宣伝ボタン/試食表示切替 + var tastingComplete = new Subject().AddTo(this); + market.CurrentShopState + .CombineLatest(market.IsPromotion, tastingComplete, (shopState, isPromotion, _) => (shopState == ShopState.Open, isPromotion)) + .Subscribe(x => + { + var (isOpen, isPromotion) = x; + if (isOpen) + { + if (isPromotion) + { + // 宣伝ボタン表示 + rewardButtonView.gameObject.SetActive(true); + signBoardView.SetActiveTastingBoard(false); + } + else if (gameData.TastingCount > 0) + { + rewardButtonView.gameObject.SetActive(false); + signBoardView.SetActiveTastingBoard(true); + BrotherPinkView.Instance.StartTasting(); + BrotherPinkView.Instance.SetTastingCount(gameData.TastingCount); + signBoardView.SetTimer(gameData.TastingCount * (int)market.TastingCustomerInterval, () => + { + BrotherPinkView.Instance.SetTastingCount(gameData.TastingCount); + }, () => + { + // 試食タイマーが終わったら表示更新トリガー + tastingComplete.OnNext(Unit.Default); + BrotherPinkView.Instance.StopTasting(); + }); + } + else + { + BrotherPinkView.Instance.StopTasting(); + rewardButtonView.gameObject.SetActive(true); + signBoardView.SetActiveTastingBoard(false); + } + } + else + { + BrotherPinkView.Instance.StopTasting(); + rewardButtonView.gameObject.SetActive(false); + signBoardView.SetActiveTastingBoard(false); + } + }).AddTo(this); + // CombineLatest動かすのに必要 + tastingComplete.OnNext(Unit.Default); } private void SetShopView(ShopState state) { +#if UNITY_EDITOR + Debug.Log($"SetShopView"); +#endif ShopClosedCompositeDisposable.Clear(); switch (state) { case ShopState.Open: - // 宣伝ボタン表示 - rewardButtonView.gameObject.SetActive(true); BrotherPinkView.Instance.SetNormal(); blueView.OpenAction(); closeSign.SetActive(false); @@ -250,8 +291,6 @@ public class MarketManager : MonoBehaviour case ShopState.Busy: break; case ShopState.Close: - // 宣伝ボタン非表示 - rewardButtonView.gameObject.SetActive(false); if (market.CustomerList.Count(x => x.State.Value == CustomerState.Order) == 0) { BrotherPinkView.Instance.SetSleepy(); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs index cae8e889..39576af3 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs @@ -1,3 +1,5 @@ +using System; +using UniRx; using UnityEngine; using UnityEngine.UI; @@ -5,15 +7,39 @@ namespace MyGame.Scenes.marketing.Scripts { public class MarketSignBoardView : MonoBehaviour { - private static readonly string remainTimeFormat = "残り{0:D2}:{1:D2}"; + private static readonly string remainTimeFormat = "残り{0:D2}:{1:D2}"; [SerializeField] private Text remainTimeText; [SerializeField] private GameObject normalBoardObject; [SerializeField] private GameObject tastingBoardObject; + private IDisposable timerDispose; + + // 宣伝中は宣伝優先で通常看板 + public void SetActiveTastingBoard(bool active) + { + normalBoardObject.SetActive(!active); + tastingBoardObject.SetActive(active); + } - public void SetTime(int seconds) + private void SetTime(int seconds) { seconds = Mathf.Max(0, seconds); remainTimeText.text = string.Format(remainTimeFormat, Mathf.Min(seconds / 60, 99), seconds % 60); } + + public void SetTimer(int remaining, Action onInterval = null, Action onComplete = null) + { + timerDispose?.Dispose(); + var timer = Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1f)) + .Select(x => (int)(remaining - x)) + .TakeWhile(x => x >= 0); + timerDispose = timer.Subscribe(x => + { + SetTime(x); + onInterval?.Invoke(); + }, () => + { + onComplete?.Invoke(); + }).AddTo(this); + } } } \ No newline at end of file From 227f4c52e5804e237f8e52489112f925dc9352bf Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:47:21 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B2=A9=E5=A3=B2=E8=A9=A6=E9=A3=9F?= =?UTF-8?q?=E4=B8=AD=E7=9C=8B=E6=9D=BF=E3=81=AECanvas=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/marketing.unity | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity index c8c418bc..4d9c0bba 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity @@ -5582,7 +5582,7 @@ MonoBehaviour: cartView: {fileID: 2048621276} blueView: {fileID: 1506158581} rewardButtonView: {fileID: 820175261} - signBoardView: {fileID: 0} + signBoardView: {fileID: 1732899481} pinkTarget: {fileID: 1749782974} coinPrefab: {fileID: 8159396421809467538, guid: 9fc8076f17c26ff4d9be53b90a7dad4c, type: 3} @@ -6721,7 +6721,7 @@ GameObject: - component: {fileID: 1265140452} - component: {fileID: 1265140451} - component: {fileID: 1265140450} - m_Layer: 5 + m_Layer: 0 m_Name: Canvas m_TagString: Untagged m_Icon: {fileID: 0} @@ -6737,17 +6737,17 @@ RectTransform: m_GameObject: {fileID: 1265140448} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.005197392, y: 0.005197392, z: 0.005197392} m_Children: - {fileID: 1629640653} m_Father: {fileID: 1423968762} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0, y: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.001, y: -0.563} + m_SizeDelta: {x: 300, y: 300} + m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1265140450 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6755,16 +6755,11 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1265140448} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Script: {fileID: 11500000, guid: be39b2648c1548e2a2338ea75a51fcc6, type: 3} m_Name: m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 --- !u!114 &1265140451 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6796,9 +6791,9 @@ Canvas: m_GameObject: {fileID: 1265140448} m_Enabled: 1 serializedVersion: 3 - m_RenderMode: 1 - m_Camera: {fileID: 1277621136} - m_PlaneDistance: 0 + m_RenderMode: 2 + m_Camera: {fileID: 658354829} + m_PlaneDistance: 1 m_PixelPerfect: 0 m_ReceivesEvents: 1 m_OverrideSorting: 0 @@ -13073,7 +13068,7 @@ GameObject: - component: {fileID: 1629640653} - component: {fileID: 1629640655} - component: {fileID: 1629640654} - m_Layer: 5 + m_Layer: 0 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} @@ -13094,10 +13089,10 @@ RectTransform: m_Father: {fileID: 1265140449} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 469.1, y: -28} - m_SizeDelta: {x: 170, y: 40} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1629640654 MonoBehaviour: @@ -13120,12 +13115,12 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 12800000, guid: b5532e9ce15694f55a0893a76a98cd78, type: 3} - m_FontSize: 28 + m_FontSize: 45 m_FontStyle: 0 m_BestFit: 0 - m_MinSize: 2 - m_MaxSize: 40 - m_Alignment: 3 + m_MinSize: 0 + m_MaxSize: 80 + m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 From 596d93f133df6f047129c137a2f6657d792f4c36 Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:47:39 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E8=A9=A6=E9=A3=9F=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=82=AC=E3=83=BC=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs | 2 ++ .../Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs index 6a587aa3..1e334546 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs @@ -76,6 +76,8 @@ public class BulkOrder : MonoBehaviour // カウントリセット gameData.OrderConditionCount = 0; GameDataManager.SaveGameData(); + // 試食スタート + BrotherPinkView.Instance.StartTasting(); LocalCacheManager.Load(CancelCallbackTag, null)?.Invoke(); LocalCacheManager.Remove(CancelCallbackTag); // キャンセルと同時に閉じる diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs index c9fd832d..e5c5e2c2 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs @@ -303,6 +303,7 @@ public class ProductManagement : MonoBehaviour GameDataManager.GameData.AddTastingCustomerCount(tank.Stock); tank.ClearStock(); GameDataManager.SaveGameData(); + BrotherPinkView.Instance.StartTasting(); } private void OnDestroy() From 16cb145ebaacd4d31093456d9b4109a7e18bfe52 Mon Sep 17 00:00:00 2001 From: koya_15 Date: Tue, 14 Dec 2021 14:27:40 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- popcorn/Assets/MyGame/Scenes/marketing/marketing.unity | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity index 4d9c0bba..bfcb1cb3 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity @@ -7062,7 +7062,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1423968761} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.052, y: -0.277, z: 0} + m_LocalPosition: {x: 0.31, y: 0.96, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1265140449} @@ -13115,11 +13115,11 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 12800000, guid: b5532e9ce15694f55a0893a76a98cd78, type: 3} - m_FontSize: 45 - m_FontStyle: 0 + m_FontSize: 52 + m_FontStyle: 1 m_BestFit: 0 m_MinSize: 0 - m_MaxSize: 80 + m_MaxSize: 300 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 From 077c0468f1668caf3a46224ecda8227b56df052b Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 15:14:25 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B2=A9=E5=A3=B2=E8=A9=A6=E9=A3=9F?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E3=81=AE=E8=A1=A8=E7=A4=BA=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Scripts/MarketManager.cs | 11 +++++++---- .../Scenes/marketing/Scripts/MarketSignBoardView.cs | 12 ++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs index 8924bc89..d19f2e8e 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs @@ -226,6 +226,9 @@ public class MarketManager : MonoBehaviour SetShopView(state); }).AddTo(this); + // 試食看板はStart時非表示 + signBoardView.SetActiveTastingBoard(false); + // 宣伝ボタン/試食表示切替 var tastingComplete = new Subject().AddTo(this); market.CurrentShopState @@ -244,6 +247,7 @@ public class MarketManager : MonoBehaviour else if (gameData.TastingCount > 0) { rewardButtonView.gameObject.SetActive(false); + // 試食表示 signBoardView.SetActiveTastingBoard(true); BrotherPinkView.Instance.StartTasting(); BrotherPinkView.Instance.SetTastingCount(gameData.TastingCount); @@ -257,18 +261,17 @@ public class MarketManager : MonoBehaviour BrotherPinkView.Instance.StopTasting(); }); } - else + else // 宣伝も試食も未発動 { BrotherPinkView.Instance.StopTasting(); rewardButtonView.gameObject.SetActive(true); - signBoardView.SetActiveTastingBoard(false); } } - else + else // 閉店 { BrotherPinkView.Instance.StopTasting(); rewardButtonView.gameObject.SetActive(false); - signBoardView.SetActiveTastingBoard(false); + signBoardView.CancelTasting(); } }).AddTo(this); // CombineLatest動かすのに必要 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs index 39576af3..f537b7a9 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketSignBoardView.cs @@ -7,7 +7,8 @@ namespace MyGame.Scenes.marketing.Scripts { public class MarketSignBoardView : MonoBehaviour { - private static readonly string remainTimeFormat = "残り{0:D2}:{1:D2}"; + private static readonly string RemainTimeFormat = "残り{0:D2}:{1:D2}"; + private static readonly string TimeUpText = "終了"; [SerializeField] private Text remainTimeText; [SerializeField] private GameObject normalBoardObject; [SerializeField] private GameObject tastingBoardObject; @@ -23,7 +24,7 @@ namespace MyGame.Scenes.marketing.Scripts private void SetTime(int seconds) { seconds = Mathf.Max(0, seconds); - remainTimeText.text = string.Format(remainTimeFormat, Mathf.Min(seconds / 60, 99), seconds % 60); + remainTimeText.text = string.Format(RemainTimeFormat, Mathf.Min(seconds / 60, 99), seconds % 60); } public void SetTimer(int remaining, Action onInterval = null, Action onComplete = null) @@ -38,8 +39,15 @@ namespace MyGame.Scenes.marketing.Scripts onInterval?.Invoke(); }, () => { + remainTimeText.text = TimeUpText; onComplete?.Invoke(); }).AddTo(this); } + + public void CancelTasting() + { + timerDispose?.Dispose(); + remainTimeText.text = TimeUpText; + } } } \ No newline at end of file From 6d10352b14acfb8db1dde40bf2e67e27b1855ad7 Mon Sep 17 00:00:00 2001 From: koya_15 Date: Tue, 14 Dec 2021 15:25:35 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=E3=82=AB=E3=82=B4=E3=81=AE=E4=B8=AD?= =?UTF-8?q?=E8=BA=AB=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab index ee18f110..ac3bf69d 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Brother_pink.prefab @@ -1648,8 +1648,8 @@ MonoBehaviour: m_EditorClassIdentifier: itemMany: {fileID: 7527088936072372818} itemFew: {fileID: 3577262440827808746} - manyCount: 8 - fewCount: 4 + manyCount: 6 + fewCount: 3 --- !u!1 &7854448233088646087 GameObject: m_ObjectHideFlags: 0