【建造】相关修改
parent
c83ea7c88f
commit
cfa3753fa0
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1c28340ad39284e1eb01a0a729ed60ca
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -24,7 +24,9 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
|
|
||||||
[LabelText("选项实例")] public List<GameObject> optionObj;
|
[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)
|
public NodeEditor(string name, int count)
|
||||||
{
|
{
|
||||||
|
@ -46,16 +48,14 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static GameBuildWindow _curWindow;
|
private static GameBuildWindow _curWindow;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 挂点Root
|
|
||||||
/// </summary>
|
|
||||||
private GameObject _buildRoot;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前建造编辑器数据
|
/// 当前建造编辑器数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private BuildEditor _buildEditor;
|
private BuildEditor _buildEditor;
|
||||||
|
|
||||||
|
private List<GameObject> _tempNodeObj = new List<GameObject>();
|
||||||
|
|
||||||
[LabelText("当前建造数据")] [VerticalGroup("BuildInfo")]
|
[LabelText("当前建造数据")] [VerticalGroup("BuildInfo")]
|
||||||
public BuildData curBuildData;
|
public BuildData curBuildData;
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
_curWindow.position = GUIHelper.GetEditorWindowRect().AlignCenter(800, 600);
|
_curWindow.position = GUIHelper.GetEditorWindowRect().AlignCenter(800, 600);
|
||||||
_curWindow._buildEditor = buildEditor;
|
_curWindow._buildEditor = buildEditor;
|
||||||
_curWindow.LoadBuildData(buildEditor.BuildData);
|
_curWindow.LoadBuildData(buildEditor.BuildData);
|
||||||
_curWindow._buildRoot = GameObject.Find(NodeRootPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadBuildData(BuildData buildData)
|
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);
|
editorNodes.Add(editorNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_tempNodeObj.Clear();
|
||||||
|
foreach (Transform child in root.transform)
|
||||||
|
{
|
||||||
|
_tempNodeObj.Add(child.gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[VerticalGroup("BuildInfo/Create")]
|
[VerticalGroup("BuildInfo/Create")]
|
||||||
|
@ -149,12 +156,13 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
//清除
|
//清除
|
||||||
DeleteNode();
|
DeleteNode();
|
||||||
|
|
||||||
|
var root = GameObject.Find(NodeRootPath);
|
||||||
editorNodes = new List<NodeEditor>(curBuildData.nodeCount);
|
editorNodes = new List<NodeEditor>(curBuildData.nodeCount);
|
||||||
var nodeTemplate = AssetDatabase.LoadAssetAtPath<GameObject>(NodeTemplatePath);
|
var nodeTemplate = AssetDatabase.LoadAssetAtPath<GameObject>(NodeTemplatePath);
|
||||||
foreach (var node in curBuildData.nodeInfos)
|
foreach (var node in curBuildData.nodeInfos)
|
||||||
{
|
{
|
||||||
//生成节点
|
//生成节点
|
||||||
var nodeObj = Instantiate(nodeTemplate, _buildRoot.transform);
|
var nodeObj = Instantiate(nodeTemplate, root.transform);
|
||||||
nodeObj.name = node.name;
|
nodeObj.name = node.name;
|
||||||
|
|
||||||
//生成选项
|
//生成选项
|
||||||
|
@ -165,8 +173,11 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
var optionObj = Instantiate(optionTemplate, nodeObj.transform);
|
var optionObj = Instantiate(optionTemplate, nodeObj.transform);
|
||||||
optionObj.name = string.Format(OptionName, i + 1);
|
optionObj.name = string.Format(OptionName, i + 1);
|
||||||
tempEditorNode.optionObj.Add(optionObj);
|
tempEditorNode.optionObj.Add(optionObj);
|
||||||
|
if (i != 0)
|
||||||
|
optionObj.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempEditorNode.BuildNode = node;
|
||||||
editorNodes.Add(tempEditorNode);
|
editorNodes.Add(tempEditorNode);
|
||||||
DestroyImmediate(optionTemplate);
|
DestroyImmediate(optionTemplate);
|
||||||
|
|
||||||
|
@ -215,18 +226,20 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
rect.sizeDelta = spriteSize;
|
rect.sizeDelta = spriteSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//初始化Icon资源路径
|
||||||
|
editorNode.BuildNode.IconPath = editorNode.optionPath.Replace("Normal", "Icon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[VerticalGroup("Save")]
|
[VerticalGroup("Save")]
|
||||||
[Button("保存")]
|
[Button("保存")]
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
_buildEditor.SaveData();
|
_buildEditor.SaveData();
|
||||||
var activeScene = SceneManager.GetActiveScene();
|
|
||||||
|
|
||||||
// 保存当前活动的场景
|
//保存场景
|
||||||
|
var activeScene = SceneManager.GetActiveScene();
|
||||||
var saveResult = EditorSceneManager.SaveScene(activeScene);
|
var saveResult = EditorSceneManager.SaveScene(activeScene);
|
||||||
if (!saveResult)
|
if (!saveResult)
|
||||||
DebugUtil.LogError("保存失败!!!");
|
DebugUtil.LogError("保存失败!!!");
|
||||||
|
@ -234,11 +247,11 @@ public class GameBuildWindow : OdinEditorWindow
|
||||||
|
|
||||||
private void DeleteNode()
|
private void DeleteNode()
|
||||||
{
|
{
|
||||||
if (_buildRoot == null) _buildRoot = GameObject.Find(NodeRootPath);
|
foreach (var obj in _tempNodeObj)
|
||||||
foreach (Transform child in _buildRoot.transform)
|
|
||||||
{
|
{
|
||||||
DebugUtil.LogError(child.name);
|
DestroyImmediate(obj);
|
||||||
DestroyImmediate(child.gameObject);
|
}
|
||||||
}
|
|
||||||
|
_tempNodeObj.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -597,7 +597,7 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 07fd0ab2afc1942f6a44d3187ed1df7c, type: 3}
|
m_Script: {fileID: 11500000, guid: 07fd0ab2afc1942f6a44d3187ed1df7c, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
buildDataJson: {fileID: 4900000, guid: 621a47d72b4044cd0bf7e9f88d1ad30b, type: 3}
|
buildDataJson: {fileID: 0}
|
||||||
--- !u!4 &1943317167
|
--- !u!4 &1943317167
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace Framework.Manager
|
||||||
{
|
{
|
||||||
[LabelText("挂点名称")] [ReadOnly] public string name;
|
[LabelText("挂点名称")] [ReadOnly] public string name;
|
||||||
|
|
||||||
|
[HideInInspector] public string IconPath;
|
||||||
|
|
||||||
public BuildNode(string name)
|
public BuildNode(string name)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
Loading…
Reference in New Issue