架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -6,15 +6,15 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class SubmoduleBase
|
||||
public abstract class SubmoduleBase : IBaseElement
|
||||
{
|
||||
public BaseElement attachedElement;
|
||||
public GameElement attachedGameElement;
|
||||
|
||||
public Submodule_BM matchedBM;
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public SubmoduleBase(BaseElement attachedElement)
|
||||
public SubmoduleBase(GameElement attachedGameElement)
|
||||
{
|
||||
this.attachedElement = attachedElement;
|
||||
this.attachedGameElement = attachedGameElement;
|
||||
}
|
||||
|
||||
public virtual void InitialRefresh()
|
||||
@@ -23,13 +23,23 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public abstract void SaveBM();
|
||||
|
||||
public virtual void OnDelete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Delete()
|
||||
{
|
||||
attachedGameElement.submoduleList.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class Submodule_BM
|
||||
public abstract class Submodule_BM : BaseElement_BM
|
||||
{
|
||||
[System.NonSerialized] public BaseElement attachedElement; //存档类对应的游戏物体
|
||||
[System.NonSerialized] public GameElement attachedElement; //存档类对应的游戏物体
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public Submodule_BM()
|
||||
@@ -37,30 +47,22 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public Submodule_BM(BaseElement attachedElement)
|
||||
public Submodule_BM(GameElement attachedElement)
|
||||
{
|
||||
this.attachedElement = attachedElement;
|
||||
attachedElementGuid = attachedElement.elementGuid;
|
||||
}
|
||||
|
||||
public static BaseElement_BM GetElementBM(Guid id)
|
||||
{
|
||||
if (BaseElement_BM.identifier.TryGetValue(id, out BaseElement_BM element_BM))
|
||||
{
|
||||
return element_BM;
|
||||
}
|
||||
|
||||
Debug.LogAssertion("Element not found or do not have id");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BaseElement GetElement(Guid id)
|
||||
{
|
||||
return GetElementBM(id)?.matchedElement;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从存档类中生成游戏物体
|
||||
/// </summary>
|
||||
public abstract void ExecuteBM();
|
||||
public abstract void DuplicateBM(BaseElement attached);
|
||||
|
||||
/// <summary>
|
||||
/// 复制物体
|
||||
/// </summary>
|
||||
/// <param name="attached">(对于物体)父物体,(对于次级模块)或挂载物体</param>
|
||||
public abstract void DuplicateBM(GameElement attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user