【建造】物品栏、提示相关

iOS_release
zhangaotian 2024-07-16 15:04:13 +08:00
parent 68cfa181e5
commit 55d797189b
9 changed files with 4644 additions and 4827 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -340,5 +340,17 @@
"Key": "Save_Success", "Key": "Save_Success",
"Value": "当前已与 {0} 账号同步至最新,是否确定退出账号?", "Value": "当前已与 {0} 账号同步至最新,是否确定退出账号?",
"Value_En": "Synced with {0} account, Confirm log out?" "Value_En": "Synced with {0} account, Confirm log out?"
},
{
"ID": 158,
"Key": "Build_Game",
"Value": "开始游戏",
"Value_En": "Start Game"
},
{
"ID": 159,
"Key": "Build_Tip",
"Value": "尚未解锁\n去探索更多关卡吧!",
"Value_En": "Not yet unlocked\nGo explore more levels!"
} }
] ]

View File

@ -60,4 +60,6 @@ QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm
退 退

View File

@ -453,68 +453,6 @@ Transform:
- {fileID: 1348874866} - {fileID: 1348874866}
m_Father: {fileID: 76654114} m_Father: {fileID: 76654114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &297726499 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8849663015456450217, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
--- !u!114 &297726501 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3351268473546380341, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297726499}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &297726503
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297726499}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 297726501}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &311710693 --- !u!1 &311710693
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -664,40 +602,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 374389568} m_TransformParent: {fileID: 374389568}
m_Modifications: m_Modifications:
- target: {fileID: 781503480839846848, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 231336066453800405, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 0
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_SizeDelta.x
value: 240
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_SizeDelta.y
value: 240
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 606
objectReference: {fileID: 0}
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -125
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1501056032042821150, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 1501056032042821150, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
@ -707,18 +615,13 @@ PrefabInstance:
- target: {fileID: 1665594906165725798, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 1665594906165725798, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2181581025797918851, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 2181581025797918851, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2564137945090303001, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
@ -854,59 +757,25 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 7644366489302203207, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_AnchorMax.y propertyPath: m_text
value: 1 value: Build_Game
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c, - target: {fileID: 8263868880915436829, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_SizeDelta.x
value: 240
objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_SizeDelta.y
value: 240
objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 363
objectReference: {fileID: 0}
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -125
objectReference: {fileID: 0}
- target: {fileID: 9145173861266666151, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: - target: {fileID: 8779257074991400646, guid: e9c96c211fb08417084dbd9a3f85ab3c,
- {fileID: 6873494323991902787, guid: e9c96c211fb08417084dbd9a3f85ab3c, type: 3} type: 3}
m_RemovedGameObjects: propertyPath: m_text
- {fileID: 9145173861266666151, guid: e9c96c211fb08417084dbd9a3f85ab3c, type: 3} value: Build_Tip
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: m_AddedComponents: []
- targetCorrespondingSourceObject: {fileID: 2181581025797918851, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
insertIndex: -1
addedObject: {fileID: 686420181}
- targetCorrespondingSourceObject: {fileID: 8849663015456450217, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
insertIndex: -1
addedObject: {fileID: 297726503}
- targetCorrespondingSourceObject: {fileID: 7130342339561235028, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
insertIndex: -1
addedObject: {fileID: 621101626}
m_SourcePrefab: {fileID: 100100000, guid: e9c96c211fb08417084dbd9a3f85ab3c, type: 3} m_SourcePrefab: {fileID: 100100000, guid: e9c96c211fb08417084dbd9a3f85ab3c, type: 3}
--- !u!224 &334302850 stripped --- !u!224 &334302850 stripped
RectTransform: RectTransform:
@ -1625,68 +1494,6 @@ Transform:
- {fileID: 397456830} - {fileID: 397456830}
m_Father: {fileID: 1497732328} m_Father: {fileID: 1497732328}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &621101622 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7130342339561235028, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
--- !u!114 &621101624 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 13335543186065596, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 621101622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &621101626
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 621101622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 621101624}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &644199642 --- !u!1 &644199642
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1831,68 +1638,6 @@ Transform:
- {fileID: 735303003} - {fileID: 735303003}
m_Father: {fileID: 1347511408} m_Father: {fileID: 1347511408}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &686420177 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2181581025797918851, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
--- !u!114 &686420179 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8460578807918861653, guid: e9c96c211fb08417084dbd9a3f85ab3c,
type: 3}
m_PrefabInstance: {fileID: 334302849}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 686420177}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &686420181
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 686420177}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 686420179}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &735303002 --- !u!1 &735303002
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using Framework.Constants; using Framework.Constants;
using Framework.Manager; using Framework.Manager;
using Gameplay.Game; using Gameplay.Game;
using Gameplay.Level;
using Gameplay.Manager; using Gameplay.Manager;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using TMPro; using TMPro;
@ -51,10 +52,14 @@ public class BuildBoot : MonoBehaviour
/// </summary> /// </summary>
public class Option public class Option
{ {
public GameObject NodeObj;
public GameObject OptionObj;
public GameObject NormalObj; public GameObject NormalObj;
public Option(GameObject root) public Option(GameObject root)
{ {
NodeObj = root.transform.parent.gameObject;
OptionObj = root;
NormalObj = root.transform.Find("Normal").gameObject; NormalObj = root.transform.Find("Normal").gameObject;
} }
} }
@ -62,48 +67,78 @@ public class BuildBoot : MonoBehaviour
private class BuildBar private class BuildBar
{ {
private GameObject _bar; private GameObject _bar;
public List<BuildItem> buildItem; public Dictionary<string, BuildItem> buildItem;
private Dictionary<string, Transform> itemTrans;
private TMP_Text _condition; private TMP_Text _condition;
private const string ContentPath = "Bar_Tip/Scroll View/Viewport/Content"; private const string ContentPath = "Bar_Tip/Scroll View/Viewport/Content";
private const string IconItemTemplate = "Bar_Tip/Scroll View/Viewport/Content/Item";
private const string TipPath = "Bar_Tip"; private const string TipPath = "Bar_Tip";
private const string ConditionText = "{0}/{1}"; private const string ConditionText = "Level\n{0}/{1}";
private const string ItemName = "Item{0}";
public BuildBar(GameObject root) public BuildBar(GameObject root)
{ {
_bar = root; _bar = root;
_condition = root.transform.Find(TipPath).GetComponent<TMP_Text>(); _condition = root.transform.Find(TipPath).GetComponent<TMP_Text>();
buildItem = new List<BuildItem>(); buildItem = new Dictionary<string, BuildItem>();
var content = root.transform.Find(ContentPath); itemTrans = new Dictionary<string, Transform>();
foreach (Transform child in content)
{
DebugUtil.LogError("Bar添加物品{0}", child.gameObject.name);
var item = new BuildItem(child.gameObject);
buildItem.Add(item);
}
} }
public void Open(List<Sprite> sprites, Action callBack, int reachCondition, int condition) public void Open(Node node, Action callBack, Action lockCallBack, int reachCondition, int condition)
{ {
_bar.SetActive(true); _bar.SetActive(true);
_condition.text = string.Format(ConditionText, reachCondition, condition); _condition.text = string.Format(ConditionText, reachCondition, condition);
for (var i = 0; i < sprites.Count; i++) var content = _bar.transform.Find(ContentPath);
var iconTemplate = _bar.transform.Find(IconItemTemplate);
buildItem.Clear();
for (var i = 0; i < node.Options.Count; i++)
{ {
if (i < sprites.Count) var optionName = node.Options[i].OptionObj.name;
var iconName = string.Format(ItemName, i + 1);
if (!itemTrans.TryGetValue(iconName, out var iconItem))
{ {
buildItem[i].SetInfo(sprites[i], callBack); iconItem = Instantiate(iconTemplate, content);
iconItem.name = iconName;
itemTrans.Add(iconName, iconItem);
} }
iconItem.gameObject.SetActive(true);
var sprite = BuildManager.Instance.GetOptionIcon(node.Name, optionName);
var item = new BuildItem(iconItem.gameObject);
buildItem.Add(optionName, item);
item.SetInfo(sprite, () =>
{
callBack?.Invoke();
PickItemDisplay(optionName);
}, lockCallBack);
//DebugUtil.Log("Bar添加物品Icon{0}", iconItem.name);
}
}
private void PickItemDisplay(string optionName)
{
foreach (var item in buildItem)
{
item.Value.SetPickActive(item.Key.Equals(optionName));
} }
} }
public void Close() public void Close()
{ {
_bar.SetActive(false); _bar.SetActive(false);
foreach (var item in buildItem)
{
item.Value.SetPickActive(false);
}
} }
} }
private class BuildItem private class BuildItem
{ {
private Button _btn; private Button _btn;
private Button _lockBtn;
private Image _imgIcon; private Image _imgIcon;
private GameObject _lock; private GameObject _lock;
private GameObject _imgPick; private GameObject _imgPick;
@ -113,25 +148,43 @@ public class BuildBoot : MonoBehaviour
_btn = root.transform.Find("Img_Item").GetComponent<Button>(); _btn = root.transform.Find("Img_Item").GetComponent<Button>();
_imgIcon = root.transform.Find("Img_Item").GetComponent<Image>(); _imgIcon = root.transform.Find("Img_Item").GetComponent<Image>();
_lock = root.transform.Find("Img_Lock").gameObject; _lock = root.transform.Find("Img_Lock").gameObject;
_lockBtn = _lock.GetComponent<Button>();
_imgPick = root.transform.Find("Bg_Pick").gameObject; _imgPick = root.transform.Find("Bg_Pick").gameObject;
} }
public void SetInfo(Sprite sprite, Action callBack) public void SetInfo(Sprite sprite, Action callBack, Action lockCallBack)
{ {
_btn.onClick.RemoveAllListeners(); _btn.onClick.RemoveAllListeners();
_btn.onClick.AddListener(() => { callBack?.Invoke(); }); _btn.onClick.AddListener(() => { callBack?.Invoke(); });
_lockBtn.onClick.RemoveAllListeners();
_lockBtn.onClick.AddListener(() => { lockCallBack?.Invoke(); });
_imgIcon.sprite = sprite; _imgIcon.sprite = sprite;
} }
public void SetPickActive(bool pick)
{
_imgPick.SetActive(pick);
}
} }
private BuildBar _buildBar; //页面关闭
private Button _btnClose; private Button _btnClose;
//物品栏
private BuildBar _buildBar;
private Button _btnBarClose; private Button _btnBarClose;
private Button _btnBarYes; private Button _btnBarYes;
//当前点击的泡泡按钮
private GameObject _curBubble; private GameObject _curBubble;
private List<Node> _nodes; //当前节点字典
private Dictionary<string, Node> _nodes;
//提示弹窗
private GameObject _tipObj;
private Button _btnTipGoGame;
private Button _btnTipClose;
private void Awake() private void Awake()
{ {
@ -154,12 +207,12 @@ public class BuildBoot : MonoBehaviour
private void InitBuildData() private void InitBuildData()
{ {
_nodes = new List<Node>(); _nodes = new Dictionary<string, Node>();
var nodeRoot = GameObject.Find("Root"); var nodeRoot = GameObject.Find("Root");
foreach (Transform child in nodeRoot.transform) foreach (Transform child in nodeRoot.transform)
{ {
var node = new Node(child.gameObject); var node = new Node(child.gameObject);
_nodes.Add(node); _nodes.Add(child.name, node);
} }
} }
@ -170,10 +223,21 @@ public class BuildBoot : MonoBehaviour
private void InitUI() private void InitUI()
{ {
_btnClose = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiTop/BG_Top/Btn_Close").GetComponent<Button>(); _btnClose = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiTop/BG_Top/Btn_Close").GetComponent<Button>();
_btnClose.onClick.AddListener(CloseUI); _btnClose.onClick.AddListener(CloseBuildPanel);
InitTipPanel();
InitBuildBar(); InitBuildBar();
} }
private void InitTipPanel()
{
_tipObj = transform.Find("UIRoot/UIMainBuild/Build_Tip").gameObject;
_btnTipClose = _tipObj.transform.Find("Btn_Close").GetComponent<Button>();
_btnTipGoGame = _tipObj.transform.Find("Btn_Game").GetComponent<Button>();
_btnTipClose.onClick.AddListener(CloseTipPanel);
_btnTipGoGame.onClick.AddListener(TipGoGame);
}
private void InitBuildBar() private void InitBuildBar()
{ {
var bar = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar").gameObject; var bar = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar").gameObject;
@ -190,30 +254,44 @@ public class BuildBoot : MonoBehaviour
{ {
foreach (var node in _nodes) foreach (var node in _nodes)
{ {
if (BuildManager.Instance.NodeInfos.TryGetValue(node.Name, out var nodeInfo)) if (BuildManager.Instance.NodeInfos.TryGetValue(node.Key, out var nodeInfo))
{ {
if (CurCondition >= nodeInfo.Condition) if (CurCondition >= nodeInfo.Condition)
{ {
DebugUtil.LogError("节点:{0}解锁了", node.Name); DebugUtil.LogError("节点:{0}解锁了", node.Key);
} }
else else
{ {
foreach (var option in node.Options) foreach (var option in node.Value.Options)
{ {
option.NormalObj.SetActive(false); option.NormalObj.SetActive(false);
} }
} }
node.BubbleObj.SetActive(CurCondition < nodeInfo.Condition); node.Value.BubbleObj.SetActive(CurCondition < nodeInfo.Condition);
} }
} }
} }
private void CloseUI() private void CloseBuildPanel()
{ {
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel)); GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel));
} }
private void CloseTipPanel()
{
_tipObj.SetActive(false);
}
private void TipGoGame()
{
var levelID = $"level{LevelSelectManager.Instance.CurPassLevelIndex + 1}";
if (LevelManager.Instance.IsLevelExist(levelID))
{
GameStateManager.Instance.ChangeState(new LevelState(levelID));
}
}
private void CloseBar() private void CloseBar()
{ {
_buildBar.Close(); _buildBar.Close();
@ -237,10 +315,16 @@ public class BuildBoot : MonoBehaviour
{ {
_curBubble = obj; _curBubble = obj;
obj.SetActive(false); obj.SetActive(false);
var node = obj.transform.parent; var nodeName = obj.transform.parent.name;
var sprites = BuildManager.Instance.GetNodeIcons(node.name); if (_nodes.TryGetValue(nodeName, out var node))
var condition = BuildManager.Instance.GetCondition(node.name); {
_buildBar.Open(sprites, BuildIconClick, CurCondition, condition); var condition = BuildManager.Instance.GetCondition(nodeName);
_buildBar.Open(node, BuildIconClick, BuildLockIconClick, CurCondition, condition);
}
else
{
DebugUtil.LogError("节点获取信息错误: {0}", nodeName);
}
} }
private void BuildIconClick() private void BuildIconClick()
@ -248,6 +332,12 @@ public class BuildBoot : MonoBehaviour
DebugUtil.LogError("点击了图标"); DebugUtil.LogError("点击了图标");
} }
private void BuildLockIconClick()
{
DebugUtil.LogError("点击了上锁图标");
_tipObj.SetActive(true);
}
private void RegisterClickEvent() private void RegisterClickEvent()
{ {
InputManager.Instance.OnBuildItemClick += OnBuilItemClick; InputManager.Instance.OnBuildItemClick += OnBuilItemClick;

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using UnityEngine; using UnityEngine;
using cfg.Build; using cfg.Build;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
@ -77,8 +78,11 @@ namespace Framework.Manager
public class OptionInfo public class OptionInfo
{ {
public int ID;
public string Name; public string Name;
public string IconPath;
//按主题解锁条件 //按主题解锁条件
public int Condition; public int Condition;
} }
@ -122,12 +126,16 @@ namespace Framework.Manager
Options = new Dictionary<string, OptionInfo>(), Options = new Dictionary<string, OptionInfo>(),
IconPath = node.IconPath IconPath = node.IconPath
}; };
foreach (var option in node.options) foreach (var option in node.options)
{ {
var index = ExtractNumber(option);
var optionInfo = new OptionInfo() var optionInfo = new OptionInfo()
{ {
ID = index,
Name = option Name = option
}; };
optionInfo.IconPath = InitOptionIconPath(node.IconPath, index);
nodeInfo.Options.Add(option, optionInfo); nodeInfo.Options.Add(option, optionInfo);
} }
@ -179,25 +187,58 @@ namespace Framework.Manager
DebugUtil.LogError("BuildManager Init"); DebugUtil.LogError("BuildManager Init");
} }
public List<Sprite> GetNodeIcons(string nodeName) /// <summary>
/// 获得选项对应的Icon路径
/// </summary>
private string InitOptionIconPath(string iconsPath, int index)
{ {
var spriteList = new List<Sprite>(); var fileEntries = Directory.GetFiles(iconsPath, "*.png");
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo)) foreach (var filePath in fileEntries)
{ {
var path = nodeInfo.IconPath; var fileName = Path.GetFileName(filePath);
var fileEntries = Directory.GetFiles(path, "*.png"); var name = fileName.Replace(".png", "");
foreach (var filePath in fileEntries) if (ExtractNumber(name) == index)
{ {
var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/'); var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/');
var sprite = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath); return assetPath;
if (sprite != null)
{
spriteList.Add(sprite);
}
} }
} }
return spriteList; return null;
}
private int ExtractNumber(string input)
{
var str = input;
int lastIndex = input.LastIndexOf('_');
if (lastIndex != -1 && lastIndex < input.Length - 1)
{
str = input.Substring(lastIndex + 1);
}
Match match = Regex.Match(str, @"\d+");
if (match.Success)
{
return int.Parse(match.Value);
}
return 0;
}
public Sprite GetOptionIcon(string nodeName, string optionName)
{
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
{
if (nodeInfo.Options.TryGetValue(optionName, out var optionInfo))
{
var sprite = AssetDatabase.LoadAssetAtPath<Sprite>(optionInfo.IconPath);
if (sprite != null)
return sprite;
}
}
return null;
} }
public int GetCondition(string nodeName) public int GetCondition(string nodeName)

