Compare commits
11 Commits
0.7.1
...
97e759f57d
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
#pragma warning disable IDE0049
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class FontTable<T> {
|
||||
protected UInt32 Offset { get; private set; }
|
||||
@@ -25,14 +26,17 @@ namespace Cryville.Common.Font {
|
||||
readonly UInt16 minorVersion;
|
||||
readonly UInt32 numFonts;
|
||||
readonly List<UInt32> tableDirectoryOffsets = new List<UInt32>();
|
||||
#pragma warning disable IDE0052 // Reserved
|
||||
readonly String dsigTag;
|
||||
readonly UInt32 dsigLength;
|
||||
readonly UInt32 dsigOffset;
|
||||
#pragma warning restore IDE0052 // Reserved
|
||||
public TTCHeader(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
ttcTag = reader.ReadTag();
|
||||
if (ttcTag != "ttcf") throw new NotImplementedException();
|
||||
if (ttcTag != "ttcf") throw new NotSupportedException();
|
||||
majorVersion = reader.ReadUInt16();
|
||||
minorVersion = reader.ReadUInt16();
|
||||
if (minorVersion != 0) throw new NotSupportedException();
|
||||
numFonts = reader.ReadUInt32();
|
||||
for (UInt32 i = 0; i < numFonts; i++) tableDirectoryOffsets.Add(reader.ReadUInt32());
|
||||
if (majorVersion == 2) {
|
||||
@@ -52,12 +56,16 @@ namespace Cryville.Common.Font {
|
||||
public sealed class TableDirectory : FontTable<TableRecord, object> {
|
||||
readonly UInt32 sfntVersion;
|
||||
readonly UInt16 numTables;
|
||||
#pragma warning disable IDE0052 // Reserved
|
||||
readonly UInt16 searchRange;
|
||||
readonly UInt16 entrySelector;
|
||||
readonly UInt16 rangeShift;
|
||||
#pragma warning restore IDE0052 // Reserved
|
||||
readonly List<TableRecord> tableRecords = new List<TableRecord>();
|
||||
public TableDirectory(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
sfntVersion = reader.ReadUInt32();
|
||||
if (sfntVersion != 0x00010000 && sfntVersion != 0x4F54544F &&
|
||||
sfntVersion != 0x74727565 && sfntVersion != 0x74797031) throw new NotSupportedException();
|
||||
numTables = reader.ReadUInt16();
|
||||
searchRange = reader.ReadUInt16();
|
||||
entrySelector = reader.ReadUInt16();
|
||||
@@ -99,48 +107,63 @@ namespace Cryville.Common.Font {
|
||||
count = reader.ReadUInt16();
|
||||
storageOffset = reader.ReadUInt16();
|
||||
for (UInt16 i = 0; i < count; i++)
|
||||
nameRecord.Add(new NameRecord {
|
||||
platformID = reader.ReadUInt16(),
|
||||
encodingID = reader.ReadUInt16(),
|
||||
languageID = reader.ReadUInt16(),
|
||||
nameID = (NameID)reader.ReadUInt16(),
|
||||
length = reader.ReadUInt16(),
|
||||
stringOffset = reader.ReadUInt16(),
|
||||
});
|
||||
nameRecord.Add(new NameRecord(
|
||||
reader.ReadUInt16(),
|
||||
reader.ReadUInt16(),
|
||||
reader.ReadUInt16(),
|
||||
(NameID)reader.ReadUInt16(),
|
||||
reader.ReadUInt16(),
|
||||
reader.ReadUInt16()
|
||||
));
|
||||
if (version == 1) {
|
||||
langTagCount = reader.ReadUInt16();
|
||||
for (UInt16 i = 0; i < langTagCount; i++)
|
||||
langTagRecord.Add(new LangTagRecord {
|
||||
length = reader.ReadUInt16(),
|
||||
langTagOffset = reader.ReadUInt16(),
|
||||
});
|
||||
langTagRecord.Add(new LangTagRecord(
|
||||
reader.ReadUInt16(),
|
||||
reader.ReadUInt16()
|
||||
));
|
||||
}
|
||||
foreach (var i in nameRecord)
|
||||
i.Load(reader, offset + storageOffset);
|
||||
if (version == 1) {
|
||||
foreach (var i in langTagRecord)
|
||||
i.Load(reader, offset + storageOffset);
|
||||
}
|
||||
UInt32 origin = (UInt32)reader.BaseStream.Position;
|
||||
for (int i = 0; i < nameRecord.Count; i++) nameRecord[i] = nameRecord[i].Load(reader, origin);
|
||||
for (int i = 0; i < langTagRecord.Count; i++) langTagRecord[i] = langTagRecord[i].Load(reader, origin);
|
||||
}
|
||||
public sealed override IReadOnlyList<NameRecord> GetItems() {
|
||||
return nameRecord;
|
||||
}
|
||||
}
|
||||
public struct NameRecord {
|
||||
public UInt16 platformID;
|
||||
public UInt16 encodingID;
|
||||
public UInt16 languageID;
|
||||
public NameID nameID;
|
||||
public UInt16 length;
|
||||
public UInt16 stringOffset;
|
||||
public String value { get; private set; }
|
||||
public NameRecord Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + stringOffset;
|
||||
public class NameRecord {
|
||||
public UInt16 PlatformID { get; private set; }
|
||||
public UInt16 EncodingID { get; private set; }
|
||||
public UInt16 LanguageID { get; private set; }
|
||||
public NameID NameID { get; private set; }
|
||||
public UInt16 Length { get; private set; }
|
||||
public UInt16 StringOffset { get; private set; }
|
||||
public String Value { get; private set; }
|
||||
public NameRecord(UInt16 platformID, UInt16 encodingID, UInt16 languageID, NameID nameID, UInt16 length, UInt16 stringOffset) {
|
||||
PlatformID = platformID;
|
||||
EncodingID = encodingID;
|
||||
LanguageID = languageID;
|
||||
NameID = nameID;
|
||||
Length = length;
|
||||
StringOffset = stringOffset;
|
||||
}
|
||||
public void Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + StringOffset;
|
||||
Encoding encoding;
|
||||
switch (platformID) {
|
||||
case 0: encoding = Encoding.BigEndianUnicode; break;
|
||||
case 3: encoding = Encoding.BigEndianUnicode; break;
|
||||
default: return this;
|
||||
try {
|
||||
switch (PlatformID) {
|
||||
case 0: encoding = Encoding.BigEndianUnicode; break;
|
||||
case 1: encoding = Encoding.GetEncoding(10000 + EncodingID); break;
|
||||
case 3: encoding = Encoding.BigEndianUnicode; break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
value = encoding.GetString(reader.ReadBytes(length));
|
||||
return this;
|
||||
catch (NotSupportedException) { return; }
|
||||
catch (ArgumentException) { return; }
|
||||
Value = encoding.GetString(reader.ReadBytes(Length));
|
||||
}
|
||||
}
|
||||
public enum NameID : UInt16 {
|
||||
@@ -171,47 +194,58 @@ namespace Cryville.Common.Font {
|
||||
DarkBackgroundPalette = 24,
|
||||
VariationsPostScriptNamePrefix = 25,
|
||||
}
|
||||
public struct LangTagRecord {
|
||||
public UInt16 length;
|
||||
public UInt16 langTagOffset;
|
||||
public String value { get; private set; }
|
||||
public LangTagRecord Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + langTagOffset;
|
||||
value = Encoding.BigEndianUnicode.GetString(reader.ReadBytes(length));
|
||||
return this;
|
||||
public class LangTagRecord {
|
||||
public UInt16 Length { get; private set; }
|
||||
public UInt16 LangTagOffset { get; private set; }
|
||||
public String Value { get; private set; }
|
||||
public LangTagRecord(UInt16 length, UInt16 langTagOffset) {
|
||||
Length = length;
|
||||
LangTagOffset = langTagOffset;
|
||||
}
|
||||
public void Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + LangTagOffset;
|
||||
Value = Encoding.BigEndianUnicode.GetString(reader.ReadBytes(Length));
|
||||
}
|
||||
}
|
||||
public sealed class MetaTable : FontTable<DataMap> {
|
||||
readonly UInt32 version;
|
||||
#pragma warning disable IDE0052 // Reserved
|
||||
readonly UInt32 flags;
|
||||
#pragma warning restore IDE0052 // Reserved
|
||||
readonly UInt32 dataMapCount;
|
||||
readonly List<DataMap> dataMaps = new List<DataMap>();
|
||||
public MetaTable(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
version = reader.ReadUInt32();
|
||||
if (version != 1) throw new NotSupportedException();
|
||||
flags = reader.ReadUInt32();
|
||||
reader.ReadUInt32();
|
||||
dataMapCount = reader.ReadUInt32();
|
||||
for (UInt32 i = 0; i < dataMapCount; i++)
|
||||
dataMaps.Add(new DataMap {
|
||||
tag = reader.ReadTag(),
|
||||
dataOffset = reader.ReadUInt32(),
|
||||
dataLength = reader.ReadUInt32(),
|
||||
});
|
||||
for (int i = 0; i < dataMaps.Count; i++) dataMaps[i] = dataMaps[i].Load(reader, offset);
|
||||
dataMaps.Add(new DataMap (
|
||||
reader.ReadTag(),
|
||||
reader.ReadUInt32(),
|
||||
reader.ReadUInt32()
|
||||
));
|
||||
foreach (var i in dataMaps)
|
||||
i.Load(reader, offset);
|
||||
}
|
||||
public sealed override IReadOnlyList<DataMap> GetItems() {
|
||||
return dataMaps;
|
||||
}
|
||||
}
|
||||
public struct DataMap {
|
||||
public String tag;
|
||||
public UInt32 dataOffset;
|
||||
public UInt32 dataLength;
|
||||
public String value { get; private set; }
|
||||
public DataMap Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + dataOffset;
|
||||
value = Encoding.ASCII.GetString(reader.ReadBytes((int)dataLength));
|
||||
return this;
|
||||
public class DataMap {
|
||||
public String Tag { get; private set; }
|
||||
public UInt32 DataOffset { get; private set; }
|
||||
public UInt32 DataLength { get; private set; }
|
||||
public String Value { get; private set; }
|
||||
public DataMap(String tag, UInt32 dataOffset, UInt32 dataLength) {
|
||||
Tag = tag;
|
||||
DataOffset = dataOffset;
|
||||
DataLength = dataLength;
|
||||
}
|
||||
public void Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + DataOffset;
|
||||
Value = Encoding.ASCII.GetString(reader.ReadBytes((int)DataLength));
|
||||
}
|
||||
}
|
||||
public static class BinaryReaderExtensions {
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace Cryville.Common.Font {
|
||||
protected override void GetName(BinaryReader reader) {
|
||||
var dir = new TableDirectory(reader, (uint)reader.BaseStream.Position);
|
||||
var nameTable = (NameTable)dir.GetSubTable((from i in dir.GetItems() where i.tableTag == "name" select i).Single());
|
||||
FamilyName = (from i in nameTable.GetItems() where i.nameID == NameID.FontFamilyName && i.value != null select i.value).First();
|
||||
SubfamilyName = (from i in nameTable.GetItems() where i.nameID == NameID.FontSubfamilyName && i.value != null select i.value).First();
|
||||
FullName = (from i in nameTable.GetItems() where i.nameID == NameID.FullFontName && i.value != null select i.value).First();
|
||||
FamilyName = (from i in nameTable.GetItems() where i.NameID == NameID.FontFamilyName && i.Value != null select i.Value).First();
|
||||
SubfamilyName = (from i in nameTable.GetItems() where i.NameID == NameID.FontSubfamilyName && i.Value != null select i.Value).First();
|
||||
FullName = (from i in nameTable.GetItems() where i.NameID == NameID.FullFontName && i.Value != null select i.Value).First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
50
Assets/Cryville/Common/Unity/ScopedThreadAttacherInjector.cs
Normal file
50
Assets/Cryville/Common/Unity/ScopedThreadAttacherInjector.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Cryville.Common.Unity {
|
||||
[InitializeOnLoad]
|
||||
public class ScopedThreadAttacherInjector {
|
||||
static readonly Encoding _encoding = new UTF8Encoding(false, true);
|
||||
static string _filePath;
|
||||
static string _oldSrc;
|
||||
|
||||
static ScopedThreadAttacherInjector() {
|
||||
BuildPlayerWindow.RegisterBuildPlayerHandler(opt => HandlePlayerBuild(opt));
|
||||
}
|
||||
|
||||
static void HandlePlayerBuild(BuildPlayerOptions opt) {
|
||||
try {
|
||||
OnPreprocessBuild();
|
||||
BuildPlayerWindow.DefaultBuildMethods.BuildPlayer(opt);
|
||||
}
|
||||
finally {
|
||||
OnPostprocessBuild();
|
||||
}
|
||||
}
|
||||
|
||||
static void OnPreprocessBuild() {
|
||||
var il2cppRoot = Environment.GetEnvironmentVariable("UNITY_IL2CPP_PATH");
|
||||
if (string.IsNullOrEmpty(il2cppRoot)) {
|
||||
_filePath = string.Empty;
|
||||
return;
|
||||
}
|
||||
_filePath = Path.Combine(il2cppRoot, "libil2cpp", "vm", "ScopedThreadAttacher.cpp");
|
||||
if (!File.Exists(_filePath)) {
|
||||
_filePath = string.Empty;
|
||||
return;
|
||||
}
|
||||
_oldSrc = File.ReadAllText(_filePath, _encoding);
|
||||
File.WriteAllText(_filePath, Regex.Replace(_oldSrc, @"~\s*?ScopedThreadAttacher\s*?\(\s*?\)\s*?\{.*\}", "~ScopedThreadAttacher(){}", RegexOptions.Singleline), _encoding);
|
||||
}
|
||||
|
||||
static void OnPostprocessBuild() {
|
||||
if (string.IsNullOrEmpty(_filePath)) return;
|
||||
File.WriteAllText(_filePath, _oldSrc, _encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2322d8e9250e9e6469826361223dfdda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,5 @@
|
||||
using Cryville.Common.Collections.Specialized;
|
||||
using Cryville.Crtr.Skin;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfa7de3f6f944914d9999fcfda245f97
|
||||
timeCreated: 1637552994
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b38d66b3e6e5d94438c72f855c4efff9
|
||||
timeCreated: 1637554149
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Cryville/Crtr/Browsing/ChartDetail.cs
Normal file
10
Assets/Cryville/Crtr/Browsing/ChartDetail.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Extension;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
public struct ChartDetail {
|
||||
public AsyncDelivery<Texture2D> Cover { get; set; }
|
||||
public ChartMeta Meta { get; set; }
|
||||
}
|
||||
}
|
||||
11
Assets/Cryville/Crtr/Browsing/ChartDetail.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/ChartDetail.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f9870328bccefa4d8d4f6d5e3cef591
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 477e04b1ed5b60e48886fb76081245c5
|
||||
timeCreated: 1637722157
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,7 @@ using Cryville.Common.Unity;
|
||||
using Cryville.Crtr.Extension;
|
||||
using Cryville.Crtr.Extensions;
|
||||
using Cryville.Crtr.Extensions.Umg;
|
||||
using Cryville.Crtr.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d443a346e9a19d4eabbb0fa9ec7016f
|
||||
timeCreated: 1637566071
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6b4df13dea0e4a469d7e54e7e8fb428
|
||||
timeCreated: 1637234060
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 256d7d3efda1f9b4c882eb42e608cc8e
|
||||
timeCreated: 1638414803
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a69c80e5f3e7bd04485bc3afc5826584
|
||||
timeCreated: 1638415083
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,15 +2,6 @@ using Cryville.Common;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
internal abstract class BrowserItem : MonoBehaviour {
|
||||
public int? Id { get; private set; }
|
||||
protected ResourceItemMeta meta;
|
||||
internal virtual void Load(int id, ResourceItemMeta item) {
|
||||
Id = id;
|
||||
meta = item;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ResourceItemMeta {
|
||||
public bool IsDirectory { get; set; }
|
||||
public AsyncDelivery<Texture2D> Icon { get; set; }
|
||||
11
Assets/Cryville/Crtr/Browsing/ResourceItemMeta.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/ResourceItemMeta.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f535064222dd08c4f8e52d6e9144079a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Cryville/Crtr/Browsing/UI.meta
Normal file
8
Assets/Cryville/Crtr/Browsing/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba8a8b6df16a9714f9785aba6adc0427
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Cryville/Crtr/Browsing/UI/BrowserItem.cs
Normal file
12
Assets/Cryville/Crtr/Browsing/UI/BrowserItem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
internal abstract class BrowserItem : MonoBehaviour {
|
||||
public int? Id { get; private set; }
|
||||
protected ResourceItemMeta meta;
|
||||
internal virtual void Load(int id, ResourceItemMeta item) {
|
||||
Id = id;
|
||||
meta = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/BrowserItem.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/BrowserItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3cee963751f1ee4c9792c8c8983f51d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,7 +2,7 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
internal class BrowserItemTile : BrowserItem {
|
||||
#pragma warning disable IDE0044
|
||||
[SerializeField]
|
||||
@@ -45,7 +45,7 @@ namespace Cryville.Crtr.Browsing {
|
||||
}
|
||||
public void OnClick() {
|
||||
if (Id == null) return;
|
||||
ResourceBrowser resourceBrowser = GetComponentInParent<ResourceBrowser>();
|
||||
var resourceBrowser = GetComponentInParent<ResourceBrowser>();
|
||||
if (_dir) resourceBrowser.OnDirectoryItemClicked(Id.Value);
|
||||
else resourceBrowser.OnObjectItemClicked(Id.Value);
|
||||
}
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/BrowserItemTile.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/BrowserItemTile.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18dcb7d928c649f46bda005527fb6a17
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,7 +4,7 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
public class DetailPanel : ResourceBrowserUnit {
|
||||
#pragma warning disable IDE0044
|
||||
[SerializeField]
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/DetailPanel.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/DetailPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bdcc04cb1961dd4e9483dbf6c6d6f8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
internal class PathPart : MonoBehaviour {
|
||||
private int _id;
|
||||
private Text _exp;
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/PathPart.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/PathPart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 961fa71cc64cc2a4b88adfc5a1aad216
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +1,11 @@
|
||||
using Cryville.Common.Unity;
|
||||
using Cryville.Common.Unity.UI;
|
||||
using Cryville.Crtr.UI;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
public class ResourceBrowser : ResourceBrowserUnit {
|
||||
public IResourceManager<ChartDetail> ResourceManager;
|
||||
public ScrollableItemGrid PathContainer;
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/ResourceBrowser.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/ResourceBrowser.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d8141a90dc49f741b382e7abbf0a9c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,13 +1,12 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Unity.UI;
|
||||
using Cryville.Crtr.Config;
|
||||
using Cryville.Crtr.Extension;
|
||||
using Cryville.Crtr.Config.UI;
|
||||
using Cryville.Crtr.UI;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
public class ResourceBrowserMaster : MonoBehaviour {
|
||||
[SerializeField]
|
||||
private Button m_playButton;
|
||||
@@ -89,9 +88,4 @@ namespace Cryville.Crtr.Browsing {
|
||||
Settings.Default.LoadChart = MainBrowser.ResourceManager.GetItemPath(id);
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChartDetail {
|
||||
public AsyncDelivery<Texture2D> Cover { get; set; }
|
||||
public ChartMeta Meta { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c6c8bc301408004a904079721302722
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
namespace Cryville.Crtr.Browsing.UI {
|
||||
public abstract class ResourceBrowserUnit : MonoBehaviour {
|
||||
protected ResourceBrowserMaster Master { get; private set; }
|
||||
protected virtual void Awake() {
|
||||
11
Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserUnit.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserUnit.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8d98fa73d49ab94cb1a16c5ef09db6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +1,10 @@
|
||||
using Cryville.Crtr.Components;
|
||||
using Cryville.Crtr.Skin.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public static class GenericResources {
|
||||
public static class BuiltinResources {
|
||||
public static Dictionary<string, Type> Components
|
||||
= new Dictionary<string, Type>();
|
||||
public static Dictionary<string, Shader> Shaders
|
||||
@@ -1,6 +1,7 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Collections.Specialized;
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -2,6 +2,9 @@ using Cryville.Common;
|
||||
using Cryville.Common.Buffers;
|
||||
using Cryville.Crtr.Config;
|
||||
using Cryville.Crtr.Event;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using Cryville.Crtr.Skin;
|
||||
using Cryville.Crtr.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -22,9 +25,9 @@ namespace Cryville.Crtr {
|
||||
public class ChartPlayer : MonoBehaviour {
|
||||
#region Fields
|
||||
Chart chart;
|
||||
Skin skin;
|
||||
SkinDefinition skin;
|
||||
public static PdtSkin pskin;
|
||||
Ruleset ruleset;
|
||||
RulesetDefinition ruleset;
|
||||
PdtRuleset pruleset;
|
||||
Dictionary<string, Texture2D> texs;
|
||||
public static Dictionary<string, SpriteFrame> frames;
|
||||
@@ -71,7 +74,7 @@ namespace Cryville.Crtr {
|
||||
logs = logobj.GetComponent<TextMeshProUGUI>();
|
||||
if (!initialized) {
|
||||
Game.Init();
|
||||
GenericResources.LoadDefault();
|
||||
BuiltinResources.LoadDefault();
|
||||
initialized = true;
|
||||
}
|
||||
OnSettingsUpdate();
|
||||
@@ -417,10 +420,10 @@ namespace Cryville.Crtr {
|
||||
);
|
||||
if (!skinFile.Exists) throw new FileNotFoundException("Skin not found\nPlease specify an available skin in the config");
|
||||
using (StreamReader reader = new StreamReader(skinFile.FullName, Encoding.UTF8)) {
|
||||
skin = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
skin = JsonConvert.DeserializeObject<SkinDefinition>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
MissingMemberHandling = MissingMemberHandling.Error
|
||||
});
|
||||
if (skin.format != Skin.CURRENT_FORMAT) throw new FormatException("Invalid skin file version");
|
||||
if (skin.format != SkinDefinition.CURRENT_FORMAT) throw new FormatException("Invalid skin file version");
|
||||
}
|
||||
|
||||
loadThread = new Thread(new ParameterizedThreadStart(Load));
|
||||
@@ -497,22 +500,22 @@ namespace Cryville.Crtr {
|
||||
IEnumerator<float> Prehandle() {
|
||||
Stopwatch timer = new Stopwatch();
|
||||
timer.Reset(); timer.Start();
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 2)"); yield return .00f;
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 2)"); yield return 0;
|
||||
cbus.BroadcastPreInit();
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)"); yield return .05f;
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)"); yield return 0;
|
||||
using (var pbus = cbus.Clone(17)) {
|
||||
while (pbus.Time != double.PositiveInfinity) {
|
||||
pbus.ForwardOnce();
|
||||
yield return (float)pbus.EventId / pbus.EventCount * .80f + .05f;
|
||||
yield return (float)pbus.EventId / pbus.EventCount;
|
||||
}
|
||||
}
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 4)"); yield return .85f;
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 4)"); yield return 1;
|
||||
cbus.BroadcastPostInit();
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Seeking to start offset"); yield return .90f;
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Seeking to start offset"); yield return 1;
|
||||
cbus.ForwardByTime(startOffset);
|
||||
bbus.ForwardByTime(startOffset);
|
||||
Game.AudioSequencer.SeekTime(startOffset, SeekOrigin.Current);
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Cleaning up"); yield return .95f;
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Cleaning up"); yield return 1;
|
||||
if (logEnabled && Settings.Default.HideLogOnPlay) ToggleLogs();
|
||||
Camera.main.cullingMask |= 1;
|
||||
GC.Collect();
|
||||
@@ -682,10 +685,10 @@ namespace Cryville.Crtr {
|
||||
DirectoryInfo dir = file.Directory;
|
||||
Logger.Log("main", 0, "Load/WorkerThread", "Loading ruleset: {0}", file);
|
||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
ruleset = JsonConvert.DeserializeObject<RulesetDefinition>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
MissingMemberHandling = MissingMemberHandling.Error
|
||||
});
|
||||
if (ruleset.format != Ruleset.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
|
||||
if (ruleset.format != RulesetDefinition.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
|
||||
ruleset.LoadPdt(dir);
|
||||
pruleset = ruleset.Root;
|
||||
pruleset.Optimize(PdtEvaluator.Instance);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Collections.Specialized;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
8
Assets/Cryville/Crtr/Config/UI.meta
Normal file
8
Assets/Cryville/Crtr/Config/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26842cf5cfcceb14a9dbb07adbdf4da0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,5 @@
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using Cryville.Crtr.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -5,7 +7,7 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using Logger = Cryville.Common.Logging.Logger;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class ConfigPanelMaster : MonoBehaviour {
|
||||
[SerializeField]
|
||||
Menu m_menu;
|
||||
@@ -22,7 +24,7 @@ namespace Cryville.Crtr.Config {
|
||||
[SerializeField]
|
||||
InputConfigPanel m_inputConfigPanel;
|
||||
|
||||
public Ruleset ruleset;
|
||||
public RulesetDefinition ruleset;
|
||||
RulesetConfig _rscfg;
|
||||
|
||||
bool _loaded;
|
||||
@@ -38,10 +40,10 @@ namespace Cryville.Crtr.Config {
|
||||
}
|
||||
DirectoryInfo dir = file.Directory;
|
||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
ruleset = JsonConvert.DeserializeObject<RulesetDefinition>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||
MissingMemberHandling = MissingMemberHandling.Error
|
||||
});
|
||||
if (ruleset.format != Ruleset.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
|
||||
if (ruleset.format != RulesetDefinition.CURRENT_FORMAT) throw new FormatException("Invalid ruleset file version");
|
||||
ruleset.LoadPdt(dir);
|
||||
}
|
||||
FileInfo cfgfile = new FileInfo(
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54c06a15adfb41548acca0d73f391fe7
|
||||
guid: bad1f43573d4f1143a94fddddd30fb81
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,12 +1,13 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Unity;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using Cryville.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class InputConfigPanel : MonoBehaviour {
|
||||
[SerializeField]
|
||||
ConfigPanelMaster m_configScene;
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d27589834da67984d98c6147c8b6b5bb
|
||||
guid: 279d2404a312e5543813d8aca02800b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,9 +1,10 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Ruleset;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class InputConfigPanelEntry : MonoBehaviour {
|
||||
[SerializeField]
|
||||
Text m_key;
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8661f4d4934e11040a0c65729d4ba47a
|
||||
guid: 9741a0ed8c1c5e0468ea89f2cf33f36c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class PVPBool : PropertyValuePanel, IPointerClickHandler {
|
||||
[SerializeField]
|
||||
RectTransform m_on;
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 362a7cfafb57b9f46bbca9ed88d18c53
|
||||
guid: 9cb1bc40304ff174f891239c8f450c1c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class PVPNumber : PVPNumberBase {
|
||||
protected override void OnValueUpdated() {
|
||||
base.OnValueUpdated();
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b5d86b95e0bf894b86c63127d5ac06c
|
||||
guid: 94cb9dad5ac3eb04ca16d58a7bae0cb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public abstract class PVPNumberBase : PropertyValuePanel {
|
||||
[SerializeField]
|
||||
EventTrigger m_ctn;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user