using System.Collections; using System.Collections.Generic; using Ichni.RhythmGame.Beatmap; using UnityEngine; namespace Ichni.RhythmGame { /// /// 包含效果的次级模块 /// public partial class EffectSubmodule : SubmoduleBase { #region [效果字典与集合] Efffects Dictionary & Lists public Dictionary> effectCollection; #endregion #region [构造函数与初始化] Constructors & Initialization public EffectSubmodule(GameElement attachedGameElement, EffectSubmodulePreset preset = EffectSubmodulePreset.Default) : base(attachedGameElement) { effectCollection = new Dictionary>(); if (preset == EffectSubmodulePreset.Default) //对于默认的效果次级模块,有Prior、Default、Late三个效果集合 { effectCollection.Add("Prior", new List()); effectCollection.Add("Default", new List()); effectCollection.Add("Late", new List()); } else if (preset == EffectSubmodulePreset.Note) //对于Note的效果次级模块,在Note的不同状态下有独立的效果集合 { effectCollection.Add("Generate", new List()); effectCollection.Add("GeneralJudge", new List()); effectCollection.Add("StartHold", new List()); //仅用于Hold effectCollection.Add("Holding", new List()); //仅用于Hold effectCollection.Add("Perfect", new List()); effectCollection.Add("Good", new List()); effectCollection.Add("Bad", new List()); effectCollection.Add("Miss", new List()); effectCollection.Add("AfterJudge", new List()); } if (!HaveSameSubmodule) { (attachedGameElement as IHaveEffectSubmodule).effectSubmodule = this; } } public EffectSubmodule(GameElement attachedGameElement, Dictionary> effectList_BM) : base(attachedGameElement) { effectCollection = new Dictionary>(); foreach (var effect in effectList_BM) { List effectList = new List(); 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 }