【建造】UI相关

iOS_release
zhangaotian 2024-07-11 20:03:13 +08:00
parent cfa3753fa0
commit 354498676f
37 changed files with 3317 additions and 1883 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 15e6a2ecea4844085968607afab9b772 guid: 3ad5c508de48f44b988ba0d467cdd525
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9ddaae1ff7a1b466885c542f1e256039 guid: 5cd3930513ca54f15974e6d0be3c54c7
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cead3e9c50ad7496683681c5b8a4f113 guid: ae1534bff8e634641b7c5cf37c364c63
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6af46bd77f05a4773b92f809a1ba9016 guid: c30b74a41123145ff9cf476744e25d6a
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0d7be711ddc994043b44b4fd9204f928 guid: 4328509b70e7941bd917ac2c5f68117a
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ade8b21c00db94eb5819e1f143920c0d guid: c4563a91f70314e358a67dc7feb9bf96
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: eeb5171242c314e4bafc4a723a15cfac guid: 829e8cdf770214e68b636b2212eccf7d
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d5cf5d428ae8f4b8685853be2000c02f guid: 24e9f1cf13925478197d672b80640be0
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0004e3e1ce9324c3298e9650080e763d guid: 678b6e6d13cf441ec8a768b2dc6f1e8b
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a1f6da81df3954bd19c844bbede7e4b2 guid: a1df2dd9c974e4b84a5ef2078bf66549
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a0660d833ba2841e0af0a72f32fcccdb guid: b82190a2710674b40ad97a1c4d96b05f
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: aa1e3671a1eff4497a023151154ea44e guid: 757fcfa28dc884490940874e30e7d9bd
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: faef3682758fc4227bb05f0e524b182b guid: db4afb5d599284544a9e9a5f65edea74
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bdf5441c65af3488bb3347f34e88bbb8 guid: 13bff0fa8528c4e6c95d0a00eb890a20
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8c60423fdfdea4176a415811c80f81b4 guid: 7646c131c2cf24e8fbad1af9cc05059f
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -104,6 +104,7 @@ public class GameBuildWindow : OdinEditorWindow
[VerticalGroup("BuildInfo/Create")] [VerticalGroup("BuildInfo/Create")]
[Button("创建/更新 节点实例")] [Button("创建/更新 节点实例")]
[InfoBox("会重新创建物体!!!")]
public void UpdateNode() public void UpdateNode()
{ {
editorNodeResource = false; editorNodeResource = false;
@ -164,6 +165,7 @@ public class GameBuildWindow : OdinEditorWindow
//生成节点 //生成节点
var nodeObj = Instantiate(nodeTemplate, root.transform); var nodeObj = Instantiate(nodeTemplate, root.transform);
nodeObj.name = node.name; nodeObj.name = node.name;
_tempNodeObj.Add(nodeObj);
//生成选项 //生成选项
var optionTemplate = nodeObj.transform.Find(OptionTemplatePath).gameObject; var optionTemplate = nodeObj.transform.Find(OptionTemplatePath).gameObject;

File diff suppressed because it is too large Load Diff

View File

@ -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();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b618b5bdf3884745b8cccd94ea6fcf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,10 +1,12 @@
#if UNITY_EDITOR
using UnityEditor; using UnityEditor;
#endif
using UnityEngine; using UnityEngine;
using PhxhSDK.Phxh; using PhxhSDK.Phxh;
using Framework.Manager; using Framework.Manager;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
namespace Framework.GameBuild namespace Framework.GameBuild
{ {
[ExecuteAlways] [ExecuteAlways]
@ -34,6 +36,12 @@ namespace Framework.GameBuild
private void Awake() private void Awake()
{ {
BuildData = JsonToLevelData(buildDataJson); BuildData = JsonToLevelData(buildDataJson);
BuildManager.Instance.Init(BuildData);
}
private void OnDestroy()
{
BuildManager.Instance.Release();
} }
private BuildData JsonToLevelData(TextAsset jsonText) private BuildData JsonToLevelData(TextAsset jsonText)
@ -73,9 +81,5 @@ namespace Framework.GameBuild
#endif #endif
} }
private void OnDestroy()
{
BuildManager.Instance.Release();
}
} }
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using Framework.Constants; using Framework.Constants;
using Gameplay.Game; using Gameplay.Game;
using Gameplay.Manager; using Gameplay.Manager;
@ -9,6 +10,9 @@ using UnityEngine.UI;
namespace Framework.GameBuild namespace Framework.GameBuild
{ {
/// <summary>
/// 建造物品栏UI类
/// </summary>
public class BuildBarUI : UIGameObjectWrapper public class BuildBarUI : UIGameObjectWrapper
{ {
/// <summary> /// <summary>
@ -32,23 +36,107 @@ namespace Framework.GameBuild
} }
} }
/// <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 public class UIMainBuild : MonoBehaviour
{ {
private Button _btnClose; private Button _btnClose;
private GameObject _buildBar; private GameObject _buildBar;
private Button _btnBarClose; private Button _btnBarClose;
private Button _btnBarYes; private Button _btnBarYes;
private List<NodeUI> _nodes;
private void Awake() private void Awake()
{ {
_btnClose = transform.Find("UI_LiuHaiTop/BG_Top/Btn_Close").GetComponent<Button>(); _btnClose = transform.Find("UI_LiuHaiTop/BG_Top/Btn_Close").GetComponent<Button>();
_btnClose.onClick.AddListener(CloseUI); _btnClose.onClick.AddListener(CloseUI);
InitBuild();
InitBuildBar(); 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() private void InitBuildBar()
{ {
@ -59,6 +147,7 @@ namespace Framework.GameBuild
_btnBarClose.onClick.AddListener(CloseBar); _btnBarClose.onClick.AddListener(CloseBar);
_btnBarYes.onClick.AddListener(YesBar); _btnBarYes.onClick.AddListener(YesBar);
} }
private void CloseUI() private void CloseUI()
{ {
GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel)); GameStateManager.Instance.ChangeState(new GameStateStart(UIConstants.UIMainPanel));

View File

@ -1,12 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
using cfg.Build; using cfg.Build;
using Gameplay.Manager;
using PhxhSDK;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine.Serialization;
namespace Framework.Manager namespace Framework.Manager
{ {
@ -44,6 +40,9 @@ namespace Framework.Manager
public class UnlockInfo public class UnlockInfo
{ {
[LabelText("条件")] public int condition; [LabelText("条件")] public int condition;
//主题 or 挂点
[LabelText("对应组")] public int conditionGroup;
} }
public class BuildNode public class BuildNode
@ -57,19 +56,6 @@ namespace Framework.Manager
this.name = name; 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; public DataBuildSeries CurSeries;
private bool _isInit; private bool _isInit;
public void Init(int nodeCount, int itemCount) public void Init(BuildData buildData)
{ {
if (_isInit) return; if (_isInit) return;
var buildSeriesTable = EditorTableManager.Instance.Tables.BuildSeriesConfig;
if (buildSeriesTable == null) return;
BuildGroups = new Dictionary<int, BuildGroup>(nodeCount); DebugUtil.LogError(buildData.nodeCount);
InitData();
InitUnlockCondition();
_isInit = true; _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() public void Release()
{ {