Chapter 2 和一些优先度调整
This commit is contained in:
@@ -2,18 +2,35 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class BeatmapContainer : IBaseElement
|
||||
{
|
||||
public List<GameElement> gameElementList;
|
||||
|
||||
[NonSerialized]
|
||||
public List<UnityAction> lowPriorityActions;
|
||||
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public BeatmapContainer()
|
||||
{
|
||||
gameElementList = new List<GameElement>();
|
||||
lowPriorityActions = new List<UnityAction>();
|
||||
Observable.EveryUpdate().Subscribe(_ => ExecuteLowPriorityActions());
|
||||
}
|
||||
|
||||
public void ExecuteLowPriorityActions()
|
||||
{
|
||||
if (lowPriorityActions.Count > 0)
|
||||
{
|
||||
lowPriorityActions.ForEach(low => low.Invoke());
|
||||
lowPriorityActions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveBM()
|
||||
@@ -37,6 +54,7 @@ namespace Ichni.RhythmGame
|
||||
public partial class BeatmapContainer_BM : BaseElement_BM
|
||||
{
|
||||
public List<BaseElement_BM> elementList;
|
||||
|
||||
|
||||
public BeatmapContainer_BM()
|
||||
{
|
||||
@@ -46,7 +64,7 @@ namespace Ichni.RhythmGame
|
||||
public BeatmapContainer_BM(List<GameElement> gameElementList)
|
||||
{
|
||||
elementList = new List<BaseElement_BM>();
|
||||
|
||||
|
||||
gameElementList.ForEach(e =>
|
||||
{
|
||||
e.SaveBM();
|
||||
@@ -56,15 +74,22 @@ namespace Ichni.RhythmGame
|
||||
|
||||
foreach (var gameElement in gameElementList)
|
||||
{
|
||||
elementList.Add(gameElement.matchedBM);
|
||||
elementList.AddRange(gameElement.submoduleList.ConvertAll(submodule => submodule.matchedBM));
|
||||
if (gameElement.matchedBM != null)
|
||||
{
|
||||
elementList.Add(gameElement.matchedBM);
|
||||
}
|
||||
|
||||
List<BaseElement_BM> submodules = gameElement.submoduleList.ConvertAll(s => s.matchedBM);
|
||||
submodules.RemoveAll(s => s == null);
|
||||
elementList.AddRange(submodules);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
EditorManager.instance.beatmapContainer = new BeatmapContainer();
|
||||
|
||||
EditorManager.instance.beatmapContainer.matchedBM = this;
|
||||
|
||||
elementList.ForEach(element =>
|
||||
{
|
||||
//#if UNITY_EDITOR
|
||||
@@ -76,14 +101,13 @@ namespace Ichni.RhythmGame
|
||||
return;
|
||||
}
|
||||
Debug.Log(element.GetType());
|
||||
if (LowLoadPriorityTypes.Contains(element.GetType()))
|
||||
if (LowPriorityGameElementTypes.Contains(element.GetType()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//#endif
|
||||
if (element is GameElement_BM gameElement)
|
||||
{
|
||||
|
||||
GameElement_BM.identifier.Add(gameElement.elementGuid, gameElement);
|
||||
}
|
||||
|
||||
@@ -99,20 +123,27 @@ namespace Ichni.RhythmGame
|
||||
return;
|
||||
}
|
||||
|
||||
if (LowLoadPriorityTypes.Contains(element.GetType()))
|
||||
if (LowPriorityGameElementTypes.Contains(element.GetType()))
|
||||
{
|
||||
element.ExecuteBM();
|
||||
}
|
||||
});
|
||||
|
||||
EditorManager.instance.beatmapContainer.ExecuteLowPriorityActions();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BeatmapContainer_BM : BaseElement_BM
|
||||
{
|
||||
private static readonly List<Type> LowLoadPriorityTypes = new()
|
||||
public static readonly List<Type> LowPriorityGameElementTypes = new()
|
||||
{
|
||||
typeof(NoteJudgeSubmodule_BM),
|
||||
};
|
||||
|
||||
public static readonly List<Type> LowPriorityDataTypes = new()
|
||||
{
|
||||
typeof(EnableControlEffect_BM),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user