方向键控制
This commit is contained in:
@@ -1250,6 +1250,17 @@
|
|||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "ec9eb0c2-a2e0-47eb-ac8b-52cb0ef46101",
|
||||||
|
"path": "<Keyboard>/rightArrow",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Right",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "031b930d-59b6-4a26-9dfe-97764c3e8b37",
|
"id": "031b930d-59b6-4a26-9dfe-97764c3e8b37",
|
||||||
@@ -1272,6 +1283,17 @@
|
|||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "680b36f2-5797-4257-83a7-3a498891d856",
|
||||||
|
"path": "<Keyboard>/leftArrow",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Left",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "45f78626-cbf2-4e1f-904d-d82e4c2a2f41",
|
"id": "45f78626-cbf2-4e1f-904d-d82e4c2a2f41",
|
||||||
@@ -1294,6 +1316,17 @@
|
|||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "40501ac1-9d3e-4059-8e8f-ff7035f6e32e",
|
||||||
|
"path": "<Keyboard>/downArrow",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Down",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "f1a47b3c-e79f-4ab3-86b6-fcc0a6470114",
|
"id": "f1a47b3c-e79f-4ab3-86b6-fcc0a6470114",
|
||||||
@@ -1316,6 +1349,17 @@
|
|||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "9996c4e1-f7fb-4793-ab51-da569bdbab09",
|
||||||
|
"path": "<Keyboard>/upArrow",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Up",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "393f1eb9-d10d-4cd1-87e7-ea299f92b2da",
|
"id": "393f1eb9-d10d-4cd1-87e7-ea299f92b2da",
|
||||||
|
|||||||
8
Assets/Procedural Worlds/Packages - Install.meta
Normal file
8
Assets/Procedural Worlds/Packages - Install.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7be223564adbc5c41926687e7ab40afa
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d84b88941db835439b793dbf6286189
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Binary file not shown.
@@ -616,67 +616,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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
|
--- !u!1 &1729919008
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1108,4 +1047,3 @@ SceneRoots:
|
|||||||
- {fileID: 1729919011}
|
- {fileID: 1729919011}
|
||||||
- {fileID: 6620360613922641342}
|
- {fileID: 6620360613922641342}
|
||||||
- {fileID: 174907469}
|
- {fileID: 174907469}
|
||||||
- {fileID: 1536631313}
|
|
||||||
|
|||||||
@@ -1338,6 +1338,17 @@ namespace NBF
|
|||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""ec9eb0c2-a2e0-47eb-ac8b-52cb0ef46101"",
|
||||||
|
""path"": ""<Keyboard>/rightArrow"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""Right"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
""name"": """",
|
""name"": """",
|
||||||
""id"": ""031b930d-59b6-4a26-9dfe-97764c3e8b37"",
|
""id"": ""031b930d-59b6-4a26-9dfe-97764c3e8b37"",
|
||||||
@@ -1360,6 +1371,17 @@ namespace NBF
|
|||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""680b36f2-5797-4257-83a7-3a498891d856"",
|
||||||
|
""path"": ""<Keyboard>/leftArrow"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""Left"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
""name"": """",
|
""name"": """",
|
||||||
""id"": ""45f78626-cbf2-4e1f-904d-d82e4c2a2f41"",
|
""id"": ""45f78626-cbf2-4e1f-904d-d82e4c2a2f41"",
|
||||||
@@ -1382,6 +1404,17 @@ namespace NBF
|
|||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""40501ac1-9d3e-4059-8e8f-ff7035f6e32e"",
|
||||||
|
""path"": ""<Keyboard>/downArrow"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""Down"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
""name"": """",
|
""name"": """",
|
||||||
""id"": ""f1a47b3c-e79f-4ab3-86b6-fcc0a6470114"",
|
""id"": ""f1a47b3c-e79f-4ab3-86b6-fcc0a6470114"",
|
||||||
@@ -1404,6 +1437,17 @@ namespace NBF
|
|||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""9996c4e1-f7fb-4793-ab51-da569bdbab09"",
|
||||||
|
""path"": ""<Keyboard>/upArrow"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""Up"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
""name"": """",
|
""name"": """",
|
||||||
""id"": ""393f1eb9-d10d-4cd1-87e7-ea299f92b2da"",
|
""id"": ""393f1eb9-d10d-4cd1-87e7-ea299f92b2da"",
|
||||||
|
|||||||
@@ -137,7 +137,8 @@ namespace NBF
|
|||||||
// UI.Inst.OpenUI<FishingShopPanel>();
|
// UI.Inst.OpenUI<FishingShopPanel>();
|
||||||
LoadData();
|
LoadData();
|
||||||
UI.Inst.OpenUI<CommonTopPanel>();
|
UI.Inst.OpenUI<CommonTopPanel>();
|
||||||
Fishing.Inst.Go(1);
|
UI.Inst.OpenUI<FishingPanel>();
|
||||||
|
// Fishing.Inst.Go(1);
|
||||||
// UI.Inst.OpenUI<SettingPanel>();
|
// UI.Inst.OpenUI<SettingPanel>();
|
||||||
// UI.Inst.OpenUI<HomePanel>();
|
// UI.Inst.OpenUI<HomePanel>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace NBF
|
|||||||
|
|
||||||
public HomeButtonGroups OpGroup;
|
public HomeButtonGroups OpGroup;
|
||||||
public BottomMenu BottomMenu;
|
public BottomMenu BottomMenu;
|
||||||
|
public GButton BtnTest;
|
||||||
|
|
||||||
public override void ConstructFromXML(XML xml)
|
public override void ConstructFromXML(XML xml)
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,7 @@ namespace NBF
|
|||||||
|
|
||||||
OpGroup = (HomeButtonGroups)GetChild("OpGroup");
|
OpGroup = (HomeButtonGroups)GetChild("OpGroup");
|
||||||
BottomMenu = (BottomMenu)GetChild("BottomMenu");
|
BottomMenu = (BottomMenu)GetChild("BottomMenu");
|
||||||
|
BtnTest = (GButton)GetChild("BtnTest");
|
||||||
OnInited();
|
OnInited();
|
||||||
UILanguage.TrySetComponentLanguage(this);
|
UILanguage.TrySetComponentLanguage(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,29 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FairyGUI;
|
using FairyGUI;
|
||||||
using NBC;
|
using NBC;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NBF
|
namespace NBF
|
||||||
{
|
{
|
||||||
public partial class HomeMainPage : HomePageBase
|
public partial class HomeMainPage : HomePageBase
|
||||||
{
|
{
|
||||||
private List<GButton> _buttons = new List<GButton>();
|
private ButtonNavigate navigate;
|
||||||
|
|
||||||
private void OnInited()
|
private void OnInited()
|
||||||
{
|
{
|
||||||
_buttons.Add(OpGroup.BtnGo);
|
List<GButton> buttons = new List<GButton>();
|
||||||
|
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()
|
protected override void OnShow()
|
||||||
@@ -21,6 +34,7 @@ namespace NBF
|
|||||||
UseBottomMenu();
|
UseBottomMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void OnHide()
|
protected override void OnHide()
|
||||||
{
|
{
|
||||||
InputManager.OnUICanceled -= OnUICanceled;
|
InputManager.OnUICanceled -= OnUICanceled;
|
||||||
@@ -37,9 +51,23 @@ namespace NBF
|
|||||||
}
|
}
|
||||||
else if (action == InputDef.UI.Up)
|
else if (action == InputDef.UI.Up)
|
||||||
{
|
{
|
||||||
|
navigate.Up();
|
||||||
}
|
}
|
||||||
else if (action == InputDef.UI.Down)
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
164
Assets/Scripts/Utils/ButtonNavigate.cs
Normal file
164
Assets/Scripts/Utils/ButtonNavigate.cs
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using FairyGUI;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NBF
|
||||||
|
{
|
||||||
|
public class ButtonNavigate
|
||||||
|
{
|
||||||
|
private readonly List<GButton> _buttons = new List<GButton>();
|
||||||
|
private int _currentIndex = 0;
|
||||||
|
|
||||||
|
public ButtonNavigate(List<GButton> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点击选中按钮
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取按钮在根坐标空间中的矩形区域
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查两个矩形在X轴上的重叠
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a"></param>
|
||||||
|
/// <param name="b"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool RectOverlapX(Rect a, Rect b)
|
||||||
|
{
|
||||||
|
return !(a.xMin >= b.xMax || a.xMax <= b.xMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查两个矩形在Y轴上的重叠
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a"></param>
|
||||||
|
/// <param name="b"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool RectOverlapY(Rect a, Rect b)
|
||||||
|
{
|
||||||
|
return !(a.yMin >= b.yMax || a.yMax <= b.yMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置按钮选中
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="button"></param>
|
||||||
|
private void SetButtonSelect(GButton button)
|
||||||
|
{
|
||||||
|
foreach (var btn in _buttons)
|
||||||
|
{
|
||||||
|
btn.selected = btn == button;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Utils/ButtonNavigate.cs.meta
Normal file
3
Assets/Scripts/Utils/ButtonNavigate.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83f029b458614e419234114c3d90f1fc
|
||||||
|
timeCreated: 1749009573
|
||||||
13
Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs
Normal file
13
Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs.meta
Normal file
3
Assets/Scripts/Utils/Extends/FairyGUIExtensions.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6f9d43645df348cc8e3e498a7570cd2f
|
||||||
|
timeCreated: 1749008303
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
<image id="r03uir" name="CommunicationCircleOn05.png" path="/Images/Misc/"/>
|
<image id="r03uir" name="CommunicationCircleOn05.png" path="/Images/Misc/"/>
|
||||||
<image id="r03uiu" name="Gradient.png" path="/Images/Panels/" exported="true" scale="9grid" scale9grid="307,1,30,6"/>
|
<image id="r03uiu" name="Gradient.png" path="/Images/Panels/" exported="true" scale="9grid" scale9grid="307,1,30,6"/>
|
||||||
<image id="r03uiv" name="Square - Stroke 2px.png" path="/Images/Shapes/Square/" exported="true" scale="9grid" scale9grid="6,8,116,114"/>
|
<image id="r03uiv" name="Square - Stroke 2px.png" path="/Images/Shapes/Square/" exported="true" scale="9grid" scale9grid="6,8,116,114"/>
|
||||||
<image id="r03uiw" name="Square - Stroke 3px.png" path="/Images/Shapes/Square/" exported="true"/>
|
<image id="r03uiw" name="Square - Stroke 3px.png" path="/Images/Shapes/Square/" exported="true" scale="9grid" scale9grid="9,10,114,109"/>
|
||||||
<image id="r03uix" name="Square - Stroke 5px.png" path="/Images/Shapes/Square/" exported="true"/>
|
<image id="r03uix" name="Square - Stroke 5px.png" path="/Images/Shapes/Square/" exported="true"/>
|
||||||
<image id="r03uiy" name="Item01.png" path="/Icon/item/" exported="true"/>
|
<image id="r03uiy" name="Item01.png" path="/Icon/item/" exported="true"/>
|
||||||
<image id="r03uiz" name="Item02.png" path="/Icon/item/" exported="true"/>
|
<image id="r03uiz" name="Item02.png" path="/Icon/item/" exported="true"/>
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
<loader id="n21_lvql" name="icon" xy="0,0" size="732,370" url="ui://6hgkvlaudheveh" align="center" vAlign="middle" fill="scaleFree">
|
<loader id="n21_lvql" name="icon" xy="0,0" size="732,370" url="ui://6hgkvlaudheveh" align="center" vAlign="middle" fill="scaleFree">
|
||||||
<relation target="" sidePair="width-width,height-height"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
</loader>
|
</loader>
|
||||||
<image id="n22_lvql" name="n22" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,0" size="732,370" color="#34a7de">
|
<image id="n22_lvql" name="n22" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,0" size="732,370" alpha="0.9" color="#4297be">
|
||||||
<gearDisplay controller="button" pages="3,5"/>
|
<gearDisplay controller="button" pages="3,4,5"/>
|
||||||
<gearColor controller="button" pages="4" values="#34a7de" default="#4297be"/>
|
<gearLook controller="button" pages="4" values="0.9,0,0,0" default="1,0,0,0"/>
|
||||||
|
<gearColor controller="button" pages="2,4" values="#34a7de|#4297be" default="#4297be"/>
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
</image>
|
</image>
|
||||||
<component id="n23_lvql" name="Weather" src="tmu81h" fileName="Com/WeatherInfo.xml" pkg="6hgkvlau" xy="4,4"/>
|
<component id="n23_lvql" name="Weather" src="tmu81h" fileName="Com/WeatherInfo.xml" pkg="6hgkvlau" xy="4,4"/>
|
||||||
</displayList>
|
</displayList>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="410,242" extention="Button">
|
<component size="410,242" extention="Button">
|
||||||
<controller name="button" pages="2,up,3,down,4,over,5,selectedOver" selected="0"/>
|
<controller name="button" pages="2,up,3,down,4,over,5,selectedOver" selected="2"/>
|
||||||
<displayList>
|
<displayList>
|
||||||
<graph id="n33_lvql" name="back" xy="0,0" size="410,242" type="rect" lineSize="0" lineColor="#ff4297be" fillColor="#cc0e0f11">
|
<graph id="n33_lvql" name="back" xy="0,0" size="410,242" type="rect" lineSize="0" lineColor="#ff4297be" fillColor="#cc0e0f11">
|
||||||
<relation target="" sidePair="width-width,height-height"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
</graph>
|
</graph>
|
||||||
<image id="n36_lvql" name="n36" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,-1" size="410,242" color="#34a7de">
|
<image id="n36_lvql" name="n36" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,0" size="410,242" alpha="0.9" color="#4297be">
|
||||||
<gearDisplay controller="button" pages="3,5"/>
|
<gearDisplay controller="button" pages="3,4,5"/>
|
||||||
|
<gearLook controller="button" pages="4" values="0.9,0,0,0" default="1,0,0,0"/>
|
||||||
|
<gearColor controller="button" pages="4" values="#4297be" default="#34a7de"/>
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
</image>
|
</image>
|
||||||
<text id="n34_lvql" name="title" xy="180,104" size="49,34" fontSize="24" color="#ffffff" align="center" vAlign="middle" text="title"/>
|
<text id="n34_lvql" name="title" xy="180,104" size="49,34" fontSize="24" color="#ffffff" align="center" vAlign="middle" text="title"/>
|
||||||
</displayList>
|
</displayList>
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="356,112" pivot="0.5,0.5" extention="Button">
|
<component size="356,112" pivot="0.5,0.5" extention="Button">
|
||||||
<controller name="button" pages="2,up,3,down,4,over,5,selectedOver" selected="0"/>
|
<controller name="button" pages="2,up,3,down,4,over,5,selectedOver" selected="2"/>
|
||||||
<displayList>
|
<displayList>
|
||||||
<image id="n36_lvql" name="n36" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="356,112" alpha="0.8" color="#0e0f11"/>
|
<image id="n36_lvql" name="n36" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="356,112" alpha="0.8" color="#0e0f11"/>
|
||||||
|
<image id="n38_lvql" name="n38" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,0" size="356,112" alpha="0.9" color="#4297be">
|
||||||
|
<gearDisplay controller="button" pages="3,4,5"/>
|
||||||
|
<gearLook controller="button" pages="4" values="0.9,0,0,0" default="1,0,0,0"/>
|
||||||
|
<gearColor controller="button" pages="4" values="#4297be" default="#34a7de"/>
|
||||||
|
</image>
|
||||||
<loader id="n33_lvql" name="icon" xy="253,11" size="90,90" alpha="0.7" url="ui://hxr7rc7plvqlr" align="center" vAlign="middle" fill="scale"/>
|
<loader id="n33_lvql" name="icon" xy="253,11" size="90,90" alpha="0.7" url="ui://hxr7rc7plvqlr" align="center" vAlign="middle" fill="scale"/>
|
||||||
<text id="n34_lvql" name="title" xy="16,17" size="217,73" alpha="0.7" fontSize="25" color="#ffffff" vAlign="middle" autoSize="none" text="设置"/>
|
<text id="n34_lvql" name="title" xy="16,17" size="217,73" alpha="0.7" fontSize="25" color="#ffffff" vAlign="middle" autoSize="none" text="设置"/>
|
||||||
<image id="n38_lvql" name="n38" src="r03uiv" fileName="Images/Shapes/Square/Square - Stroke 2px.png" pkg="6hgkvlau" xy="0,0" size="356,112" color="#34a7de">
|
|
||||||
<gearDisplay controller="button" pages="3,5"/>
|
|
||||||
</image>
|
|
||||||
</displayList>
|
</displayList>
|
||||||
<Button mode="Radio"/>
|
<Button mode="Radio"/>
|
||||||
</component>
|
</component>
|
||||||
@@ -7,5 +7,6 @@
|
|||||||
<component id="n1_lvql" name="BottomMenu" src="9mf1z" fileName="Com/Menu/BottomMenu.xml" pkg="6hgkvlau" xy="0,992">
|
<component id="n1_lvql" name="BottomMenu" src="9mf1z" fileName="Com/Menu/BottomMenu.xml" pkg="6hgkvlau" xy="0,992">
|
||||||
<relation target="" sidePair="center-center,bottom-bottom"/>
|
<relation target="" sidePair="center-center,bottom-bottom"/>
|
||||||
</component>
|
</component>
|
||||||
|
<component id="n2_wp6f" name="BtnTest" src="lvqlo" fileName="Com/Home/BtnHomeSmall.xml" xy="1467,810"/>
|
||||||
</displayList>
|
</displayList>
|
||||||
</component>
|
</component>
|
||||||
Reference in New Issue
Block a user