diff --git a/Assets/PlayerInputControl.inputactions b/Assets/PlayerInputControl.inputactions index c732e6677..ed539d7fa 100644 --- a/Assets/PlayerInputControl.inputactions +++ b/Assets/PlayerInputControl.inputactions @@ -1250,6 +1250,17 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "ec9eb0c2-a2e0-47eb-ac8b-52cb0ef46101", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": "", + "action": "Right", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "031b930d-59b6-4a26-9dfe-97764c3e8b37", @@ -1272,6 +1283,17 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "680b36f2-5797-4257-83a7-3a498891d856", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": "", + "action": "Left", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "45f78626-cbf2-4e1f-904d-d82e4c2a2f41", @@ -1294,6 +1316,17 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "40501ac1-9d3e-4059-8e8f-ff7035f6e32e", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": "", + "action": "Down", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "f1a47b3c-e79f-4ab3-86b6-fcc0a6470114", @@ -1316,6 +1349,17 @@ "isComposite": false, "isPartOfComposite": false }, + { + "name": "", + "id": "9996c4e1-f7fb-4793-ab51-da569bdbab09", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": "", + "action": "Up", + "isComposite": false, + "isPartOfComposite": false + }, { "name": "", "id": "393f1eb9-d10d-4cd1-87e7-ea299f92b2da", diff --git a/Assets/Procedural Worlds/Packages - Install.meta b/Assets/Procedural Worlds/Packages - Install.meta new file mode 100644 index 000000000..a19be10f5 --- /dev/null +++ b/Assets/Procedural Worlds/Packages - Install.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7be223564adbc5c41926687e7ab40afa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Procedural Worlds/Packages - Install/Gaia Pro Assets and Biomes.meta b/Assets/Procedural Worlds/Packages - Install/Gaia Pro Assets and Biomes.meta new file mode 100644 index 000000000..403765fc3 --- /dev/null +++ b/Assets/Procedural Worlds/Packages - Install/Gaia Pro Assets and Biomes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d84b88941db835439b793dbf6286189 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Fgui/Common/Common_fui.bytes b/Assets/Resources/Fgui/Common/Common_fui.bytes index dbf5711ab..4e262ff4b 100644 Binary files a/Assets/Resources/Fgui/Common/Common_fui.bytes and b/Assets/Resources/Fgui/Common/Common_fui.bytes differ diff --git a/Assets/Resources/Fgui/Main/Main_fui.bytes b/Assets/Resources/Fgui/Main/Main_fui.bytes index e6f6fcc5b..21cf6c91e 100644 Binary files a/Assets/Resources/Fgui/Main/Main_fui.bytes and b/Assets/Resources/Fgui/Main/Main_fui.bytes differ diff --git a/Assets/Scenes/StartUp.unity b/Assets/Scenes/StartUp.unity index 3a4f105c9..84db14c7c 100644 --- a/Assets/Scenes/StartUp.unity +++ b/Assets/Scenes/StartUp.unity @@ -616,67 +616,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1536631313 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1537701984236076, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_Name - value: spin_5002 - objectReference: {fileID: 0} - - target: {fileID: 1537701984236076, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4427156100795457, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: -0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 90c34a6a9abe7ba4fb0c17635d2f838e, type: 3} --- !u!1 &1729919008 GameObject: m_ObjectHideFlags: 0 @@ -1108,4 +1047,3 @@ SceneRoots: - {fileID: 1729919011} - {fileID: 6620360613922641342} - {fileID: 174907469} - - {fileID: 1536631313} diff --git a/Assets/Scripts/Fishing/PlayerInputControl.cs b/Assets/Scripts/Fishing/PlayerInputControl.cs index c377a2704..5885c3188 100644 --- a/Assets/Scripts/Fishing/PlayerInputControl.cs +++ b/Assets/Scripts/Fishing/PlayerInputControl.cs @@ -1338,6 +1338,17 @@ namespace NBF ""isComposite"": false, ""isPartOfComposite"": false }, + { + ""name"": """", + ""id"": ""ec9eb0c2-a2e0-47eb-ac8b-52cb0ef46101"", + ""path"": ""/rightArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Right"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, { ""name"": """", ""id"": ""031b930d-59b6-4a26-9dfe-97764c3e8b37"", @@ -1360,6 +1371,17 @@ namespace NBF ""isComposite"": false, ""isPartOfComposite"": false }, + { + ""name"": """", + ""id"": ""680b36f2-5797-4257-83a7-3a498891d856"", + ""path"": ""/leftArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Left"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, { ""name"": """", ""id"": ""45f78626-cbf2-4e1f-904d-d82e4c2a2f41"", @@ -1382,6 +1404,17 @@ namespace NBF ""isComposite"": false, ""isPartOfComposite"": false }, + { + ""name"": """", + ""id"": ""40501ac1-9d3e-4059-8e8f-ff7035f6e32e"", + ""path"": ""/downArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Down"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, { ""name"": """", ""id"": ""f1a47b3c-e79f-4ab3-86b6-fcc0a6470114"", @@ -1404,6 +1437,17 @@ namespace NBF ""isComposite"": false, ""isPartOfComposite"": false }, + { + ""name"": """", + ""id"": ""9996c4e1-f7fb-4793-ab51-da569bdbab09"", + ""path"": ""/upArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Up"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, { ""name"": """", ""id"": ""393f1eb9-d10d-4cd1-87e7-ea299f92b2da"", diff --git a/Assets/Scripts/Startup/App.cs b/Assets/Scripts/Startup/App.cs index f86232fa8..dfdc7bfdd 100644 --- a/Assets/Scripts/Startup/App.cs +++ b/Assets/Scripts/Startup/App.cs @@ -137,7 +137,8 @@ namespace NBF // UI.Inst.OpenUI(); LoadData(); UI.Inst.OpenUI(); - Fishing.Inst.Go(1); + UI.Inst.OpenUI(); + // Fishing.Inst.Go(1); // UI.Inst.OpenUI(); // UI.Inst.OpenUI(); } diff --git a/Assets/Scripts/UI/Home/Pages/HomeMainPage.Designer.cs b/Assets/Scripts/UI/Home/Pages/HomeMainPage.Designer.cs index c7706415c..77f03d174 100644 --- a/Assets/Scripts/UI/Home/Pages/HomeMainPage.Designer.cs +++ b/Assets/Scripts/UI/Home/Pages/HomeMainPage.Designer.cs @@ -13,6 +13,7 @@ namespace NBF public HomeButtonGroups OpGroup; public BottomMenu BottomMenu; + public GButton BtnTest; public override void ConstructFromXML(XML xml) { @@ -20,6 +21,7 @@ namespace NBF OpGroup = (HomeButtonGroups)GetChild("OpGroup"); BottomMenu = (BottomMenu)GetChild("BottomMenu"); + BtnTest = (GButton)GetChild("BtnTest"); OnInited(); UILanguage.TrySetComponentLanguage(this); } diff --git a/Assets/Scripts/UI/Home/Pages/HomeMainPage.cs b/Assets/Scripts/UI/Home/Pages/HomeMainPage.cs index 8f17e3cd3..c7994cbf0 100644 --- a/Assets/Scripts/UI/Home/Pages/HomeMainPage.cs +++ b/Assets/Scripts/UI/Home/Pages/HomeMainPage.cs @@ -3,16 +3,29 @@ using System.Collections.Generic; using FairyGUI; using NBC; +using UnityEngine; namespace NBF { public partial class HomeMainPage : HomePageBase { - private List _buttons = new List(); + private ButtonNavigate navigate; private void OnInited() { - _buttons.Add(OpGroup.BtnGo); + List buttons = new List(); + var children = OpGroup.GetChildren(); + foreach (var child in children) + { + if (child is GButton button) + { + buttons.Add(button); + } + } + + buttons.Add(BtnTest); + + navigate = new ButtonNavigate(buttons); } protected override void OnShow() @@ -21,6 +34,7 @@ namespace NBF UseBottomMenu(); } + protected override void OnHide() { InputManager.OnUICanceled -= OnUICanceled; @@ -37,9 +51,23 @@ namespace NBF } else if (action == InputDef.UI.Up) { + navigate.Up(); } else if (action == InputDef.UI.Down) { + navigate.Down(); + } + else if (action == InputDef.UI.Right) + { + navigate.Right(); + } + else if (action == InputDef.UI.Left) + { + navigate.Left(); + } + else if (action == InputDef.UI.Enter) + { + navigate.Click(); } } diff --git a/Assets/Scripts/Utils/ButtonNavigate.cs b/Assets/Scripts/Utils/ButtonNavigate.cs new file mode 100644 index 000000000..a198d0cbe --- /dev/null +++ b/Assets/Scripts/Utils/ButtonNavigate.cs @@ -0,0 +1,164 @@ +using System.Collections.Generic; +using FairyGUI; +using UnityEngine; + +namespace NBF +{ + public class ButtonNavigate + { + private readonly List _buttons = new List(); + private int _currentIndex = 0; + + public ButtonNavigate(List buttons, bool selectFist = true) + { + _buttons.AddRange(buttons); + if (selectFist && _buttons.Count > 0) + { + SetButtonSelect(buttons[0]); + } + } + + public void Up() + { + Navigate(Vector2.up); + } + + public void Down() + { + Navigate(Vector2.down); + } + + public void Left() + { + Navigate(Vector2.left); + } + + public void Right() + { + Navigate(Vector2.right); + } + + /// + /// 点击选中按钮 + /// + public void Click() + { + foreach (var button in _buttons) + { + if (button.selected) + { + button.Click(); + break; + } + } + } + + private void Navigate(Vector2 direction) + { + GButton current = _buttons[_currentIndex]; + Rect currentRect = GetGlobalRect(current); + + GButton bestCandidate = null; + float bestDistance = float.MaxValue; + + foreach (var candidate in _buttons) + { + if (candidate == current) continue; + + Rect candidateRect = GetGlobalRect(candidate); + + // 检查方向匹配性 + bool isDirectionMatch = false; + + if (direction == Vector2.up) // 上方向 + { + isDirectionMatch = candidateRect.yMax <= currentRect.yMin && + RectOverlapX(currentRect, candidateRect); + } + else if (direction == Vector2.down) // 下方向 + { + isDirectionMatch = candidateRect.yMin >= currentRect.yMax && + RectOverlapX(currentRect, candidateRect); + } + else if (direction == Vector2.left) // 左方向 + { + isDirectionMatch = candidateRect.xMax <= currentRect.xMin && + RectOverlapY(currentRect, candidateRect); + } + else if (direction == Vector2.right) // 右方向 + { + isDirectionMatch = candidateRect.xMin >= currentRect.xMax && + RectOverlapY(currentRect, candidateRect); + } + + if (isDirectionMatch) + { + float distance = Vector2.Distance(currentRect.center, candidateRect.center); + if (distance < bestDistance) + { + bestDistance = distance; + bestCandidate = candidate; + } + } + } + + if (bestCandidate != null) + { + _currentIndex = _buttons.IndexOf(bestCandidate); + SetButtonSelect(bestCandidate); + } + } + + /// + /// 获取按钮在根坐标空间中的矩形区域 + /// + /// + /// + private Rect GetGlobalRect(GObject obj) + { + // 获取对象在根组件中的全局位置 + Vector2 globalPos = obj.LocalToGlobal(Vector2.zero); + Vector2 rootPos = GRoot.inst.GlobalToLocal(globalPos); + + // 考虑对象的缩放 + float width = obj.width * obj.scaleX; + float height = obj.height * obj.scaleY; + + return new Rect(rootPos.x, rootPos.y, width, height); + } + + /// + /// 检查两个矩形在X轴上的重叠 + /// + /// + /// + /// + private bool RectOverlapX(Rect a, Rect b) + { + return !(a.xMin >= b.xMax || a.xMax <= b.xMin); + } + + /// + /// 检查两个矩形在Y轴上的重叠 + /// + /// + /// + /// + private bool RectOverlapY(Rect a, Rect b) + { + return !(a.yMin >= b.yMax || a.yMax <= b.yMin); + } + + /// + /// 设置按钮选中 + /// + /// + private void SetButtonSelect(GButton button) + { + foreach (var btn in _buttons) + { + btn.selected = btn == button; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Utils/ButtonNavigate.cs.meta b/Assets/Scripts/Utils/ButtonNavigate.cs.meta new file mode 100644 index 000000000..502bb882e --- /dev/null +++ b/Assets/Scripts/Utils/ButtonNavigate.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 83f029b458614e419234114c3d90f1fc +timeCreated: 1749009573 \ No newline at end of file diff --git a/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs b/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs new file mode 100644 index 000000000..b0cc13a44 --- /dev/null +++ b/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs @@ -0,0 +1,13 @@ +using FairyGUI; + +namespace NBF +{ + public static class FairyGUIExtensions + { + public static void Click(this GButton button) + { + button.FireClick(true); + button.onClick.Call(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs.meta b/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs.meta new file mode 100644 index 000000000..95f3576fd --- /dev/null +++ b/Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6f9d43645df348cc8e3e498a7570cd2f +timeCreated: 1749008303 \ No newline at end of file diff --git a/FGUIProject/assets/Common/package.xml b/FGUIProject/assets/Common/package.xml index 6963012bb..ed71c6012 100644 --- a/FGUIProject/assets/Common/package.xml +++ b/FGUIProject/assets/Common/package.xml @@ -138,7 +138,7 @@ - + diff --git a/FGUIProject/assets/Main/Com/Home/BtnHomeMap.xml b/FGUIProject/assets/Main/Com/Home/BtnHomeMap.xml index 2a8437e63..11367326f 100644 --- a/FGUIProject/assets/Main/Com/Home/BtnHomeMap.xml +++ b/FGUIProject/assets/Main/Com/Home/BtnHomeMap.xml @@ -5,9 +5,11 @@ - - - + + + + + diff --git a/FGUIProject/assets/Main/Com/Home/BtnHomeMedium.xml b/FGUIProject/assets/Main/Com/Home/BtnHomeMedium.xml index 7299303d5..0f2efaa31 100644 --- a/FGUIProject/assets/Main/Com/Home/BtnHomeMedium.xml +++ b/FGUIProject/assets/Main/Com/Home/BtnHomeMedium.xml @@ -1,12 +1,15 @@ - + - - + + + + + diff --git a/FGUIProject/assets/Main/Com/Home/BtnHomeSmall.xml b/FGUIProject/assets/Main/Com/Home/BtnHomeSmall.xml index ae57ea57c..8f8b0ae29 100644 --- a/FGUIProject/assets/Main/Com/Home/BtnHomeSmall.xml +++ b/FGUIProject/assets/Main/Com/Home/BtnHomeSmall.xml @@ -1,13 +1,15 @@ - + + + + + + - - -