Unify VecPtComp with Vec1, and VecPt with Vec2.

This commit is contained in:
2023-04-18 09:45:46 +08:00
parent a2c5850fcd
commit f54564c567
4 changed files with 48 additions and 333 deletions

View File

@@ -586,6 +586,16 @@ namespace Cryville.Crtr {
DirectoryInfo dir = info.chartFile.Directory; DirectoryInfo dir = info.chartFile.Directory;
Logger.Log("main", 0, "Load/WorkerThread", "Loading chart: {0}", info.chartFile); Logger.Log("main", 0, "Load/WorkerThread", "Loading chart: {0}", info.chartFile);
motionRegistry = new Dictionary<Identifier, MotionRegistry> {
{ new Identifier("pt") , new MotionRegistry(typeof(Vec2)) },
{ new Identifier("dir") , new MotionRegistry(typeof(Vec3)) },
{ new Identifier("normal") , new MotionRegistry(typeof(Vec3)) },
{ new Identifier("sv") , new MotionRegistry(new Vec1(0f), new Vec1(hitRect.height)) },
{ new Identifier("svm") , new MotionRegistry(new Vec1m(1f)) },
{ new Identifier("dist") , new MotionRegistry(new Vec1(0f), new Vec1(float.PositiveInfinity)) },
{ new Identifier("track") , new MotionRegistry(typeof(Vec1)) },
};
using (StreamReader reader = new StreamReader(info.chartFile.FullName, Encoding.UTF8)) { using (StreamReader reader = new StreamReader(info.chartFile.FullName, Encoding.UTF8)) {
chart = JsonConvert.DeserializeObject<Chart>(reader.ReadToEnd(), new JsonSerializerSettings() { chart = JsonConvert.DeserializeObject<Chart>(reader.ReadToEnd(), new JsonSerializerSettings() {
MissingMemberHandling = MissingMemberHandling.Error MissingMemberHandling = MissingMemberHandling.Error

View File

@@ -275,8 +275,8 @@ namespace Cryville.Crtr.Event {
static readonly int n_pt = IdentifierManager.SharedInstance.Request("pt"); static readonly int n_pt = IdentifierManager.SharedInstance.Request("pt");
public Vector2 ScreenPoint { public Vector2 ScreenPoint {
get { get {
var mv = GetRawValue<VecPt>(n_pt); var mv = GetRawValue<Vec2>(n_pt);
return mv.ToVector2(ChartPlayer.hitRect); return mv.ToVector2();
} }
} }
@@ -306,16 +306,14 @@ namespace Cryville.Crtr.Event {
static readonly int n_svm = IdentifierManager.SharedInstance.Request("svm"); static readonly int n_svm = IdentifierManager.SharedInstance.Request("svm");
public float ScrollVelocity { public float ScrollVelocity {
get { get {
return GetRawValue<VecPtComp>(n_sv).ToFloat(ChartPlayer.hitRect) return GetRawValue<Vec1>(n_sv).Value * GetRawValue<Vec1m>(n_svm).Value;
* GetRawValue<Vec1m>(n_svm).Value;
} }
} }
static readonly int n_dist = IdentifierManager.SharedInstance.Request("dist"); static readonly int n_dist = IdentifierManager.SharedInstance.Request("dist");
public float Distance { public float Distance {
get { get {
var mv = GetRawValue<VecPtComp>(n_dist); return GetRawValue<Vec1>(n_dist).Value;
return mv.ToFloat(ChartPlayer.hitRect);
} }
} }

View File

@@ -9,7 +9,6 @@ using FFmpeg.AutoGen;
using Ionic.Zip; using Ionic.Zip;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
using Logger = Cryville.Common.Logger; using Logger = Cryville.Common.Logger;
@@ -96,16 +95,6 @@ namespace Cryville.Crtr {
} }
} }
ChartPlayer.motionRegistry = new Dictionary<Identifier, MotionRegistry> {
{ new Identifier("pt") , new MotionRegistry(typeof(VecPt)) },
{ new Identifier("dir") , new MotionRegistry(typeof(Vec3)) },
{ new Identifier("normal") , new MotionRegistry(typeof(Vec3)) },
{ new Identifier("sv") , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, 1f)) },
{ new Identifier("svm") , new MotionRegistry(new Vec1m(1f)) },
{ new Identifier("dist") , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, float.PositiveInfinity)) },
{ new Identifier("track") , new MotionRegistry(typeof(Vec1)) },
};
var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts"); var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts");
if (!dir.Exists || Settings.Default.LastRunVersion != Application.version) { if (!dir.Exists || Settings.Default.LastRunVersion != Application.version) {
Directory.CreateDirectory(dir.FullName); Directory.CreateDirectory(dir.FullName);

File diff suppressed because it is too large Load Diff