Chapter 2 和一些优先度调整

This commit is contained in:
SoulliesOfficial
2025-04-26 21:11:30 -04:00
parent d4cb0353fe
commit 40f6d7ccdd
274 changed files with 18570 additions and 1485 deletions

View File

@@ -50,7 +50,18 @@ namespace Ichni.RhythmGame
List<EffectBase> effectList = new List<EffectBase>();
foreach (var effectBM in effect.Value)
{
effectList.Add(effectBM.ConvertToGameType(attachedGameElement));
if (BeatmapContainer_BM.LowPriorityDataTypes.Contains(effectBM.GetType()))
{
(EditorManager.instance.beatmapContainer).lowPriorityActions.Add(() =>
{
effectList.Add(effectBM.ConvertToGameType(attachedGameElement));
});
}
else
{
effectList.Add(effectBM.ConvertToGameType(attachedGameElement));
}
}
effectCollection.Add(effect.Key, effectList);
}
@@ -226,6 +237,11 @@ namespace Ichni.RhythmGame
}
else if (state == EffectState.Middle)
{
if (nowEffectState == EffectState.Before)
{
PreExecute();
}
nowEffectState = EffectState.Middle;
effectProgressPercent = (songTime - triggerTime) / effectTime;
Execute();

View File

@@ -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),
};
}
}
}

View File

@@ -52,6 +52,7 @@ namespace Ichni.RhythmGame
public override EffectBase_BM ConvertToBM()
{
connectedGameElement.SaveBM();
return new EnableControlEffect_BM(connectedGameElement.elementGuid,
connectedVariableName, enableValue, useExpression, expression);
}