基础内容-9
为次级模块增加存档类,仍在思考框架中
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -7,15 +9,58 @@ namespace Ichni.RhythmGame
|
||||
public abstract class SubmoduleBase
|
||||
{
|
||||
public BaseElement attachedElement;
|
||||
|
||||
|
||||
public Submodule_BM matchedBM;
|
||||
|
||||
public SubmoduleBase(BaseElement attachedElement)
|
||||
{
|
||||
this.attachedElement = attachedElement;
|
||||
}
|
||||
|
||||
|
||||
public virtual void InitialRefresh()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public abstract void SaveBM();
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class Submodule_BM
|
||||
{
|
||||
[System.NonSerialized] public BaseElement attachedElement; //存档类对应的游戏物体
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public Submodule_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Submodule_BM(BaseElement 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;
|
||||
}
|
||||
|
||||
public abstract void ExecuteBM();
|
||||
public abstract void DuplicateBM(BaseElement attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user