基础内容-8

添加BM存档类
This commit is contained in:
SoulliesOfficial
2025-02-02 21:59:43 -05:00
parent efca87e9cd
commit bc1c5d65ef
20 changed files with 926 additions and 90 deletions

View File

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