View File

@ -1,28 +1,28 @@
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/ad_adconfig.json,A36B3A44ABABA2DDE095849E3626C9,1094,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/ad_adconfig.json,A36B3A44ABABA2DDE095849E3626C9,1094,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/build_builditemconfig.json,6075FDA09E32518F3E635C72B56BE7BB,5390,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/build_builditemconfig.json,6075FDA09E32518F3E635C72B56BE7BB,5390,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/build_buildseriesconfig.json,42EAC994C82DC8ECBF7E095FB6A39,156,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/build_buildseriesconfig.json,42EAC994C82DC8ECBF7E095FB6A39,156,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/prop_propconfig.json,7C02F583533F144939CBFF8C7E18473,880,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/prop_propconfig.json,7C02F583533F144939CBFF8C7E18473,880,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/stringcfg_stringconfig.json,448F97FC077CE499139EFC4854438,7226,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Config/Data/stringcfg_stringconfig.json,9A1616ADF3898E6E92CA8CFC8B5A6DB3,7497,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADConfig.cs,A4C9CBC6BD55B1C14634FD73C748ACA,1928,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADConfig.cs,A4C9CBC6BD55B1C14634FD73C748ACA,1928,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADType.cs,F6A7395BDA6D1E7D1EF51E344CB045,603,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/ADType.cs,F6A7395BDA6D1E7D1EF51E344CB045,603,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/DataAD.cs,7F68864C5AB693111C5C3250967FB782,3417,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/AD/DataAD.cs,7F68864C5AB693111C5C3250967FB782,3417,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/Event.cs,9BC756F4D9E749FBCEF49BF6929557,6506,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/Event.cs,9BC756F4D9E749FBCEF49BF6929557,6506,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/EventFirst.cs,72E992B782D0734B64364E4777CA3B35,2964,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/BI/EventFirst.cs,72E992B782D0734B64364E4777CA3B35,2964,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/BuildItemConfig.cs,4714A01BBC36D6A99C9B955B333A51,2059,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/BuildItemConfig.cs,4714A01BBC36D6A99C9B955B333A51,2059,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/BuildSeriesConfig.cs,EAC945DD99AC18E8BB8BEC47F39463A,2087,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/BuildSeriesConfig.cs,EAC945DD99AC18E8BB8BEC47F39463A,2087,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/DataBuildItem.cs,84FCA11123B22C3DE7285A6E56DF6499,3697,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/DataBuildItem.cs,84FCA11123B22C3DE7285A6E56DF6499,3697,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/DataBuildSeries.cs,6A95F8649FE3B730BEC3CE2C3877849,2860,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Build/DataBuildSeries.cs,6A95F8649FE3B730BEC3CE2C3877849,2860,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/DataProp.cs,B1E5165AD7B7B28F863BF25E9581BF7B,4385,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/DataProp.cs,B1E5165AD7B7B28F863BF25E9581BF7B,4385,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropConfig.cs,263DA0E1E0FA37A6401A432E49E8,2040,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropConfig.cs,263DA0E1E0FA37A6401A432E49E8,2040,1721113276759
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropType.cs,56DDB93BC3D6491F012DAE849526897,757,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Prop/PropType.cs,56DDB93BC3D6491F012DAE849526897,757,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/DataString.cs,1613DCE5B077AE52BB90193DD949348,2327,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/DataString.cs,1613DCE5B077AE52BB90193DD949348,2327,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/StringConfig.cs,90AC6ED26EAF4A66498B4816B635F47,2080,1720505680246 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/StringCfg/StringConfig.cs,90AC6ED26EAF4A66498B4816B635F47,2080,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Tables.cs,39B71A95C87B6A23CC35B8E8F3C595,2753,1720505680247 /Users/zhangaotian/UnityProject/Forest_Client/Forest/Assets/Scripts/Gameplay/DataTable/Tables.cs,39B71A95C87B6A23CC35B8E8F3C595,2753,1721113276758
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__beans__.xlsx,FBF2DDFEE7FB39A727F2C3ACA7E228E,11821,1718685908733 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__beans__.xlsx,FBF2DDFEE7FB39A727F2C3ACA7E228E,11821,1718685908733
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__enums__.xlsx,9966F8C0BCDDD717667BB975C9862F80,12651,1718685908733 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__enums__.xlsx,9966F8C0BCDDD717667BB975C9862F80,12651,1718685908733
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__tables__.xlsx,D0163D3F43E7627ABD0AEBC1439C079,11188,1720501036099 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/__tables__.xlsx,D0163D3F43E7627ABD0AEBC1439C079,11188,1720508366753
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/AD.xlsx,C664BD5E7C8E22397FB8CDF12EAED4E,9832,1719548816307 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/AD.xlsx,C664BD5E7C8E22397FB8CDF12EAED4E,9832,1719548816307
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/BuildItemConfig.xlsx,59F98AB50F4738F745894959F31AAC,10350,1720505626778 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/BuildItemConfig.xlsx,59F98AB50F4738F745894959F31AAC,10350,1720508366752
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/BuildSeriesConfig.xlsx,CF1411D7DEAFE70A2D82CDB4D746577,9511,1720505240267 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/BuildSeriesConfig.xlsx,CF1411D7DEAFE70A2D82CDB4D746577,9511,1720508366753
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/Prop.xlsx,518794514E27F37BF9D0B6BA712533A5,10050,1718685908733 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/Prop.xlsx,518794514E27F37BF9D0B6BA712533A5,10050,1718685908733
/Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/StringConfig.xlsx,7928FA644D565490BF62C9F31161DF,12898,1719225115683 /Users/zhangaotian/UnityProject/Forest_Client/Tool/Luban/Datas/StringConfig.xlsx,D2AE14881D4FD3C270BE9F271379FC,13019,1721113260612

Binary file not shown.