【建造】UI相关
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 6.4 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 15e6a2ecea4844085968607afab9b772
|
||||
guid: 3ad5c508de48f44b988ba0d467cdd525
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 7.8 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ddaae1ff7a1b466885c542f1e256039
|
||||
guid: 5cd3930513ca54f15974e6d0be3c54c7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 7.5 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cead3e9c50ad7496683681c5b8a4f113
|
||||
guid: ae1534bff8e634641b7c5cf37c364c63
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 28 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6af46bd77f05a4773b92f809a1ba9016
|
||||
guid: c30b74a41123145ff9cf476744e25d6a
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 21 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0d7be711ddc994043b44b4fd9204f928
|
||||
guid: 4328509b70e7941bd917ac2c5f68117a
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ade8b21c00db94eb5819e1f143920c0d
|
||||
guid: c4563a91f70314e358a67dc7feb9bf96
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.4 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eeb5171242c314e4bafc4a723a15cfac
|
||||
guid: 829e8cdf770214e68b636b2212eccf7d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 12 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5cf5d428ae8f4b8685853be2000c02f
|
||||
guid: 24e9f1cf13925478197d672b80640be0
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.5 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0004e3e1ce9324c3298e9650080e763d
|
||||
guid: 678b6e6d13cf441ec8a768b2dc6f1e8b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 10 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a1f6da81df3954bd19c844bbede7e4b2
|
||||
guid: a1df2dd9c974e4b84a5ef2078bf66549
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 8.6 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a0660d833ba2841e0af0a72f32fcccdb
|
||||
guid: b82190a2710674b40ad97a1c4d96b05f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aa1e3671a1eff4497a023151154ea44e
|
||||
guid: 757fcfa28dc884490940874e30e7d9bd
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 47 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: faef3682758fc4227bb05f0e524b182b
|
||||
guid: db4afb5d599284544a9e9a5f65edea74
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 106 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bdf5441c65af3488bb3347f34e88bbb8
|
||||
guid: 13bff0fa8528c4e6c95d0a00eb890a20
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 75 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8c60423fdfdea4176a415811c80f81b4
|
||||
guid: 7646c131c2cf24e8fbad1af9cc05059f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
|
@ -104,6 +104,7 @@ public class GameBuildWindow : OdinEditorWindow
|
|||
|
||||
[VerticalGroup("BuildInfo/Create")]
|
||||
[Button("创建/更新 节点实例")]
|
||||
[InfoBox("会重新创建物体!!!")]
|
||||
public void UpdateNode()
|
||||
{
|
||||
editorNodeResource = false;
|
||||
|
@ -164,6 +165,7 @@ public class GameBuildWindow : OdinEditorWindow
|
|||
//生成节点
|
||||
var nodeObj = Instantiate(nodeTemplate, root.transform);
|
||||
nodeObj.name = node.name;
|
||||
_tempNodeObj.Add(nodeObj);
|
||||
|
||||
//生成选项
|
||||
var optionTemplate = nodeObj.transform.Find(OptionTemplatePath).gameObject;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using Framework.Manager;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
public class BuildBoot : MonoBehaviour
|
||||
{
|
||||
[LabelText("当前条件")] public int curCondition;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// BuildManager.Instance.Init();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9b618b5bdf3884745b8cccd94ea6fcf1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,10 +1,12 @@
|
|||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
using UnityEngine;
|
||||
using PhxhSDK.Phxh;
|
||||
using Framework.Manager;
|
||||
using Sirenix.OdinInspector;
|
||||
|
||||
|
||||
namespace Framework.GameBuild
|
||||
{
|
||||
[ExecuteAlways]
|
||||
|
@ -34,8 +36,14 @@ namespace Framework.GameBuild
|
|||
private void Awake()
|
||||
{
|
||||
BuildData = JsonToLevelData(buildDataJson);
|
||||
BuildManager.Instance.Init(BuildData);
|
||||
}
|
||||
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
BuildManager.Instance.Release();
|
||||
}
|
||||
|
||||
private BuildData JsonToLevelData(TextAsset jsonText)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
|
@ -73,9 +81,5 @@ namespace Framework.GameBuild
|
|||
#endif
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
BuildManager.Instance.Release();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Constants;
|
||||
using Gameplay.Game;
|
||||
using Gameplay.Manager;
|
||||
|
@ -9,6 +10,9 @@ using UnityEngine.UI;
|
|||
|
||||
namespace Framework.GameBuild
|
||||
{
|
||||
/// <summary>
|
||||
/// 建造物品栏UI类
|
||||
/// </summary>
|
||||
public class BuildBarUI : UIGameObjectWrapper
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -31,34 +35,119 @@ namespace Framework.GameBuild
|
|||
_condition = GetComponent<TMP_Text>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选项UI类
|
||||
/// </summary>
|
||||
public class OptionUI : UIGameObjectWrapper
|
||||
{
|
||||
public GameObject NormalObj;
|
||||
public Button NormalBtn;
|
||||
|
||||
public OptionUI(GameObject root, bool isScaleShow = true) : base(root, isScaleShow)
|
||||
{
|
||||
NormalObj = root.transform.Find("Normal").gameObject;
|
||||
NormalBtn = root.GetComponent<Button>();
|
||||
}
|
||||
|
||||
public void BindButton(Action callBack)
|
||||
{
|
||||
NormalBtn.onClick.RemoveAllListeners();
|
||||
BindButton(NormalBtn, callBack);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 节点UI类
|
||||
/// </summary>
|
||||
public class NodeUI : UIGameObjectWrapper
|
||||
{
|
||||
public GameObject NodeObj;
|
||||
|
||||
public GameObject BubbleObj;
|
||||
|
||||
public Button BubbleBtn;
|
||||
|
||||
public List<OptionUI> OptionObj;
|
||||
|
||||
public NodeUI(GameObject root, bool isScaleShow = true) : base(root, isScaleShow)
|
||||
{
|
||||
NodeObj = root;
|
||||
OptionObj = new List<OptionUI>();
|
||||
foreach (Transform child in root.transform)
|
||||
{
|
||||
if (!child.gameObject.name.Equals("Btn"))
|
||||
{
|
||||
var option = new OptionUI(child.gameObject);
|
||||
OptionObj.Add(option);
|
||||
}
|
||||
else
|
||||
{
|
||||
BubbleObj = child.gameObject;
|
||||
BubbleBtn = BubbleObj.GetComponent<Button>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BindButton(Action callBack)
|
||||
{
|
||||
foreach (var option in OptionObj)
|
||||
{
|
||||
option.BindButton(callBack);
|
||||
}
|
||||
|
||||
BubbleBtn.onClick.RemoveAllListeners();
|
||||
BindButton(BubbleBtn, callBack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class UIMainBuild : MonoBehaviour
|
||||
{
|
||||
private Button _btnClose;
|
||||
|
||||
private GameObject _buildBar;
|
||||
private Button _btnBarClose;
|
||||
private Button _btnBarYes;
|
||||
|
||||
private List<NodeUI> _nodes;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_btnClose = transform.Find("UI_LiuHaiTop/BG_Top/Btn_Close").GetComponent<Button>();
|
||||
_btnClose.onClick.AddListener(CloseUI);
|
||||
|
||||
|
||||
InitBuild();
|
||||
InitBuildBar();
|
||||
}
|
||||
|
||||
private void InitBuild()
|
||||
{
|
||||
_nodes = new List<NodeUI>();
|
||||
var buildRoot = gameObject.transform.Find("Build/Root").gameObject;
|
||||
foreach (Transform child in buildRoot.transform)
|
||||
{
|
||||
var node = new NodeUI(child.gameObject);
|
||||
node.BindButton(OptionClick);
|
||||
_nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
private void OptionClick()
|
||||
{
|
||||
DebugUtil.LogError("点击了");
|
||||
}
|
||||
|
||||
private void InitBuildBar()
|
||||
{
|
||||
_buildBar = transform.Find("UI_LiuHaiBottom/Build_Bar").gameObject;
|
||||
_btnBarClose = transform.Find("UI_LiuHaiBottom/Build_Bar/Btn_Close").GetComponent<Button>();
|
||||
_btnBarYes = transform.Find("UI_LiuHaiBottom/Build_Bar/Btn_Yes").GetComponent<Button>();
|
||||
|
||||
|
||||
_btnBarClose.onClick.AddListener(CloseBar);
|
||||
_btnBarYes.onClick.AddListener(YesBar);
|
||||
}
|
||||
|
||||
private void CloseUI()
|
||||
{
|
||||
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel));
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using cfg.Build;
|
||||
using Gameplay.Manager;
|
||||
using PhxhSDK;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Framework.Manager
|
||||
{
|
||||
|
@ -39,13 +35,16 @@ namespace Framework.Manager
|
|||
[LabelText("解锁条件类型")] [SerializeField] public UnlockConditionType unlockConditionType;
|
||||
[LabelText("解锁条件")] public List<UnlockInfo> unlockInfos;
|
||||
[LabelText("挂点数据")] public List<BuildNode> nodeInfos;
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class UnlockInfo
|
||||
{
|
||||
[LabelText("条件")] public int condition;
|
||||
|
||||
//主题 or 挂点
|
||||
[LabelText("对应组")] public int conditionGroup;
|
||||
}
|
||||
|
||||
|
||||
public class BuildNode
|
||||
{
|
||||
[LabelText("挂点名称")] [ReadOnly] public string name;
|
||||
|
@ -57,19 +56,6 @@ namespace Framework.Manager
|
|||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public BuildData()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class BuildGroup
|
||||
{
|
||||
public int GroupID;
|
||||
|
||||
public int UnlockCondition;
|
||||
//public Dictionary<int, BuildItem> BuildItems = new();
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,87 +76,19 @@ namespace Framework.Manager
|
|||
}
|
||||
}
|
||||
|
||||
public Dictionary<int, BuildGroup> BuildGroups;
|
||||
public DataBuildSeries CurSeries;
|
||||
|
||||
private bool _isInit;
|
||||
|
||||
public void Init(int nodeCount, int itemCount)
|
||||
public void Init(BuildData buildData)
|
||||
{
|
||||
if (_isInit) return;
|
||||
var buildSeriesTable = EditorTableManager.Instance.Tables.BuildSeriesConfig;
|
||||
if (buildSeriesTable == null) return;
|
||||
|
||||
BuildGroups = new Dictionary<int, BuildGroup>(nodeCount);
|
||||
|
||||
InitData();
|
||||
|
||||
InitUnlockCondition();
|
||||
DebugUtil.LogError(buildData.nodeCount);
|
||||
|
||||
_isInit = true;
|
||||
|
||||
/*foreach (var group in BuildGroups)
|
||||
{
|
||||
DebugUtil.LogWarning("当前 {0} 物品组的解锁关卡是:{1}", group.Key, group.Value.UnlockCondition);
|
||||
foreach (var item in group.Value.BuildItems)
|
||||
{
|
||||
DebugUtil.LogError("当前 {0} 物品组的物体有:{1}", group.Key, item.Value._buildItem.ID);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
/*var buildItemTable = EditorTableManager.Instance.Tables.BuildItemConfig;
|
||||
if (buildItemTable?.DataList == null) return;
|
||||
foreach (var buildItem in buildItemTable.DataList)
|
||||
{
|
||||
//查找该系列的所有建造物品
|
||||
if (buildItem.SeriesID == CurSeries.ID)
|
||||
{
|
||||
//根据物品组ID查找并添加
|
||||
if (!BuildGroups.TryGetValue(buildItem.BuildGroupID, out var buildGroup))
|
||||
{
|
||||
var group = new BuildGroup();
|
||||
var item = new BuildItem(buildItem);
|
||||
item.Load();
|
||||
group.BuildItems.TryAdd(buildItem.ID, item);
|
||||
group.UnlockCondition = GetUnlockCondition(CurSeries, buildItem.BuildGroupID);
|
||||
BuildGroups.TryAdd(buildItem.BuildGroupID, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!buildGroup.BuildItems.TryGetValue(buildItem.ID, out var buildGroupItem))
|
||||
{
|
||||
var item = new BuildItem(buildItem);
|
||||
item.Load();
|
||||
buildGroup.BuildItems.TryAdd(buildItem.ID, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据物品组ID获取解锁条件关卡
|
||||
/// </summary>
|
||||
private int GetUnlockCondition(DataBuildSeries series, int groupID)
|
||||
{
|
||||
var index = groupID - 1;
|
||||
if (series.UnlockCondition.Length > index && index >= 0)
|
||||
{
|
||||
return series.UnlockCondition[index];
|
||||
}
|
||||
|
||||
return Constants.LevelConstants.DefaultUnlockCondition;
|
||||
}
|
||||
|
||||
public void InitUnlockCondition()
|
||||
{
|
||||
DebugUtil.LogError("是否为空?{0}", LevelSelectManager.Instance == null);
|
||||
/*DebugUtil.LogError("所有关卡:{0},当前关卡:{1}", LevelSelectManager.Instance.CurAllLevelDatas.Count,
|
||||
LevelSelectManager.Instance.CurPassLevelIndex);*/
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
|
|