4 Commits

Author SHA1 Message Date
c95ae92ba8 Fix input proxy not deactivated on stop. 2022-11-16 00:28:10 +08:00
31e9f1352b Redefine stack and propagation of judge. 2022-11-16 00:27:38 +08:00
9974b25377 Adjust config scene layout. 2022-11-16 00:25:25 +08:00
852c93c6d0 Add generic ruleset config. 2022-11-16 00:25:08 +08:00
7 changed files with 27 additions and 14 deletions

Binary file not shown.

View File

@@ -400,6 +400,7 @@ namespace Cryville.Crtr {
try { try {
Logger.Log("main", 1, "Game", "Stopping"); Logger.Log("main", 1, "Game", "Stopping");
Game.AudioSession = Game.AudioSequencer.NewSession(); Game.AudioSession = Game.AudioSequencer.NewSession();
inputProxy.Deactivate();
if (cbus != null) { cbus.Dispose(); cbus = null; } if (cbus != null) { cbus.Dispose(); cbus = null; }
if (bbus != null) { bbus.Dispose(); bbus = null; } if (bbus != null) { bbus.Dispose(); bbus = null; }
if (tbus != null) { tbus.Dispose(); tbus = null; } if (tbus != null) { tbus.Dispose(); tbus = null; }

View File

@@ -1,7 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
@@ -10,6 +10,9 @@ namespace Cryville.Crtr.Config {
[SerializeField] [SerializeField]
Transform m_content; Transform m_content;
[SerializeField]
SettingsPanel m_genericConfigPanel;
[SerializeField] [SerializeField]
InputConfigPanel m_inputConfigPanel; InputConfigPanel m_inputConfigPanel;
@@ -43,6 +46,9 @@ namespace Cryville.Crtr.Config {
}); });
} }
} }
m_genericConfigPanel.Target = _rscfg.generic;
var proxy = new InputProxy(ruleset.Root, null); var proxy = new InputProxy(ruleset.Root, null);
proxy.LoadFrom(_rscfg.inputs); proxy.LoadFrom(_rscfg.inputs);
m_inputConfigPanel.proxy = proxy; m_inputConfigPanel.proxy = proxy;

View File

@@ -1,12 +1,18 @@
using System.Collections.Generic; using Newtonsoft.Json;
using System.Collections.Generic;
namespace Cryville.Crtr.Config { namespace Cryville.Crtr.Config {
public class RulesetConfig { public class RulesetConfig {
public Dictionary<string, InputConfigEntry> inputs public Generic generic = new Generic();
= new Dictionary<string, InputConfigEntry>(); public class Generic {
[JsonProperty("skin")]
public string Skin { get; set; }
} }
public class InputConfigEntry { public Dictionary<string, InputEntry> inputs
= new Dictionary<string, InputEntry>();
public class InputEntry {
public string handler; public string handler;
public int type; public int type;
} }
}
} }

View File

@@ -37,7 +37,7 @@ namespace Cryville.Crtr {
readonly Dictionary<string, int> _use = new Dictionary<string, int>(); readonly Dictionary<string, int> _use = new Dictionary<string, int>();
readonly Dictionary<string, List<string>> _rev = new Dictionary<string, List<string>>(); readonly Dictionary<string, List<string>> _rev = new Dictionary<string, List<string>>();
public event EventHandler<ProxyChangedEventArgs> ProxyChanged; public event EventHandler<ProxyChangedEventArgs> ProxyChanged;
public void LoadFrom(Dictionary<string, InputConfigEntry> config) { public void LoadFrom(Dictionary<string, RulesetConfig.InputEntry> config) {
foreach (var cfg in config) { foreach (var cfg in config) {
Set(new InputProxyEntry { Set(new InputProxyEntry {
Target = cfg.Key, Target = cfg.Key,
@@ -48,10 +48,10 @@ namespace Cryville.Crtr {
}); });
} }
} }
public void SaveTo(Dictionary<string, InputConfigEntry> config) { public void SaveTo(Dictionary<string, RulesetConfig.InputEntry> config) {
config.Clear(); config.Clear();
foreach (var p in _tproxies) { foreach (var p in _tproxies) {
config.Add(p.Key, new InputConfigEntry { config.Add(p.Key, new RulesetConfig.InputEntry {
handler = ReflectionHelper.GetNamespaceQualifiedName(p.Value.Source.Value.Handler.GetType()), handler = ReflectionHelper.GetNamespaceQualifiedName(p.Value.Source.Value.Handler.GetType()),
type = p.Value.Source.Value.Type type = p.Value.Source.Value.Type
}); });

View File

@@ -116,8 +116,8 @@ namespace Cryville.Crtr {
if (def.scores != null) UpdateScore(def.scores); if (def.scores != null) UpdateScore(def.scores);
if (def.pass != null) Pass(def.pass); if (def.pass != null) Pass(def.pass);
actlist.RemoveAt(index); actlist.RemoveAt(index);
if (def.stack != def.prop && actlist.Count > 0) { if (def.prop != 0 && actlist.Count > 0) {
index = BinarySearchFirst(actlist, ev.StartClip, def.prop); index = BinarySearchFirst(actlist, ev.StartClip, def.stack - def.prop);
if (index < 0) index = ~index; if (index < 0) index = ~index;
} }
else index++; else index++;
@@ -216,7 +216,7 @@ namespace Cryville.Crtr {
public Identifier[] miss; public Identifier[] miss;
public Dictionary<ScoreOperation, PdtExpression> scores; public Dictionary<ScoreOperation, PdtExpression> scores;
public int stack; public int stack;
public int prop = -1; public int prop = 1;
} }
public class ScoreOperation { public class ScoreOperation {
public Identifier name; public Identifier name;