基础内容-8
添加BM存档类
This commit is contained in:
@@ -12,29 +12,31 @@ namespace Ichni.RhythmGame
|
||||
public partial class PathNode : BaseElement
|
||||
{
|
||||
public ColorSubmodule colorSubmodule;
|
||||
|
||||
|
||||
public Track track;
|
||||
|
||||
|
||||
public int index => track.trackPathSubmodule.pathNodeList.IndexOf(this);
|
||||
|
||||
|
||||
public SplinePoint node;
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
||||
{
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform).GetComponent<PathNode>();
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform)
|
||||
.GetComponent<PathNode>();
|
||||
|
||||
pathNode.Initialize(elementName, id, tags);
|
||||
pathNode.track = track;
|
||||
//pathNode.index = index;
|
||||
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition, Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize);
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition,
|
||||
Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize);
|
||||
pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode);
|
||||
pathNode.colorSubmodule = new ColorSubmodule(pathNode, nodeColor);
|
||||
|
||||
|
||||
track.trackPathSubmodule.pathNodeList.Add(pathNode);
|
||||
pathNode.SetParent(track);
|
||||
|
||||
|
||||
return pathNode;
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class PathNode
|
||||
{
|
||||
public override void Refresh()
|
||||
@@ -61,4 +63,53 @@ namespace Ichni.RhythmGame
|
||||
track.trackPathSubmodule.SetPathNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class PathNode
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM, index,
|
||||
node.position, node.normal, node.size, node.color);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class PathNode_BM : BaseElement_BM
|
||||
{
|
||||
public int index;
|
||||
public Vector3 position;
|
||||
public Vector3 normal;
|
||||
public float size;
|
||||
public Color color;
|
||||
|
||||
public PathNode_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
|
||||
int index, Vector3 position, Vector3 normal, float size, Color color)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.index = index;
|
||||
this.position = position;
|
||||
this.normal = normal;
|
||||
this.size = size;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags,
|
||||
GetElement(attachedElementGuid) as Track, position, normal, size, color);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track,
|
||||
position, normal, size, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user