【建造】相关修改

iOS_release
zhangaotian 2024-07-11 16:14:51 +08:00
parent c83ea7c88f
commit cfa3753fa0
6 changed files with 3235 additions and 148 deletions

View File

@ -0,0 +1,45 @@
{
"nodeCount": 5,
"thematicCount": 3,
"unlockType": 0,
"unlockConditionType": 0,
"unlockInfos": [
{
"condition": 20
},
{
"condition": 45
},
{
"condition": 75
},
{
"condition": 105
},
{
"condition": 140
}
],
"nodeInfos": [
{
"name": "Node1",
"IconPath": "Assets/Art/GameBuild/Texture/Series_Spring/Node1/Icon"
},
{
"name": "Node2",
"IconPath": "Assets/Art/GameBuild/Texture/Series_Spring/Node2/Icon"
},
{
"name": "Node3",
"IconPath": "Assets/Art/GameBuild/Texture/Series_Spring/Node3/Icon"
},
{
"name": "Node4",
"IconPath": "Assets/Art/GameBuild/Texture/Series_Spring/Node4/Icon"
},
{
"name": "Node5",
"IconPath": "Assets/Art/GameBuild/Texture/Series_Spring/Node5/Icon"
}
]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c28340ad39284e1eb01a0a729ed60ca
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -24,7 +24,9 @@ public class GameBuildWindow : OdinEditorWindow
[LabelText("选项实例")] public List<GameObject> optionObj;
[LabelText("选项资源路径")] [FolderPath] public string optionPath;
[LabelText("选项资源路径")] [FolderPath] public string optionPath = "Assets/Art/GameBuild/Texture";
[HideInInspector] public BuildData.BuildNode BuildNode;
public NodeEditor(string name, int count)
{
@ -46,16 +48,14 @@ public class GameBuildWindow : OdinEditorWindow
/// </summary>
private static GameBuildWindow _curWindow;
/// <summary>
/// 挂点Root
/// </summary>
private GameObject _buildRoot;
/// <summary>
/// 当前建造编辑器数据
/// </summary>
private BuildEditor _buildEditor;
private List<GameObject> _tempNodeObj = new List<GameObject>();
[LabelText("当前建造数据")] [VerticalGroup("BuildInfo")]
public BuildData curBuildData;
@ -68,7 +68,6 @@ public class GameBuildWindow : OdinEditorWindow
_curWindow.position = GUIHelper.GetEditorWindowRect().AlignCenter(800, 600);
_curWindow._buildEditor = buildEditor;
_curWindow.LoadBuildData(buildEditor.BuildData);
_curWindow._buildRoot = GameObject.Find(NodeRootPath);
}
private void LoadBuildData(BuildData buildData)
@ -90,9 +89,17 @@ public class GameBuildWindow : OdinEditorWindow
}
}
editorNode.BuildNode = node;
editorNode.optionPath = node.IconPath.Replace("Icon", "Normal");
editorNodes.Add(editorNode);
}
}
_tempNodeObj.Clear();
foreach (Transform child in root.transform)
{
_tempNodeObj.Add(child.gameObject);
}
}
[VerticalGroup("BuildInfo/Create")]
@ -149,12 +156,13 @@ public class GameBuildWindow : OdinEditorWindow
//清除
DeleteNode();
var root = GameObject.Find(NodeRootPath);
editorNodes = new List<NodeEditor>(curBuildData.nodeCount);
var nodeTemplate = AssetDatabase.LoadAssetAtPath<GameObject>(NodeTemplatePath);
foreach (var node in curBuildData.nodeInfos)
{
//生成节点
var nodeObj = Instantiate(nodeTemplate, _buildRoot.transform);
var nodeObj = Instantiate(nodeTemplate, root.transform);
nodeObj.name = node.name;
//生成选项
@ -165,8 +173,11 @@ public class GameBuildWindow : OdinEditorWindow
var optionObj = Instantiate(optionTemplate, nodeObj.transform);
optionObj.name = string.Format(OptionName, i + 1);
tempEditorNode.optionObj.Add(optionObj);
if (i != 0)
optionObj.SetActive(false);
}
tempEditorNode.BuildNode = node;
editorNodes.Add(tempEditorNode);
DestroyImmediate(optionTemplate);
@ -215,18 +226,20 @@ public class GameBuildWindow : OdinEditorWindow
rect.sizeDelta = spriteSize;
}
}
}
}
//初始化Icon资源路径
editorNode.BuildNode.IconPath = editorNode.optionPath.Replace("Normal", "Icon");
}
}
[VerticalGroup("Save")]
[Button("保存")]
public void Save()
{
_buildEditor.SaveData();
var activeScene = SceneManager.GetActiveScene();
// 保存当前活动的场景
//保存场景
var activeScene = SceneManager.GetActiveScene();
var saveResult = EditorSceneManager.SaveScene(activeScene);
if (!saveResult)
DebugUtil.LogError("保存失败!!!");
@ -234,11 +247,11 @@ public class GameBuildWindow : OdinEditorWindow
private void DeleteNode()
{
if (_buildRoot == null) _buildRoot = GameObject.Find(NodeRootPath);
foreach (Transform child in _buildRoot.transform)
foreach (var obj in _tempNodeObj)
{
DebugUtil.LogError(child.name);
DestroyImmediate(child.gameObject);
}
DestroyImmediate(obj);
}
_tempNodeObj.Clear();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -597,7 +597,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 07fd0ab2afc1942f6a44d3187ed1df7c, type: 3}
m_Name:
m_EditorClassIdentifier:
buildDataJson: {fileID: 4900000, guid: 621a47d72b4044cd0bf7e9f88d1ad30b, type: 3}
buildDataJson: {fileID: 0}
--- !u!4 &1943317167
Transform:
m_ObjectHideFlags: 0

View File

@ -50,6 +50,8 @@ namespace Framework.Manager
{
[LabelText("挂点名称")] [ReadOnly] public string name;
[HideInInspector] public string IconPath;
public BuildNode(string name)
{
this.name = name;