From adf5d3d9249128c7819ee254810d5fbb2809e9cd Mon Sep 17 00:00:00 2001 From: "Rei.K" Date: Mon, 24 Aug 2026 02:58:34 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A2=BA=E8=AA=8D=E3=83=80=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=83=AD=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/MVC/Horror/Dialogs/HorrorConfirmDialog.cs | 5 ++++- .../MVC/Horror/Dialogs/HorrorConfirmDialogComponent.cs | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialog.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialog.cs index 77f75fa82..e41f754ee 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialog.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialog.cs @@ -4,6 +4,7 @@ using Game.MVC.Core.Enums; using Game.MVC.Core.Scenes; using Game.Shared.Extensions; +using Game.Shared.Services.Interfaces; using R3; namespace Game.Horror.Dialogs @@ -15,6 +16,7 @@ public class HorrorConfirmDialog : GameDialogScene(); private readonly IHorrorUISoundService _uiSoundService = GameServiceManager.Resolve(); + private readonly ILocalizationService _localizationService = GameServiceManager.Resolve(); private string _messageLocalizeKey; public static async UniTask RunAsync(string messageLocalizeKey) @@ -50,7 +52,8 @@ public override UniTask Startup() .Subscribe(x => TrySetResult(x)) .AddTo(Disposables); - SceneComponent.Initialize(_messageLocalizeKey); + string message = _localizationService.GetStringByMessages(_messageLocalizeKey); + SceneComponent.Initialize(message); return base.Startup(); } diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialogComponent.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialogComponent.cs index a4b7e57dc..8d6c4dbfb 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialogComponent.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorConfirmDialogComponent.cs @@ -1,6 +1,4 @@ -using Game.Core.Services; using Game.MVC.Core.Scenes; -using Game.Shared.Services.Interfaces; using R3; using TMPro; using UnityEngine; @@ -17,10 +15,6 @@ public class HorrorConfirmDialogComponent : GameSceneComponent public Observable OnSubmit => _submitButton.OnClickAsObservable().Select(_ => true); public Observable OnCancel => _cancelButton.OnClickAsObservable().Select(_ => false); - public void Initialize(string messageLocalizeKey) - { - var localization = GameServiceManager.Resolve(); - _message.text = localization.GetStringByMessages(messageLocalizeKey); - } + public void Initialize(string message) => _message.text = message; } } From 89ef445d34d9fdc4d7a7d52b88fe0d5abdea5ad3 Mon Sep 17 00:00:00 2001 From: "Rei.K" Date: Mon, 24 Aug 2026 03:03:57 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A3=85=E5=82=99=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=AB=E3=83=83=E3=83=88=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialogs/HorrorEquipmentShortcutDialog.cs | 21 +++++++-- .../HorrorEquipmentShortcutDialogComponent.cs | 43 ++++++------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialog.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialog.cs index e2ad4b174..804f7fcc0 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialog.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialog.cs @@ -20,7 +20,9 @@ public class HorrorEquipmentShortcutDialog : GameDialogScene(); private readonly IHorrorUISoundService _uiSoundService = GameServiceManager.Resolve(); + private readonly IHorrorEquipmentService _equipmentService = GameServiceManager.Resolve(); private IObjectInfo _target; + private int _currentIndex; // 現在選択中のスロット。初期フォーカス(先頭スロット)と初期値 0 が対応する public static async UniTask RunAsync(IObjectInfo target) { @@ -36,7 +38,6 @@ public UniTask SetArg(IObjectInfo target) public override UniTask Startup() { - // キャンセルで閉じる(親がインベントリ表示中は Menu をブロックしているため Cancel のみ) _inputService.UI.Cancel.OnPerformedAsObservable() .Where(_ => State.IsProcessing()) .Subscribe(_ => @@ -46,13 +47,25 @@ public override UniTask Startup() }) .AddTo(Disposables); - // Del で現在スロットの登録を外す _inputService.UI.Remove.OnPerformedAsObservable() .Where(_ => State.IsProcessing()) - .Subscribe(_ => SceneComponent.RemoveCurrent()) + .Subscribe(_ => _equipmentService.ClearSlot(_currentIndex)) .AddTo(Disposables); - SceneComponent.Initialize(_target); + SceneComponent.OnSlotSelected + .Subscribe(index => _currentIndex = index) + .AddTo(Disposables); + + SceneComponent.OnSlotClicked + .Where(_ => State.IsProcessing()) + .Subscribe(index => + { + if (_target == null) return; + _equipmentService.TryAssignSlot(index, _target.ObjectCategory, _target.ObjectId); + }) + .AddTo(Disposables); + + SceneComponent.Initialize(); return base.Startup(); } diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialogComponent.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialogComponent.cs index 77d8e92fa..6096380f6 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialogComponent.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorEquipmentShortcutDialogComponent.cs @@ -1,16 +1,15 @@ +using System.Linq; using Game.Core.Services; using Game.Horror.Equipment; using Game.Horror.Services.Interfaces; using Game.MVC.Core.Scenes; -using Game.Shared.Interfaces; using R3; using UnityEngine; namespace Game.Horror.Dialogs { /// - /// ショートカット登録ダイアログのビュー。D-Pad 4スロットへの登録/解除と現在スロットの追跡を担う。 - /// スロット並びは 1=左 / 2=上 / 3=右 / 4=下(index 0-3)。 + /// ショートカット登録ダイアログのビュー /// public class HorrorEquipmentShortcutDialogComponent : GameSceneComponent { @@ -18,29 +17,24 @@ public class HorrorEquipmentShortcutDialogComponent : GameSceneComponent private IInputSystemService _inputService; private IHorrorEquipmentService _equipmentService; - private IObjectInfo _target; - private int _currentIndex; - public void Initialize(IObjectInfo target) + /// スロット決定(クリック)。値は決定されたスロット index。 + public Observable OnSlotClicked + => _slots.Select((slot, index) => slot.OnClick.Select(_ => index)).Merge(); + + /// スロット選択(フォーカス移動)。値は選択されたスロット index。 + public Observable OnSlotSelected + => _slots.Select((slot, index) => slot.OnSelect.Select(_ => index)).Merge(); + + public void Initialize() { - _target = target; _inputService = GameServiceManager.Resolve(); _equipmentService = GameServiceManager.Resolve(); for (int i = 0; i < _slots.Length; i++) { _slots[i].Initialize(); - - int index = i; - RefreshSlot(index); - - _slots[i].OnSelect - .Subscribe(_ => _currentIndex = index) - .AddTo(Disposables); - - _slots[i].OnClick - .Subscribe(_ => Register(index)) - .AddTo(Disposables); + RefreshSlot(i); } // 初期フォーカスを先頭スロットへ @@ -52,18 +46,7 @@ public void Initialize(IObjectInfo target) .AddTo(Disposables); } - /// 現在選択中スロットの登録を外す(Dialog の Remove 入力から呼ぶ)。表示は EquipmentChanged の購読で追従する。 - public void RemoveCurrent() - => _equipmentService.ClearSlot(_currentIndex); - - // 対象アイテムを指定スロットへ登録する。Assign は既登録なら移動/入替、未登録なら上書きで - // 影響が2スロットに及ぶが、表示は EquipmentChanged の購読(全スロット再表示)で追従する。 - private void Register(int index) - { - if (_target == null) return; - _equipmentService.TryAssignSlot(index, _target.ObjectCategory, _target.ObjectId); - } - + /// 全スロットの表示を現在の装備状態から再構築する(Dialog の EquipmentChanged 購読から呼ぶ)。 private void RefreshAllSlots() { for (int i = 0; i < _slots.Length; i++) From fb15ca605cf628a02c5574bdf6f8582a0b8a53c8 Mon Sep 17 00:00:00 2001 From: "Rei.K" Date: Mon, 24 Aug 2026 03:15:23 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=83=99=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=AA=E3=81=AE=E3=82=AF=E3=83=A9=E3=83=95=E3=83=88?= =?UTF-8?q?=E5=AE=9F=E8=A1=8C=E3=83=97=E3=83=AD=E3=82=BB=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Horror/Dialogs/HorrorInventoryDialog.cs | 67 +++++++++++++- .../Dialogs/HorrorInventoryDialogComponent.cs | 7 +- .../Horror/Inventory/HorrorCraftRecipeView.cs | 7 ++ .../MVC/Horror/Inventory/HorrorCraftView.cs | 88 ++++--------------- 4 files changed, 91 insertions(+), 78 deletions(-) diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialog.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialog.cs index f1f04b8bb..c88b79fb5 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialog.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialog.cs @@ -1,5 +1,8 @@ +using System.Threading; using Cysharp.Threading.Tasks; using Game.Core.Services; +using Game.Horror.Constants; +using Game.Horror.Inventory; using Game.Horror.Services.Interfaces; using Game.MVC.Core.Enums; using Game.MVC.Core.Scenes; @@ -32,8 +35,10 @@ public class HorrorInventoryDialog : GameDialogScene(); private readonly IHorrorPlayerService _playerService = GameServiceManager.Resolve(); private readonly IHorrorUISoundService _uiSoundService = GameServiceManager.Resolve(); + private readonly IHorrorCraftService _craftService = GameServiceManager.Resolve(); private HorrorInventoryResult _result; + private bool _isCraftHolding; // 長押し進行中(Cancel・タブ切替・トグルの抑止用) public static async UniTask RunAsync() { @@ -60,7 +65,7 @@ public override UniTask Startup() .Where(_ => State.IsProcessing()) .Subscribe(_ => { - if (SceneComponent.IsCrafting()) return; + if (_isCraftHolding) return; _uiSoundService.PlayCancelSfx(); @@ -73,18 +78,18 @@ public override UniTask Startup() // インベントリトグルでダイアログを閉じる(サブメニュー展開中・クラフトの長押し中は無効) _inputService.Player.Inventory.OnPerformedAsObservable() - .Where(_ => State.IsProcessing() && !SceneComponent.IsProcessing()) + .Where(_ => State.IsProcessing() && !SceneComponent.IsSubmenuOpen() && !_isCraftHolding) .Subscribe(_ => TrySetResult(_result)) .AddTo(Disposables); // L1 (Previous) / R1 (Next) でタブ循環(サブメニュー展開中・クラフトの長押し中は無効) _inputService.UI.Previous.OnPerformedAsObservable() - .Where(_ => State.IsProcessing() && !SceneComponent.IsProcessing()) + .Where(_ => State.IsProcessing() && !SceneComponent.IsSubmenuOpen() && !_isCraftHolding) .Subscribe(_ => SceneComponent.PreviousTab()) .AddTo(Disposables); _inputService.UI.Next.OnPerformedAsObservable() - .Where(_ => State.IsProcessing() && !SceneComponent.IsProcessing()) + .Where(_ => State.IsProcessing() && !SceneComponent.IsSubmenuOpen() && !_isCraftHolding) .Subscribe(_ => SceneComponent.NextTab()) .AddTo(Disposables); @@ -133,6 +138,17 @@ public override UniTask Startup() }) .AddTo(Disposables); + // クラフトの長押し:決定またはレシピ行のポインタ押下で開始し、閾値到達で実行(ゲージの描画は View 側) + var craftView = SceneComponent.CraftView; + if (craftView != null) + { + Observable.Merge(_inputService.UI.Submit.OnPerformedAsObservable().AsUnitObservable(), + craftView.OnRecipePointerPressed) + .Where(_ => State.IsProcessing() && !_isCraftHolding && craftView.IsVisible) + .SubscribeAwait(async (_, ct) => await RunCraftHoldAsync(craftView, ct)) + .AddTo(Disposables); + } + SceneComponent.Initialize(); return base.Startup(); @@ -143,5 +159,48 @@ public override async UniTask Terminate() ApplicationEvents.ResumeTime(); await base.Terminate(); } + + // 長押し1回分のフロー。エッジ(決定押下・行ポインタ押下)で開始し、中断または実行で終わる。 + // 押しっぱなしでのタブ進入・実行直後の押し続けは新しいエッジを生まないため、再実行は構造的に起きない。 + private async UniTask RunCraftHoldAsync(HorrorCraftView view, CancellationToken ct = default) + { + _isCraftHolding = true; + var elapsed = 0f; + try + { + // 押下と同フレームの選択更新(ポインタ押下による行選択)を待ってから対象を確定する + await UniTask.Yield(PlayerLoopTiming.Update, ct); + + var craftId = view.SelectedCraftId; + if (craftId == null) return; + + while (true) + { + if (!State.IsProcessing() || !view.IsVisible || view.SelectedCraftId != craftId) return; + + bool held = _inputService.UI.Submit.IsPressed() || view.IsSelectedPointerHeld; + + // 中断条件:押下解除・素材不足(他タブでの破棄などで実行不可へ変わった場合を含む) + if (!held || !_craftService.CanCraft(craftId.Value)) return; + + elapsed += Time.unscaledDeltaTime; + view.SetHoldProgress(elapsed / HorrorCraftConstants.CraftHoldSeconds); + + if (elapsed >= HorrorCraftConstants.CraftHoldSeconds) + { + view.SetHoldProgress(0f); // 実行前にゲージを消す(旧 Execute と同順) + _craftService.TryCraft(craftId.Value); + return; + } + + await UniTask.Yield(PlayerLoopTiming.Update, ct); + } + } + finally + { + _isCraftHolding = false; + view.SetHoldProgress(0f); // 中断時の後始末(冪等。View 破棄後も SetHoldProgress 内の null ガードで安全) + } + } } } diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialogComponent.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialogComponent.cs index a6b737e77..41083a91b 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialogComponent.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Dialogs/HorrorInventoryDialogComponent.cs @@ -42,6 +42,8 @@ public Observable OnContextActionClicked SlotView = _selectedSlot }); + public HorrorCraftView CraftView => _craftView; + public void Initialize() { _inputService = GameServiceManager.Resolve(); @@ -76,8 +78,6 @@ public void Initialize() public void NextTab() => _tabGroup.NextTab(); public void PreviousTab() => _tabGroup.PreviousTab(); - public bool IsProcessing() => IsSubmenuOpen() || IsCrafting(); - #region InventorySlots // 初期化と購読は寿命中 1 回のみ。再実行すると Disposables に購読が重複登録されるため、 @@ -191,9 +191,6 @@ private void BindKeyItems() #region Craft - /// クラフトの長押しが進行中か(ダイアログを閉じる・タブを切り替える入力の抑止に使う)。 - public bool IsCrafting() => _craftView != null && _craftView.IsCrafting; - private void BindCraft() { if (_craftView == null) return; diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftRecipeView.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftRecipeView.cs index 6993aec2e..2f0789de3 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftRecipeView.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftRecipeView.cs @@ -44,6 +44,10 @@ public class HorrorCraftRecipeView : MonoBehaviour, IPointerDownHandler, IPointe /// この行の上でポインタが押されているか(長押し判定用)。 public bool IsPointerHeld { get; private set; } + /// この行の上でポインタが押された瞬間の通知(長押し開始のトリガー用)。 + private readonly Subject _pointerPressed = new(); + public Observable OnPointerPressed => _pointerPressed; + private ILocalizationService _localizationService; private IHorrorIconService _iconService; @@ -106,6 +110,7 @@ public void OnPointerDown(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) return; IsPointerHeld = true; + _pointerPressed.OnNext(Unit.Default); } public void OnPointerUp(PointerEventData eventData) @@ -116,5 +121,7 @@ public void OnPointerUp(PointerEventData eventData) // タブ切替などで非表示になると PointerUp が届かないため、押下状態を持ち越さない private void OnDisable() => IsPointerHeld = false; + + private void OnDestroy() => _pointerPressed.Dispose(); } } diff --git a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftView.cs b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftView.cs index d6a2d7ab2..335a97107 100644 --- a/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftView.cs +++ b/src/Game.Client/Assets/Programs/Runtime/MVC/Horror/Inventory/HorrorCraftView.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using Game.Core.Services; -using Game.Horror.Constants; using Game.Horror.Services.Interfaces; using Game.Shared.Extensions; using Game.Shared.Services.Interfaces; @@ -12,10 +11,8 @@ namespace Game.Horror.Inventory { /// - /// インベントリダイアログのクラフトタブ。レシピ一覧・選択レシピの詳細(成果物と素材の必要数/所持数)を表示し、 - /// 決定の長押しでクラフトを実行する。 - /// クリック(押して離す)では実行せず、 の押下継続だけを起点にする。 - /// ダイアログ表示中は timeScale = 0 のため、進捗は で積む。 + /// インベントリダイアログのクラフトタブのビュー + /// レシピ一覧・選択レシピの詳細(成果物と素材の必要数/所持数)の表示、 長押しゲージの描画・入力通知(行のポインタ押下・選択) /// public class HorrorCraftView : MonoBehaviour { @@ -39,25 +36,28 @@ public class HorrorCraftView : MonoBehaviour private readonly List _recipeViews = new(); private readonly CompositeDisposable _disposables = new(); - private IInputSystemService _inputService; private ILocalizationService _localizationService; private IHorrorIconService _iconService; private IHorrorCraftService _craftService; private IHorrorInventoryService _inventoryService; private HorrorCraftRecipeView _selected; - private float _holdElapsed; - // 押しっぱなしのままタブへ入った場合や、クラフト直後の押しっぱなしで続けて実行されないよう、 - // 一度離すまで次の長押しを開始しない - private bool _awaitRelease; + /// 選択中レシピの CraftId(未選択は null)。 + public int? SelectedCraftId => _selected != null ? _selected.CraftId : null; - /// 長押しが進行中か(ダイアログ側でキャンセル・タブ切替を抑止するために見る)。 - public bool IsCrafting => _holdElapsed > 0f; + /// 選択中の行の上でポインタが押され続けているか(長押しの保持判定用)。 + public bool IsSelectedPointerHeld => _selected != null && _selected.IsPointerHeld; + + /// クラフトタブが表示中か。 + public bool IsVisible => isActiveAndEnabled; + + /// いずれかのレシピ行の上でポインタが押された瞬間の通知(長押し開始のトリガー用)。 + private readonly Subject _recipePointerPressed = new(); + public Observable OnRecipePointerPressed => _recipePointerPressed; public void Initialize() { - _inputService = GameServiceManager.Resolve(); _localizationService = GameServiceManager.Resolve(); _iconService = GameServiceManager.Resolve(); _craftService = GameServiceManager.Resolve(); @@ -100,6 +100,7 @@ private void BuildRecipes() view.SetRecipe(recipe.Id, recipe.ResultObjectCategory, recipe.ResultObjectId, recipe.ResultCount); view.SetPossessedCount(_inventoryService.GetCount(recipe.ResultObjectCategory, recipe.ResultObjectId)); view.OnSelected.Subscribe(Select).AddTo(_disposables); + view.OnPointerPressed.Subscribe(_ => _recipePointerPressed.OnNext(Unit.Default)).AddTo(_disposables); _recipeViews.Add(view); } @@ -112,10 +113,6 @@ private void Select(HorrorCraftRecipeView view) { if (view == null) return; - // 選択が移ったら進行中の長押しは打ち切る - if (_selected != view) - ResetHold(); - _selected = view; UpdateDetail(view); } @@ -179,50 +176,8 @@ private void BuildMaterials(int craftId) #region Hold - private void Update() - { - if (_selected == null || _craftService == null) return; - - bool held = _inputService.UI.Submit.IsPressed() || _selected.IsPointerHeld; - - if (_awaitRelease) - { - if (!held) _awaitRelease = false; - return; - } - - // 中断条件:押下解除・素材不足(他タブでの破棄などで実行不可へ変わった場合を含む) - if (!held || !_craftService.CanCraft(_selected.CraftId)) - { - ResetHold(); - return; - } - - _holdElapsed += Time.unscaledDeltaTime; - SetHoldProgress(_holdElapsed / HorrorCraftConstants.CraftHoldSeconds); - - if (_holdElapsed >= HorrorCraftConstants.CraftHoldSeconds) - Execute(); - } - - private void Execute() - { - var craftId = _selected.CraftId; - - ResetHold(); - _awaitRelease = true; - _craftService.TryCraft(craftId); - } - - private void ResetHold() - { - if (_holdElapsed <= 0f) return; - - _holdElapsed = 0f; - SetHoldProgress(0f); - } - - private void SetHoldProgress(float progress01) + /// 長押しゲージの進捗(0〜1)を表示する。0 でゲージ非表示(Dialog の長押しフローから呼ぶ)。 + public void SetHoldProgress(float progress01) { if (_holdGauge == null) return; @@ -244,20 +199,15 @@ private void ValidateHoldGauge() + $"(現在 min={_holdGauge.minValue} / max={_holdGauge.maxValue})", this); } - // タブ切替で表示が戻ったときに、前回の押下状態・進捗を引き継がない - private void OnEnable() - { - ResetHold(); - _awaitRelease = true; - } - - private void OnDisable() => ResetHold(); + // タブ非表示ではゲージ表示を持ち越さない + private void OnDisable() => SetHoldProgress(0f); #endregion private void OnDestroy() { _disposables.Dispose(); + _recipePointerPressed.Dispose(); } } }