Compare commits
12 Commits
0.5.0-rc0
...
2d35e3177b
Author | SHA1 | Date | |
---|---|---|---|
2d35e3177b | |||
7b1f639412 | |||
fcc9935325 | |||
8b29cd2893 | |||
f44d9546e1 | |||
1d1d2646c4 | |||
6444de41a2 | |||
ea856f3339 | |||
74b1a5485b | |||
975b48e61e | |||
9e0bf024d7 | |||
d2ff168e25 |
Binary file not shown.
@@ -200,8 +200,7 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
|
|
||||||
void GenerateLine(int index, int line) {
|
void GenerateLine(int index, int line) {
|
||||||
for (int j = 0; j < LineItemCount; j++) {
|
for (int j = 0; j < LineItemCount; j++) {
|
||||||
var child = GameObject.Instantiate(m_itemTemplate);
|
var child = GameObject.Instantiate(m_itemTemplate, transform, false);
|
||||||
child.transform.SetParent(transform, false);
|
|
||||||
lines[index][j] = child;
|
lines[index][j] = child;
|
||||||
}
|
}
|
||||||
LoadLine(index, line);
|
LoadLine(index, line);
|
||||||
|
@@ -60,10 +60,10 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void OnPlay() {
|
public void OnPlay() {
|
||||||
Master.Open(_id);
|
Master.Open(_id, _data);
|
||||||
}
|
}
|
||||||
public void OnConfig() {
|
public void OnConfig() {
|
||||||
Master.OpenConfig(_id);
|
Master.OpenConfig(_id, _data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Logger = Cryville.Common.Logger;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Browsing {
|
namespace Cryville.Crtr.Browsing {
|
||||||
internal class LegacyResourceManager : IResourceManager<ChartDetail> {
|
internal class LegacyResourceManager : IResourceManager<ChartDetail> {
|
||||||
@@ -117,7 +118,10 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
foreach (var converter in converters[file.Extension]) {
|
foreach (var converter in converters[file.Extension]) {
|
||||||
var resources = converter.ConvertFrom(file);
|
var resources = converter.ConvertFrom(file);
|
||||||
foreach (var res in resources) {
|
foreach (var res in resources) {
|
||||||
if (res is ChartResource) {
|
if (!res.Valid) {
|
||||||
|
Logger.Log("main", 3, "Resource", "Attempt to import invalid resource {0}", res);
|
||||||
|
}
|
||||||
|
else if (res is ChartResource) {
|
||||||
var tres = (ChartResource)res;
|
var tres = (ChartResource)res;
|
||||||
var dir = new DirectoryInfo(_rootPath + "/charts/" + res.Name);
|
var dir = new DirectoryInfo(_rootPath + "/charts/" + res.Name);
|
||||||
if (!dir.Exists) dir.Create();
|
if (!dir.Exists) dir.Create();
|
||||||
@@ -134,6 +138,7 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
if (!dir.Exists) dir.Create();
|
if (!dir.Exists) dir.Create();
|
||||||
var dest = new FileInfo(_rootPath + "/charts/" + res.Name + "/cover" + tres.Source.Extension);
|
var dest = new FileInfo(_rootPath + "/charts/" + res.Name + "/cover" + tres.Source.Extension);
|
||||||
if (!dest.Exists) tres.Source.CopyTo(dest.FullName);
|
if (!dest.Exists) tres.Source.CopyTo(dest.FullName);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (res is SongResource) {
|
else if (res is SongResource) {
|
||||||
var tres = (SongResource)res;
|
var tres = (SongResource)res;
|
||||||
|
@@ -24,10 +24,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
const float SPEED = 8;
|
const float SPEED = 8;
|
||||||
float _ratio;
|
float _ratio;
|
||||||
#pragma warning disable IDE0051
|
#pragma warning disable IDE0051
|
||||||
void Start() {
|
|
||||||
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if (_value && _ratio != 1) {
|
if (_value && _ratio != 1) {
|
||||||
_ratio += SPEED * Time.deltaTime;
|
_ratio += SPEED * Time.deltaTime;
|
||||||
@@ -40,6 +36,10 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
UpdateGraphics();
|
UpdateGraphics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnRectTransformDimensionsChange() {
|
||||||
|
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
|
||||||
|
}
|
||||||
#pragma warning restore IDE0051
|
#pragma warning restore IDE0051
|
||||||
|
|
||||||
void UpdateGraphics() {
|
void UpdateGraphics() {
|
||||||
|
@@ -60,7 +60,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
ev.callback.AddListener(e => OnPointerClick((PointerEventData)e));
|
ev.callback.AddListener(e => OnPointerClick((PointerEventData)e));
|
||||||
m_ctn.triggers.Add(ev);
|
m_ctn.triggers.Add(ev);
|
||||||
|
|
||||||
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
|
|
||||||
if (MaxStep != 0) SetRatio(0.5f);
|
if (MaxStep != 0) SetRatio(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +69,10 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
SetValueFromPos(pp);
|
SetValueFromPos(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnRectTransformDimensionsChange() {
|
||||||
|
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
|
||||||
|
}
|
||||||
#pragma warning restore IDE0051
|
#pragma warning restore IDE0051
|
||||||
|
|
||||||
Vector2 pp;
|
Vector2 pp;
|
||||||
|
@@ -32,8 +32,7 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
public void Load(string name, IEnumerable<PropertyInfo> props, object target) {
|
public void Load(string name, IEnumerable<PropertyInfo> props, object target) {
|
||||||
Name = name.ToUpper();
|
Name = name.ToUpper();
|
||||||
foreach (var prop in props) {
|
foreach (var prop in props) {
|
||||||
var obj = GameObject.Instantiate<GameObject>(m_propertyPrefab);
|
var obj = GameObject.Instantiate<GameObject>(m_propertyPrefab, transform, false);
|
||||||
obj.transform.SetParent(transform, false);
|
|
||||||
obj.GetComponent<PropertyPanel>().Load(prop, target);
|
obj.GetComponent<PropertyPanel>().Load(prop, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
if (prop.PropertyType == typeof(bool)) vp = m_bool;
|
if (prop.PropertyType == typeof(bool)) vp = m_bool;
|
||||||
else if (prop.PropertyType == typeof(float) || prop.PropertyType == typeof(int)) vp = m_number;
|
else if (prop.PropertyType == typeof(float) || prop.PropertyType == typeof(int)) vp = m_number;
|
||||||
else return;
|
else return;
|
||||||
_value = GameObject.Instantiate(vp, _valueContainer).GetComponent<PropertyValuePanel>();
|
_value = GameObject.Instantiate(vp, _valueContainer, false).GetComponent<PropertyValuePanel>();
|
||||||
if (_value is PVPNumber) {
|
if (_value is PVPNumber) {
|
||||||
var t = (PVPNumber)_value;
|
var t = (PVPNumber)_value;
|
||||||
t.IntegerMode = prop.PropertyType == typeof(int);
|
t.IntegerMode = prop.PropertyType == typeof(int);
|
||||||
|
@@ -64,8 +64,8 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
_units[_slideDest + 1].SlideToRight();
|
_units[_slideDest + 1].SlideToRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Open(int id) {
|
public void Open(int id, ChartDetail detail) {
|
||||||
SetDataSettings(id);
|
SetDataSettings(id, detail);
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
SceneManager.LoadScene("Play", LoadSceneMode.Additive);
|
SceneManager.LoadScene("Play", LoadSceneMode.Additive);
|
||||||
#else
|
#else
|
||||||
@@ -74,8 +74,8 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
GameObject.Find("/Master").GetComponent<Master>().HideMenu();
|
GameObject.Find("/Master").GetComponent<Master>().HideMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenConfig(int id) {
|
public void OpenConfig(int id, ChartDetail detail) {
|
||||||
SetDataSettings(id);
|
SetDataSettings(id, detail);
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
SceneManager.LoadScene("Config", LoadSceneMode.Additive);
|
SceneManager.LoadScene("Config", LoadSceneMode.Additive);
|
||||||
#else
|
#else
|
||||||
@@ -84,9 +84,9 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
GameObject.Find("/Master").GetComponent<Master>().HideMenu();
|
GameObject.Find("/Master").GetComponent<Master>().HideMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDataSettings(int id) {
|
void SetDataSettings(int id, ChartDetail detail) {
|
||||||
Settings.Default.LoadRuleset = "key/.umgr";
|
Settings.Default.LoadRuleset = detail.Meta.ruleset + "/.umgr";
|
||||||
Settings.Default.LoadSkin = "key/0/.umgs";
|
Settings.Default.LoadSkin = detail.Meta.ruleset + "/Old KeyUI/.umgs";
|
||||||
Settings.Default.LoadChart = MainBrowser.ResourceManager.GetItemPath(id);
|
Settings.Default.LoadChart = MainBrowser.ResourceManager.GetItemPath(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,10 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
Name = StringUtils.EscapeFileName(name);
|
Name = StringUtils.EscapeFileName(name);
|
||||||
}
|
}
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
public abstract bool Valid { get; }
|
||||||
|
public override string ToString() {
|
||||||
|
return string.Format("{0} ({1})", Name, ReflectionHelper.GetSimpleName(GetType()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class ChartResource : Resource {
|
public class ChartResource : Resource {
|
||||||
public ChartResource(string name, Chart main, ChartMeta meta) : base(name) {
|
public ChartResource(string name, Chart main, ChartMeta meta) : base(name) {
|
||||||
@@ -19,17 +23,20 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
}
|
}
|
||||||
public Chart Main { get; private set; }
|
public Chart Main { get; private set; }
|
||||||
public ChartMeta Meta { get; private set; }
|
public ChartMeta Meta { get; private set; }
|
||||||
|
public override bool Valid { get { return true; } }
|
||||||
}
|
}
|
||||||
public class CoverResource : Resource {
|
public class CoverResource : Resource {
|
||||||
public CoverResource(string name, FileInfo src) : base(name) {
|
public CoverResource(string name, FileInfo src) : base(name) {
|
||||||
Source = src;
|
Source = src;
|
||||||
}
|
}
|
||||||
public FileInfo Source { get; private set; }
|
public FileInfo Source { get; private set; }
|
||||||
|
public override bool Valid { get { return Source.Exists; } }
|
||||||
}
|
}
|
||||||
public class SongResource : Resource {
|
public class SongResource : Resource {
|
||||||
public SongResource(string name, FileInfo src) : base(name) {
|
public SongResource(string name, FileInfo src) : base(name) {
|
||||||
Source = src;
|
Source = src;
|
||||||
}
|
}
|
||||||
public FileInfo Source { get; private set; }
|
public FileInfo Source { get; private set; }
|
||||||
|
public override bool Valid { get { return Source.Exists; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -107,8 +107,14 @@ namespace Cryville.Crtr {
|
|||||||
bool firstFrame;
|
bool firstFrame;
|
||||||
double atime0;
|
double atime0;
|
||||||
void Update() {
|
void Update() {
|
||||||
// if (Input.GetKeyDown(KeyCode.Return)) TogglePlay();
|
if (started) GameUpdate();
|
||||||
if (started) {
|
#if !NO_THREAD
|
||||||
|
else if (loadThread != null) LoadUpdate();
|
||||||
|
#endif
|
||||||
|
if (logEnabled) LogUpdate();
|
||||||
|
else Game.MainLogger.Enumerate((level, module, msg) => { });
|
||||||
|
}
|
||||||
|
void GameUpdate() {
|
||||||
try {
|
try {
|
||||||
if (Screen.width != screenSize.x || Screen.height != screenSize.y)
|
if (Screen.width != screenSize.x || Screen.height != screenSize.y)
|
||||||
throw new InvalidOperationException("Window resized while playing");
|
throw new InvalidOperationException("Window resized while playing");
|
||||||
@@ -144,8 +150,7 @@ namespace Cryville.Crtr {
|
|||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !NO_THREAD
|
void LoadUpdate() {
|
||||||
else if (loadThread != null) {
|
|
||||||
if (texLoader != null) {
|
if (texLoader != null) {
|
||||||
string url = texLoader.url;
|
string url = texLoader.url;
|
||||||
string name = StringUtils.TrimExt(url.Substring(url.LastIndexOfAny(new char[] {'/', '\\'}) + 1));
|
string name = StringUtils.TrimExt(url.Substring(url.LastIndexOfAny(new char[] {'/', '\\'}) + 1));
|
||||||
@@ -203,8 +208,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
string timetext = string.Empty;
|
||||||
if (logEnabled) {
|
void LogUpdate() {
|
||||||
string _logs = logs.text;
|
string _logs = logs.text;
|
||||||
Game.MainLogger.Enumerate((level, module, msg) => {
|
Game.MainLogger.Enumerate((level, module, msg) => {
|
||||||
string color;
|
string color;
|
||||||
@@ -239,18 +244,18 @@ namespace Cryville.Crtr {
|
|||||||
UnityEngine.Profiling.Profiler.GetTotalReservedMemory()
|
UnityEngine.Profiling.Profiler.GetTotalReservedMemory()
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
if (started) sttext += string.Format(
|
sttext += timetext;
|
||||||
|
if (judge != null) sttext += "\n== Scores ==\n" + judge.GetFullFormattedScoreString();
|
||||||
|
status.text = sttext;
|
||||||
|
}
|
||||||
|
void OnCameraPostRender(Camera cam) {
|
||||||
|
if (started) timetext = string.Format(
|
||||||
"\nSTime: {0:R}\nATime: {1:R}\nITime: {2:R}",
|
"\nSTime: {0:R}\nATime: {1:R}\nITime: {2:R}",
|
||||||
cbus.Time,
|
cbus.Time,
|
||||||
Game.AudioClient.Position - atime0,
|
Game.AudioClient.Position - atime0,
|
||||||
inputProxy.GetTimestampAverage()
|
inputProxy.GetTimestampAverage()
|
||||||
);
|
);
|
||||||
if (judge != null) sttext += "\n== Scores ==\n" + judge.GetFullFormattedScoreString();
|
else timetext = string.Empty;
|
||||||
status.text = sttext;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Game.MainLogger.Enumerate((level, module, msg) => { });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -309,6 +314,8 @@ namespace Cryville.Crtr {
|
|||||||
Game.NetworkTaskWorker.SuspendBackgroundTasks();
|
Game.NetworkTaskWorker.SuspendBackgroundTasks();
|
||||||
Game.AudioSession = Game.AudioSequencer.NewSession();
|
Game.AudioSession = Game.AudioSequencer.NewSession();
|
||||||
|
|
||||||
|
Camera.onPostRender += OnCameraPostRender;
|
||||||
|
|
||||||
var hitPlane = new Plane(Vector3.forward, Vector3.zero);
|
var hitPlane = new Plane(Vector3.forward, Vector3.zero);
|
||||||
var r0 = Camera.main.ViewportPointToRay(new Vector3(0, 0, 1));
|
var r0 = Camera.main.ViewportPointToRay(new Vector3(0, 0, 1));
|
||||||
float dist;
|
float dist;
|
||||||
@@ -430,6 +437,7 @@ namespace Cryville.Crtr {
|
|||||||
if (nbus != null) nbus.Dispose();
|
if (nbus != null) nbus.Dispose();
|
||||||
inputProxy.Deactivate();
|
inputProxy.Deactivate();
|
||||||
foreach (var t in texs) Texture.Destroy(t.Value);
|
foreach (var t in texs) Texture.Destroy(t.Value);
|
||||||
|
Camera.onPostRender -= OnCameraPostRender;
|
||||||
Logger.Log("main", 1, "Game", "Stopped");
|
Logger.Log("main", 1, "Game", "Stopped");
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@@ -3,6 +3,16 @@ using UnityEngine.SceneManagement;
|
|||||||
|
|
||||||
namespace Cryville.Crtr.Config {
|
namespace Cryville.Crtr.Config {
|
||||||
public class ConfigScene : MonoBehaviour {
|
public class ConfigScene : MonoBehaviour {
|
||||||
|
[SerializeField]
|
||||||
|
Transform m_content;
|
||||||
|
|
||||||
|
public void SwitchCategory(GameObject cat) {
|
||||||
|
foreach (Transform c in m_content) {
|
||||||
|
c.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
cat.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void ReturnToMenu() {
|
public void ReturnToMenu() {
|
||||||
GameObject.Find("Master").GetComponent<Master>().ShowMenu();
|
GameObject.Find("Master").GetComponent<Master>().ShowMenu();
|
||||||
#if UNITY_5_5_OR_NEWER
|
#if UNITY_5_5_OR_NEWER
|
||||||
|
@@ -66,8 +66,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
ruleset.LoadPdt(dir);
|
ruleset.LoadPdt(dir);
|
||||||
_proxy = new InputProxy(ruleset.Root, null);
|
_proxy = new InputProxy(ruleset.Root, null);
|
||||||
foreach (var i in ruleset.Root.inputs) {
|
foreach (var i in ruleset.Root.inputs) {
|
||||||
var e = GameObject.Instantiate(m_prefabInputConfigEntry).GetComponent<InputConfigEntry>();
|
var e = GameObject.Instantiate(m_prefabInputConfigEntry, m_entryList.transform).GetComponent<InputConfigEntry>();
|
||||||
e.transform.SetParent(m_entryList.transform);
|
|
||||||
_entries.Add(i.Key, e);
|
_entries.Add(i.Key, e);
|
||||||
e.SetKey(this, i.Key);
|
e.SetKey(this, i.Key);
|
||||||
}
|
}
|
||||||
@@ -92,8 +91,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
void AddSourceItem(InputSource? src) {
|
void AddSourceItem(InputSource? src) {
|
||||||
if (_recvsrcs.Contains(src)) return;
|
if (_recvsrcs.Contains(src)) return;
|
||||||
_recvsrcs.Add(src);
|
_recvsrcs.Add(src);
|
||||||
var obj = Instantiate(m_prefabListItem);
|
var obj = Instantiate(m_prefabListItem, m_deviceList);
|
||||||
obj.transform.SetParent(m_deviceList);
|
|
||||||
obj.transform.Find("Text").GetComponent<Text>().text = src == null ? "None" : src.Value.Handler.GetTypeName(src.Value.Type);
|
obj.transform.Find("Text").GetComponent<Text>().text = src == null ? "None" : src.Value.Handler.GetTypeName(src.Value.Type);
|
||||||
var btn = obj.GetComponent<Button>();
|
var btn = obj.GetComponent<Button>();
|
||||||
if (src != null) btn.interactable = !_proxy.IsUsed(src.Value);
|
if (src != null) btn.interactable = !_proxy.IsUsed(src.Value);
|
||||||
|
@@ -2,6 +2,7 @@ using Cryville.Crtr.Browsing;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -21,19 +22,25 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
src = JsonConvert.DeserializeObject<MalodyChart>(reader.ReadToEnd());
|
src = JsonConvert.DeserializeObject<MalodyChart>(reader.ReadToEnd());
|
||||||
}
|
}
|
||||||
if (src.meta.mode != 0) throw new NotImplementedException("The chart mode is not supported");
|
if (src.meta.mode != 0) throw new NotImplementedException("The chart mode is not supported");
|
||||||
|
if (src.meta.mode_ext.column != 4) throw new NotImplementedException("The key count is not supported");
|
||||||
|
|
||||||
|
var ruleset = "malody!" + MODES[src.meta.mode];
|
||||||
|
if (src.meta.mode == 0) {
|
||||||
|
ruleset += "." + src.meta.mode_ext.column.ToString(CultureInfo.InvariantCulture) + "k";
|
||||||
|
}
|
||||||
|
|
||||||
ChartMeta meta = new ChartMeta() {
|
ChartMeta meta = new ChartMeta() {
|
||||||
song = new ChartMeta.MetaInfo() {
|
song = new ChartMeta.MetaInfo() {
|
||||||
name = src.meta.song.titleorg != null ? src.meta.song.titleorg : src.meta.song.title,
|
name = src.meta.song.titleorg != null ? src.meta.song.titleorg : src.meta.song.title,
|
||||||
author = src.meta.song.artistorg != null ? src.meta.song.artistorg : src.meta.song.artist,
|
author = src.meta.song.artistorg != null ? src.meta.song.artistorg : src.meta.song.artist,
|
||||||
},
|
},
|
||||||
ruleset = "malody!" + MODES[src.meta.mode],
|
ruleset = ruleset,
|
||||||
};
|
};
|
||||||
|
|
||||||
Chart chart = new Chart {
|
Chart chart = new Chart {
|
||||||
format = 2,
|
format = 2,
|
||||||
time = new BeatTime(-4, 0, 1),
|
time = new BeatTime(-4, 0, 1),
|
||||||
ruleset = "malody!" + MODES[src.meta.mode],
|
ruleset = ruleset,
|
||||||
sigs = new List<Chart.Signature>(),
|
sigs = new List<Chart.Signature>(),
|
||||||
sounds = new List<Chart.Sound>(),
|
sounds = new List<Chart.Sound>(),
|
||||||
motions = new List<Chart.Motion>(),
|
motions = new List<Chart.Motion>(),
|
||||||
@@ -68,7 +75,7 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
float pbeat = 0f, ctime = 0f;
|
float pbeat = 0f, ctime = 0f;
|
||||||
int[] endbeat = new int[] { 0, 0, 1 };
|
int[] endbeat = new int[] { 0, 0, 1 };
|
||||||
foreach (var ev in events) {
|
foreach (var ev in events) {
|
||||||
float cbeat = bp(ev.beat);
|
float cbeat = ConvertBeat(ev.beat);
|
||||||
ctime += baseBpm == null ? 0 : (cbeat - pbeat) / baseBpm.Value * 60f;
|
ctime += baseBpm == null ? 0 : (cbeat - pbeat) / baseBpm.Value * 60f;
|
||||||
pbeat = cbeat;
|
pbeat = cbeat;
|
||||||
if (ev is MalodyChart.Time) {
|
if (ev is MalodyChart.Time) {
|
||||||
@@ -105,7 +112,7 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
else throw new NotImplementedException();
|
else throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (bp(tev.beat) > bp(endbeat)) endbeat = tev.beat;
|
if (ConvertBeat(tev.beat) > ConvertBeat(endbeat)) endbeat = tev.beat;
|
||||||
var rn = new Chart.Note() {
|
var rn = new Chart.Note() {
|
||||||
time = new BeatTime(tev.beat[0], tev.beat[1], tev.beat[2]),
|
time = new BeatTime(tev.beat[0], tev.beat[1], tev.beat[2]),
|
||||||
motions = new List<Chart.Motion> {
|
motions = new List<Chart.Motion> {
|
||||||
@@ -113,7 +120,7 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (tev.endbeat != null) {
|
if (tev.endbeat != null) {
|
||||||
if (bp(tev.endbeat) > bp(endbeat)) endbeat = tev.endbeat;
|
if (ConvertBeat(tev.endbeat) > ConvertBeat(endbeat)) endbeat = tev.endbeat;
|
||||||
rn.endtime = new BeatTime(tev.endbeat[0], tev.endbeat[1], tev.endbeat[2]);
|
rn.endtime = new BeatTime(tev.endbeat[0], tev.endbeat[1], tev.endbeat[2]);
|
||||||
longEvents.Add(ev, new StartEventState {
|
longEvents.Add(ev, new StartEventState {
|
||||||
Destination = rn,
|
Destination = rn,
|
||||||
@@ -152,7 +159,7 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
public ChartEvent Destination { get; set; }
|
public ChartEvent Destination { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
float bp(int[] beat) {
|
float ConvertBeat(int[] beat) {
|
||||||
return beat[0] + (float)beat[1] / beat[2];
|
return beat[0] + (float)beat[1] / beat[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,8 +43,10 @@ namespace Cryville.Crtr {
|
|||||||
if (_use[proxy.Target] > 0)
|
if (_use[proxy.Target] > 0)
|
||||||
throw new InvalidOperationException("Input already assigned");
|
throw new InvalidOperationException("Input already assigned");
|
||||||
if (proxy.Source != null) {
|
if (proxy.Source != null) {
|
||||||
|
if (_judge != null) {
|
||||||
proxy.Source.Value.Handler.OnInput -= OnInput; // Prevent duplicated hooks, no exception will be thrown
|
proxy.Source.Value.Handler.OnInput -= OnInput; // Prevent duplicated hooks, no exception will be thrown
|
||||||
proxy.Source.Value.Handler.OnInput += OnInput;
|
proxy.Source.Value.Handler.OnInput += OnInput;
|
||||||
|
}
|
||||||
_tproxies.Add(proxy.Target, proxy);
|
_tproxies.Add(proxy.Target, proxy);
|
||||||
_sproxies.Add(proxy.Source.Value, proxy);
|
_sproxies.Add(proxy.Source.Value, proxy);
|
||||||
IncrementUseRecursive(name);
|
IncrementUseRecursive(name);
|
||||||
@@ -53,7 +55,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
void Remove(InputProxyEntry proxy) {
|
void Remove(InputProxyEntry proxy) {
|
||||||
var name = proxy.Target;
|
var name = proxy.Target;
|
||||||
proxy.Source.Value.Handler.OnInput -= OnInput;
|
if (_judge != null) _tproxies[name].Source.Value.Handler.OnInput -= OnInput;
|
||||||
_sproxies.Remove(_tproxies[name].Source.Value);
|
_sproxies.Remove(_tproxies[name].Source.Value);
|
||||||
_tproxies.Remove(name);
|
_tproxies.Remove(name);
|
||||||
DecrementUseRecursive(name);
|
DecrementUseRecursive(name);
|
||||||
|
@@ -85,6 +85,19 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
return ~num;
|
return ~num;
|
||||||
}
|
}
|
||||||
|
int BinarySearchFirst(List<JudgeEvent> list, float time, int stack) {
|
||||||
|
if (list[0].Definition.stack == stack && list[0].StartClip == time) return 0;
|
||||||
|
int num = 0;
|
||||||
|
int num2 = list.Count - 1;
|
||||||
|
while (num <= num2) {
|
||||||
|
int num3 = num + (num2 - num >> 1);
|
||||||
|
int num4 = -list[num3].Definition.stack.CompareTo(stack);
|
||||||
|
if (num4 == 0) num4 = list[num3].StartClip.CompareTo(time);
|
||||||
|
if (num4 >= 0) num2 = num3 - 1;
|
||||||
|
else num = num3 + 1;
|
||||||
|
}
|
||||||
|
return num + 1;
|
||||||
|
}
|
||||||
public void Feed(Identifier target, float ft, float tt) {
|
public void Feed(Identifier target, float ft, float tt) {
|
||||||
Forward(target, tt);
|
Forward(target, tt);
|
||||||
var actlist = activeEvs[target];
|
var actlist = activeEvs[target];
|
||||||
@@ -103,11 +116,14 @@ 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);
|
||||||
index = BinarySearch(actlist, ev.StartClip, def.prop);
|
if (def.stack != def.prop && actlist.Count > 0) {
|
||||||
|
index = BinarySearchFirst(actlist, ev.StartClip, def.prop);
|
||||||
if (index < 0) index = ~index;
|
if (index < 0) index = ~index;
|
||||||
}
|
}
|
||||||
else index++;
|
else index++;
|
||||||
}
|
}
|
||||||
|
else index++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool Pass(Identifier[] ids) {
|
bool Pass(Identifier[] ids) {
|
||||||
@@ -150,10 +166,12 @@ namespace Cryville.Crtr {
|
|||||||
var key = scoreop.Key;
|
var key = scoreop.Key;
|
||||||
_etor.ContextSelfValue = scoreSrcs[key.name.Key];
|
_etor.ContextSelfValue = scoreSrcs[key.name.Key];
|
||||||
_etor.Evaluate(scoreOps[key.name.Key], scoreop.Value);
|
_etor.Evaluate(scoreOps[key.name.Key], scoreop.Value);
|
||||||
|
scoreSrcs[key.name.Key].Invalidate();
|
||||||
foreach (var s in _rs.scores) {
|
foreach (var s in _rs.scores) {
|
||||||
if (s.Value.value != null) {
|
if (s.Value.value != null) {
|
||||||
_etor.ContextSelfValue = scoreSrcs[s.Key.Key];
|
_etor.ContextSelfValue = scoreSrcs[s.Key.Key];
|
||||||
_etor.Evaluate(scoreOps[s.Key.Key], s.Value.value);
|
_etor.Evaluate(scoreOps[s.Key.Key], s.Value.value);
|
||||||
|
scoreSrcs[s.Key.Key].Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,11 +6,13 @@ namespace Cryville.Crtr {
|
|||||||
public class Menu : MonoBehaviour {
|
public class Menu : MonoBehaviour {
|
||||||
#pragma warning disable IDE0044
|
#pragma warning disable IDE0044
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ResourceBrowserMaster m_browserMaster;
|
ResourceBrowserMaster m_browserMaster;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Animator m_targetAnimator;
|
Animator m_targetAnimator;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ProgressBar m_progressBar;
|
ProgressBar m_progressBar;
|
||||||
|
[SerializeField]
|
||||||
|
SettingsPanel m_settingsPanel;
|
||||||
#pragma warning restore IDE0044
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
@@ -19,6 +21,7 @@ namespace Cryville.Crtr {
|
|||||||
void Awake() {
|
void Awake() {
|
||||||
Game.Init();
|
Game.Init();
|
||||||
transform.parent.Find("Canvas/Contents").gameObject.SetActive(true);
|
transform.parent.Find("Canvas/Contents").gameObject.SetActive(true);
|
||||||
|
m_settingsPanel.Target = Settings.Default;
|
||||||
}
|
}
|
||||||
void Update() {
|
void Update() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
|
@@ -146,6 +146,8 @@ namespace Cryville.Crtr {
|
|||||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("attack_timing"), new func_attack_timing(cccb));
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("attack_timing"), new func_attack_timing(cccb));
|
||||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("enter_timing"), new func_enter_timing(cccb));
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("enter_timing"), new func_enter_timing(cccb));
|
||||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("release_timing"), new func_release_timing(cccb));
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("release_timing"), new func_release_timing(cccb));
|
||||||
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("leave_timing"), new func_leave_timing(cccb));
|
||||||
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("contact_timing"), new func_contact_timing(cccb));
|
||||||
}
|
}
|
||||||
static PdtEvaluator() {
|
static PdtEvaluator() {
|
||||||
_shortops.Add(new PdtOperatorSignature("@", 2), new op_at_2());
|
_shortops.Add(new PdtOperatorSignature("@", 2), new op_at_2());
|
||||||
@@ -507,6 +509,22 @@ namespace Cryville.Crtr {
|
|||||||
return ft > t0 && ft <= t1;
|
return ft > t0 && ft <= t1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class func_leave_timing : JudgeFunction {
|
||||||
|
public func_leave_timing(Func<int, PropSrc> ctxcb) : base(1, ctxcb) { }
|
||||||
|
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
||||||
|
if (fv == null || tv == null) return false;
|
||||||
|
var t1 = GetOperand(0).AsNumber() + tn;
|
||||||
|
return ft < t1 && tt >= t1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class func_contact_timing : JudgeFunction {
|
||||||
|
public func_contact_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
||||||
|
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
||||||
|
var t0 = GetOperand(0).AsNumber() + fn;
|
||||||
|
var t1 = GetOperand(1).AsNumber() + tn;
|
||||||
|
return (fv == null || ft < t1) && (tv == null || tt >= t0);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
unsafe static class oputil {
|
unsafe static class oputil {
|
||||||
public static float AsNumber(PropSrc src) {
|
public static float AsNumber(PropSrc src) {
|
||||||
|
@@ -6,6 +6,7 @@ namespace Cryville.Crtr {
|
|||||||
public abstract class PropSrc {
|
public abstract class PropSrc {
|
||||||
int _type;
|
int _type;
|
||||||
byte[] _buf = null;
|
byte[] _buf = null;
|
||||||
|
public void Invalidate() { _buf = null; }
|
||||||
public void Get(out int type, out byte[] value) {
|
public void Get(out int type, out byte[] value) {
|
||||||
if (_buf == null) InternalGet(out _type, out _buf);
|
if (_buf == null) InternalGet(out _type, out _buf);
|
||||||
type = _type;
|
type = _type;
|
||||||
|
@@ -7,30 +7,41 @@ using UnityEngine;
|
|||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class SettingsPanel : MonoBehaviour {
|
public class SettingsPanel : MonoBehaviour {
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject m_categoryPrefab;
|
GameObject m_categoryPrefab;
|
||||||
|
|
||||||
private Transform _container;
|
[SerializeField]
|
||||||
|
Transform m_container;
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
bool _invalidated = true;
|
||||||
void Awake() {
|
object m_target;
|
||||||
_container = transform.Find("Content/__content__");
|
public object Target {
|
||||||
|
get {
|
||||||
|
return m_target;
|
||||||
}
|
}
|
||||||
public void Start() {
|
set {
|
||||||
|
if (m_target != value) {
|
||||||
|
m_target = value;
|
||||||
|
_invalidated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() {
|
||||||
|
if (!_invalidated) return;
|
||||||
LoadProperties();
|
LoadProperties();
|
||||||
foreach (Transform c in _container) GameObject.Destroy(c.gameObject);
|
foreach (Transform c in m_container) GameObject.Destroy(c.gameObject);
|
||||||
foreach (var c in _categories) {
|
foreach (var c in _categories) {
|
||||||
var obj = GameObject.Instantiate<GameObject>(m_categoryPrefab);
|
var obj = GameObject.Instantiate<GameObject>(m_categoryPrefab, m_container, false);
|
||||||
obj.transform.SetParent(_container, false);
|
obj.GetComponent<PropertyCategoryPanel>().Load(c.Key, c.Value, Target);
|
||||||
obj.GetComponent<PropertyCategoryPanel>().Load(c.Key, c.Value, Settings.Default);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
|
||||||
|
|
||||||
Dictionary<string, List<PropertyInfo>> _categories = null;
|
Dictionary<string, List<PropertyInfo>> _categories = new Dictionary<string, List<PropertyInfo>>();
|
||||||
public void LoadProperties() {
|
public void LoadProperties() {
|
||||||
if (_categories != null) return;
|
_categories.Clear();
|
||||||
_categories = new Dictionary<string, List<PropertyInfo>>();
|
_invalidated = false;
|
||||||
foreach (var p in typeof(Settings).GetProperties()) {
|
if (Target == null) return;
|
||||||
|
foreach (var p in Target.GetType().GetProperties()) {
|
||||||
bool browsable = true;
|
bool browsable = true;
|
||||||
string category = "miscellaneous";
|
string category = "miscellaneous";
|
||||||
foreach (var attr in p.GetCustomAttributes(true)) {
|
foreach (var attr in p.GetCustomAttributes(true)) {
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user