基础内容-8
添加BM存档类
This commit is contained in:
@@ -6,20 +6,69 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class EnvironmentObject : SubstantialObject
|
||||
public partial class EnvironmentObject : SubstantialObject
|
||||
{
|
||||
public bool isStatic;
|
||||
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
string themeBundleName, string objectName, BaseElement parent,
|
||||
Vector3 position, Vector3 eulerAngles, Vector3 scale,
|
||||
Vector3 position, Vector3 eulerAngles, Vector3 scale,
|
||||
bool isStatic, bool isFirstGenerated = true)
|
||||
{
|
||||
EnvironmentObject themeBundleObject = ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
|
||||
EnvironmentObject environmentObject = Instantiate(themeBundleObject, parent.transform).GetComponent<EnvironmentObject>();
|
||||
EnvironmentObject themeBundleObject =
|
||||
ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
|
||||
EnvironmentObject environmentObject =
|
||||
Instantiate(themeBundleObject, parent.transform).GetComponent<EnvironmentObject>();
|
||||
environmentObject.Initialize(elementName, id, tags);
|
||||
environmentObject.isStatic = isStatic;
|
||||
return environmentObject;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EnvironmentObject
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.EnvironmentObject_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
themeBundleName, objectName, isStatic);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class EnvironmentObject_BM : BaseElement_BM
|
||||
{
|
||||
public string themeBundleName;
|
||||
public string objectName;
|
||||
public bool isStatic;
|
||||
|
||||
public EnvironmentObject_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EnvironmentObject_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, string themeBundleName, string objectName, bool isStatic)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.themeBundleName = themeBundleName;
|
||||
this.objectName = objectName;
|
||||
this.isStatic = isStatic;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = EnvironmentObject.GenerateElement(elementName, elementGuid, tags,
|
||||
themeBundleName, objectName, GetElement(attachedElementGuid),
|
||||
Vector3.zero, Vector3.zero, Vector3.one, isStatic, false);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return EnvironmentObject.GenerateElement(elementName, elementGuid, tags,
|
||||
themeBundleName, objectName, parent,
|
||||
Vector3.zero, Vector3.zero, Vector3.one, isStatic, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,25 +15,27 @@ namespace Ichni.RhythmGame
|
||||
public Transform rotationPoint;
|
||||
public Transform positionPoint;
|
||||
public Transform cameraTransform;
|
||||
|
||||
|
||||
public CameraViewType cameraViewType;
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
|
||||
|
||||
public static GameCamera GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement parentElement,
|
||||
CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
|
||||
Vector3 initialPosition, Vector3 initialEulerAngles)
|
||||
{
|
||||
GameCamera gameCamera = Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent<GameCamera>();
|
||||
|
||||
GameCamera gameCamera =
|
||||
Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent<GameCamera>();
|
||||
|
||||
gameCamera.Initialize(elementName, id, tags);
|
||||
gameCamera.parentElement = parentElement;
|
||||
gameCamera.cameraViewType = cameraViewType;
|
||||
gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic;
|
||||
gameCamera.perspectiveAngle = perspectiveAngle;
|
||||
gameCamera.orthographicSize = orthographicSize;
|
||||
gameCamera.transformSubmodule = new TransformSubmodule(gameCamera, initialPosition, initialEulerAngles, Vector3.one);
|
||||
gameCamera.transformSubmodule =
|
||||
new TransformSubmodule(gameCamera, initialPosition, initialEulerAngles, Vector3.one);
|
||||
gameCamera.cameraTransform = gameCamera.transform;
|
||||
|
||||
gameCamera.SetParent(parentElement);
|
||||
@@ -41,7 +43,7 @@ namespace Ichni.RhythmGame
|
||||
return gameCamera;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class GameCamera
|
||||
{
|
||||
public enum CameraViewType
|
||||
@@ -51,7 +53,7 @@ namespace Ichni.RhythmGame
|
||||
Orthographic = 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class GameCamera
|
||||
{
|
||||
public override void SetTransformObserver()
|
||||
@@ -69,11 +71,12 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
offset += eulerOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
|
||||
rotationPoint.eulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
}
|
||||
|
||||
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
@@ -81,6 +84,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
offset += posOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
|
||||
positionPoint.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
@@ -88,4 +92,56 @@ namespace Ichni.RhythmGame
|
||||
}).AddTo(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GameCamera
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.GameCamera_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
cameraViewType, perspectiveAngle, orthographicSize, transformSubmodule.currentPosition,
|
||||
transformSubmodule.currentEulerAngles);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class GameCamera_BM : BaseElement_BM
|
||||
{
|
||||
public GameCamera.CameraViewType cameraViewType;
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
public Vector3 initialPosition;
|
||||
public Vector3 initialEulerAngles;
|
||||
|
||||
public GameCamera_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GameCamera_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement,
|
||||
GameCamera.CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
|
||||
Vector3 initialPosition, Vector3 initialEulerAngles)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.cameraViewType = cameraViewType;
|
||||
this.perspectiveAngle = perspectiveAngle;
|
||||
this.orthographicSize = orthographicSize;
|
||||
this.initialPosition = initialPosition;
|
||||
this.initialEulerAngles = initialEulerAngles;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
GameCamera.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
cameraViewType, perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return GameCamera.GenerateElement(elementName, elementGuid, tags, parent, cameraViewType,
|
||||
perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class NoteVisualBase : SubstantialObject
|
||||
public abstract class NoteVisualBase : SubstantialObject
|
||||
{
|
||||
public NoteBase note;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class SubstantialObject : BaseElement
|
||||
public abstract class SubstantialObject : BaseElement
|
||||
{
|
||||
public string themeBundleName, objectName;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class CrossTrackPoint : BaseElement
|
||||
public partial class CrossTrackPoint : BaseElement
|
||||
{
|
||||
public ElementFolder trackListFolder;
|
||||
public Track nowAttachedTrack;
|
||||
@@ -56,4 +56,45 @@ namespace Ichni.RhythmGame
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CrossTrackPoint
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.CrossTrackPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackSwitch, trackPercent);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class CrossTrackPoint_BM : BaseElement_BM
|
||||
{
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
public CrossTrackPoint_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CrossTrackPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.trackSwitch = trackSwitch;
|
||||
this.trackPercent = trackPercent;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as ElementFolder,
|
||||
trackSwitch, trackPercent);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, parent as ElementFolder,
|
||||
trackSwitch, trackPercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,17 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TrackHeadPoint : BaseElement
|
||||
public partial class TrackHeadPoint : BaseElement
|
||||
{
|
||||
public Track track;
|
||||
public TrackTimeSubmoduleMovable trackTimeSubmoduleMovable;
|
||||
public SplinePositioner trackPositioner;
|
||||
|
||||
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
{
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackHeadPoint>();
|
||||
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform)
|
||||
.AddComponent<TrackHeadPoint>();
|
||||
|
||||
head.Initialize(elementName, id, tags);
|
||||
head.track = track;
|
||||
head.trackPositioner = head.gameObject.AddComponent<SplinePositioner>();
|
||||
@@ -34,4 +35,40 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TrackHeadPoint
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackHeadPoint_BM : BaseElement_BM
|
||||
{
|
||||
public TrackHeadPoint_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TrackHeadPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
TrackHeadPoint.GenerateElement(elementName, elementGuid, tags,
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, parent as Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Ichni.RhythmGame
|
||||
/// <summary>
|
||||
/// 在轨道上根据百分比进行运动的点
|
||||
/// </summary>
|
||||
public class TrackPercentPoint : BaseElement
|
||||
public partial class TrackPercentPoint : BaseElement
|
||||
{
|
||||
public Track track;
|
||||
public SplinePositioner trackPositioner;
|
||||
@@ -56,4 +56,41 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TrackPercentPoint
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackPercentPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackPercent.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackPercentPoint_BM : BaseElement_BM
|
||||
{
|
||||
public FlexibleFloat_BM trackPercent;
|
||||
public TrackPercentPoint_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TrackPercentPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM trackPercent)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.trackPercent = trackPercent;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as Track, trackPercent.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, parent as Track, trackPercent.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,13 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Trail : BaseElement
|
||||
public partial class Trail : BaseElement
|
||||
{
|
||||
public TrailRenderer trailRenderer;
|
||||
public Material renderMaterial;
|
||||
|
||||
public float visibleTimeLength;
|
||||
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags,
|
||||
BaseElement parentElement, float visibleTimeLength, Material material = null)
|
||||
{
|
||||
@@ -19,14 +19,57 @@ namespace Ichni.RhythmGame
|
||||
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
|
||||
|
||||
trail.Initialize(name, id, tags);
|
||||
trail.renderMaterial = material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
|
||||
trail.renderMaterial =
|
||||
material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
|
||||
trail.trailRenderer.material = trail.renderMaterial;
|
||||
trail.visibleTimeLength = visibleTimeLength;
|
||||
trail.SetParent(parentElement);
|
||||
|
||||
|
||||
trail.transformSubmodule = new TransformSubmodule(trail);
|
||||
|
||||
|
||||
return trail;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Trail
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM, visibleTimeLength,
|
||||
renderMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Trail_BM : BaseElement_BM
|
||||
{
|
||||
public float visibleTimeLength;
|
||||
public Material renderMaterial;
|
||||
|
||||
public Trail_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
|
||||
float visibleTimeLength, Material renderMaterial)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.visibleTimeLength = visibleTimeLength;
|
||||
this.renderMaterial = renderMaterial;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
visibleTimeLength, renderMaterial);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return Trail.GenerateElement(elementName, elementGuid, tags, parent, visibleTimeLength, renderMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user