99 lines
3.8 KiB
C#
99 lines
3.8 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using Ichni.RhythmGame.Beatmap;
|
||
using UnityEngine;
|
||
|
||
namespace Ichni.RhythmGame
|
||
{
|
||
/// <summary>
|
||
/// 包含效果的次级模块
|
||
/// </summary>
|
||
public partial class EffectSubmodule : SubmoduleBase
|
||
{
|
||
#region [效果字典与集合] Efffects Dictionary & Lists
|
||
public Dictionary<string, List<EffectBase>> effectCollection;
|
||
#endregion
|
||
|
||
#region [构造函数与初始化] Constructors & Initialization
|
||
public EffectSubmodule(GameElement attachedGameElement, EffectSubmodulePreset preset = EffectSubmodulePreset.Default)
|
||
: base(attachedGameElement)
|
||
{
|
||
effectCollection = new Dictionary<string, List<EffectBase>>();
|
||
|
||
if (preset == EffectSubmodulePreset.Default) //对于默认的效果次级模块,有Prior、Default、Late三个效果集合
|
||
{
|
||
effectCollection.Add("Prior", new List<EffectBase>());
|
||
effectCollection.Add("Default", new List<EffectBase>());
|
||
effectCollection.Add("Late", new List<EffectBase>());
|
||
}
|
||
else if (preset == EffectSubmodulePreset.Note) //对于Note的效果次级模块,在Note的不同状态下有独立的效果集合
|
||
{
|
||
effectCollection.Add("Generate", new List<EffectBase>());
|
||
effectCollection.Add("GeneralJudge", new List<EffectBase>());
|
||
effectCollection.Add("StartHold", new List<EffectBase>()); //仅用于Hold
|
||
effectCollection.Add("Holding", new List<EffectBase>()); //仅用于Hold
|
||
effectCollection.Add("Perfect", new List<EffectBase>());
|
||
effectCollection.Add("Good", new List<EffectBase>());
|
||
effectCollection.Add("Bad", new List<EffectBase>());
|
||
effectCollection.Add("Miss", new List<EffectBase>());
|
||
effectCollection.Add("AfterJudge", new List<EffectBase>());
|
||
}
|
||
|
||
if (!HaveSameSubmodule)
|
||
{
|
||
(attachedGameElement as IHaveEffectSubmodule).effectSubmodule = this;
|
||
}
|
||
}
|
||
|
||
public EffectSubmodule(GameElement attachedGameElement, Dictionary<string, List<EffectBase_BM>> effectList_BM) : base(attachedGameElement)
|
||
{
|
||
effectCollection = new Dictionary<string, List<EffectBase>>();
|
||
|
||
foreach (var effect in effectList_BM)
|
||
{
|
||
List<EffectBase> effectList = new List<EffectBase>();
|
||
foreach (var effectBM in effect.Value)
|
||
{
|
||
if (BeatmapContainer_BM.LowPriorityDataTypes.Contains(effectBM.GetType())) // 如果是低优先级数据类型
|
||
{
|
||
(GameManager.Instance.beatmapContainer).lowPriorityActions.Add(() =>
|
||
{
|
||
effectList.Add(effectBM.ConvertToGameType(attachedGameElement));
|
||
});
|
||
}
|
||
else
|
||
{
|
||
effectList.Add(effectBM.ConvertToGameType(attachedGameElement));
|
||
}
|
||
}
|
||
|
||
effectCollection.Add(effect.Key, effectList);
|
||
}
|
||
|
||
if (!HaveSameSubmodule && attachedGameElement is IHaveEffectSubmodule host)
|
||
{
|
||
host.effectSubmodule = this;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
#region [枚举类型] Enums
|
||
public partial class EffectSubmodule
|
||
{
|
||
public enum EffectSubmodulePreset
|
||
{
|
||
Default,
|
||
Note,
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region [组件接口] Component Interface
|
||
public interface IHaveEffectSubmodule
|
||
{
|
||
public EffectSubmodule effectSubmodule { get; set; }
|
||
}
|
||
#endregion
|
||
|
||
} |