From 5fe3254e65efd5a2597acf92ac5e629823a25db6 Mon Sep 17 00:00:00 2001 From: zhangaotian <8474238@qq.com> Date: Tue, 30 Jul 2024 16:04:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90bug=E3=80=91=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Forest/Assets/Config/Level/level19.json | 131 +++++++----------- Forest/Assets/Scenes/StartScene.unity | 13 ++ .../Scripts/Framework/Manager/InputManager.cs | 11 +- .../LoadingExecutor/LevelLoadingExecutor.cs | 1 + .../Scripts/Gameplay/Manager/LevelManager.cs | 7 + 5 files changed, 78 insertions(+), 85 deletions(-) diff --git a/Forest/Assets/Config/Level/level19.json b/Forest/Assets/Config/Level/level19.json index 471523c..e85ab82 100644 --- a/Forest/Assets/Config/Level/level19.json +++ b/Forest/Assets/Config/Level/level19.json @@ -1,6 +1,6 @@ { "columnCount": 5, - "rowCount": 7, + "rowCount": 5, "undoCount": 0, "addTimeCount": 0, "openHoleCount": 0, @@ -12,9 +12,7 @@ 3, 4, 5, - 6, 7, - 8, 9, 10, 11, @@ -30,48 +28,34 @@ 21, 22, 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34 + 24 ], "emptyHoleIndex": [ - 15, - 16, - 17, - 18, - 19 + 0, + 4, + 20, + 22, + 24 ], "planksType": [ 0, 0, 0, - 0, - 0, - 0, - 0, - 0, + 1, + 1, 2, 2, - 2, - 2 + 7, + 9, + 11 ], "squareType": [ - 3, - 3, - 3, - 3, 3, 3, 1, 1, + 1, + 4, 4, 4, 4, @@ -79,80 +63,61 @@ ], "HolesOfPlanksIndex": [ [ - 25, - 26, - 27, - 28, - 29 + 15, + 16, + 17, + 18, + 19 ], [ 5, - 6, 7, - 8, 9 ], [ - 30, - 31, - 32, - 33, - 34 - ], - [ - 0, 1, 2, - 3, - 4 + 3 + ], + [ + 9, + 14, + 19 + ], + [ + 5, + 10, + 15 + ], + [ + 13, + 14, + 18, + 19 ], [ 10, 11, - 12, - 13, - 14 + 15, + 16 ], [ - 20, - 21, - 22, - 23, - 24 - ], - [ - 26, - 27, - 28 - ], - [ - 6, 7, - 8 + 11, + 12, + 13 ], [ - 5, - 6, - 10, - 11 - ], - [ - 8, - 9, + 17, 13, - 14 + 18, + 23 ], [ - 23, - 24, - 28, - 29 - ], - [ - 20, - 21, - 25, - 26 + 17, + 11, + 16, + 21 ] ] } \ No newline at end of file diff --git a/Forest/Assets/Scenes/StartScene.unity b/Forest/Assets/Scenes/StartScene.unity index 20c56f1..0cbcd1c 100644 --- a/Forest/Assets/Scenes/StartScene.unity +++ b/Forest/Assets/Scenes/StartScene.unity @@ -134,6 +134,7 @@ GameObject: - component: {fileID: 123179489} - component: {fileID: 123179488} - component: {fileID: 123179486} + - component: {fileID: 123179490} m_Layer: 0 m_Name: UICamera m_TagString: Untagged @@ -251,6 +252,18 @@ Transform: m_Children: [] m_Father: {fileID: 2081420527} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &123179490 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 123179485} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fff49514adc6448d0a4cbea3ff37308b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &158007422 GameObject: m_ObjectHideFlags: 0 diff --git a/Forest/Assets/Scripts/Framework/Manager/InputManager.cs b/Forest/Assets/Scripts/Framework/Manager/InputManager.cs index 9c5a33a..be88bdd 100644 --- a/Forest/Assets/Scripts/Framework/Manager/InputManager.cs +++ b/Forest/Assets/Scripts/Framework/Manager/InputManager.cs @@ -1,5 +1,6 @@ using PhxhSDK; using UnityEngine; +using Gameplay.Manager; using Framework.Constants; using UnityEngine.InputSystem; using UnityEngine.EventSystems; @@ -67,14 +68,15 @@ namespace Framework.Manager if (_isMousePressedLastFrame && !_mouseButtonAsFinger.isPressed) { Vector2 pos = CameraManager.Instance.MainCamera.ScreenToWorldPoint(currentMouse.position.ReadValue()); - if (!IsPointerOverUIObject(currentMouse.position.ReadValue())) + if (!IsPointerOverUIObject(currentMouse.position.ReadValue()) || + (LevelManager.Instance.CanCheckInput() && IsPointerOverUIObject(currentMouse.position.ReadValue()))) { Check(pos); } } _isMousePressedLastFrame = _mouseButtonAsFinger.isPressed; - + #endif } @@ -84,6 +86,11 @@ namespace Framework.Manager var pos = CameraManager.Instance.MainCamera.ScreenToWorldPoint(new Vector3(touch.screenPosition.x, touch.screenPosition.y, -Camera.main.transform.position.z)); + if (IsPointerOverUIObject(touch) && LevelManager.Instance.CanCheckInput()) + { + Check(pos); + } + if (IsPointerOverUIObject(touch)) { return; diff --git a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/LevelLoadingExecutor.cs b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/LevelLoadingExecutor.cs index 821ce91..ce24213 100644 --- a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/LevelLoadingExecutor.cs +++ b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/LevelLoadingExecutor.cs @@ -55,6 +55,7 @@ namespace Gameplay.LoadingExecutor protected override void _OnEnd() { + LevelManager.Instance.IsInGame = true; LevelManager.Instance.ReportEnterLevel(); AudioManager.Instance.PlayMusic(AudioType.MUSIC, AudioManager.Instance.BGMInLevel, new UnityAudio(true)); } diff --git a/Forest/Assets/Scripts/Gameplay/Manager/LevelManager.cs b/Forest/Assets/Scripts/Gameplay/Manager/LevelManager.cs index 7d27238..b67e1fb 100644 --- a/Forest/Assets/Scripts/Gameplay/Manager/LevelManager.cs +++ b/Forest/Assets/Scripts/Gameplay/Manager/LevelManager.cs @@ -28,6 +28,7 @@ namespace Gameplay.Manager public bool IsPause; public bool IsOver; public bool IsTimeEnd; + public bool IsInGame; public int Step; public float ElapsedTime; @@ -588,6 +589,11 @@ namespace Gameplay.Manager #endregion + public bool CanCheckInput() + { + return IsInGame && !IsOver && !IsPause; + } + public void Release() { IsPause = false; @@ -596,6 +602,7 @@ namespace Gameplay.Manager IsFail2AddTime = false; IsWatchAD = false; CanGfxCoin = false; + IsInGame = false; ReleaseGfx(); UnRegisterEvent();