【建造】UI解锁相关
parent
6fbd21787c
commit
68cfa181e5
|
@ -453,6 +453,68 @@ Transform:
|
|||
- {fileID: 1348874866}
|
||||
m_Father: {fileID: 76654114}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -602,65 +664,90 @@ PrefabInstance:
|
|||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 374389568}
|
||||
m_Modifications:
|
||||
- target: {fileID: 781503480839846848, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: 606
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 907971685945980573, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -125
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1501056032042821150, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1665594906165725798, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2181581025797918851, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2564137945090303001, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: 120
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3971867689370811158, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
value: -125
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5333295855086785665, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
|
@ -770,32 +857,32 @@ PrefabInstance:
|
|||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: 363
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6311661543308928235, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
value: -125
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9145173861266666151, guid: e9c96c211fb08417084dbd9a3f85ab3c,
|
||||
type: 3}
|
||||
|
@ -807,7 +894,19 @@ PrefabInstance:
|
|||
m_RemovedGameObjects:
|
||||
- {fileID: 9145173861266666151, guid: e9c96c211fb08417084dbd9a3f85ab3c, type: 3}
|
||||
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}
|
||||
--- !u!224 &334302850 stripped
|
||||
RectTransform:
|
||||
|
@ -1526,6 +1625,68 @@ Transform:
|
|||
- {fileID: 397456830}
|
||||
m_Father: {fileID: 1497732328}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1573,7 +1734,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 9b618b5bdf3884745b8cccd94ea6fcf1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curCondition: 0
|
||||
CurCondition: 50
|
||||
--- !u!1 &655320739
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1670,6 +1831,68 @@ Transform:
|
|||
- {fileID: 735303003}
|
||||
m_Father: {fileID: 1347511408}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -3960,7 +4183,7 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 5
|
||||
m_SortingOrder: 6
|
||||
m_Sprite: {fileID: 21300000, guid: 679bf02009f604c9ba9473b2637c9f20, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
|
@ -4494,7 +4717,7 @@ Transform:
|
|||
m_GameObject: {fileID: 2046127229}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: -0.645, y: 0.505, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Constants;
|
||||
using Framework.Manager;
|
||||
using Gameplay.Game;
|
||||
using Gameplay.Manager;
|
||||
using Sirenix.OdinInspector;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BuildBoot : MonoBehaviour
|
||||
{
|
||||
[LabelText("当前条件")] public int curCondition;
|
||||
[LabelText("当前条件")] public int CurCondition;
|
||||
|
||||
/// <summary>
|
||||
/// 节点类
|
||||
/// </summary>
|
||||
public class Node
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public GameObject NodeObj;
|
||||
|
||||
public GameObject BubbleObj;
|
||||
|
@ -24,7 +28,7 @@ public class BuildBoot : MonoBehaviour
|
|||
|
||||
public Node(GameObject root)
|
||||
{
|
||||
NodeObj = root;
|
||||
Name = root.name;
|
||||
Options = new List<Option>();
|
||||
foreach (Transform child in root.transform)
|
||||
{
|
||||
|
@ -55,12 +59,78 @@ public class BuildBoot : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private class BuildBar
|
||||
{
|
||||
private GameObject _bar;
|
||||
public List<BuildItem> buildItem;
|
||||
private TMP_Text _condition;
|
||||
private const string ContentPath = "Bar_Tip/Scroll View/Viewport/Content";
|
||||
private const string TipPath = "Bar_Tip";
|
||||
private const string ConditionText = "{0}/{1}";
|
||||
|
||||
public BuildBar(GameObject root)
|
||||
{
|
||||
_bar = root;
|
||||
_condition = root.transform.Find(TipPath).GetComponent<TMP_Text>();
|
||||
buildItem = new List<BuildItem>();
|
||||
var content = root.transform.Find(ContentPath);
|
||||
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)
|
||||
{
|
||||
_bar.SetActive(true);
|
||||
_condition.text = string.Format(ConditionText, reachCondition, condition);
|
||||
for (var i = 0; i < sprites.Count; i++)
|
||||
{
|
||||
if (i < sprites.Count)
|
||||
{
|
||||
buildItem[i].SetInfo(sprites[i], callBack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_bar.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class BuildItem
|
||||
{
|
||||
private Button _btn;
|
||||
private Image _imgIcon;
|
||||
private GameObject _lock;
|
||||
private GameObject _imgPick;
|
||||
|
||||
public BuildItem(GameObject root)
|
||||
{
|
||||
_btn = root.transform.Find("Img_Item").GetComponent<Button>();
|
||||
_imgIcon = root.transform.Find("Img_Item").GetComponent<Image>();
|
||||
_lock = root.transform.Find("Img_Lock").gameObject;
|
||||
_imgPick = root.transform.Find("Bg_Pick").gameObject;
|
||||
}
|
||||
|
||||
public void SetInfo(Sprite sprite, Action callBack)
|
||||
{
|
||||
_btn.onClick.RemoveAllListeners();
|
||||
_btn.onClick.AddListener(() => { callBack?.Invoke(); });
|
||||
_imgIcon.sprite = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
private BuildBar _buildBar;
|
||||
private Button _btnClose;
|
||||
private GameObject _buildBar;
|
||||
private Button _btnBarClose;
|
||||
private Button _btnBarYes;
|
||||
|
||||
private GameObject _curBubble;
|
||||
|
||||
private List<Node> _nodes;
|
||||
|
||||
private void Awake()
|
||||
|
@ -70,6 +140,11 @@ public class BuildBoot : MonoBehaviour
|
|||
InitBuildData();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
UnregisterClickEvent();
|
||||
|
@ -87,8 +162,6 @@ public class BuildBoot : MonoBehaviour
|
|||
_nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -103,7 +176,8 @@ public class BuildBoot : MonoBehaviour
|
|||
|
||||
private void InitBuildBar()
|
||||
{
|
||||
_buildBar = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar").gameObject;
|
||||
var bar = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar").gameObject;
|
||||
_buildBar = new BuildBar(bar);
|
||||
_btnBarClose = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar/Btn_Close")
|
||||
.GetComponent<Button>();
|
||||
_btnBarYes = transform.Find("UIRoot/UIMainBuild/UI_LiuHaiBottom/Build_Bar/Btn_Yes").GetComponent<Button>();
|
||||
|
@ -112,6 +186,29 @@ public class BuildBoot : MonoBehaviour
|
|||
_btnBarYes.onClick.AddListener(YesBar);
|
||||
}
|
||||
|
||||
private void UpdateUI()
|
||||
{
|
||||
foreach (var node in _nodes)
|
||||
{
|
||||
if (BuildManager.Instance.NodeInfos.TryGetValue(node.Name, out var nodeInfo))
|
||||
{
|
||||
if (CurCondition >= nodeInfo.Condition)
|
||||
{
|
||||
DebugUtil.LogError("节点:{0}解锁了", node.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var option in node.Options)
|
||||
{
|
||||
option.NormalObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
node.BubbleObj.SetActive(CurCondition < nodeInfo.Condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseUI()
|
||||
{
|
||||
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel));
|
||||
|
@ -119,16 +216,17 @@ public class BuildBoot : MonoBehaviour
|
|||
|
||||
private void CloseBar()
|
||||
{
|
||||
_buildBar.SetActive(false);
|
||||
_buildBar.Close();
|
||||
_curBubble.SetActive(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void YesBar()
|
||||
{
|
||||
DebugUtil.LogError("保存更改");
|
||||
_buildBar.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnBuilItemClick(GameObject obj)
|
||||
{
|
||||
|
@ -137,7 +235,17 @@ public class BuildBoot : MonoBehaviour
|
|||
|
||||
private void OnBuildBubbleClick(GameObject obj)
|
||||
{
|
||||
DebugUtil.LogError("Btn");
|
||||
_curBubble = obj;
|
||||
obj.SetActive(false);
|
||||
var node = obj.transform.parent;
|
||||
var sprites = BuildManager.Instance.GetNodeIcons(node.name);
|
||||
var condition = BuildManager.Instance.GetCondition(node.name);
|
||||
_buildBar.Open(sprites, BuildIconClick, CurCondition, condition);
|
||||
}
|
||||
|
||||
private void BuildIconClick()
|
||||
{
|
||||
DebugUtil.LogError("点击了图标");
|
||||
}
|
||||
|
||||
private void RegisterClickEvent()
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using cfg.Build;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Framework.Manager
|
||||
{
|
||||
|
@ -68,6 +71,8 @@ namespace Framework.Manager
|
|||
|
||||
//按挂点解锁条件
|
||||
public int Condition;
|
||||
|
||||
public string IconPath;
|
||||
}
|
||||
|
||||
public class OptionInfo
|
||||
|
@ -83,7 +88,6 @@ namespace Framework.Manager
|
|||
private const string NodeName = "Node{0}";
|
||||
private const string OptionName = "Option{0}";
|
||||
|
||||
|
||||
private static BuildManager _instance;
|
||||
|
||||
public static BuildManager Instance
|
||||
|
@ -103,8 +107,9 @@ namespace Framework.Manager
|
|||
public int CurCondition;
|
||||
public Dictionary<string, NodeInfo> NodeInfos;
|
||||
private bool _isInit;
|
||||
private bool _isInGame;
|
||||
|
||||
public void Init(BuildData buildData, int condition = 0)
|
||||
public void Init(BuildData buildData, bool inGame = true)
|
||||
{
|
||||
if (_isInit) return;
|
||||
NodeInfos = new Dictionary<string, NodeInfo>();
|
||||
|
@ -114,7 +119,8 @@ namespace Framework.Manager
|
|||
var nodeInfo = new NodeInfo
|
||||
{
|
||||
Name = node.name,
|
||||
Options = new Dictionary<string, OptionInfo>()
|
||||
Options = new Dictionary<string, OptionInfo>(),
|
||||
IconPath = node.IconPath
|
||||
};
|
||||
foreach (var option in node.options)
|
||||
{
|
||||
|
@ -169,8 +175,41 @@ namespace Framework.Manager
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DebugUtil.LogError("BuildManager Init");
|
||||
}
|
||||
|
||||
public List<Sprite> GetNodeIcons(string nodeName)
|
||||
{
|
||||
var spriteList = new List<Sprite>();
|
||||
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
|
||||
{
|
||||
var path = nodeInfo.IconPath;
|
||||
var fileEntries = Directory.GetFiles(path, "*.png");
|
||||
foreach (var filePath in fileEntries)
|
||||
{
|
||||
var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/');
|
||||
var sprite = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath);
|
||||
if (sprite != null)
|
||||
{
|
||||
spriteList.Add(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spriteList;
|
||||
}
|
||||
|
||||
public int GetCondition(string nodeName)
|
||||
{
|
||||
var condition = 0;
|
||||
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
|
||||
{
|
||||
condition = nodeInfo.Condition;
|
||||
}
|
||||
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue