Implement custom ruleset config. (2)

This commit is contained in:
2023-08-02 17:28:55 +08:00
parent 3b22d4fce3
commit 9044631fe7
7 changed files with 96 additions and 27 deletions

View File

@@ -2,6 +2,7 @@ using Cryville.Common;
using Cryville.Common.Collections.Specialized;
using Cryville.Common.Math;
using Cryville.Common.Pdt;
using Cryville.Crtr.Config;
using Cryville.Crtr.Event;
using System;
using System.Collections.Generic;
@@ -48,6 +49,7 @@ namespace Cryville.Crtr {
_vec = ContextState.GetComputedValue(name);
_vecsrc.Invalidate();
_vecsrc.Get(out type, out value);
RevokePotentialConstant();
}
else if (ContextState != null && ContextState.Handler.PropSrcs.TryGetValue(name, out prop)) {
prop.Get(out type, out value);
@@ -56,6 +58,9 @@ namespace Cryville.Crtr {
else if (ContextSkinContainer != null && ContextSkinContainer.Variables.TryGetValue(name, out variable)) {
variable.Source.Get(out type, out value);
}
else if (ContextRulesetConfig != null && ContextRulesetConfig.TryGetMappedSource(name, out prop)) {
prop.Get(out type, out value);
}
else if (ContextJudge != null && ContextJudge.TryGetScoreSrc(name, out prop)) {
prop.Get(out type, out value);
RevokePotentialConstant();
@@ -124,6 +129,7 @@ namespace Cryville.Crtr {
public ContainerState ContextState { get; set; }
public SkinContainer ContextSkinContainer { get; set; }
public Transform ContextTransform { get; set; }
public RulesetConfigStore ContextRulesetConfig { get; set; }
public Judge ContextJudge { get; set; }
public PropSrc ContextSelfValue { get; set; }
@@ -166,6 +172,7 @@ namespace Cryville.Crtr {
ContextCascadeBlocks.Push(0);
ContextEvent = null;
ContextJudge = null;
ContextRulesetConfig = null;
ContextSelfValue = null;
ContextSkinContainer = null;
ContextState = null;
@@ -204,7 +211,6 @@ namespace Cryville.Crtr {
_ctxops.Add(IdentifierManager.Shared.Request("min"), new func_min(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("max"), new func_max(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("abs"), new func_abs(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("range"), new func_anim(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("anim"), new func_anim(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("cubic_bezier"), new func_cubic_bezier(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("ease"), new func_cubic_bezier_fixed(0.25f, 0.1f, 0.25f, 1f, () => ContextSelfValue));