Clip保存与读取
This commit is contained in:
@@ -70,6 +70,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class BaseElement_BM
|
||||
{
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
/// <summary>
|
||||
/// 从存档类中生成游戏物体
|
||||
/// </summary>
|
||||
|
||||
@@ -126,14 +126,12 @@ namespace Ichni.RhythmGame
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveColorSubmodule).colorSubmodule = new ColorSubmodule(attachedElement,
|
||||
originalBaseColor, emissionEnabled, originalEmissionColor, originalEmissionIntensity);
|
||||
attachedElement.submoduleList.Add((attachedElement as IHaveColorSubmodule).colorSubmodule);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as IHaveColorSubmodule).colorSubmodule = new ColorSubmodule(attached,
|
||||
originalBaseColor, emissionEnabled, originalEmissionColor, originalEmissionIntensity);
|
||||
attached.submoduleList.Add((attached as IHaveColorSubmodule).colorSubmodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,13 +143,11 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveEffectSubmodule).effectSubmodule = new EffectSubmodule(attachedElement, effectCollection);
|
||||
attachedElement.submoduleList.Add((attachedElement as IHaveEffectSubmodule).effectSubmodule);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as IHaveEffectSubmodule).effectSubmodule = new EffectSubmodule(attached, effectCollection);
|
||||
attached.submoduleList.Add((attached as IHaveEffectSubmodule).effectSubmodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Ichni.RhythmGame
|
||||
public SubmoduleBase(GameElement attachedGameElement)
|
||||
{
|
||||
this.attachedGameElement = attachedGameElement;
|
||||
this.attachedGameElement.submoduleList.Add(this);
|
||||
}
|
||||
|
||||
public abstract void SaveBM();
|
||||
@@ -46,9 +47,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class Submodule_BM : BaseElement_BM
|
||||
{
|
||||
[System.NonSerialized] public GameElement attachedElement; //存档类对应的游戏物体
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
[System.NonSerialized] protected GameElement attachedElement; //存档类对应的游戏物体
|
||||
|
||||
public Submodule_BM()
|
||||
{
|
||||
|
||||
|
||||
@@ -136,13 +136,11 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveTimeDurationSubmodule).timeDurationSubmodule = new TimeDurationSubmodule(attachedElement, isOverridingDuration, startTime, endTime);
|
||||
attachedElement.submoduleList.Add((attachedElement as IHaveTimeDurationSubmodule).timeDurationSubmodule);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
{
|
||||
(attached as IHaveTimeDurationSubmodule).timeDurationSubmodule = new TimeDurationSubmodule(attached, isOverridingDuration, startTime, endTime);
|
||||
attached.submoduleList.Add((attached as IHaveTimeDurationSubmodule).timeDurationSubmodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +228,11 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveTransformSubmodule).transformSubmodule = new TransformSubmodule(attachedElement, originalPosition, originalEulerAngles, originalScale);
|
||||
attachedElement.submoduleList.Add((attachedElement as IHaveTransformSubmodule).transformSubmodule);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as IHaveTransformSubmodule).transformSubmodule = new TransformSubmodule(attached, originalPosition, originalEulerAngles, originalScale);
|
||||
attached.submoduleList.Add((attached as IHaveTransformSubmodule).transformSubmodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Ichni.RhythmGame
|
||||
if (element is GameElement_BM gameElement)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log("Adding element to identifier: " + gameElement.elementName + " " + gameElement.elementGuid);
|
||||
//Debug.Log("Adding element to identifier: " + gameElement.elementName + " " + gameElement.elementGuid);
|
||||
#endif
|
||||
GameElement_BM.identifier.Add(gameElement.elementGuid, gameElement);
|
||||
}
|
||||
|
||||
@@ -163,9 +163,10 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取自身和所有子GameElement
|
||||
/// 获取所有子GameElement
|
||||
/// </summary>
|
||||
public List<GameElement> GetAllGameElementsFromThis()
|
||||
/// <param name="includeThis">是否包括自身</param>
|
||||
public List<GameElement> GetAllGameElementsFromThis(bool includeThis = true)
|
||||
{
|
||||
void GetAllChildrenRecursively(GameElement parent, List<GameElement> elements)
|
||||
{
|
||||
@@ -178,6 +179,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
List<GameElement> gameElements = new List<GameElement> { this };
|
||||
GetAllChildrenRecursively(this, gameElements);
|
||||
|
||||
if(!includeThis) gameElements.Remove(this);
|
||||
|
||||
return gameElements;
|
||||
}
|
||||
@@ -197,7 +200,6 @@ namespace Ichni.RhythmGame
|
||||
public string elementName;
|
||||
public List<string> tags;
|
||||
public Guid elementGuid;
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public GameElement_BM()
|
||||
{
|
||||
|
||||
@@ -40,13 +40,11 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as NoteBase).noteJudgeSubmodule = new NoteJudgeSubmodule(attachedElement as NoteBase);
|
||||
attachedElement.submoduleList.Add((attachedElement as NoteBase).noteJudgeSubmodule);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as NoteBase).noteJudgeSubmodule = new NoteJudgeSubmodule(attached as NoteBase);
|
||||
attached.submoduleList.Add((attached as NoteBase).noteJudgeSubmodule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Ichni.RhythmGame
|
||||
public TrackSubmodule(Track track) : base(track)
|
||||
{
|
||||
this.track = track;
|
||||
this.track.submoduleList.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user