Compare commits
75 Commits
Author | SHA1 | Date | |
---|---|---|---|
59c2210359 | |||
4fab20953a | |||
ee7b0f5081 | |||
33ee7a9a87 | |||
900bd7b77a | |||
6bd32c9aef | |||
13893b2853 | |||
23789c15eb | |||
a1f7418d32 | |||
274a823d02 | |||
ba6239068a | |||
ff8c925f32 | |||
2a6a33e60c | |||
8910b1f4a0 | |||
36dddea4d9 | |||
6a648c2dcd | |||
2d4087dc89 | |||
f91aacd78e | |||
9c08cbf0d2 | |||
88d35e4eaf | |||
675ce68073 | |||
db0165d145 | |||
7015426300 | |||
0d4cc5e208 | |||
e7ce0985fb | |||
eb6dafbd60 | |||
b6e238780e | |||
c7ea6f1d4b | |||
4a5b2a6889 | |||
b84d645aee | |||
67b44db1ae | |||
ee4399109a | |||
87ef534f59 | |||
87362b47c5 | |||
f60ba1088d | |||
abb7ad6f24 | |||
880b475c07 | |||
4707c40e6a | |||
7f87c23da2 | |||
6df10837fe | |||
42cb54de1d | |||
9fd685b8b3 | |||
b364005741 | |||
7d938de409 | |||
bb4ecfcd8c | |||
ff410529b0 | |||
fdc55a8e3b | |||
fc8512ff63 | |||
1b1ed42a1b | |||
b437925f92 | |||
c04e50e959 | |||
314cdb9935 | |||
77c91d015a | |||
291a018c13 | |||
18ff4b8e16 | |||
7714c277fd | |||
d6c2ac6be6 | |||
682fe38d40 | |||
3e525842cb | |||
3dd25b51a8 | |||
041c1e374e | |||
16b1d323dc | |||
c4d5e5f480 | |||
187f07d2c9 | |||
4e9d7e5b87 | |||
7df5b15e2e | |||
4863aa0ae7 | |||
eb53c3465b | |||
f683d61298 | |||
fbd03c8037 | |||
da68c8b877 | |||
c0744a3464 | |||
3ca3746cec | |||
5e76ddf2cd | |||
dca1ba304e |
Binary file not shown.
BIN
Assets/Animations/IConfig.anim
Normal file
BIN
Assets/Animations/IConfig.anim
Normal file
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 66a6563760d5cfa47ac1057052043fa7
|
guid: 2e0c61e29fd90f04b9e41265d93e2029
|
||||||
timeCreated: 1610937108
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
Binary file not shown.
Binary file not shown.
BIN
Assets/Animations/TConfig_Main.anim
Normal file
BIN
Assets/Animations/TConfig_Main.anim
Normal file
Binary file not shown.
8
Assets/Animations/TConfig_Main.anim.meta
Normal file
8
Assets/Animations/TConfig_Main.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d815e4d844e6a1c4d849e96e199f8881
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/Animations/TMain_Config.anim
Normal file
BIN
Assets/Animations/TMain_Config.anim
Normal file
Binary file not shown.
8
Assets/Animations/TMain_Config.anim.meta
Normal file
8
Assets/Animations/TMain_Config.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82867c59112ff5a419fbea2ebff2d3b9
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
90
Assets/Cryville/Common/Buffers/CategorizedPool.cs
Normal file
90
Assets/Cryville/Common/Buffers/CategorizedPool.cs
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Cryville.Common.Buffers {
|
||||||
|
/// <summary>
|
||||||
|
/// A set of resource pools categorized by a category type.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TCategory">The category type.</typeparam>
|
||||||
|
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
|
||||||
|
public abstract class CategorizedPool<TCategory, TObject> where TObject : class {
|
||||||
|
/// <summary>
|
||||||
|
/// The set of underlying pools.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>The <see cref="Rent(TCategory)" /> and <see cref="Return(TCategory, TObject)" /> method select an underlying pool directly from this set with the category as the key. When overridden, this set must be available since construction.</para>
|
||||||
|
/// </remarks>
|
||||||
|
protected abstract IReadOnlyDictionary<TCategory, ObjectPool<TObject>> Buckets { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// The count of objects rented from the set of pools.
|
||||||
|
/// </summary>
|
||||||
|
public int RentedCount { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Rents an object from the pool.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category">The category.</param>
|
||||||
|
/// <returns>The rented object.</returns>
|
||||||
|
public TObject Rent(TCategory category) {
|
||||||
|
var obj = Buckets[category].Rent();
|
||||||
|
RentedCount++;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a rented object to the pool.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category">The category.</param>
|
||||||
|
/// <param name="obj">The object to return.</param>
|
||||||
|
public void Return(TCategory category, TObject obj) {
|
||||||
|
Buckets[category].Return(obj);
|
||||||
|
--RentedCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// A utility to access a categorized pool, representing a single unit that uses a shared categorized pool.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TCategory">The category type.</typeparam>
|
||||||
|
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
|
||||||
|
public class CategorizedPoolAccessor<TCategory, TObject> where TObject : class {
|
||||||
|
readonly CategorizedPool<TCategory, TObject> _pool;
|
||||||
|
static readonly SimpleObjectPool<Dictionary<TObject, TCategory>> _dictPool
|
||||||
|
= new SimpleObjectPool<Dictionary<TObject, TCategory>>(1024);
|
||||||
|
Dictionary<TObject, TCategory> _rented;
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an instance of the <see cref="CategorizedPoolAccessor{TCategory, TObject}" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pool">The categorized pool.</param>
|
||||||
|
public CategorizedPoolAccessor(CategorizedPool<TCategory, TObject> pool) {
|
||||||
|
_pool = pool;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Rents an object from the pool.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category">The category.</param>
|
||||||
|
/// <returns>The rented object.</returns>
|
||||||
|
public TObject Rent(TCategory category) {
|
||||||
|
var obj = _pool.Rent(category);
|
||||||
|
if (_rented == null) _rented = _dictPool.Rent();
|
||||||
|
_rented.Add(obj, category);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a rented object to the pool.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">The object to return.</param>
|
||||||
|
public void Return(TObject obj) {
|
||||||
|
_pool.Return(_rented[obj], obj);
|
||||||
|
_rented.Remove(obj);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all objects rented by this accessor to the pool.
|
||||||
|
/// </summary>
|
||||||
|
public void ReturnAll() {
|
||||||
|
if (_rented == null) return;
|
||||||
|
foreach (var obj in _rented) {
|
||||||
|
_pool.Return(obj.Value, obj.Key);
|
||||||
|
}
|
||||||
|
_rented.Clear();
|
||||||
|
_dictPool.Return(_rented);
|
||||||
|
_rented = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Common/Buffers/CategorizedPool.cs.meta
Normal file
11
Assets/Cryville/Common/Buffers/CategorizedPool.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ec18f22479042d747b88c093aa90c5c0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -14,6 +14,10 @@
|
|||||||
_objs = new T[capacity];
|
_objs = new T[capacity];
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The count of objects rented from the pool.
|
||||||
|
/// </summary>
|
||||||
|
public int RentedCount { get { return _index; } }
|
||||||
|
/// <summary>
|
||||||
/// Rents a object from the pool.
|
/// Rents a object from the pool.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The rented object.</returns>
|
/// <returns>The rented object.</returns>
|
||||||
@@ -24,6 +28,7 @@
|
|||||||
_objs[_index++] = null;
|
_objs[_index++] = null;
|
||||||
}
|
}
|
||||||
if (obj == null) obj = Construct();
|
if (obj == null) obj = Construct();
|
||||||
|
else Reset(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,5 +43,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The new instance.</returns>
|
/// <returns>The new instance.</returns>
|
||||||
protected abstract T Construct();
|
protected abstract T Construct();
|
||||||
|
/// <summary>
|
||||||
|
/// Resets an object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">The object.</param>
|
||||||
|
protected virtual void Reset(T obj) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Cryville.Common.Font {
|
namespace Cryville.Common.Font {
|
||||||
public abstract class FontFile : IEnumerable<Typeface> {
|
public abstract class FontFile : IEnumerable<Typeface> {
|
||||||
|
@@ -24,11 +24,11 @@ namespace Cryville.Common {
|
|||||||
if (Key == 0) return "";
|
if (Key == 0) return "";
|
||||||
return Name.ToString();
|
return Name.ToString();
|
||||||
}
|
}
|
||||||
public static implicit operator Identifier(string identifier) {
|
public static bool operator ==(Identifier lhs, Identifier rhs) {
|
||||||
return new Identifier(identifier);
|
return lhs.Equals(rhs);
|
||||||
}
|
}
|
||||||
public static implicit operator string(Identifier identifier) {
|
public static bool operator !=(Identifier lhs, Identifier rhs) {
|
||||||
return identifier.ToString();
|
return !lhs.Equals(rhs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,16 +54,13 @@ namespace Cryville.Common.Math {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="System.Single" /> column vector and fills it with polynomial coefficients.
|
/// Fills a <see cref="System.Single" /> column vector with polynomial coefficients.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="size">The size of the column vector.</param>
|
/// <param name="vec">The column vector.</param>
|
||||||
/// <param name="num">The base number.</param>
|
/// <param name="num">The base number.</param>
|
||||||
/// <returns>A <see cref="System.Single" /> column vector filled with polynomial coefficients.</returns>
|
public static void FillWithPolynomialCoefficients(ColumnVector<float> vec, float num) {
|
||||||
public static ColumnVector<float> WithPolynomialCoefficients(int size, float num) {
|
for (var i = 0; i < vec.Size; i++)
|
||||||
var m = new ColumnVector<float>(size);
|
vec[i] = (float)System.Math.Pow(num, i);
|
||||||
for (var i = 0; i < size; i++)
|
|
||||||
m[i] = (float)System.Math.Pow(num, i);
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using UnsafeIL;
|
||||||
|
|
||||||
namespace Cryville.Common.Math {
|
namespace Cryville.Common.Math {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,11 +40,11 @@ namespace Cryville.Common.Math {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The vector type.</typeparam>
|
/// <typeparam name="T">The vector type.</typeparam>
|
||||||
/// <param name="v">The column vector.</param>
|
/// <param name="v">The column vector.</param>
|
||||||
|
/// <param name="result">The result column vector.</param>
|
||||||
/// <param name="o">The column operator.</param>
|
/// <param name="o">The column operator.</param>
|
||||||
/// <returns>The column vector eliminated.</returns>
|
public void Eliminate<T>(ColumnVector<T> v, ColumnVector<T> result, IVectorOperator<T> o) {
|
||||||
public ColumnVector<T> Eliminate<T>(ColumnVector<T> v, IVectorOperator<T> o) {
|
|
||||||
int s = Size;
|
int s = Size;
|
||||||
Array.Copy(content, buffer, Size * Size);
|
FillBuffer();
|
||||||
for (int i = 0; i < s; i++) refl[i] = i;
|
for (int i = 0; i < s; i++) refl[i] = i;
|
||||||
for (int r = 0; r < s; r++) {
|
for (int r = 0; r < s; r++) {
|
||||||
for (int r0 = r; r0 < s; r0++)
|
for (int r0 = r; r0 < s; r0++)
|
||||||
@@ -66,14 +66,17 @@ namespace Cryville.Common.Math {
|
|||||||
v[or1] = o.Add(v[or1], o.ScalarMultiply(-sf1, v[or]));
|
v[or1] = o.Add(v[or1], o.ScalarMultiply(-sf1, v[or]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ColumnVector<T> res = new ColumnVector<T>(s);
|
|
||||||
for (int r2 = s - 1; r2 >= 0; r2--) {
|
for (int r2 = s - 1; r2 >= 0; r2--) {
|
||||||
var v2 = v[refl[r2]];
|
var v2 = v[refl[r2]];
|
||||||
for (int c2 = r2 + 1; c2 < s; c2++)
|
for (int c2 = r2 + 1; c2 < s; c2++)
|
||||||
v2 = o.Add(v2, o.ScalarMultiply(-buffer[refl[r2], c2], res[refl[c2]]));
|
v2 = o.Add(v2, o.ScalarMultiply(-buffer[refl[r2], c2], result[refl[c2]]));
|
||||||
res[refl[r2]] = v2;
|
result[refl[r2]] = v2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unsafe void FillBuffer() {
|
||||||
|
fixed (void* ptrc = content, ptrb = buffer) {
|
||||||
|
Unsafe.CopyBlock(ptrb, ptrc, (uint)(Size * Size * sizeof(float)));
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a square matrix and fills it with polynomial coefficients.
|
/// Creates a square matrix and fills it with polynomial coefficients.
|
||||||
|
@@ -1,7 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Cryville.Common.Pdt {
|
namespace Cryville.Common.Pdt {
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the attributed member is an element list.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>An element list is a <see cref="System.Collections.IDictionary" /> that represents a collection of PDT elements. There must be at most one element list in a class.</para>
|
||||||
|
/// </remarks>
|
||||||
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||||
public class ElementListAttribute : Attribute { }
|
public class ElementListAttribute : Attribute { }
|
||||||
public class ComponentListAttribute : Attribute { }
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the attributed member is a property list.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>A property list is a <see cref="System.Collections.IDictionary" /> that represents a collection of PDT properties. There must be at most one property list in a class.</para>
|
||||||
|
/// </remarks>
|
||||||
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||||
public class PropertyListAttribute : Attribute { }
|
public class PropertyListAttribute : Attribute { }
|
||||||
}
|
}
|
||||||
|
@@ -186,7 +186,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
protected abstract PdtOperator GetOperator(PdtOperatorSignature sig);
|
protected abstract PdtOperator GetOperator(PdtOperatorSignature sig);
|
||||||
unsafe void Operate(PdtOperator op, int pc, bool noset = false) {
|
unsafe void Operate(PdtOperator op, int pc, bool noset = false) {
|
||||||
fixed (byte* pmem = _mem) {
|
fixed (byte* pmem = _mem) {
|
||||||
op.Begin(this);
|
op.Begin(this, pc);
|
||||||
for (int i = 0; i < pc; i++) {
|
for (int i = 0; i < pc; i++) {
|
||||||
var frame = _stack[--_framecount];
|
var frame = _stack[--_framecount];
|
||||||
op.LoadOperand(new PdtVariableMemory(frame.Type, pmem + frame.Offset, frame.Length));
|
op.LoadOperand(new PdtVariableMemory(frame.Type, pmem + frame.Offset, frame.Length));
|
||||||
|
@@ -11,7 +11,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the value of this expression is constant.
|
/// Whether the value of this expression is constant.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>The value of this property is <c>false</c> until it is optimized.</remarks>
|
/// <remarks>The value of this property is <see langword="false" /> until it is optimized.</remarks>
|
||||||
public bool IsConstant { get; internal set; }
|
public bool IsConstant { get; internal set; }
|
||||||
internal bool IsPotentialConstant;
|
internal bool IsPotentialConstant;
|
||||||
internal PdtExpression(LinkedList<PdtInstruction> ins) {
|
internal PdtExpression(LinkedList<PdtInstruction> ins) {
|
||||||
|
@@ -34,9 +34,9 @@ namespace Cryville.Common.Pdt {
|
|||||||
0x0001, 0x0080, 0x0100, 0x0000, 0x0030, 0x0080, 0x0080, 0x0000, 0x0200, 0x0400, 0x0080, 0x0080, 0x0080, 0x0080, 0x0040, 0x0080,
|
0x0001, 0x0080, 0x0100, 0x0000, 0x0030, 0x0080, 0x0080, 0x0000, 0x0200, 0x0400, 0x0080, 0x0080, 0x0080, 0x0080, 0x0040, 0x0080,
|
||||||
0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x1000, 0x1800, 0x0080, 0x0080, 0x0080, 0x0030,
|
0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x1000, 0x1800, 0x0080, 0x0080, 0x0080, 0x0030,
|
||||||
0x0080, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
0x0080, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
||||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030,
|
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0080, 0x0000, 0x0080, 0x0030,
|
||||||
0x0000, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
0x0000, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
||||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x1000, 0x0080, 0x1000, 0x0000, 0x0000,
|
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x1000, 0x0080, 0x1000, 0x0080, 0x0000,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -54,43 +54,92 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <param name="binder">The binder.</param>
|
/// <param name="binder">The binder.</param>
|
||||||
/// <returns>The interpreted object.</returns>
|
/// <returns>The interpreted object.</returns>
|
||||||
public static T Interpret<T>(string src, Binder binder) {
|
public static T Interpret<T>(string src, Binder binder) {
|
||||||
return (T)new PdtInterpreter(src, typeof(T), binder).Interpret();
|
return (T)new PdtInterpreter(src, binder).Interpret(typeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The source string.
|
||||||
|
/// </summary>
|
||||||
public string Source { get; private set; }
|
public string Source { get; private set; }
|
||||||
readonly Type _type;
|
Binder _binder;
|
||||||
readonly Binder _binder;
|
/// <summary>
|
||||||
|
/// The current position in the string being parsed by the interpreter.
|
||||||
|
/// </summary>
|
||||||
public int Position { get; private set; }
|
public int Position { get; private set; }
|
||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
|
/// <summary>
|
||||||
|
/// The character at the current position.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected char cc { get { return Source[Position]; } }
|
protected char cc { get { return Source[Position]; } }
|
||||||
|
/// <summary>
|
||||||
|
/// The category of the character.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected int ct { get { return cm[cc]; } }
|
protected int ct { get { return cm[cc]; } }
|
||||||
protected string tokenb(int flag) { // Token Whitelist
|
/// <summary>
|
||||||
|
/// Reads a token until a character of type <paramref name="flag" /> is met.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="flag">The type filter.</param>
|
||||||
|
/// <returns>A token from the current position (inclusive) to the next character of type <paramref name="flag" /> (exclusive).</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">No character of type <paramref name="flag" /> is met.</exception>
|
||||||
|
protected string tokenb(int flag) {
|
||||||
int sp = Position;
|
int sp = Position;
|
||||||
while ((ct & flag) == 0) Position++;
|
while ((ct & flag) == 0) Position++;
|
||||||
return Source.Substring(sp, Position - sp);
|
return Source.Substring(sp, Position - sp);
|
||||||
}
|
}
|
||||||
protected string tokenw(int flag) { // Token Whitelist
|
/// <summary>
|
||||||
|
/// Reads a token until a character that is not of type <paramref name="flag" /> is met.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="flag">The type filter.</param>
|
||||||
|
/// <returns>A token from the current position (inclusive) to the next character that is not of type <paramref name="flag" /> (exclusive).</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">No character that is not of type <paramref name="flag" /> is met.</exception>
|
||||||
|
protected string tokenw(int flag) {
|
||||||
int sp = Position;
|
int sp = Position;
|
||||||
while ((ct & flag) != 0) Position++;
|
while ((ct & flag) != 0) Position++;
|
||||||
return Source.Substring(sp, Position - sp);
|
return Source.Substring(sp, Position - sp);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Skips over whitespaces.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected void ws() {
|
protected void ws() {
|
||||||
while ((ct & 0x0001) != 0) Position++;
|
while ((ct & 0x0001) != 0) Position++;
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the current character and increments the position.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The current character.</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected char GetChar() {
|
protected char GetChar() {
|
||||||
char r = cc;
|
char r = cc;
|
||||||
Position++;
|
Position++;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Reads an identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An identifier.</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected string GetIdentifier() {
|
protected string GetIdentifier() {
|
||||||
if ((ct & 0x0020) == 0) return "";
|
if ((ct & 0x0020) == 0) return "";
|
||||||
return tokenw(0x0010);
|
return tokenw(0x0010);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Reads a number.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A number.</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected string GetNumber() {
|
protected string GetNumber() {
|
||||||
return tokenw(0x0040);
|
return tokenw(0x0040);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Reads a string.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string.</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected string GetString() {
|
protected string GetString() {
|
||||||
int sp = Position;
|
int sp = Position;
|
||||||
do {
|
do {
|
||||||
@@ -100,6 +149,11 @@ namespace Cryville.Common.Pdt {
|
|||||||
Position++;
|
Position++;
|
||||||
return Regex.Replace(Source.Substring(sp + 1, Position - sp - 2), @"\\(.)", "$1");
|
return Regex.Replace(Source.Substring(sp + 1, Position - sp - 2), @"\\(.)", "$1");
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Reads an expression.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An expression.</returns>
|
||||||
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||||
protected PdtExpression GetExp() {
|
protected PdtExpression GetExp() {
|
||||||
var ins = new LinkedList<PdtInstruction>();
|
var ins = new LinkedList<PdtInstruction>();
|
||||||
int _;
|
int _;
|
||||||
@@ -112,23 +166,27 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// Creates an instance of the <see cref="PdtInterpreter" /> class.
|
/// Creates an instance of the <see cref="PdtInterpreter" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="src">The source string.</param>
|
/// <param name="src">The source string.</param>
|
||||||
/// <param name="type">The destination type.</param>
|
|
||||||
/// <param name="binder">The binder. May be <c>null</c>.</param>
|
/// <param name="binder">The binder. May be <c>null</c>.</param>
|
||||||
public PdtInterpreter(string src, Type type, Binder binder) {
|
public PdtInterpreter(string src, Binder binder) {
|
||||||
Source = src;
|
Source = src;
|
||||||
_type = type;
|
|
||||||
_binder = binder;
|
_binder = binder;
|
||||||
if (_binder == null)
|
}
|
||||||
_binder = BinderAttribute.CreateBinderOfType(_type);
|
int[] m_formatVersion;
|
||||||
|
public int[] GetFormatVersion() {
|
||||||
|
if (m_formatVersion == null) InterpretDirectives();
|
||||||
|
return m_formatVersion;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interprets the source to an object.
|
/// Interprets the source to an object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="type">The output type.</param>
|
||||||
/// <returns>The interpreted object.</returns>
|
/// <returns>The interpreted object.</returns>
|
||||||
public object Interpret() {
|
public object Interpret(Type type) {
|
||||||
try {
|
try {
|
||||||
InterpretDirectives();
|
if (m_formatVersion == null) InterpretDirectives();
|
||||||
return InterpretObject(_type);
|
if (_binder == null)
|
||||||
|
_binder = BinderAttribute.CreateBinderOfType(type);
|
||||||
|
return InterpretObject(type);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new PdtParsingException(this, ex);
|
throw new PdtParsingException(this, ex);
|
||||||
@@ -146,7 +204,10 @@ namespace Cryville.Common.Pdt {
|
|||||||
break;
|
break;
|
||||||
case "format":
|
case "format":
|
||||||
ws();
|
ws();
|
||||||
if (GetNumber() != "1")
|
m_formatVersion = (from i in GetNumber().Split('.') select int.Parse(i)).ToArray();
|
||||||
|
if (m_formatVersion.Length == 0)
|
||||||
|
throw new FormatException("Invalid format version");
|
||||||
|
if (m_formatVersion[0] != 1)
|
||||||
throw new NotSupportedException("Format not supported");
|
throw new NotSupportedException("Format not supported");
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
@@ -167,10 +228,14 @@ namespace Cryville.Common.Pdt {
|
|||||||
}
|
}
|
||||||
object InterpretObject(Type type) {
|
object InterpretObject(Type type) {
|
||||||
var result = ReflectionHelper.InvokeEmptyConstructor(type);
|
var result = ReflectionHelper.InvokeEmptyConstructor(type);
|
||||||
bool dictflag = ReflectionHelper.IsGenericDictionary(type);
|
bool dictflag = typeof(IDictionary).IsAssignableFrom(type);
|
||||||
while (true) {
|
while (true) {
|
||||||
try { ws(); }
|
try { ws(); }
|
||||||
catch (IndexOutOfRangeException) { return result; }
|
catch (IndexOutOfRangeException) { return result; }
|
||||||
|
if (cc == '}') {
|
||||||
|
GetChar();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
object pkey = InterpretKey(type);
|
object pkey = InterpretKey(type);
|
||||||
char c = GetChar();
|
char c = GetChar();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -183,19 +248,20 @@ namespace Cryville.Common.Pdt {
|
|||||||
((IDictionary)result).Add(key, value);
|
((IDictionary)result).Add(key, value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MemberInfo prop;
|
MemberInfo prop = null;
|
||||||
bool flag = ReflectionHelper.TryFindMemberWithAttribute<ElementListAttribute>(type, out prop);
|
bool flag = false;
|
||||||
if (!flag && pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
if (pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
||||||
|
if (prop == null) flag = ReflectionHelper.TryFindMemberWithAttribute<ElementListAttribute>(type, out prop);
|
||||||
|
if (prop == null) throw new MissingMemberException(string.Format("The property \"{0}\" is not found", pkey));
|
||||||
Type ptype = ReflectionHelper.GetMemberType(prop);
|
Type ptype = ReflectionHelper.GetMemberType(prop);
|
||||||
if (ReflectionHelper.IsGenericDictionary(ptype)) {
|
if (flag) {
|
||||||
|
if (!typeof(IDictionary).IsAssignableFrom(ptype))
|
||||||
|
throw new InvalidOperationException("Internal error: Element list is not a dictionary");
|
||||||
var ktype = ptype.GetGenericArguments()[0];
|
var ktype = ptype.GetGenericArguments()[0];
|
||||||
var vtype = ptype.GetGenericArguments()[1];
|
var vtype = ptype.GetGenericArguments()[1];
|
||||||
if (flag) {
|
object key = _binder.ChangeType(pkey, ktype, null);
|
||||||
object key = _binder.ChangeType(pkey, ktype, null);
|
object value = InterpretObject(vtype);
|
||||||
object value = InterpretObject(vtype);
|
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
||||||
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
|
||||||
}
|
|
||||||
else ReflectionHelper.SetValue(prop, result, InterpretObject(ptype));
|
|
||||||
}
|
}
|
||||||
else ReflectionHelper.SetValue(prop, result, InterpretObject(ptype));
|
else ReflectionHelper.SetValue(prop, result, InterpretObject(ptype));
|
||||||
}
|
}
|
||||||
@@ -211,28 +277,36 @@ namespace Cryville.Common.Pdt {
|
|||||||
((IDictionary)result).Add(key, value);
|
((IDictionary)result).Add(key, value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MemberInfo prop;
|
MemberInfo prop = null;
|
||||||
bool flag = ReflectionHelper.TryFindMemberWithAttribute<PropertyListAttribute>(type, out prop);
|
bool flag = false;
|
||||||
if (!flag && pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
if (pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
||||||
|
if (prop == null) flag = ReflectionHelper.TryFindMemberWithAttribute<PropertyListAttribute>(type, out prop);
|
||||||
|
if (prop == null) throw new MissingMemberException(string.Format("The property \"{0}\" is not found", pkey));
|
||||||
var ptype = ReflectionHelper.GetMemberType(prop);
|
var ptype = ReflectionHelper.GetMemberType(prop);
|
||||||
if (!typeof(IDictionary).IsAssignableFrom(ptype)) {
|
if (flag) {
|
||||||
object value = _binder.ChangeType(exp, ptype, null);
|
if (!typeof(IDictionary).IsAssignableFrom(ptype))
|
||||||
ReflectionHelper.SetValue(prop, result, value, _binder);
|
throw new InvalidOperationException("Internal error: Property list is not a dictionary");
|
||||||
}
|
|
||||||
else {
|
|
||||||
var ktype = ptype.GetGenericArguments()[0];
|
var ktype = ptype.GetGenericArguments()[0];
|
||||||
var vtype = ptype.GetGenericArguments()[1];
|
var vtype = ptype.GetGenericArguments()[1];
|
||||||
object key = _binder.ChangeType(pkey, ktype, null);
|
object key = _binder.ChangeType(pkey, ktype, null);
|
||||||
object value = _binder.ChangeType(exp, vtype, null);
|
object value = _binder.ChangeType(exp, vtype, null);
|
||||||
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
object value = _binder.ChangeType(exp, ptype, null);
|
||||||
|
ReflectionHelper.SetValue(prop, result, value, _binder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '}':
|
default:
|
||||||
return result;
|
throw new InvalidOperationException("Internal error: Invalid key interpretation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Interprets a key from the current position.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The interpreted key.</returns>
|
||||||
protected virtual object InterpretKey(Type type) {
|
protected virtual object InterpretKey(Type type) {
|
||||||
return tokenb(0x1000).Trim();
|
return tokenb(0x1000).Trim();
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The count of the operands loaded.
|
/// The count of the operands loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected int LoadedOperandCount { get { return ParamCount - _loadindex; } }
|
protected int LoadedOperandCount { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the operand at the specified index.
|
/// Gets the operand at the specified index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -24,24 +24,24 @@ namespace Cryville.Common.Pdt {
|
|||||||
int i = index + _loadindex;
|
int i = index + _loadindex;
|
||||||
return _operands[i];
|
return _operands[i];
|
||||||
}
|
}
|
||||||
internal int ParamCount { get; private set; }
|
readonly int _pc;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instance of the <see cref="PdtOperator" /> class.
|
/// Creates an instance of the <see cref="PdtOperator" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pc">The suggested parameter count.</param>
|
/// <param name="pc">The suggested parameter count.</param>
|
||||||
protected PdtOperator(int pc) {
|
protected PdtOperator(int pc) {
|
||||||
ParamCount = pc;
|
_pc = pc;
|
||||||
_operands = new PdtVariableMemory[pc];
|
_operands = new PdtVariableMemory[pc];
|
||||||
}
|
}
|
||||||
PdtEvaluatorBase _etor;
|
PdtEvaluatorBase _etor;
|
||||||
bool _rfreq = true;
|
bool _rfreq = true;
|
||||||
internal void Begin(PdtEvaluatorBase etor) {
|
internal void Begin(PdtEvaluatorBase etor, int pc) {
|
||||||
_etor = etor;
|
_etor = etor;
|
||||||
_loadindex = ParamCount;
|
_loadindex = LoadedOperandCount = pc;
|
||||||
}
|
}
|
||||||
internal void LoadOperand(PdtVariableMemory mem) {
|
internal void LoadOperand(PdtVariableMemory mem) {
|
||||||
if (_loadindex == 0) return;
|
if (--_loadindex >= _pc) return;
|
||||||
_operands[--_loadindex] = mem;
|
_operands[_loadindex] = mem;
|
||||||
}
|
}
|
||||||
internal void Call(byte* prmem, bool noset) {
|
internal void Call(byte* prmem, bool noset) {
|
||||||
_prmem = prmem;
|
_prmem = prmem;
|
||||||
@@ -55,6 +55,9 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the operator.
|
/// Executes the operator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>When overridden, this method reads operands by calling <see cref="GetOperand(int)" />, and writes the result to the frame obtained by calling <see cref="GetReturnFrame(int, int)" />.</para>
|
||||||
|
/// </remarks>
|
||||||
protected abstract void Execute();
|
protected abstract void Execute();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a return frame.
|
/// Gets a return frame.
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using UnsafeIL;
|
||||||
|
|
||||||
namespace Cryville.Common.Pdt {
|
namespace Cryville.Common.Pdt {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,7 +43,9 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <param name="dest">The destination buffer.</param>
|
/// <param name="dest">The destination buffer.</param>
|
||||||
/// <param name="destOffset">The offset on the destination buffer to start copying to.</param>
|
/// <param name="destOffset">The offset on the destination buffer to start copying to.</param>
|
||||||
/// <param name="length">The length to copy.</param>
|
/// <param name="length">The length to copy.</param>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException"><paramref name="length" /> is greater than the length of the span.</exception>
|
||||||
public void CopyTo(byte* dest, int destOffset, int length) {
|
public void CopyTo(byte* dest, int destOffset, int length) {
|
||||||
|
if (length > Length) throw new ArgumentOutOfRangeException("length");
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
dest[destOffset + i] = _ptr[i];
|
dest[destOffset + i] = _ptr[i];
|
||||||
}
|
}
|
||||||
@@ -126,10 +129,43 @@ namespace Cryville.Common.Pdt {
|
|||||||
throw new InvalidCastException("Not an identifier");
|
throw new InvalidCastException("Not an identifier");
|
||||||
return *(int*)(_ptr + offset);
|
return *(int*)(_ptr + offset);
|
||||||
}
|
}
|
||||||
internal void* TrustedAsOfLength(int len) {
|
/// <summary>
|
||||||
if (Length < len)
|
/// Gets the memory of the span as an instance of the specified type.
|
||||||
throw new InvalidCastException("Type not matched");
|
/// </summary>
|
||||||
return _ptr;
|
/// <typeparam name="T">The specified type.</typeparam>
|
||||||
|
/// <param name="offset">The offset on the span to start reading from.</param>
|
||||||
|
/// <returns>An instance of the specified type.</returns>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> is not less than the length of the span.</exception>
|
||||||
|
/// <exception cref="InvalidCastException">The length of the span is not sufficient.</exception>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>Use <see cref="AsNumber(int)" /> instead while reading an unaligned number.</para>
|
||||||
|
/// </remarks>
|
||||||
|
public T As<T>(int offset = 0) {
|
||||||
|
var len = Unsafe.SizeOf<T>();
|
||||||
|
if (offset >= Length)
|
||||||
|
throw new ArgumentOutOfRangeException("offset");
|
||||||
|
if (offset + len > Length)
|
||||||
|
throw new InvalidCastException("Frame length not sufficient");
|
||||||
|
return Unsafe.Read<T>(_ptr + offset);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the memory of the span to an instance of the specified type.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The specified type.</typeparam>
|
||||||
|
/// <param name="value">The value.</param>
|
||||||
|
/// <param name="offset">The offset from the start of the span.</param>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> is not less than the length of the span.</exception>
|
||||||
|
/// <exception cref="InvalidCastException">The length of the span is not sufficient.</exception>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>Use <see cref="SetNumber(float, int)" /> instead while writing an unaligned number.</para>
|
||||||
|
/// </remarks>
|
||||||
|
public void Set<T>(T value, int offset = 0) {
|
||||||
|
var len = Unsafe.SizeOf<T>();
|
||||||
|
if (offset >= Length)
|
||||||
|
throw new ArgumentOutOfRangeException("offset");
|
||||||
|
if (offset + len > Length)
|
||||||
|
throw new InvalidCastException("Frame length not sufficient");
|
||||||
|
Unsafe.Write(_ptr + offset, value);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the array suffix.
|
/// Gets the array suffix.
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Cryville.Common.Unity.UI {
|
||||||
|
public class SetIntegerParameterBehaviour : SetParameterBehaviour {
|
||||||
|
[SerializeField] int m_value;
|
||||||
|
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
|
||||||
|
animator.SetInteger(m_name, m_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 57079cdf55a0d1149903f00ee732fa85
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Cryville/Common/Unity/UI/SetParameterBehaviour.cs
Normal file
8
Assets/Cryville/Common/Unity/UI/SetParameterBehaviour.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Cryville.Common.Unity.UI {
|
||||||
|
public abstract class SetParameterBehaviour : StateMachineBehaviour {
|
||||||
|
[SerializeField] protected string m_name;
|
||||||
|
public override abstract void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d48088ca586ef5a41a42f6564e35b230
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -45,7 +45,7 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MethodInfo _methodCreateFontAsset;
|
static MethodInfo _methodCreateFontAsset;
|
||||||
static object[] _paramsCreateFontAsset = new object[] { null, null, 90, 9, GlyphRenderMode.SDFAA, 1024, 1024, Type.Missing, Type.Missing };
|
static readonly object[] _paramsCreateFontAsset = new object[] { null, null, 90, 9, GlyphRenderMode.SDFAA, 1024, 1024, Type.Missing, Type.Missing };
|
||||||
static FontAsset CreateFontAsset(string path, int index) {
|
static FontAsset CreateFontAsset(string path, int index) {
|
||||||
if (_methodCreateFontAsset == null) {
|
if (_methodCreateFontAsset == null) {
|
||||||
_methodCreateFontAsset = typeof(FontAsset).GetMethod(
|
_methodCreateFontAsset = typeof(FontAsset).GetMethod(
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Cryville.Crtr.Browsing {
|
namespace Cryville.Crtr.Browsing {
|
||||||
public abstract class ExtensionInterface {
|
public abstract class ExtensionInterface {
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Unity.UI;
|
using Cryville.Common.Unity.UI;
|
||||||
|
using Cryville.Crtr.Config;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -12,11 +13,12 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
private Button m_playButton;
|
private Button m_playButton;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button m_configButton;
|
private Button m_configButton;
|
||||||
|
[SerializeField]
|
||||||
|
private ConfigPanelMaster m_configPanel;
|
||||||
|
|
||||||
private DockLayoutGroup _group;
|
private DockLayoutGroup _group;
|
||||||
public ResourceBrowser MainBrowser { get; private set; }
|
public ResourceBrowser MainBrowser { get; private set; }
|
||||||
private DetailPanel _detailPanel;
|
private DetailPanel _detailPanel;
|
||||||
private SettingsPanel _settingsPanel;
|
|
||||||
readonly List<ResourceBrowserUnit> _units = new List<ResourceBrowserUnit>();
|
readonly List<ResourceBrowserUnit> _units = new List<ResourceBrowserUnit>();
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
#pragma warning disable IDE0051
|
||||||
@@ -25,7 +27,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
MainBrowser = transform.GetChild(0).GetComponent<ResourceBrowser>();
|
MainBrowser = transform.GetChild(0).GetComponent<ResourceBrowser>();
|
||||||
MainBrowser.ResourceManager = new LegacyResourceManager(Settings.Default.GameDataPath);
|
MainBrowser.ResourceManager = new LegacyResourceManager(Settings.Default.GameDataPath);
|
||||||
_detailPanel = transform.GetChild(1).GetComponent<DetailPanel>();
|
_detailPanel = transform.GetChild(1).GetComponent<DetailPanel>();
|
||||||
_settingsPanel = transform.GetChild(2).GetComponent<SettingsPanel>();
|
|
||||||
_units.Add(MainBrowser);
|
_units.Add(MainBrowser);
|
||||||
_units.Add(_detailPanel);
|
_units.Add(_detailPanel);
|
||||||
}
|
}
|
||||||
@@ -80,12 +81,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
|
|
||||||
public void OpenConfig(int id, ChartDetail detail) {
|
public void OpenConfig(int id, ChartDetail detail) {
|
||||||
SetDataSettings(id, detail);
|
SetDataSettings(id, detail);
|
||||||
#if UNITY_5_3_OR_NEWER
|
|
||||||
SceneManager.LoadScene("Config", LoadSceneMode.Additive);
|
|
||||||
#else
|
|
||||||
Application.LoadLevelAdditive("Config");
|
|
||||||
#endif
|
|
||||||
GameObject.Find("/Master").GetComponent<Master>().HideMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDataSettings(int id, ChartDetail detail) {
|
void SetDataSettings(int id, ChartDetail detail) {
|
||||||
|
@@ -109,10 +109,11 @@ namespace Cryville.Crtr {
|
|||||||
public float BeatOffset;
|
public float BeatOffset;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public abstract int Priority {
|
public abstract int Priority { get; }
|
||||||
get;
|
|
||||||
}
|
[JsonIgnore]
|
||||||
|
public virtual bool Standalone { get { return false; } }
|
||||||
|
|
||||||
public ChartEvent Clone() {
|
public ChartEvent Clone() {
|
||||||
return (ChartEvent)MemberwiseClone();
|
return (ChartEvent)MemberwiseClone();
|
||||||
}
|
}
|
||||||
@@ -259,9 +260,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int Priority {
|
public override int Priority { get { return 10; } }
|
||||||
get { return 10; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Group : EventContainer {
|
public class Group : EventContainer {
|
||||||
public List<Track> tracks = new List<Track>();
|
public List<Track> tracks = new List<Track>();
|
||||||
@@ -281,15 +280,11 @@ namespace Cryville.Crtr {
|
|||||||
default: return base.GetEventsOfType(type);
|
default: return base.GetEventsOfType(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override int Priority {
|
public override int Priority { get { return 10; } }
|
||||||
get { return 10; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Track : EventContainer {
|
public class Track : EventContainer {
|
||||||
public override int Priority {
|
public override int Priority { get { return 10; } }
|
||||||
get { return 10; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Motion : ChartEvent {
|
public class Motion : ChartEvent {
|
||||||
@@ -375,9 +370,7 @@ namespace Cryville.Crtr {
|
|||||||
[DefaultValue(0.0f)]
|
[DefaultValue(0.0f)]
|
||||||
public float sumfix = 0.0f;
|
public float sumfix = 0.0f;
|
||||||
|
|
||||||
public override int Priority {
|
public override int Priority { get { return -2; } }
|
||||||
get { return -2; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Motion() {
|
public Motion() {
|
||||||
SubmitPropOp("motion", new PropOp.String(v => motion = v));
|
SubmitPropOp("motion", new PropOp.String(v => motion = v));
|
||||||
@@ -413,9 +406,7 @@ namespace Cryville.Crtr {
|
|||||||
default: return base.GetEventsOfType(type);
|
default: return base.GetEventsOfType(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override int Priority {
|
public override int Priority { get { return 12; } }
|
||||||
get { return 12; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Judge : ChartEvent {
|
public class Judge : ChartEvent {
|
||||||
@@ -428,9 +419,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
|
|
||||||
public override int Priority {
|
public override int Priority { get { return 0; } }
|
||||||
get { return 0; }
|
public override bool Standalone { get { return true; } }
|
||||||
}
|
|
||||||
|
|
||||||
public Judge() {
|
public Judge() {
|
||||||
SubmitPropSrc("name", new PropSrc.Identifier(() => Id.Key));
|
SubmitPropSrc("name", new PropSrc.Identifier(() => Id.Key));
|
||||||
@@ -444,9 +434,7 @@ namespace Cryville.Crtr {
|
|||||||
public class Signature : ChartEvent {
|
public class Signature : ChartEvent {
|
||||||
public float? tempo;
|
public float? tempo;
|
||||||
|
|
||||||
public override int Priority {
|
public override int Priority { get { return -4; } }
|
||||||
get { return -4; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Sound> sounds;
|
public List<Sound> sounds;
|
||||||
@@ -457,9 +445,7 @@ namespace Cryville.Crtr {
|
|||||||
// TODO [Obsolete]
|
// TODO [Obsolete]
|
||||||
public float offset;
|
public float offset;
|
||||||
|
|
||||||
public override int Priority {
|
public override int Priority { get { return 0; } }
|
||||||
get { return 0; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@ using UnityEngine;
|
|||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.Scripting;
|
using UnityEngine.Scripting;
|
||||||
using UnityEngine.UI;
|
|
||||||
using diag = System.Diagnostics;
|
using diag = System.Diagnostics;
|
||||||
using Logger = Cryville.Common.Logger;
|
using Logger = Cryville.Common.Logger;
|
||||||
|
|
||||||
@@ -43,14 +42,14 @@ namespace Cryville.Crtr {
|
|||||||
EventBus bbus;
|
EventBus bbus;
|
||||||
EventBus tbus;
|
EventBus tbus;
|
||||||
EventBus nbus;
|
EventBus nbus;
|
||||||
|
InputProxy inputProxy;
|
||||||
Judge judge;
|
Judge judge;
|
||||||
|
public static EffectManager effectManager;
|
||||||
bool started = false;
|
bool started = false;
|
||||||
|
|
||||||
static bool initialized;
|
static bool initialized;
|
||||||
static Text logs;
|
TextMeshProUGUI logs;
|
||||||
TextMeshProUGUI status;
|
TextMeshProUGUI status;
|
||||||
readonly TargetString statusstr = new TargetString();
|
|
||||||
readonly StringBuffer statusbuf = new StringBuffer();
|
|
||||||
|
|
||||||
static Vector2 screenSize;
|
static Vector2 screenSize;
|
||||||
public static Rect hitRect;
|
public static Rect hitRect;
|
||||||
@@ -63,6 +62,7 @@ namespace Cryville.Crtr {
|
|||||||
static double renderStep = 0.05;
|
static double renderStep = 0.05;
|
||||||
public static double actualRenderStep = 0;
|
public static double actualRenderStep = 0;
|
||||||
static bool autoRenderStep = false;
|
static bool autoRenderStep = false;
|
||||||
|
public static float graphicalOffset = 0;
|
||||||
public static float soundOffset = 0;
|
public static float soundOffset = 0;
|
||||||
static float startOffset = 0;
|
static float startOffset = 0;
|
||||||
public static float sv = 16f;
|
public static float sv = 16f;
|
||||||
@@ -70,15 +70,15 @@ namespace Cryville.Crtr {
|
|||||||
public static Dictionary<Identifier, MotionRegistry> motionRegistry = new Dictionary<Identifier, MotionRegistry>();
|
public static Dictionary<Identifier, MotionRegistry> motionRegistry = new Dictionary<Identifier, MotionRegistry>();
|
||||||
|
|
||||||
public static PdtEvaluator etor;
|
public static PdtEvaluator etor;
|
||||||
|
|
||||||
InputProxy inputProxy;
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region MonoBehaviour
|
#region MonoBehaviour
|
||||||
void Start() {
|
void Start() {
|
||||||
|
d_addLogEntry = new Action<int, string, string>(AddLogEntry);
|
||||||
|
|
||||||
var logobj = GameObject.Find("Logs");
|
var logobj = GameObject.Find("Logs");
|
||||||
if (logobj != null)
|
if (logobj != null)
|
||||||
logs = logobj.GetComponent<Text>();
|
logs = logobj.GetComponent<TextMeshProUGUI>();
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
Game.Init();
|
Game.Init();
|
||||||
GenericResources.LoadDefault();
|
GenericResources.LoadDefault();
|
||||||
@@ -133,7 +133,7 @@ namespace Cryville.Crtr {
|
|||||||
if (forceSyncFrames != 0) {
|
if (forceSyncFrames != 0) {
|
||||||
forceSyncFrames--;
|
forceSyncFrames--;
|
||||||
double target = Game.AudioClient.Position - atime0;
|
double target = Game.AudioClient.Position - atime0;
|
||||||
dt = target - cbus.Time;
|
dt = target - cbus.Time - graphicalOffset;
|
||||||
step = autoRenderStep ? 1f / Application.targetFrameRate : renderStep;
|
step = autoRenderStep ? 1f / Application.targetFrameRate : renderStep;
|
||||||
inputProxy.SyncTime(target);
|
inputProxy.SyncTime(target);
|
||||||
}
|
}
|
||||||
@@ -142,6 +142,7 @@ namespace Cryville.Crtr {
|
|||||||
step = autoRenderStep ? Time.smoothDeltaTime : renderStep;
|
step = autoRenderStep ? Time.smoothDeltaTime : renderStep;
|
||||||
}
|
}
|
||||||
inputProxy.ForceTick();
|
inputProxy.ForceTick();
|
||||||
|
if (paused) return;
|
||||||
cbus.ForwardByTime(dt);
|
cbus.ForwardByTime(dt);
|
||||||
bbus.ForwardByTime(dt);
|
bbus.ForwardByTime(dt);
|
||||||
UnityEngine.Profiling.Profiler.BeginSample("ChartPlayer.Forward");
|
UnityEngine.Profiling.Profiler.BeginSample("ChartPlayer.Forward");
|
||||||
@@ -160,6 +161,8 @@ namespace Cryville.Crtr {
|
|||||||
tbus.ForwardStepByTime(renderDist, step);
|
tbus.ForwardStepByTime(renderDist, step);
|
||||||
tbus.EndGraphicalUpdate();
|
tbus.EndGraphicalUpdate();
|
||||||
UnityEngine.Profiling.Profiler.EndSample();
|
UnityEngine.Profiling.Profiler.EndSample();
|
||||||
|
|
||||||
|
effectManager.Tick(cbus.Time);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
Game.LogException("Game", "An error occured while playing", ex);
|
Game.LogException("Game", "An error occured while playing", ex);
|
||||||
@@ -175,6 +178,12 @@ namespace Cryville.Crtr {
|
|||||||
if (texHandler.isDone) {
|
if (texHandler.isDone) {
|
||||||
var tex = texHandler.texture;
|
var tex = texHandler.texture;
|
||||||
tex.wrapMode = TextureWrapMode.Clamp;
|
tex.wrapMode = TextureWrapMode.Clamp;
|
||||||
|
if (frames.ContainsKey(name)) {
|
||||||
|
Logger.Log("main", 3, "Load/Prehandle", "Duplicated texture name: {0}", name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
frames.Add(name, new SpriteFrame(tex));
|
||||||
|
}
|
||||||
texs.Add(name, tex);
|
texs.Add(name, tex);
|
||||||
texLoader.Dispose();
|
texLoader.Dispose();
|
||||||
texHandler.Dispose();
|
texHandler.Dispose();
|
||||||
@@ -190,14 +199,14 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (texLoader == null)
|
if (texLoader == null) {
|
||||||
if (texLoadQueue.Count > 0) {
|
if (texLoadQueue.Count > 0) {
|
||||||
#if UNITY_5_4_OR_NEWER
|
#if UNITY_5_4_OR_NEWER
|
||||||
texHandler = new DownloadHandlerTexture();
|
texHandler = new DownloadHandlerTexture();
|
||||||
texLoader = new UnityWebRequest(Game.FileProtocolPrefix + texLoadQueue.Dequeue(), "GET", texHandler, null);
|
texLoader = new UnityWebRequest(Game.FileProtocolPrefix + texLoadQueue.Dequeue(), "GET", texHandler, null);
|
||||||
texLoader.SendWebRequest();
|
texLoader.SendWebRequest();
|
||||||
#else
|
#else
|
||||||
texLoader = new WWW(Game.FileProtocolPrefix + texLoadQueue.Dequeue());
|
texLoader = new WWW(Game.FileProtocolPrefix + texLoadQueue.Dequeue());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (!texloaddone) {
|
else if (!texloaddone) {
|
||||||
@@ -205,6 +214,7 @@ namespace Cryville.Crtr {
|
|||||||
texloadtimer.Stop();
|
texloadtimer.Stop();
|
||||||
Logger.Log("main", 1, "Load/MainThread", "Main thread done ({0}ms)", texloadtimer.Elapsed.TotalMilliseconds);
|
Logger.Log("main", 1, "Load/MainThread", "Main thread done ({0}ms)", texloadtimer.Elapsed.TotalMilliseconds);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!loadThread.IsAlive) {
|
if (!loadThread.IsAlive) {
|
||||||
if (threadException != null) {
|
if (threadException != null) {
|
||||||
Logger.Log("main", 4, "Load/MainThread", "Load failed");
|
Logger.Log("main", 4, "Load/MainThread", "Load failed");
|
||||||
@@ -220,25 +230,46 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
readonly TargetString statusstr = new TargetString();
|
||||||
|
readonly StringBuffer statusbuf = new StringBuffer();
|
||||||
|
readonly TargetString logsstr = new TargetString();
|
||||||
|
readonly StringBuffer logsbuf = new StringBuffer();
|
||||||
|
readonly List<string> logEntries = new List<string>();
|
||||||
|
int logsLength = 0;
|
||||||
|
Action<int, string, string> d_addLogEntry;
|
||||||
|
void AddLogEntry(int level, string module, string msg) {
|
||||||
|
string color;
|
||||||
|
switch (level) {
|
||||||
|
case 0: color = "#888888"; break;
|
||||||
|
case 1: color = "#bbbbbb"; break;
|
||||||
|
case 2: color = "#0088ff"; break;
|
||||||
|
case 3: color = "#ffff00"; break;
|
||||||
|
case 4: color = "#ff0000"; break;
|
||||||
|
case 5: color = "#bb0000"; break;
|
||||||
|
default: color = "#ff00ff"; break;
|
||||||
|
}
|
||||||
|
var l = string.Format(
|
||||||
|
"\n<color={1}bb><{2}> {3}</color>",
|
||||||
|
DateTime.UtcNow.ToString("s"), color, module, msg
|
||||||
|
);
|
||||||
|
logEntries.Add(l);
|
||||||
|
logsLength += l.Length;
|
||||||
|
}
|
||||||
void LogUpdate() {
|
void LogUpdate() {
|
||||||
string _logs = logs.text;
|
logsbuf.Clear();
|
||||||
Game.MainLogger.Enumerate((level, module, msg) => {
|
Game.MainLogger.Enumerate(d_addLogEntry);
|
||||||
string color;
|
while (logsLength >= 4096) {
|
||||||
switch (level) {
|
logsLength -= logEntries[0].Length;
|
||||||
case 0: color = "#888888"; break;
|
logEntries.RemoveAt(0);
|
||||||
case 1: color = "#bbbbbb"; break;
|
}
|
||||||
case 2: color = "#0088ff"; break;
|
foreach (var l in logEntries) {
|
||||||
case 3: color = "#ffff00"; break;
|
logsbuf.Append(l);
|
||||||
case 4: color = "#ff0000"; break;
|
}
|
||||||
case 5: color = "#bb0000"; break;
|
logsstr.Length = logsbuf.Count;
|
||||||
default: color = "#ff00ff"; break;
|
var larr = logsstr.TrustedAsArray();
|
||||||
}
|
logsbuf.CopyTo(0, larr, 0, logsbuf.Count);
|
||||||
_logs += string.Format(
|
logs.SetText(larr, 0, logsbuf.Count);
|
||||||
"\r\n<color={1}bb><{2}> {3}</color>",
|
|
||||||
DateTime.UtcNow.ToString("s"), color, module, msg
|
|
||||||
);
|
|
||||||
});
|
|
||||||
logs.text = _logs.Substring(Mathf.Max(0, _logs.IndexOf('\n', Mathf.Max(0, _logs.Length - 4096))));
|
|
||||||
statusbuf.Clear();
|
statusbuf.Clear();
|
||||||
statusbuf.AppendFormat(
|
statusbuf.AppendFormat(
|
||||||
"FPS: i{0:0} / s{1:0}\nSMem: {2:N0} / {3:N0}\nIMem: {4:N0} / {5:N0}",
|
"FPS: i{0:0} / s{1:0}\nSMem: {2:N0} / {3:N0}\nIMem: {4:N0} / {5:N0}",
|
||||||
@@ -258,15 +289,19 @@ namespace Cryville.Crtr {
|
|||||||
);
|
);
|
||||||
if (started) {
|
if (started) {
|
||||||
statusbuf.AppendFormat(
|
statusbuf.AppendFormat(
|
||||||
"\nStates: c{0} / b{1}",
|
"\nStates: c{0} / b{1}\nPools: RMV {2}, MC {3}",
|
||||||
cbus.ActiveStateCount, bbus.ActiveStateCount
|
cbus.ActiveStateCount, bbus.ActiveStateCount,
|
||||||
|
ContainerState.RMVPool.RentedCount,
|
||||||
|
ContainerState.MCPool.RentedCount
|
||||||
);
|
);
|
||||||
statusbuf.AppendFormat(
|
statusbuf.AppendFormat(
|
||||||
"\nSTime: {0:G17}s {3}\ndATime: {1:+0.0ms;-0.0ms;0} {3}\ndITime: {2:+0.0ms;-0.0ms;0} {3}",
|
"\nSTime: {0:G17}s {3} {4}\ndATime: {1:+0.0ms;-0.0ms;0} {3} {4}\ndITime: {2:+0.0ms;-0.0ms;0} {3} {5}",
|
||||||
cbus.Time,
|
cbus.Time,
|
||||||
(Game.AudioClient.Position - atime0 - cbus.Time) * 1e3,
|
(Game.AudioClient.Position - atime0 - cbus.Time) * 1e3,
|
||||||
(inputProxy.GetTimestampAverage() - cbus.Time) * 1e3,
|
(inputProxy.GetTimestampAverage() - cbus.Time) * 1e3,
|
||||||
forceSyncFrames != 0 ? "(force sync)" : ""
|
forceSyncFrames != 0 ? "(force sync)" : "",
|
||||||
|
paused ? "(paused)" : "",
|
||||||
|
paused ? "(semi-locked)" : ""
|
||||||
);
|
);
|
||||||
if (judge != null) {
|
if (judge != null) {
|
||||||
statusbuf.Append("\n== Scores ==\n");
|
statusbuf.Append("\n== Scores ==\n");
|
||||||
@@ -275,9 +310,9 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusstr.Length = statusbuf.Count;
|
statusstr.Length = statusbuf.Count;
|
||||||
var arr = statusstr.TrustedAsArray();
|
var sarr = statusstr.TrustedAsArray();
|
||||||
statusbuf.CopyTo(0, arr, 0, statusbuf.Count);
|
statusbuf.CopyTo(0, sarr, 0, statusbuf.Count);
|
||||||
status.SetText(arr, 0, statusbuf.Count);
|
status.SetText(sarr, 0, statusbuf.Count);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -307,6 +342,8 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
bool logEnabled = true;
|
bool logEnabled = true;
|
||||||
public void ToggleLogs() {
|
public void ToggleLogs() {
|
||||||
|
logEntries.Clear();
|
||||||
|
logsLength = 0;
|
||||||
logs.text = "";
|
logs.text = "";
|
||||||
status.SetText("");
|
status.SetText("");
|
||||||
logEnabled = !logEnabled;
|
logEnabled = !logEnabled;
|
||||||
@@ -319,6 +356,20 @@ namespace Cryville.Crtr {
|
|||||||
else Logger.Log("main", 2, "Load/MainThread", "The chart is currently loading");
|
else Logger.Log("main", 2, "Load/MainThread", "The chart is currently loading");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool paused = false;
|
||||||
|
public void TogglePause() {
|
||||||
|
paused = !paused;
|
||||||
|
if (!paused) {
|
||||||
|
forceSyncFrames = Settings.Default.ForceSyncFrames;
|
||||||
|
Game.AudioClient.Start();
|
||||||
|
inputProxy.UnlockTime();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Game.AudioClient.Pause();
|
||||||
|
inputProxy.LockTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Load
|
#region Load
|
||||||
@@ -329,9 +380,10 @@ namespace Cryville.Crtr {
|
|||||||
renderStep = Settings.Default.RenderStep;
|
renderStep = Settings.Default.RenderStep;
|
||||||
actualRenderStep = renderStep;
|
actualRenderStep = renderStep;
|
||||||
autoRenderStep = renderStep == 0;
|
autoRenderStep = renderStep == 0;
|
||||||
|
graphicalOffset = Settings.Default.GraphicalOffset;
|
||||||
soundOffset = Settings.Default.SoundOffset;
|
soundOffset = Settings.Default.SoundOffset;
|
||||||
startOffset = Settings.Default.StartOffset;
|
startOffset = Settings.Default.StartOffset;
|
||||||
forceSyncFrames= Settings.Default.ForceSyncFrames;
|
forceSyncFrames = Settings.Default.ForceSyncFrames;
|
||||||
texloaddone = false;
|
texloaddone = false;
|
||||||
Game.NetworkTaskWorker.SuspendBackgroundTasks();
|
Game.NetworkTaskWorker.SuspendBackgroundTasks();
|
||||||
Game.AudioSession = Game.AudioSequencer.NewSession();
|
Game.AudioSession = Game.AudioSequencer.NewSession();
|
||||||
@@ -368,6 +420,7 @@ namespace Cryville.Crtr {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
sv = _rscfg.generic.ScrollVelocity;
|
sv = _rscfg.generic.ScrollVelocity;
|
||||||
|
soundOffset += _rscfg.generic.SoundOffset;
|
||||||
|
|
||||||
FileInfo skinFile = new FileInfo(
|
FileInfo skinFile = new FileInfo(
|
||||||
string.Format("{0}/skins/{1}/{2}/.umgs", Game.GameDataPath, rulesetFile.Directory.Name, _rscfg.generic.Skin)
|
string.Format("{0}/skins/{1}/{2}/.umgs", Game.GameDataPath, rulesetFile.Directory.Name, _rscfg.generic.Skin)
|
||||||
@@ -402,16 +455,6 @@ namespace Cryville.Crtr {
|
|||||||
try {
|
try {
|
||||||
diag::Stopwatch timer = new diag::Stopwatch();
|
diag::Stopwatch timer = new diag::Stopwatch();
|
||||||
timer.Reset(); timer.Start();
|
timer.Reset(); timer.Start();
|
||||||
Logger.Log("main", 0, "Load/Prehandle", "Initializing textures");
|
|
||||||
foreach (var t in texs) {
|
|
||||||
if (frames.ContainsKey(t.Key)) {
|
|
||||||
Logger.Log("main", 3, "Load/Prehandle", "Duplicated texture name: {0}", t.Key);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var f = new SpriteFrame(t.Value);
|
|
||||||
f.Init();
|
|
||||||
frames.Add(t.Key, f);
|
|
||||||
}
|
|
||||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 2)");
|
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 2)");
|
||||||
cbus.BroadcastPreInit();
|
cbus.BroadcastPreInit();
|
||||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)");
|
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)");
|
||||||
@@ -428,8 +471,10 @@ namespace Cryville.Crtr {
|
|||||||
timer.Stop();
|
timer.Stop();
|
||||||
Logger.Log("main", 1, "Load/Prehandle", "Prehandling done ({0}ms)", timer.Elapsed.TotalMilliseconds);
|
Logger.Log("main", 1, "Load/Prehandle", "Prehandling done ({0}ms)", timer.Elapsed.TotalMilliseconds);
|
||||||
if (Settings.Default.ClearLogOnPlay) {
|
if (Settings.Default.ClearLogOnPlay) {
|
||||||
logs.text = "";
|
logEntries.Clear();
|
||||||
|
logsLength = 0;
|
||||||
Game.MainLogger.Enumerate((level, module, msg) => { });
|
Game.MainLogger.Enumerate((level, module, msg) => { });
|
||||||
|
logs.text = "";
|
||||||
}
|
}
|
||||||
Game.AudioSequencer.Playing = true;
|
Game.AudioSequencer.Playing = true;
|
||||||
atime0 = Game.AudioClient.BufferPosition;
|
atime0 = Game.AudioClient.BufferPosition;
|
||||||
@@ -447,12 +492,16 @@ namespace Cryville.Crtr {
|
|||||||
public void Stop() {
|
public void Stop() {
|
||||||
try {
|
try {
|
||||||
Logger.Log("main", 1, "Game", "Stopping");
|
Logger.Log("main", 1, "Game", "Stopping");
|
||||||
|
Game.AudioClient.Start();
|
||||||
Game.AudioSession = Game.AudioSequencer.NewSession();
|
Game.AudioSession = Game.AudioSequencer.NewSession();
|
||||||
inputProxy.Deactivate();
|
inputProxy.Deactivate();
|
||||||
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
||||||
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
||||||
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
||||||
if (cbus != null) { cbus.Dispose(); cbus.DisposeAll(); cbus = null; }
|
if (cbus != null) { cbus.Dispose(); cbus.DisposeAll(); cbus = null; }
|
||||||
|
effectManager.Dispose();
|
||||||
|
effectManager = null;
|
||||||
|
etor = null;
|
||||||
Logger.Log("main", 1, "Game", "Stopped");
|
Logger.Log("main", 1, "Game", "Stopped");
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
@@ -496,8 +545,6 @@ namespace Cryville.Crtr {
|
|||||||
try {
|
try {
|
||||||
workerTimer = new diag::Stopwatch();
|
workerTimer = new diag::Stopwatch();
|
||||||
workerTimer.Start();
|
workerTimer.Start();
|
||||||
RMVPool.Prepare();
|
|
||||||
MotionCachePool.Prepare();
|
|
||||||
LoadChart(info);
|
LoadChart(info);
|
||||||
workerTimer.Stop();
|
workerTimer.Stop();
|
||||||
Logger.Log("main", 1, "Load/WorkerThread", "Worker thread done ({0}ms)", workerTimer.Elapsed.TotalMilliseconds);
|
Logger.Log("main", 1, "Load/WorkerThread", "Worker thread done ({0}ms)", workerTimer.Elapsed.TotalMilliseconds);
|
||||||
@@ -533,12 +580,12 @@ namespace Cryville.Crtr {
|
|||||||
LoadSkin(info.skinFile);
|
LoadSkin(info.skinFile);
|
||||||
|
|
||||||
Logger.Log("main", 0, "Load/WorkerThread", "Initializing judge and input");
|
Logger.Log("main", 0, "Load/WorkerThread", "Initializing judge and input");
|
||||||
judge = new Judge(pruleset);
|
judge = new Judge(this, pruleset);
|
||||||
etor.ContextJudge = judge;
|
etor.ContextJudge = judge;
|
||||||
|
|
||||||
inputProxy = new InputProxy(pruleset, judge);
|
inputProxy = new InputProxy(pruleset, judge);
|
||||||
inputProxy.LoadFrom(_rscfg.inputs);
|
inputProxy.LoadFrom(_rscfg.inputs);
|
||||||
if (!inputProxy.IsCompleted) {
|
if (!inputProxy.IsCompleted()) {
|
||||||
throw new ArgumentException("Input config not completed\nPlease complete the input settings");
|
throw new ArgumentException("Input config not completed\nPlease complete the input settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,6 +633,8 @@ namespace Cryville.Crtr {
|
|||||||
pruleset = ruleset.Root;
|
pruleset = ruleset.Root;
|
||||||
pruleset.Optimize(etor);
|
pruleset.Optimize(etor);
|
||||||
}
|
}
|
||||||
|
ContainerState.RMVPool = new RMVPool();
|
||||||
|
ContainerState.MCPool = new MotionCachePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSkin(FileInfo file) {
|
void LoadSkin(FileInfo file) {
|
||||||
@@ -594,6 +643,7 @@ namespace Cryville.Crtr {
|
|||||||
skin.LoadPdt(dir);
|
skin.LoadPdt(dir);
|
||||||
pskin = skin.Root;
|
pskin = skin.Root;
|
||||||
pskin.Optimize(etor);
|
pskin.Optimize(etor);
|
||||||
|
effectManager = new EffectManager(pskin);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Components {
|
namespace Cryville.Crtr.Components {
|
||||||
public abstract class MeshBase : SkinComponent {
|
public abstract class MeshBase : SkinComponent {
|
||||||
@@ -7,6 +8,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected MeshWrapper mesh = new MeshWrapper();
|
protected MeshWrapper mesh = new MeshWrapper();
|
||||||
|
protected Material[] materials;
|
||||||
|
|
||||||
short _zindex;
|
short _zindex;
|
||||||
public short ZIndex {
|
public short ZIndex {
|
||||||
@@ -22,9 +24,16 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
protected void UpdateZIndex() {
|
protected void UpdateZIndex() {
|
||||||
if (!mesh.Initialized) return;
|
if (!mesh.Initialized) return;
|
||||||
foreach (var mat in mesh.Renderer.materials) {
|
foreach (var mat in materials) {
|
||||||
mat.renderQueue = _zindex;
|
mat.renderQueue = _zindex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected override void OnDestroy() {
|
||||||
|
if (materials != null)
|
||||||
|
foreach (var mat in materials) {
|
||||||
|
Material.Destroy(mat);
|
||||||
|
}
|
||||||
|
mesh.Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
|
|
||||||
public SectionalGameObject() {
|
public SectionalGameObject() {
|
||||||
SubmitProperty("partial", new PropOp.Boolean(v => part = Part.idle));
|
SubmitProperty("partial", new PropOp.Boolean(v => part = Part.idle));
|
||||||
SubmitProperty("part", new PropOp.Enum<Part>(v => part = v, v => (Part)v), 2);
|
SubmitProperty("part", new PropOp.Enum<Part>(v => part = v, v => (Part)v), 1);
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDestroy() {
|
|
||||||
mesh.Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init() {
|
public override void Init() {
|
||||||
@@ -67,7 +63,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
SubmitProperty("head", new PropOp.String(v => head.FrameName = v));
|
SubmitProperty("head", new PropOp.String(v => head.FrameName = v));
|
||||||
SubmitProperty("body", new PropOp.String(v => body.FrameName = v));
|
SubmitProperty("body", new PropOp.String(v => body.FrameName = v));
|
||||||
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v));
|
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v));
|
||||||
SubmitProperty("shape", new op_set_shape(this), 2);
|
SubmitProperty("shape", new op_set_shape(this), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
@@ -80,11 +76,10 @@ namespace Cryville.Crtr.Components {
|
|||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
if (o.Type != PdtInternalType.Vector) throw new ArgumentException("Not a vector");
|
if (o.Type != PdtInternalType.Vector) throw new ArgumentException("Not a vector");
|
||||||
_self._shapeLength = (o.Length - sizeof(int)) / sizeof(Vector2);
|
_self._shapeLength = (o.Length - sizeof(int)) / sizeof(Vector2);
|
||||||
var ptr = (Vector2*)o.TrustedAsOfLength(sizeof(Vector2));
|
|
||||||
if (_self._shape != null) _shapePool.Return(_self._shape);
|
if (_self._shape != null) _shapePool.Return(_self._shape);
|
||||||
_self._shape = _shapePool.Rent(_self._shapeLength);
|
_self._shape = _shapePool.Rent(_self._shapeLength);
|
||||||
for (int i = 0; i < _self._shapeLength; i++) {
|
for (int i = 0; i < _self._shapeLength; i++) {
|
||||||
_self._shape[i] = ptr[i];
|
_self._shape[i] = o.As<Vector2>(i * sizeof(Vector2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,23 +107,25 @@ namespace Cryville.Crtr.Components {
|
|||||||
base.Init();
|
base.Init();
|
||||||
mesh.Init(transform);
|
mesh.Init(transform);
|
||||||
|
|
||||||
var mats = mesh.Renderer.materials = new Material[] { mesh.NewMaterial, mesh.NewMaterial, mesh.NewMaterial };
|
mesh.Renderer.materials = materials = new Material[] {
|
||||||
head.Bind(mats[0]);
|
MeshWrapper.NewMaterial(),
|
||||||
body.Bind(mats[1]);
|
MeshWrapper.NewMaterial(),
|
||||||
tail.Bind(mats[2]);
|
MeshWrapper.NewMaterial(),
|
||||||
|
};
|
||||||
|
head.Bind(materials[0]);
|
||||||
|
body.Bind(materials[1]);
|
||||||
|
tail.Bind(materials[2]);
|
||||||
|
|
||||||
UpdateZIndex();
|
UpdateZIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDestroy() {
|
protected override void OnDestroy() {
|
||||||
base.OnDestroy();
|
|
||||||
Reset();
|
|
||||||
foreach (var m in mesh.Renderer.materials) Material.Destroy(m);
|
|
||||||
if (_shape != null) _shapePool.Return(_shape);
|
if (_shape != null) _shapePool.Return(_shape);
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
_ptPool.Return(vertices);
|
_ptPool.Return(vertices);
|
||||||
_lPool.Return(lengths);
|
_lPool.Return(lengths);
|
||||||
}
|
}
|
||||||
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AppendPointInternal(Vector3 p, Quaternion r) {
|
protected override void AppendPointInternal(Vector3 p, Quaternion r) {
|
||||||
@@ -152,7 +149,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
List<Vector3> verts;
|
List<Vector3> verts;
|
||||||
List<Vector2> uvs;
|
List<Vector2> uvs;
|
||||||
List<int> trih = null, trib = null, trit = null;
|
List<int> trih = null, trib = null, trit = null;
|
||||||
static List<int> _emptyTris = new List<int>();
|
static readonly List<int> _emptyTris = new List<int>();
|
||||||
|
|
||||||
public override void Seal() {
|
public override void Seal() {
|
||||||
if (vertCount <= 1 || sumLength == 0) return;
|
if (vertCount <= 1 || sumLength == 0) return;
|
||||||
|
5
Assets/Cryville/Crtr/Components/SkinAnimation.cs
Normal file
5
Assets/Cryville/Crtr/Components/SkinAnimation.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
namespace Cryville.Crtr.Components {
|
||||||
|
public class SkinAnimation : SkinComponent {
|
||||||
|
protected override void OnDestroy() { }
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/Components/SkinAnimation.cs.meta
Normal file
11
Assets/Cryville/Crtr/Components/SkinAnimation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 80318e36af5412345871bdbf80d49ef2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -14,8 +14,8 @@ namespace Cryville.Crtr.Components {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name of the property.</param>
|
/// <param name="name">The name of the property.</param>
|
||||||
/// <param name="property">The property.</param>
|
/// <param name="property">The property.</param>
|
||||||
protected void SubmitProperty(string name, PdtOperator property, int uct = 1) {
|
protected void SubmitProperty(string name, PdtOperator property, int udl = 0) {
|
||||||
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, uct));
|
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, udl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,10 +30,10 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
public struct SkinProperty {
|
public struct SkinProperty {
|
||||||
public PdtOperator Operator { get; set; }
|
public PdtOperator Operator { get; set; }
|
||||||
public int UpdateCloneType { get; set; }
|
public int UpdateDynamicLevel { get; set; }
|
||||||
public SkinProperty(PdtOperator op, int uct = 1) {
|
public SkinProperty(PdtOperator op, int udl = 0) {
|
||||||
Operator = op;
|
Operator = op;
|
||||||
UpdateCloneType = uct;
|
UpdateDynamicLevel = udl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,19 +16,15 @@ namespace Cryville.Crtr.Components {
|
|||||||
public op_set_bound(SpriteBase self) : base(2) {
|
public op_set_bound(SpriteBase self) : base(2) {
|
||||||
_self = self;
|
_self = self;
|
||||||
}
|
}
|
||||||
protected unsafe override void Execute() {
|
protected override void Execute() {
|
||||||
_self.SetBound(
|
_self.SetBound(
|
||||||
*(Vector2*)GetOperand(0).TrustedAsOfLength(sizeof(Vector2)),
|
GetOperand(0).As<Vector2>(),
|
||||||
*(Vector3*)GetOperand(1).TrustedAsOfLength(sizeof(Vector3))
|
GetOperand(1).As<Vector3>()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
|
|
||||||
protected override void OnDestroy() {
|
|
||||||
mesh.Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 _scale = Vector2.one;
|
Vector2 _scale = Vector2.one;
|
||||||
public Vector2 Scale {
|
public Vector2 Scale {
|
||||||
get { return _scale; }
|
get { return _scale; }
|
||||||
@@ -92,6 +88,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
|
|
||||||
protected void InternalInit(string meshName = "quad") {
|
protected void InternalInit(string meshName = "quad") {
|
||||||
mesh.Init(transform);
|
mesh.Init(transform);
|
||||||
|
mesh.Renderer.materials = materials = new Material[] { MeshWrapper.NewMaterial() };
|
||||||
mesh.Mesh = GenericResources.Meshes[meshName];
|
mesh.Mesh = GenericResources.Meshes[meshName];
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
UpdateZIndex();
|
UpdateZIndex();
|
||||||
|
@@ -29,19 +29,12 @@ namespace Cryville.Crtr.Components {
|
|||||||
return Rect.width / Rect.height;
|
return Rect.width / Rect.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool _loaded;
|
|
||||||
Material _mat;
|
Material _mat;
|
||||||
public void Bind(Material mat) {
|
public void Bind(Material mat) {
|
||||||
_loaded = true;
|
|
||||||
_mat = mat;
|
_mat = mat;
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
public void Load() {
|
|
||||||
_loaded = true;
|
|
||||||
Reload();
|
|
||||||
}
|
|
||||||
public void Reload() {
|
public void Reload() {
|
||||||
if (!_loaded) return;
|
|
||||||
if (!string.IsNullOrEmpty(FrameName)) {
|
if (!string.IsNullOrEmpty(FrameName)) {
|
||||||
if (ChartPlayer.frames.ContainsKey(FrameName)) {
|
if (ChartPlayer.frames.ContainsKey(FrameName)) {
|
||||||
Frame = ChartPlayer.frames[FrameName];
|
Frame = ChartPlayer.frames[FrameName];
|
||||||
@@ -56,11 +49,16 @@ namespace Cryville.Crtr.Components {
|
|||||||
_mat.mainTexture = Frame == null ? null : Frame.Texture;
|
_mat.mainTexture = Frame == null ? null : Frame.Texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static bool IsNullOrEmpty(SpriteInfo sprite) {
|
||||||
|
return sprite == null || sprite.Frame == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpritePlane : SpriteBase {
|
public class SpritePlane : SpriteBase {
|
||||||
public SpritePlane() {
|
public SpritePlane() {
|
||||||
SubmitProperty("frame", new PropOp.String(v => Frame = v));
|
SubmitProperty("frame", new PropOp.String(v => Frame = v));
|
||||||
|
SubmitProperty("frames", new PropOp.StringArray(v => Frames = v));
|
||||||
|
SubmitProperty("index", new PropOp.Integer(v => Index = v));
|
||||||
SubmitProperty("fit", new PropOp.Enum<FitMode>(v => Fit = v, v => (FitMode)v));
|
SubmitProperty("fit", new PropOp.Enum<FitMode>(v => Fit = v, v => (FitMode)v));
|
||||||
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
||||||
}
|
}
|
||||||
@@ -83,37 +81,61 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SpriteInfo frameInfo = new SpriteInfo();
|
int m_index;
|
||||||
|
public int Index {
|
||||||
public string Frame {
|
get { return m_index; }
|
||||||
get { return frameInfo.FrameName; }
|
|
||||||
set {
|
set {
|
||||||
frameInfo.FrameName = value;
|
m_index = value;
|
||||||
OnFrameUpdate();
|
OnFrameUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SpriteInfo[] m_frames = new SpriteInfo[] { new SpriteInfo() };
|
||||||
|
public string[] Frames {
|
||||||
|
set {
|
||||||
|
m_frames = new SpriteInfo[value.Length];
|
||||||
|
for (int i = 0; i < value.Length; i++) {
|
||||||
|
m_frames[i] = new SpriteInfo() { FrameName = value[i] };
|
||||||
|
}
|
||||||
|
OnFrameUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Frame {
|
||||||
|
set {
|
||||||
|
if (value == CurrentFrame.FrameName) return;
|
||||||
|
CurrentFrame.FrameName = value;
|
||||||
|
OnFrameUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected SpriteInfo CurrentFrame {
|
||||||
|
get {
|
||||||
|
if (m_frames.Length == 0) return null;
|
||||||
|
if (m_index < 0) m_index = 0;
|
||||||
|
else if (m_index >= m_frames.Length) m_index = m_frames.Length - 1;
|
||||||
|
return m_frames[m_index];
|
||||||
|
}
|
||||||
|
}
|
||||||
protected void OnFrameUpdate() {
|
protected void OnFrameUpdate() {
|
||||||
if (!mesh.Initialized) return;
|
if (!mesh.Initialized) return;
|
||||||
if (frameInfo.Frame == null) {
|
var frame = CurrentFrame;
|
||||||
|
if (SpriteInfo.IsNullOrEmpty(frame)) {
|
||||||
mesh.Renderer.enabled = false;
|
mesh.Renderer.enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mesh.Renderer.enabled = true;
|
mesh.Renderer.enabled = true;
|
||||||
|
mesh.Renderer.material.mainTexture = frame.Frame.Texture;
|
||||||
UpdateUV();
|
UpdateUV();
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
UpdateZIndex();
|
UpdateZIndex();
|
||||||
}
|
}
|
||||||
|
readonly Vector2[] _uvs = new Vector2[4];
|
||||||
protected virtual void UpdateUV() {
|
protected virtual void UpdateUV() {
|
||||||
if (frameInfo.Frame == null) {
|
var frame = CurrentFrame;
|
||||||
Logger.Log("main", 4, "Skin", "Unable to load texture {0}", frameInfo.FrameName);
|
if (SpriteInfo.IsNullOrEmpty(frame)) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
Vector2[] muv = OriginalUV;
|
Vector2[] muv = OriginalUV;
|
||||||
Vector2[] uv = new Vector2[muv.Length];
|
for (int i = 0; i < _uvs.Length; i++) {
|
||||||
for (int i = 0; i < uv.Length; i++) {
|
_uvs[i] = frame.Frame.GetUV(muv[i]);
|
||||||
uv[i] = frameInfo.Frame.GetUV(muv[i]);
|
|
||||||
}
|
}
|
||||||
mesh.Mesh.uv = uv;
|
mesh.Mesh.uv = _uvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
float _opacity = 1;
|
float _opacity = 1;
|
||||||
@@ -124,7 +146,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
UpdateOpacity();
|
UpdateOpacity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void UpdateOpacity() {
|
protected void UpdateOpacity() {
|
||||||
if (!mesh.Initialized) return;
|
if (!mesh.Initialized) return;
|
||||||
var c = mesh.Renderer.material.color;
|
var c = mesh.Renderer.material.color;
|
||||||
c.a = _opacity;
|
c.a = _opacity;
|
||||||
@@ -144,7 +166,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateScale() {
|
protected override void UpdateScale() {
|
||||||
if (frameInfo.Frame == null) return;
|
if (SpriteInfo.IsNullOrEmpty(CurrentFrame)) return;
|
||||||
base.UpdateScale();
|
base.UpdateScale();
|
||||||
if (m_fit != FitMode.none && Scale.x != Scale.y) m_fit = FitMode.none;
|
if (m_fit != FitMode.none && Scale.x != Scale.y) m_fit = FitMode.none;
|
||||||
}
|
}
|
||||||
@@ -153,8 +175,8 @@ namespace Cryville.Crtr.Components {
|
|||||||
get {
|
get {
|
||||||
switch (m_fit) {
|
switch (m_fit) {
|
||||||
case FitMode.none: return Vector3.one;
|
case FitMode.none: return Vector3.one;
|
||||||
case FitMode.width: return new Vector3(1, 1, 1 / frameInfo.Ratio);
|
case FitMode.width: return new Vector3(1, 1, 1 / CurrentFrame.Ratio);
|
||||||
case FitMode.height: return new Vector3(frameInfo.Ratio, 1, 1);
|
case FitMode.height: return new Vector3(CurrentFrame.Ratio, 1, 1);
|
||||||
default: throw new NotSupportedException("Unsupported fit mode");
|
default: throw new NotSupportedException("Unsupported fit mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +184,6 @@ namespace Cryville.Crtr.Components {
|
|||||||
|
|
||||||
public override void Init() {
|
public override void Init() {
|
||||||
InternalInit();
|
InternalInit();
|
||||||
frameInfo.Bind(mesh.Renderer.material);
|
|
||||||
OnFrameUpdate();
|
OnFrameUpdate();
|
||||||
UpdateOpacity();
|
UpdateOpacity();
|
||||||
}
|
}
|
||||||
|
@@ -44,24 +44,26 @@ namespace Cryville.Crtr.Components {
|
|||||||
UpdateUV();
|
UpdateUV();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly Vector2[] _uvs = new Vector2[8];
|
||||||
|
readonly Vector3[] _verts = new Vector3[8];
|
||||||
protected override void UpdateUV() {
|
protected override void UpdateUV() {
|
||||||
Vector2[] muv = OriginalUV;
|
var frame = CurrentFrame;
|
||||||
Vector2[] uv = new Vector2[muv.Length];
|
if (SpriteInfo.IsNullOrEmpty(frame)) return;
|
||||||
|
|
||||||
var or = frameInfo.Ratio;
|
Vector2[] muv = OriginalUV;
|
||||||
|
|
||||||
|
var or = frame.Ratio;
|
||||||
var sr = Scale.x / Scale.y;
|
var sr = Scale.x / Scale.y;
|
||||||
var b = new Vector2(
|
var rr = or / sr;
|
||||||
(or / sr) * _border.x,
|
var b1 = rr * _border.x;
|
||||||
1 - (or / sr) * (1 - _border.y)
|
var b2 = 1 - rr * (1 - _border.y);
|
||||||
);
|
|
||||||
Vector3[] vert = mesh.Mesh.vertices;
|
|
||||||
|
|
||||||
for (int i = 0; i < muv.Length; i++) {
|
for (int i = 0; i < muv.Length; i++) {
|
||||||
float x; float bx;
|
float x; float bx;
|
||||||
switch ((int)muv[i].x) {
|
switch ((int)muv[i].x) {
|
||||||
case 0: x = 0; bx = 0; break;
|
case 0: x = 0; bx = 0; break;
|
||||||
case 1: x = _border.x; bx = b.x; break;
|
case 1: x = _border.x; bx = b1; break;
|
||||||
case 2: x = _border.y; bx = b.y; break;
|
case 2: x = _border.y; bx = b2; break;
|
||||||
case 3: x = 1; bx = 1; break;
|
case 3: x = 1; bx = 1; break;
|
||||||
default: throw new NotSupportedException("Built-in resource corrupted");
|
default: throw new NotSupportedException("Built-in resource corrupted");
|
||||||
}
|
}
|
||||||
@@ -71,18 +73,18 @@ namespace Cryville.Crtr.Components {
|
|||||||
case 3: y = 1; break;
|
case 3: y = 1; break;
|
||||||
default: throw new NotSupportedException("Built-in resource corrupted");
|
default: throw new NotSupportedException("Built-in resource corrupted");
|
||||||
}
|
}
|
||||||
uv[i] = frameInfo.Frame.GetUV(x, y);
|
_uvs[i] = frame.Frame.GetUV(x, y);
|
||||||
bx -= 0.5f; y -= 0.5f;
|
bx -= 0.5f; y -= 0.5f;
|
||||||
vert[i] = new Vector3(bx, 0, y);
|
_verts[i] = new Vector3(bx, 0, y);
|
||||||
}
|
}
|
||||||
mesh.Mesh.uv = uv;
|
mesh.Mesh.uv = _uvs;
|
||||||
mesh.Mesh.vertices = vert;
|
mesh.Mesh.vertices = _verts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init() {
|
public override void Init() {
|
||||||
frameInfo.Load();
|
|
||||||
InternalInit("quad_scale3h");
|
InternalInit("quad_scale3h");
|
||||||
OnFrameUpdate();
|
OnFrameUpdate();
|
||||||
|
UpdateOpacity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,8 @@ namespace Cryville.Crtr.Components {
|
|||||||
var values = GetOperand(1);
|
var values = GetOperand(1);
|
||||||
int arrtype; int len;
|
int arrtype; int len;
|
||||||
values.GetArraySuffix(out arrtype, out len);
|
values.GetArraySuffix(out arrtype, out len);
|
||||||
|
if (arrtype != PdtInternalType.String) throw new InvalidCastException("Not an array of strings");
|
||||||
|
if (len != keys.Length) throw new ArgumentException("Length of key not equal to frame count");
|
||||||
var result = new Dictionary<char, SpriteInfo>(len);
|
var result = new Dictionary<char, SpriteInfo>(len);
|
||||||
int o = 0;
|
int o = 0;
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
@@ -77,7 +79,6 @@ namespace Cryville.Crtr.Components {
|
|||||||
verts.Clear();
|
verts.Clear();
|
||||||
uvs.Clear();
|
uvs.Clear();
|
||||||
foreach (var f in m_frames) {
|
foreach (var f in m_frames) {
|
||||||
f.Value.Load();
|
|
||||||
if (frameHeight == 0) frameHeight = f.Value.Rect.height;
|
if (frameHeight == 0) frameHeight = f.Value.Rect.height;
|
||||||
else if (frameHeight != f.Value.Rect.height) throw new Exception("Inconsistent frame height for text component");
|
else if (frameHeight != f.Value.Rect.height) throw new Exception("Inconsistent frame height for text component");
|
||||||
var tex = f.Value.Frame.Texture;
|
var tex = f.Value.Frame.Texture;
|
||||||
@@ -85,6 +86,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
var m = new MeshWrapper();
|
var m = new MeshWrapper();
|
||||||
m.Init(mesh.MeshTransform);
|
m.Init(mesh.MeshTransform);
|
||||||
m.Mesh = new Mesh();
|
m.Mesh = new Mesh();
|
||||||
|
m.Renderer.material = MeshWrapper.NewMaterial(); // TODO Destroy or add to `materials`
|
||||||
m.Renderer.material.mainTexture = tex;
|
m.Renderer.material.mainTexture = tex;
|
||||||
meshes.Add(tex, m);
|
meshes.Add(tex, m);
|
||||||
verts.Add(tex, new List<Vector3>());
|
verts.Add(tex, new List<Vector3>());
|
||||||
@@ -102,10 +104,11 @@ namespace Cryville.Crtr.Components {
|
|||||||
void UpdateMeshes() {
|
void UpdateMeshes() {
|
||||||
if (meshes.Count == 0) return;
|
if (meshes.Count == 0) return;
|
||||||
sum_x = 0;
|
sum_x = 0;
|
||||||
foreach (var t in meshes.Keys) {
|
foreach (var t in meshes) {
|
||||||
verts[t].Clear();
|
var key = t.Key;
|
||||||
uvs[t].Clear();
|
verts[key].Clear();
|
||||||
tris[t].Clear();
|
uvs[key].Clear();
|
||||||
|
tris[key].Clear();
|
||||||
}
|
}
|
||||||
foreach (var c in m_value) {
|
foreach (var c in m_value) {
|
||||||
var f = m_frames[c];
|
var f = m_frames[c];
|
||||||
@@ -121,11 +124,12 @@ namespace Cryville.Crtr.Components {
|
|||||||
uvs[t].Add(f.Frame.GetUV(new Vector2(0, 1)));
|
uvs[t].Add(f.Frame.GetUV(new Vector2(0, 1)));
|
||||||
sum_x += w + m_spacing;
|
sum_x += w + m_spacing;
|
||||||
}
|
}
|
||||||
foreach (var t in meshes.Keys) {
|
foreach (var t in meshes) {
|
||||||
var m = meshes[t].Mesh;
|
var key = t.Key;
|
||||||
|
var m = meshes[key].Mesh;
|
||||||
m.Clear();
|
m.Clear();
|
||||||
int cc = verts[t].Count / 4;
|
int cc = verts[key].Count / 4;
|
||||||
var _tris = tris[t];
|
var _tris = tris[key];
|
||||||
for (int i = 0; i < cc; i++) {
|
for (int i = 0; i < cc; i++) {
|
||||||
_tris.Add(i * 4);
|
_tris.Add(i * 4);
|
||||||
_tris.Add(i * 4 + 3);
|
_tris.Add(i * 4 + 3);
|
||||||
@@ -134,9 +138,9 @@ namespace Cryville.Crtr.Components {
|
|||||||
_tris.Add(i * 4 + 3);
|
_tris.Add(i * 4 + 3);
|
||||||
_tris.Add(i * 4 + 2);
|
_tris.Add(i * 4 + 2);
|
||||||
}
|
}
|
||||||
m.SetVertices(verts[t]);
|
m.SetVertices(verts[key]);
|
||||||
m.SetUVs(0, uvs[t]);
|
m.SetUVs(0, uvs[key]);
|
||||||
m.SetTriangles(tris[t], 0);
|
m.SetTriangles(tris[key], 0);
|
||||||
m.RecalculateNormals();
|
m.RecalculateNormals();
|
||||||
}
|
}
|
||||||
sum_x -= m_spacing;
|
sum_x -= m_spacing;
|
||||||
@@ -164,10 +168,10 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
void UpdateOpacity() {
|
void UpdateOpacity() {
|
||||||
if (!mesh.Initialized) return;
|
if (!mesh.Initialized) return;
|
||||||
foreach (var m in meshes.Values) {
|
foreach (var m in meshes) {
|
||||||
var c = m.Renderer.material.color;
|
var c = m.Value.Renderer.material.color;
|
||||||
c.a = _opacity;
|
c.a = _opacity;
|
||||||
m.Renderer.material.color = c;
|
m.Value.Renderer.material.color = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,11 +3,13 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using Logger = Cryville.Common.Logger;
|
using Logger = Cryville.Common.Logger;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Config {
|
namespace Cryville.Crtr.Config {
|
||||||
public class ConfigScene : MonoBehaviour {
|
public class ConfigPanelMaster : MonoBehaviour {
|
||||||
|
[SerializeField]
|
||||||
|
Menu m_menu;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
Transform m_content;
|
Transform m_content;
|
||||||
|
|
||||||
@@ -20,7 +22,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
public Ruleset ruleset;
|
public Ruleset ruleset;
|
||||||
RulesetConfig _rscfg;
|
RulesetConfig _rscfg;
|
||||||
|
|
||||||
void Start() {
|
void OnEnable() {
|
||||||
try {
|
try {
|
||||||
ChartPlayer.etor = new PdtEvaluator();
|
ChartPlayer.etor = new PdtEvaluator();
|
||||||
FileInfo file = new FileInfo(
|
FileInfo file = new FileInfo(
|
||||||
@@ -57,11 +59,13 @@ namespace Cryville.Crtr.Config {
|
|||||||
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;
|
||||||
|
|
||||||
|
m_inputConfigPanel.OnConfigEnable();
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
Popup.CreateException(ex);
|
Popup.CreateException(ex);
|
||||||
Logger.Log("main", 4, "Config", "An error occured while loading the config: {0}", ex);
|
Logger.Log("main", 4, "Config", "An error occured while loading the config: {0}", ex);
|
||||||
ReturnToMenu();
|
m_menu.Back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +76,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
cat.SetActive(true);
|
cat.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveAndReturnToMenu() {
|
void OnDisable() {
|
||||||
m_inputConfigPanel.proxy.SaveTo(_rscfg.inputs);
|
m_inputConfigPanel.proxy.SaveTo(_rscfg.inputs);
|
||||||
m_inputConfigPanel.proxy.Dispose();
|
m_inputConfigPanel.proxy.Dispose();
|
||||||
FileInfo cfgfile = new FileInfo(
|
FileInfo cfgfile = new FileInfo(
|
||||||
@@ -81,15 +85,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
using (StreamWriter cfgwriter = new StreamWriter(cfgfile.FullName, false, Encoding.UTF8)) {
|
using (StreamWriter cfgwriter = new StreamWriter(cfgfile.FullName, false, Encoding.UTF8)) {
|
||||||
cfgwriter.Write(JsonConvert.SerializeObject(_rscfg, Game.GlobalJsonSerializerSettings));
|
cfgwriter.Write(JsonConvert.SerializeObject(_rscfg, Game.GlobalJsonSerializerSettings));
|
||||||
}
|
}
|
||||||
ReturnToMenu();
|
m_inputConfigPanel.OnConfigDisable();
|
||||||
}
|
|
||||||
public void ReturnToMenu() {
|
|
||||||
GameObject.Find("Master").GetComponent<Master>().ShowMenu();
|
|
||||||
#if UNITY_5_5_OR_NEWER
|
|
||||||
SceneManager.UnloadSceneAsync("Config");
|
|
||||||
#elif UNITY_5_3_OR_NEWER
|
|
||||||
SceneManager.UnloadScene("Config");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
using Cryville.Common.Unity;
|
using Cryville.Common;
|
||||||
|
using Cryville.Common.Unity;
|
||||||
using Cryville.Common.Unity.Input;
|
using Cryville.Common.Unity.Input;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -7,7 +8,7 @@ using UnityEngine.UI;
|
|||||||
namespace Cryville.Crtr.Config {
|
namespace Cryville.Crtr.Config {
|
||||||
public class InputConfigPanel : MonoBehaviour {
|
public class InputConfigPanel : MonoBehaviour {
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
ConfigScene m_configScene;
|
ConfigPanelMaster m_configScene;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
GameObject m_inputDialog;
|
GameObject m_inputDialog;
|
||||||
@@ -24,12 +25,12 @@ namespace Cryville.Crtr.Config {
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
GameObject m_prefabInputConfigEntry;
|
GameObject m_prefabInputConfigEntry;
|
||||||
|
|
||||||
readonly SimpleInputConsumer _consumer = new SimpleInputConsumer(Game.InputManager);
|
SimpleInputConsumer _consumer;
|
||||||
public InputProxy proxy;
|
public InputProxy proxy;
|
||||||
readonly Dictionary<string, InputConfigPanelEntry> _entries = new Dictionary<string, InputConfigPanelEntry>();
|
readonly Dictionary<Identifier, InputConfigPanelEntry> _entries = new Dictionary<Identifier, InputConfigPanelEntry>();
|
||||||
|
|
||||||
string _sel;
|
Identifier _sel;
|
||||||
public void OpenDialog(string entry) {
|
public void OpenDialog(Identifier entry) {
|
||||||
_sel = entry;
|
_sel = entry;
|
||||||
m_inputDialog.SetActive(true);
|
m_inputDialog.SetActive(true);
|
||||||
CallHelper.Purge(m_deviceList);
|
CallHelper.Purge(m_deviceList);
|
||||||
@@ -50,7 +51,10 @@ namespace Cryville.Crtr.Config {
|
|||||||
CloseDialog();
|
CloseDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start() {
|
public void OnConfigEnable() {
|
||||||
|
CallHelper.Purge(m_entryList);
|
||||||
|
_entries.Clear();
|
||||||
|
_consumer = new SimpleInputConsumer(Game.InputManager);
|
||||||
_consumer.Activate();
|
_consumer.Activate();
|
||||||
foreach (var i in m_configScene.ruleset.Root.inputs) {
|
foreach (var i in m_configScene.ruleset.Root.inputs) {
|
||||||
var e = GameObject.Instantiate(m_prefabInputConfigEntry, m_entryList.transform).GetComponent<InputConfigPanelEntry>();
|
var e = GameObject.Instantiate(m_prefabInputConfigEntry, m_entryList.transform).GetComponent<InputConfigPanelEntry>();
|
||||||
@@ -61,13 +65,12 @@ namespace Cryville.Crtr.Config {
|
|||||||
proxy.ProxyChanged += OnProxyChanged;
|
proxy.ProxyChanged += OnProxyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy() {
|
public void OnConfigDisable() {
|
||||||
_consumer.Deactivate();
|
_consumer.Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnProxyChanged(object sender, ProxyChangedEventArgs e) {
|
void OnProxyChanged(object sender, ProxyChangedEventArgs e) {
|
||||||
_entries[e.Name].SetEnabled(!e.Used);
|
_entries[e.Name].OnProxyChanged(e);
|
||||||
_entries[e.Name].SetValue(e.Proxy == null ? "None" : e.Proxy.Value.Handler.GetTypeName(e.Proxy.Value.Type));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly List<InputSource?> _recvsrcs = new List<InputSource?>();
|
readonly List<InputSource?> _recvsrcs = new List<InputSource?>();
|
||||||
@@ -83,9 +86,21 @@ namespace Cryville.Crtr.Config {
|
|||||||
if (_recvsrcs.Contains(src)) return;
|
if (_recvsrcs.Contains(src)) return;
|
||||||
_recvsrcs.Add(src);
|
_recvsrcs.Add(src);
|
||||||
var obj = Instantiate(m_prefabListItem, m_deviceList);
|
var obj = Instantiate(m_prefabListItem, m_deviceList);
|
||||||
obj.transform.Find("Text").GetComponent<Text>().text = src == null ? "None" : src.Value.Handler.GetTypeName(src.Value.Type);
|
var text = obj.transform.Find("Text").GetComponent<Text>();
|
||||||
|
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) {
|
||||||
|
var tsrc = src.Value;
|
||||||
|
bool flag = false;
|
||||||
|
if (proxy.IsUsed(tsrc)) {
|
||||||
|
text.text += " (Used)";
|
||||||
|
}
|
||||||
|
else if (tsrc.Handler.GetDimension(src.Value.Type) < m_configScene.ruleset.Root.inputs[_sel].dim) {
|
||||||
|
text.text += " (Not Applicable)";
|
||||||
|
}
|
||||||
|
else flag = true;
|
||||||
|
btn.interactable = flag;
|
||||||
|
}
|
||||||
btn.onClick.AddListener(() => {
|
btn.onClick.AddListener(() => {
|
||||||
CloseDialog(src);
|
CloseDialog(src);
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
using UnityEngine;
|
using Cryville.Common;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Config {
|
namespace Cryville.Crtr.Config {
|
||||||
@@ -12,20 +14,31 @@ namespace Cryville.Crtr.Config {
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
Button m_button;
|
Button m_button;
|
||||||
|
|
||||||
public void SetKey(InputConfigPanel master, string name) {
|
public void SetKey(InputConfigPanel master, Identifier name) {
|
||||||
m_key.text = name;
|
m_key.text = (string)name.Name;
|
||||||
m_value.text = "None";
|
m_value.text = "None";
|
||||||
m_button.onClick.AddListener(() => {
|
m_button.onClick.AddListener(() => {
|
||||||
master.OpenDialog(name);
|
master.OpenDialog(name);
|
||||||
|
EventSystem.current.SetSelectedGameObject(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValue(string name) {
|
public void OnProxyChanged(ProxyChangedEventArgs e) {
|
||||||
m_value.text = name;
|
if (e.Used) {
|
||||||
}
|
m_button.interactable = false;
|
||||||
|
m_value.text = "(Not Required)";
|
||||||
public void SetEnabled(bool flag) {
|
}
|
||||||
m_button.interactable = flag;
|
else {
|
||||||
|
m_button.interactable = true;
|
||||||
|
if (e.Proxy == null) {
|
||||||
|
m_value.text = "(Unassigned)";
|
||||||
|
if (e.Required) m_value.text += " (Required)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_value.text = e.Proxy.Value.Handler.GetTypeName(e.Proxy.Value.Type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_value.color = e.Required ? Color.yellow : Color.black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,12 @@ namespace Cryville.Crtr.Config {
|
|||||||
[JsonProperty("skin")]
|
[JsonProperty("skin")]
|
||||||
public string Skin { get; set; }
|
public string Skin { get; set; }
|
||||||
|
|
||||||
|
[Category("gameplay")]
|
||||||
|
[JsonProperty("sound_offset")]
|
||||||
|
[Step(0.04f)]
|
||||||
|
[Precision(1e-3)]
|
||||||
|
public float SoundOffset { get; set; }
|
||||||
|
|
||||||
[Category("deprecated")][Obsolete]
|
[Category("deprecated")][Obsolete]
|
||||||
[JsonProperty("scroll_velocity")][DefaultValue(1)]
|
[JsonProperty("scroll_velocity")][DefaultValue(1)]
|
||||||
[LogarithmicScale][Step(0.5f)][Precision(1e-1)]
|
[LogarithmicScale][Step(0.5f)][Precision(1e-1)]
|
||||||
@@ -19,6 +25,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
|
|
||||||
public Generic() {
|
public Generic() {
|
||||||
Skin = "";
|
Skin = "";
|
||||||
|
SoundOffset = 0;
|
||||||
ScrollVelocity = 1;
|
ScrollVelocity = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
59
Assets/Cryville/Crtr/EffectGroup.cs
Normal file
59
Assets/Cryville/Crtr/EffectGroup.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Cryville.Common.Buffers;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr {
|
||||||
|
public class EffectGroup {
|
||||||
|
public EffectDefinition Definition { get; private set; }
|
||||||
|
readonly EffectPool _pool;
|
||||||
|
class EffectPool : ObjectPool<EffectInstance> {
|
||||||
|
readonly List<EffectInstance> _instances
|
||||||
|
= new List<EffectInstance>();
|
||||||
|
readonly EffectGroup _group;
|
||||||
|
public EffectPool(EffectGroup group) : base(256) {
|
||||||
|
_group = group;
|
||||||
|
}
|
||||||
|
protected override EffectInstance Construct() {
|
||||||
|
var result = new EffectInstance(_group.Definition);
|
||||||
|
_instances.Add(result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public void DisposeAll() {
|
||||||
|
foreach (var i in _instances) i.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
readonly Dictionary<float, EffectInstance> _instances
|
||||||
|
= new Dictionary<float, EffectInstance>();
|
||||||
|
readonly List<EffectInstance> _endQueue
|
||||||
|
= new List<EffectInstance>();
|
||||||
|
public EffectGroup(EffectDefinition def) {
|
||||||
|
Definition = def;
|
||||||
|
_pool = new EffectPool(this);
|
||||||
|
}
|
||||||
|
double _time;
|
||||||
|
public void Tick(double time) {
|
||||||
|
_time = time;
|
||||||
|
while (_endQueue.Count > 0) {
|
||||||
|
var item = _endQueue[0];
|
||||||
|
if (item.EndTime > _time) break;
|
||||||
|
item.OnDone();
|
||||||
|
_instances.Remove(item.Index);
|
||||||
|
_pool.Return(item);
|
||||||
|
_endQueue.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Emit(float index) {
|
||||||
|
EffectInstance instance;
|
||||||
|
if (!_instances.TryGetValue(index, out instance)) {
|
||||||
|
_instances.Add(index, instance = _pool.Rent());
|
||||||
|
}
|
||||||
|
instance.Index = index;
|
||||||
|
instance.OnEmit(_time);
|
||||||
|
var i = _endQueue.BinarySearch(instance);
|
||||||
|
if (i < 0) i = ~i;
|
||||||
|
_endQueue.Insert(i, instance);
|
||||||
|
}
|
||||||
|
public void Dispose() {
|
||||||
|
_pool.DisposeAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/EffectGroup.cs.meta
Normal file
11
Assets/Cryville/Crtr/EffectGroup.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d0d27f9b4383b3445a2a27bfe94173a5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
66
Assets/Cryville/Crtr/EffectInstance.cs
Normal file
66
Assets/Cryville/Crtr/EffectInstance.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using Cryville.Common;
|
||||||
|
using Cryville.Crtr.Components;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr {
|
||||||
|
public class EffectInstance : ISkinnableGroup, IComparable<EffectInstance> {
|
||||||
|
readonly EffectDefinition _def;
|
||||||
|
readonly SkinContainer _skinContainer;
|
||||||
|
public Transform RootTransform { get; private set; }
|
||||||
|
public EffectInstance(EffectDefinition def) {
|
||||||
|
_def = def;
|
||||||
|
_skinContainer = new SkinContainer(_def.elements);
|
||||||
|
RootTransform = new GameObject("effect:" + GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
||||||
|
SkinContext = new SkinContext(RootTransform);
|
||||||
|
ChartPlayer.etor.ContextCascadeInsertBlock();
|
||||||
|
_skinContainer.MatchStatic(this);
|
||||||
|
ChartPlayer.etor.ContextCascadeDiscardBlock();
|
||||||
|
foreach (var i in RootTransform.GetComponentsInChildren<SkinComponent>())
|
||||||
|
i.Init();
|
||||||
|
_indexSrc = new PropSrc.Float(() => Index);
|
||||||
|
_durationOp = new PropOp.Float(v => _duration = v);
|
||||||
|
}
|
||||||
|
public float Index { get; set; }
|
||||||
|
static readonly int _var_index = IdentifierManager.SharedInstance.Request("index");
|
||||||
|
readonly PropSrc _indexSrc;
|
||||||
|
double _startTime;
|
||||||
|
float _duration;
|
||||||
|
readonly PropOp _durationOp;
|
||||||
|
public double EndTime { get { return _startTime + _duration; } }
|
||||||
|
public void OnEmit(double time) {
|
||||||
|
_startTime = time;
|
||||||
|
RootTransform.gameObject.SetActive(true);
|
||||||
|
ChartPlayer.etor.ContextCascadeInsert();
|
||||||
|
ChartPlayer.etor.ContextCascadeUpdate(_var_index, _indexSrc);
|
||||||
|
ChartPlayer.etor.Evaluate(_durationOp, _def.duration);
|
||||||
|
_skinContainer.MatchDynamic(this, 0);
|
||||||
|
ChartPlayer.etor.ContextCascadeDiscard();
|
||||||
|
}
|
||||||
|
public void OnDone() {
|
||||||
|
RootTransform.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
public void Dispose() {
|
||||||
|
GameObject.Destroy(RootTransform.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TypeName { get { throw new InvalidOperationException("Type name undefined"); } }
|
||||||
|
public SkinContext SkinContext { get; private set; }
|
||||||
|
public Anchor OpenedAnchor { get { throw new InvalidOperationException("Anchor not supported"); } }
|
||||||
|
public void PushAnchorEvent(double time, int name) {
|
||||||
|
throw new InvalidOperationException("Anchor not supported");
|
||||||
|
}
|
||||||
|
public void RegisterAnchor(int name) {
|
||||||
|
throw new InvalidOperationException("Anchor not supported");
|
||||||
|
}
|
||||||
|
public bool TryGetAnchorsByName(int name, out IReadOnlyCollection<Anchor> result) {
|
||||||
|
throw new InvalidOperationException("Anchor not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int CompareTo(EffectInstance other) {
|
||||||
|
return EndTime.CompareTo(other.EndTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/EffectInstance.cs.meta
Normal file
11
Assets/Cryville/Crtr/EffectInstance.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f442db34239c47046ba1b6fdae8e1216
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
22
Assets/Cryville/Crtr/EffectManager.cs
Normal file
22
Assets/Cryville/Crtr/EffectManager.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr {
|
||||||
|
public class EffectManager {
|
||||||
|
readonly Dictionary<int, EffectGroup> _groups
|
||||||
|
= new Dictionary<int, EffectGroup>();
|
||||||
|
public EffectManager(PdtSkin skin) {
|
||||||
|
foreach (var e in skin.effects) {
|
||||||
|
_groups.Add(e.Key.Key, new EffectGroup(e.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Tick(double time) {
|
||||||
|
foreach (var g in _groups) g.Value.Tick(time);
|
||||||
|
}
|
||||||
|
public void Emit(int id, float index) {
|
||||||
|
_groups[id].Emit(index);
|
||||||
|
}
|
||||||
|
public void Dispose() {
|
||||||
|
foreach (var g in _groups) g.Value.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/EffectManager.cs.meta
Normal file
11
Assets/Cryville/Crtr/EffectManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 980c0f18a6f491d44a866a85910cb458
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -8,10 +8,9 @@ using System.Runtime.CompilerServices;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Event {
|
namespace Cryville.Crtr.Event {
|
||||||
public abstract class ContainerHandler {
|
public abstract class ContainerHandler : ISkinnableGroup {
|
||||||
#region Struct
|
#region Struct
|
||||||
public ContainerHandler() { }
|
public ContainerHandler() { }
|
||||||
public abstract string TypeName { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prehandling <see cref="ContainerState"/>, prehandling the events.
|
/// Prehandling <see cref="ContainerState"/>, prehandling the events.
|
||||||
@@ -42,7 +41,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
/// <see cref="GameObject"/> group, the <see cref="Transform"/> containing all the generated elements in the <see cref="ContainerHandler"/>.
|
/// <see cref="GameObject"/> group, the <see cref="Transform"/> containing all the generated elements in the <see cref="ContainerHandler"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Transform gogroup;
|
protected Transform gogroup;
|
||||||
public SkinContext SkinContext;
|
|
||||||
|
|
||||||
public Vector3 Position { get; protected set; }
|
public Vector3 Position { get; protected set; }
|
||||||
public Quaternion Rotation { get; protected set; }
|
public Quaternion Rotation { get; protected set; }
|
||||||
@@ -66,23 +64,27 @@ namespace Cryville.Crtr.Event {
|
|||||||
get { return cs.Container; }
|
get { return cs.Container; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static readonly int _var_current_time = IdentifierManager.SharedInstance.Request("current_time");
|
||||||
|
static readonly int _var_invisible_bounds = IdentifierManager.SharedInstance.Request("invisible_bounds");
|
||||||
|
public readonly Dictionary<int, PropSrc> PropSrcs = new Dictionary<int, PropSrc>();
|
||||||
SkinContainer skinContainer;
|
SkinContainer skinContainer;
|
||||||
protected Judge judge;
|
protected Judge judge;
|
||||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||||
skinContainer = new SkinContainer(skin);
|
skinContainer = new SkinContainer(skin.elements);
|
||||||
this.judge = judge;
|
this.judge = judge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly Dictionary<int, List<Anchor>> Anchors = new Dictionary<int, List<Anchor>>();
|
public readonly Dictionary<int, List<Anchor>> Anchors = new Dictionary<int, List<Anchor>>();
|
||||||
public readonly Dictionary<int, Anchor> DynamicAnchors = new Dictionary<int, Anchor>();
|
public readonly Dictionary<int, Anchor> DynamicAnchors = new Dictionary<int, Anchor>();
|
||||||
public readonly Dictionary<int, bool> DynamicAnchorSet = new Dictionary<int, bool>();
|
public readonly Dictionary<int, double> DynamicAnchorSetTime = new Dictionary<int, double>();
|
||||||
public Anchor OpenedAnchor;
|
Anchor a_cur;
|
||||||
protected Anchor a_cur;
|
Anchor a_head;
|
||||||
protected Anchor a_head;
|
Anchor a_tail;
|
||||||
protected Anchor a_tail;
|
readonly static int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
||||||
protected readonly static int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
||||||
protected readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
||||||
protected readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
double atime_head;
|
||||||
|
double atime_tail;
|
||||||
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
|
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
|
||||||
var strname = IdentifierManager.SharedInstance.Retrieve(name);
|
var strname = IdentifierManager.SharedInstance.Retrieve(name);
|
||||||
var go = new GameObject("." + strname).transform;
|
var go = new GameObject("." + strname).transform;
|
||||||
@@ -92,7 +94,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (DynamicAnchors.ContainsKey(name))
|
if (DynamicAnchors.ContainsKey(name))
|
||||||
throw new ArgumentException(string.Format("The anchor \"{0}\" already exists", strname));
|
throw new ArgumentException(string.Format("The anchor \"{0}\" already exists", strname));
|
||||||
DynamicAnchors.Add(name, result);
|
DynamicAnchors.Add(name, result);
|
||||||
DynamicAnchorSet.Add(name, false);
|
DynamicAnchorSetTime.Add(name, double.NaN);
|
||||||
}
|
}
|
||||||
List<Anchor> list;
|
List<Anchor> list;
|
||||||
if (!Anchors.TryGetValue(name, out list))
|
if (!Anchors.TryGetValue(name, out list))
|
||||||
@@ -102,6 +104,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
protected void OpenAnchor(Anchor anchor) {
|
protected void OpenAnchor(Anchor anchor) {
|
||||||
if (OpenedAnchor != null) throw new InvalidOperationException("An anchor has been opened");
|
if (OpenedAnchor != null) throw new InvalidOperationException("An anchor has been opened");
|
||||||
|
anchor.Transform.gameObject.SetActive(true);
|
||||||
OpenedAnchor = anchor;
|
OpenedAnchor = anchor;
|
||||||
}
|
}
|
||||||
protected void CloseAnchor() {
|
protected void CloseAnchor() {
|
||||||
@@ -121,11 +124,17 @@ namespace Cryville.Crtr.Event {
|
|||||||
a_tail = RegisterAnchor(_a_tail, true);
|
a_tail = RegisterAnchor(_a_tail, true);
|
||||||
}
|
}
|
||||||
public virtual void Init() {
|
public virtual void Init() {
|
||||||
skinContainer.MatchStatic(ps);
|
ChartPlayer.etor.ContextState = ps;
|
||||||
|
ChartPlayer.etor.ContextEvent = Container;
|
||||||
|
skinContainer.MatchStatic(this);
|
||||||
|
ChartPlayer.etor.ContextEvent = null;
|
||||||
|
ChartPlayer.etor.ContextState = null;
|
||||||
foreach (var i in gogroup.GetComponentsInChildren<SkinComponent>())
|
foreach (var i in gogroup.GetComponentsInChildren<SkinComponent>())
|
||||||
i.Init();
|
i.Init();
|
||||||
}
|
}
|
||||||
public virtual void PostInit() {
|
public virtual void PostInit() {
|
||||||
|
PropSrcs.Add(_var_current_time, new PropSrc.Float(() => (float)cs.rootPrototype.Time));
|
||||||
|
PropSrcs.Add(_var_invisible_bounds, new PropSrc.Boolean(() => atime_head > atime_tail));
|
||||||
gogroup.gameObject.SetActive(false);
|
gogroup.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -135,8 +144,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
else if (s.CloneType == 17) Init();
|
else if (s.CloneType == 17) Init();
|
||||||
}
|
}
|
||||||
public virtual void StartLogicalUpdate(ContainerState s) { }
|
public virtual void StartLogicalUpdate(ContainerState s) { }
|
||||||
public virtual void StartPreGraphicalUpdate(ContainerState s) { }
|
protected virtual void StartPreGraphicalUpdate(ContainerState s) { }
|
||||||
public virtual void StartGraphicalUpdate(ContainerState s) {
|
protected virtual void StartGraphicalUpdate(ContainerState s) {
|
||||||
if (gogroup) gogroup.gameObject.SetActive(true);
|
if (gogroup) gogroup.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -144,30 +153,30 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (s.CloneType == 3) SetPreGraphicalActive(true, s);
|
if (s.CloneType == 3) SetPreGraphicalActive(true, s);
|
||||||
else if (ev is StampedEvent.Anchor) {
|
else if (ev is StampedEvent.Anchor) {
|
||||||
var tev = (StampedEvent.Anchor)ev;
|
var tev = (StampedEvent.Anchor)ev;
|
||||||
|
if (gogroup) {
|
||||||
|
OpenAnchor(tev.Target);
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
tev.Target.Transform.SetPositionAndRotation(Position, Rotation);
|
||||||
|
#else
|
||||||
|
tev.Target.Transform.position = Position;
|
||||||
|
tev.Target.Transform.rotation = Rotation;
|
||||||
|
#endif
|
||||||
|
MatchDynamic(s, 1);
|
||||||
|
CloseAnchor();
|
||||||
|
}
|
||||||
if (tev.Target == a_head) {
|
if (tev.Target == a_head) {
|
||||||
SetGraphicalActive(true, s);
|
SetGraphicalActive(true, s);
|
||||||
}
|
}
|
||||||
else if (tev.Target == a_tail) {
|
else if (tev.Target == a_tail) {
|
||||||
SetGraphicalActive(false, s);
|
SetGraphicalActive(false, s);
|
||||||
}
|
}
|
||||||
if (gogroup) {
|
|
||||||
OpenAnchor(tev.Target);
|
|
||||||
#if UNITY_5_6_OR_NEWER
|
|
||||||
tev.Target.Transform.SetPositionAndRotation(Position, Rotation);
|
|
||||||
#else
|
|
||||||
tev.Target.Transform.position = GetCurrentWorldPoint();
|
|
||||||
tev.Target.Transform.rotation = Quaternion.Euler(s.Direction);
|
|
||||||
#endif
|
|
||||||
skinContainer.MatchDynamic(s);
|
|
||||||
CloseAnchor();
|
|
||||||
}
|
|
||||||
anchorEvPool.Return(tev);
|
anchorEvPool.Return(tev);
|
||||||
}
|
}
|
||||||
else if (gogroup && s.CloneType == 2) skinContainer.MatchDynamic(s);
|
else if (gogroup && s.CloneType == 2) MatchDynamic(s, 1);
|
||||||
}
|
}
|
||||||
#region End methods
|
#region End methods
|
||||||
public virtual void EndGraphicalUpdate(ContainerState s) { }
|
protected virtual void EndGraphicalUpdate(ContainerState s) { }
|
||||||
public virtual void EndPreGraphicalUpdate(ContainerState s) { }
|
protected virtual void EndPreGraphicalUpdate(ContainerState s) { }
|
||||||
public virtual void EndLogicalUpdate(ContainerState s) { }
|
public virtual void EndLogicalUpdate(ContainerState s) { }
|
||||||
public virtual void EndPhysicalUpdate(ContainerState s) { }
|
public virtual void EndPhysicalUpdate(ContainerState s) { }
|
||||||
public virtual void Dispose() {
|
public virtual void Dispose() {
|
||||||
@@ -177,29 +186,41 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
public virtual void DisposeAll() { }
|
public virtual void DisposeAll() { }
|
||||||
#endregion
|
#endregion
|
||||||
|
#region Utils
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
protected static bool CanDoGraphicalUpdate(ContainerState s) { return s.CloneType >= 2 && s.CloneType < 16; }
|
protected static bool CanDoGraphicalUpdate(ContainerState s) { return s.CloneType >= 2 && s.CloneType < 16; }
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
void MatchDynamic(ContainerState s, int dl) {
|
||||||
|
ChartPlayer.etor.ContextState = s;
|
||||||
|
ChartPlayer.etor.ContextEvent = Container;
|
||||||
|
skinContainer.MatchDynamic(this, dl);
|
||||||
|
ChartPlayer.etor.ContextEvent = null;
|
||||||
|
ChartPlayer.etor.ContextState = null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region Anchor
|
#region Anchor
|
||||||
public virtual void Anchor() {
|
public virtual void Anchor() {
|
||||||
foreach (var a in DynamicAnchors.Keys) DynamicAnchorSet[a] = false;
|
foreach (var p in PropSrcs) p.Value.Invalidate();
|
||||||
skinContainer.MatchDynamic(cs);
|
foreach (var a in DynamicAnchors) DynamicAnchorSetTime[a.Key] = double.NaN;
|
||||||
|
atime_head = cs.StampedContainer.Time;
|
||||||
|
atime_tail = atime_head + cs.StampedContainer.Duration;
|
||||||
|
MatchDynamic(cs, 0);
|
||||||
if (cs.Active) PushAnchorEvent(cs.Time, a_cur);
|
if (cs.Active) PushAnchorEvent(cs.Time, a_cur);
|
||||||
if (Alive) {
|
if (double.IsNaN(DynamicAnchorSetTime[_a_head])) DynamicAnchorSetTime[_a_head] = atime_head;
|
||||||
if (!DynamicAnchorSet[_a_head]) PushAnchorEvent(cs.StampedContainer.Time, a_head, -1, true);
|
if (double.IsNaN(DynamicAnchorSetTime[_a_tail])) DynamicAnchorSetTime[_a_tail] = atime_tail;
|
||||||
if (!DynamicAnchorSet[_a_tail]) PushAnchorEvent(cs.StampedContainer.Time + cs.StampedContainer.Duration, a_tail, 1, true);
|
foreach (var t in DynamicAnchorSetTime) {
|
||||||
|
if (double.IsNaN(t.Value)) continue;
|
||||||
|
int priority = 0;
|
||||||
|
bool forced = true;
|
||||||
|
if (t.Key == _a_head) { priority = -1; }
|
||||||
|
else if (t.Key == _a_tail) { priority = 1; }
|
||||||
|
else forced = false;
|
||||||
|
PushAnchorEvent(t.Value, DynamicAnchors[t.Key], priority, forced);
|
||||||
}
|
}
|
||||||
|
foreach (var anchors in Anchors) foreach (var anchor in anchors.Value) anchor.Transform.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
|
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
|
||||||
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
|
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
|
||||||
public void PushAnchorEvent(double time, int name) {
|
|
||||||
Anchor anchor;
|
|
||||||
if (!DynamicAnchors.TryGetValue(name, out anchor))
|
|
||||||
throw new ArgumentException(string.Format("Specified anchor \"{0}\" not found", IdentifierManager.SharedInstance.Retrieve(name)));
|
|
||||||
if (DynamicAnchorSet[name])
|
|
||||||
throw new InvalidOperationException(string.Format("Specified anchor \"{0}\" has been set", IdentifierManager.SharedInstance.Retrieve(name)));
|
|
||||||
PushAnchorEvent(time, anchor);
|
|
||||||
DynamicAnchorSet[name] = true;
|
|
||||||
}
|
|
||||||
void PushAnchorEvent(double time, Anchor anchor, int priority = 0, bool forced = false) {
|
void PushAnchorEvent(double time, Anchor anchor, int priority = 0, bool forced = false) {
|
||||||
var tev = anchorEvPool.Rent();
|
var tev = anchorEvPool.Rent();
|
||||||
tev.Time = time;
|
tev.Time = time;
|
||||||
@@ -216,5 +237,27 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ISkinnableGroup
|
||||||
|
public abstract string TypeName { get; }
|
||||||
|
public SkinContext SkinContext { get; private set; }
|
||||||
|
public Anchor OpenedAnchor { get; private set; }
|
||||||
|
public bool TryGetAnchorsByName(int name, out IReadOnlyCollection<Anchor> result) {
|
||||||
|
List<Anchor> anchors;
|
||||||
|
var ret = Anchors.TryGetValue(name, out anchors);
|
||||||
|
result = anchors;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
void ISkinnableGroup.RegisterAnchor(int name) {
|
||||||
|
RegisterAnchor(name, true);
|
||||||
|
}
|
||||||
|
public void PushAnchorEvent(double time, int name) {
|
||||||
|
if (!DynamicAnchors.ContainsKey(name))
|
||||||
|
throw new ArgumentException(string.Format("Specified anchor \"{0}\" not found", IdentifierManager.SharedInstance.Retrieve(name)));
|
||||||
|
if (name == _a_head) atime_head = time;
|
||||||
|
else if (name == _a_tail) atime_tail = time;
|
||||||
|
DynamicAnchorSetTime[name] = time;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
//#define DISABLE_CACHE
|
//#define DISABLE_CACHE
|
||||||
|
|
||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
|
using Cryville.Common.Buffers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -70,7 +71,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
|
|
||||||
public byte CloneType;
|
public byte CloneType;
|
||||||
public ContainerState rootPrototype = null;
|
public ContainerState rootPrototype = null;
|
||||||
private ContainerState prototype = null;
|
|
||||||
|
|
||||||
public ContainerHandler Handler {
|
public ContainerHandler Handler {
|
||||||
get;
|
get;
|
||||||
@@ -87,10 +87,13 @@ namespace Cryville.Crtr.Event {
|
|||||||
Container = _ev;
|
Container = _ev;
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
AddChild(_ev, this, parent);
|
AddChild(_ev, parent);
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_rmvpa = new CategorizedPoolAccessor<Identifier, RealtimeMotionValue>(RMVPool);
|
||||||
|
_mcpa = new CategorizedPoolAccessor<Identifier, MotionCache>(MCPool);
|
||||||
|
|
||||||
Values = new Dictionary<Identifier, RealtimeMotionValue>(ChartPlayer.motionRegistry.Count);
|
Values = new Dictionary<Identifier, RealtimeMotionValue>(ChartPlayer.motionRegistry.Count);
|
||||||
CachedValues = new Dictionary<Identifier, MotionCache>(ChartPlayer.motionRegistry.Count);
|
CachedValues = new Dictionary<Identifier, MotionCache>(ChartPlayer.motionRegistry.Count);
|
||||||
foreach (var m in ChartPlayer.motionRegistry)
|
foreach (var m in ChartPlayer.motionRegistry)
|
||||||
@@ -99,11 +102,13 @@ namespace Cryville.Crtr.Event {
|
|||||||
rootPrototype = this;
|
rootPrototype = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddChild(EventContainer c, ContainerState s, ContainerState target) {
|
void AddChild(EventContainer c, ContainerState parent) {
|
||||||
target.Children.Add(c, s);
|
parent.Children.Add(c, this);
|
||||||
Type t = c.GetType();
|
Type t = c.GetType();
|
||||||
if (!target.TypedChildren.ContainsKey(t)) target.TypedChildren.Add(t, new List<ContainerState>());
|
List<ContainerState> tc;
|
||||||
target.TypedChildren[t].Add(s);
|
if (!parent.TypedChildren.TryGetValue(t, out tc))
|
||||||
|
parent.TypedChildren.Add(t, tc = new List<ContainerState>());
|
||||||
|
tc.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerState Clone(byte ct) {
|
public ContainerState Clone(byte ct) {
|
||||||
@@ -116,18 +121,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
r.Values = mvs;
|
r.Values = mvs;
|
||||||
|
|
||||||
var cvs = new Dictionary<Identifier, MotionCache>(ChartPlayer.motionRegistry.Count);
|
var cvs = new Dictionary<Identifier, MotionCache>(ChartPlayer.motionRegistry.Count);
|
||||||
foreach (var cv in CachedValues) {
|
|
||||||
var dv = r.MCPool.Rent(cv.Key);
|
|
||||||
cv.Value.CopyTo(dv);
|
|
||||||
cvs.Add(cv.Key, dv);
|
|
||||||
}
|
|
||||||
r.CachedValues = cvs;
|
r.CachedValues = cvs;
|
||||||
|
|
||||||
r.Children = new Dictionary<EventContainer, ContainerState>();
|
r.Children = new Dictionary<EventContainer, ContainerState>();
|
||||||
|
r.TypedChildren = new Dictionary<Type, List<ContainerState>>();
|
||||||
foreach (var child in Children) {
|
foreach (var child in Children) {
|
||||||
var cc = child.Value.Clone(ct);
|
var cc = child.Value.Clone(ct);
|
||||||
cc.Parent = r;
|
cc.Parent = r;
|
||||||
AddChild(child.Key, cc, r);
|
cc.AddChild(child.Key, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
r.ActiveChildren = new HashSet<EventContainer>();
|
r.ActiveChildren = new HashSet<EventContainer>();
|
||||||
@@ -142,7 +143,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
else if (ct == 3) Handler.ns = r;
|
else if (ct == 3) Handler.ns = r;
|
||||||
else if (ct >= 16) Handler.ps = r;
|
else if (ct >= 16) Handler.ps = r;
|
||||||
else throw new InvalidOperationException("Invalid clone type");
|
else throw new InvalidOperationException("Invalid clone type");
|
||||||
r.prototype = this;
|
|
||||||
r.CloneType = ct;
|
r.CloneType = ct;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
foreach (var cv in CachedValues) {
|
foreach (var cv in CachedValues) {
|
||||||
MotionCache dv;
|
MotionCache dv;
|
||||||
if (!dest.CachedValues.TryGetValue(cv.Key, out dv)) {
|
if (!dest.CachedValues.TryGetValue(cv.Key, out dv)) {
|
||||||
dest.CachedValues.Add(cv.Key, dv = dest.MCPool.Rent(cv.Key));
|
dest.CachedValues.Add(cv.Key, dv = dest._mcpa.Rent(cv.Key));
|
||||||
}
|
}
|
||||||
cv.Value.CopyTo(dv);
|
cv.Value.CopyTo(dv);
|
||||||
}
|
}
|
||||||
@@ -190,10 +190,12 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (Disposed) return;
|
if (Disposed) return;
|
||||||
Disposed = true;
|
Disposed = true;
|
||||||
if (CloneType == 1) Handler.Dispose();
|
if (CloneType == 1) Handler.Dispose();
|
||||||
|
if (CloneType == 1 || CloneType == 17) {
|
||||||
|
_rmvpa.ReturnAll();
|
||||||
|
_mcpa.ReturnAll();
|
||||||
|
}
|
||||||
foreach (var s in Children)
|
foreach (var s in Children)
|
||||||
s.Value.Dispose();
|
s.Value.Dispose();
|
||||||
RMVPool.ReturnAll();
|
|
||||||
MCPool.ReturnAll();
|
|
||||||
}
|
}
|
||||||
public void DisposeAll() {
|
public void DisposeAll() {
|
||||||
foreach (var s in Children)
|
foreach (var s in Children)
|
||||||
@@ -214,8 +216,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Motion
|
#region Motion
|
||||||
readonly RMVPool RMVPool = new RMVPool();
|
internal static RMVPool RMVPool;
|
||||||
readonly MotionCachePool MCPool = new MotionCachePool();
|
internal static MotionCachePool MCPool;
|
||||||
|
readonly CategorizedPoolAccessor<Identifier, RealtimeMotionValue> _rmvpa;
|
||||||
|
readonly CategorizedPoolAccessor<Identifier, MotionCache> _mcpa;
|
||||||
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
||||||
Dictionary<Identifier, RealtimeMotionValue> Values;
|
Dictionary<Identifier, RealtimeMotionValue> Values;
|
||||||
Dictionary<Identifier, MotionCache> CachedValues;
|
Dictionary<Identifier, MotionCache> CachedValues;
|
||||||
@@ -235,7 +239,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
void InvalidateMotion(Identifier name) {
|
void InvalidateMotion(Identifier name) {
|
||||||
MotionCache cache;
|
MotionCache cache;
|
||||||
if (!CachedValues.TryGetValue(name, out cache))
|
if (!CachedValues.TryGetValue(name, out cache))
|
||||||
CachedValues.Add(name, cache = MCPool.Rent(name));
|
CachedValues.Add(name, cache = _mcpa.Rent(name));
|
||||||
cache.Valid = false;
|
cache.Valid = false;
|
||||||
foreach (var c in ActiveChildren)
|
foreach (var c in ActiveChildren)
|
||||||
Children[c].InvalidateMotion(name);
|
Children[c].InvalidateMotion(name);
|
||||||
@@ -244,7 +248,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
public Vector GetRawValue(Identifier key) {
|
public Vector GetRawValue(Identifier key) {
|
||||||
MotionCache tr;
|
MotionCache tr;
|
||||||
if (!CachedValues.TryGetValue(key, out tr))
|
if (!CachedValues.TryGetValue(key, out tr))
|
||||||
CachedValues.Add(key, tr = MCPool.Rent(key));
|
CachedValues.Add(key, tr = _mcpa.Rent(key));
|
||||||
Vector r = tr.Value;
|
Vector r = tr.Value;
|
||||||
#if !DISABLE_CACHE
|
#if !DISABLE_CACHE
|
||||||
if (tr.Valid) return r;
|
if (tr.Valid) return r;
|
||||||
@@ -353,14 +357,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (ev != null) {
|
if (ev != null) {
|
||||||
if (ev.Unstamped is Chart.Motion) {
|
if (ev.Unstamped is Chart.Motion) {
|
||||||
var tev = (Chart.Motion)ev.Unstamped;
|
var tev = (Chart.Motion)ev.Unstamped;
|
||||||
var mv = RMVPool.Rent(tev.Name);
|
var mv = _rmvpa.Rent(tev.Name);
|
||||||
mv.CloneTypeFlag = CloneType;
|
mv.CloneTypeFlag = CloneType;
|
||||||
GetMotionValue(tev.Name).CopyTo(mv);
|
GetMotionValue(tev.Name).CopyTo(mv);
|
||||||
PlayingMotions.Add(ev, mv);
|
PlayingMotions.Add(ev, mv);
|
||||||
Update(ev);
|
Update(ev);
|
||||||
if (!ev.Unstamped.IsLong) {
|
if (!ev.Unstamped.IsLong) {
|
||||||
PlayingMotions.Remove(ev);
|
PlayingMotions.Remove(ev);
|
||||||
RMVPool.Return(mv);
|
_rmvpa.Return(mv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ev.Unstamped is EventContainer) {
|
else if (ev.Unstamped is EventContainer) {
|
||||||
@@ -378,7 +382,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (nev is Chart.Motion) {
|
if (nev is Chart.Motion) {
|
||||||
Update(ev);
|
Update(ev);
|
||||||
var mv = PlayingMotions[ev.Origin];
|
var mv = PlayingMotions[ev.Origin];
|
||||||
if (mv.CloneTypeFlag == CloneType) RMVPool.Return(mv);
|
if (mv.CloneTypeFlag == CloneType) _rmvpa.Return(mv);
|
||||||
PlayingMotions.Remove(ev.Origin);
|
PlayingMotions.Remove(ev.Origin);
|
||||||
}
|
}
|
||||||
else if (nev is EventContainer) {
|
else if (nev is EventContainer) {
|
||||||
@@ -430,14 +434,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
|
|
||||||
public void BroadcastPreInit() {
|
public void BroadcastPreInit() {
|
||||||
Handler.PreInit();
|
Handler.PreInit();
|
||||||
foreach (var c in Children.Values) {
|
foreach (var c in Children) {
|
||||||
c.BroadcastPreInit();
|
c.Value.BroadcastPreInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void BroadcastPostInit() {
|
public void BroadcastPostInit() {
|
||||||
Handler.PostInit();
|
Handler.PostInit();
|
||||||
foreach (var c in Children.Values) {
|
foreach (var c in Children) {
|
||||||
c.BroadcastPostInit();
|
c.Value.BroadcastPostInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,8 +461,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
|
|
||||||
public void Anchor() {
|
public void Anchor() {
|
||||||
Handler.Anchor();
|
Handler.Anchor();
|
||||||
foreach (var ls in Children.Values) {
|
foreach (var ls in Children) {
|
||||||
if (ls.Handler.Alive) ls.Anchor();
|
if (ls.Value.Handler.Alive) ls.Value.Anchor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@@ -48,7 +48,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
foreach (var ev in c.Events) {
|
foreach (var ev in c.Events) {
|
||||||
if (ev.time == null) {
|
if (ev.time == null) {
|
||||||
coevents.Add(ev);
|
if (!ev.Standalone) coevents.Add(ev);
|
||||||
ev.time = c.time;
|
ev.time = c.time;
|
||||||
if (ev is EventContainer)
|
if (ev is EventContainer)
|
||||||
ev.endtime = c.endtime;
|
ev.endtime = c.endtime;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Event {
|
namespace Cryville.Crtr.Event {
|
||||||
public class EventBus : StateBase<EventBatch>, IDisposable {
|
public class EventBus : StateBase<EventBatch>, IDisposable {
|
||||||
EventBus prototype = null;
|
|
||||||
public ContainerState RootState {
|
public ContainerState RootState {
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
@@ -25,7 +25,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
|
|
||||||
public EventBus Clone(byte ct, float offsetTime = 0) {
|
public EventBus Clone(byte ct, float offsetTime = 0) {
|
||||||
var r = (EventBus)MemberwiseClone();
|
var r = (EventBus)MemberwiseClone();
|
||||||
r.prototype = this;
|
|
||||||
r.states = new Dictionary<EventContainer, ContainerState>();
|
r.states = new Dictionary<EventContainer, ContainerState>();
|
||||||
r.activeStates = new HashSet<ContainerState>();
|
r.activeStates = new HashSet<ContainerState>();
|
||||||
r.invalidatedStates = new HashSet<ContainerState>();
|
r.invalidatedStates = new HashSet<ContainerState>();
|
||||||
@@ -64,8 +63,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
s = RootState;
|
s = RootState;
|
||||||
}
|
}
|
||||||
AddState(s);
|
AddState(s);
|
||||||
foreach (var c in s.Children.Values)
|
foreach (var c in s.Children)
|
||||||
Expand(c);
|
Expand(c.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddState(ContainerState s) {
|
public void AddState(ContainerState s) {
|
||||||
@@ -74,13 +73,13 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AttachBus() {
|
void AttachBus() {
|
||||||
foreach (var s in states.Values)
|
foreach (var s in states)
|
||||||
s.Bus = this;
|
s.Value.Bus = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||||
foreach (var s in states.Values)
|
foreach (var s in states)
|
||||||
s.AttachSystems(skin, judge);
|
s.Value.AttachSystems(skin, judge);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<StampedEvent.Temporary> tempEvents = new List<StampedEvent.Temporary>();
|
List<StampedEvent.Temporary> tempEvents = new List<StampedEvent.Temporary>();
|
||||||
@@ -122,6 +121,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
var batch = Events[EventId];
|
var batch = Events[EventId];
|
||||||
for (var i = 0; i < batch.Count; i++) {
|
for (var i = 0; i < batch.Count; i++) {
|
||||||
var ev = batch[i];
|
var ev = batch[i];
|
||||||
|
HandleTempEvents(time0, ev.Priority);
|
||||||
if (ev is StampedEvent.ClipBehind) {
|
if (ev is StampedEvent.ClipBehind) {
|
||||||
var cevs = ev.Origin.Coevents;
|
var cevs = ev.Origin.Coevents;
|
||||||
if (cevs != null) foreach (var cev in cevs) {
|
if (cevs != null) foreach (var cev in cevs) {
|
||||||
@@ -139,16 +139,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
EventId++;
|
EventId++;
|
||||||
}
|
}
|
||||||
if (time2 == time0) {
|
HandleTempEvents(time0);
|
||||||
while (tempEvents.Count > 0) {
|
|
||||||
var ev = tempEvents[0];
|
|
||||||
if (ev.Time != time0) break;
|
|
||||||
if (ev.Container != null) {
|
|
||||||
states[ev.Container].Handle(ev);
|
|
||||||
}
|
|
||||||
tempEvents.RemoveAt(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Time = toTime;
|
Time = toTime;
|
||||||
@@ -156,6 +147,17 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
ValidateStates();
|
ValidateStates();
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
void HandleTempEvents(double time, int maxPriority = int.MaxValue) {
|
||||||
|
while (tempEvents.Count > 0) {
|
||||||
|
var ev2 = tempEvents[0];
|
||||||
|
if (ev2.Time != time || ev2.Priority >= maxPriority) break;
|
||||||
|
if (ev2.Container != null) {
|
||||||
|
states[ev2.Container].Handle(ev2);
|
||||||
|
}
|
||||||
|
tempEvents.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ValidateStates() {
|
private void ValidateStates() {
|
||||||
foreach (var s in invalidatedStates)
|
foreach (var s in invalidatedStates)
|
||||||
|
@@ -11,10 +11,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
Value.CopyTo(dest.Value);
|
Value.CopyTo(dest.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal class MotionCachePool {
|
internal class MotionCachePool : CategorizedPool<Identifier, MotionCache> {
|
||||||
private class Bucket : ObjectPool<MotionCache> {
|
private class Bucket : ObjectPool<MotionCache> {
|
||||||
readonly MotionRegistry _reg;
|
readonly MotionRegistry _reg;
|
||||||
public Bucket(string name, int capacity) : base(capacity) {
|
public Bucket(Identifier name, int capacity) : base(capacity) {
|
||||||
_reg = ChartPlayer.motionRegistry[name];
|
_reg = ChartPlayer.motionRegistry[name];
|
||||||
}
|
}
|
||||||
protected override MotionCache Construct() {
|
protected override MotionCache Construct() {
|
||||||
@@ -22,34 +22,16 @@ namespace Cryville.Crtr.Event {
|
|||||||
result.Value = (Vector)ReflectionHelper.InvokeEmptyConstructor(_reg.Type);
|
result.Value = (Vector)ReflectionHelper.InvokeEmptyConstructor(_reg.Type);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
protected override void Reset(MotionCache obj) {
|
||||||
|
obj.Valid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static Dictionary<Identifier, Bucket> _buckets;
|
readonly Dictionary<Identifier, ObjectPool<MotionCache>> m_buckets;
|
||||||
public static void Prepare() {
|
protected override IReadOnlyDictionary<Identifier, ObjectPool<MotionCache>> Buckets { get { return m_buckets; } }
|
||||||
_buckets = new Dictionary<Identifier, Bucket>(ChartPlayer.motionRegistry.Count);
|
public MotionCachePool() {
|
||||||
|
m_buckets = new Dictionary<Identifier, ObjectPool<MotionCache>>(ChartPlayer.motionRegistry.Count);
|
||||||
foreach (var reg in ChartPlayer.motionRegistry)
|
foreach (var reg in ChartPlayer.motionRegistry)
|
||||||
_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
m_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
||||||
}
|
|
||||||
|
|
||||||
static readonly SimpleObjectPool<Dictionary<MotionCache, Identifier>> _dictPool
|
|
||||||
= new SimpleObjectPool<Dictionary<MotionCache, Identifier>>(1024);
|
|
||||||
Dictionary<MotionCache, Identifier> _rented;
|
|
||||||
public MotionCache Rent(Identifier name) {
|
|
||||||
var obj = _buckets[name].Rent();
|
|
||||||
obj.Valid = false;
|
|
||||||
if (_rented == null) _rented = _dictPool.Rent();
|
|
||||||
_rented.Add(obj, name);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
public void Return(MotionCache obj) {
|
|
||||||
_buckets[_rented[obj]].Return(obj);
|
|
||||||
_rented.Remove(obj);
|
|
||||||
}
|
|
||||||
public void ReturnAll() {
|
|
||||||
if (_rented == null) return;
|
|
||||||
foreach (var obj in _rented)
|
|
||||||
_buckets[obj.Value].Return(obj.Key);
|
|
||||||
_rented.Clear();
|
|
||||||
_dictPool.Return(_rented);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,42 +3,22 @@ using Cryville.Common.Buffers;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Event {
|
namespace Cryville.Crtr.Event {
|
||||||
internal class RMVPool {
|
internal class RMVPool : CategorizedPool<Identifier, RealtimeMotionValue> {
|
||||||
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
||||||
readonly MotionRegistry _reg;
|
readonly MotionRegistry _reg;
|
||||||
public Bucket(string name, int capacity) : base(capacity) {
|
public Bucket(Identifier name, int capacity) : base(capacity) {
|
||||||
_reg = ChartPlayer.motionRegistry[name];
|
_reg = ChartPlayer.motionRegistry[name];
|
||||||
}
|
}
|
||||||
protected override RealtimeMotionValue Construct() {
|
protected override RealtimeMotionValue Construct() {
|
||||||
return new RealtimeMotionValue().Init(_reg.InitValue);
|
return new RealtimeMotionValue().Init(_reg.InitValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static Dictionary<Identifier, Bucket> _buckets;
|
readonly Dictionary<Identifier, ObjectPool<RealtimeMotionValue>> m_buckets;
|
||||||
public static void Prepare() {
|
protected override IReadOnlyDictionary<Identifier, ObjectPool<RealtimeMotionValue>> Buckets { get { return m_buckets; } }
|
||||||
_buckets = new Dictionary<Identifier, Bucket>(ChartPlayer.motionRegistry.Count);
|
public RMVPool() {
|
||||||
|
m_buckets = new Dictionary<Identifier, ObjectPool<RealtimeMotionValue>>(ChartPlayer.motionRegistry.Count);
|
||||||
foreach (var reg in ChartPlayer.motionRegistry)
|
foreach (var reg in ChartPlayer.motionRegistry)
|
||||||
_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
m_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
||||||
}
|
|
||||||
|
|
||||||
static readonly SimpleObjectPool<Dictionary<RealtimeMotionValue, Identifier>> _dictPool
|
|
||||||
= new SimpleObjectPool<Dictionary<RealtimeMotionValue, Identifier>>(1024);
|
|
||||||
Dictionary<RealtimeMotionValue, Identifier> _rented;
|
|
||||||
public RealtimeMotionValue Rent(Identifier name) {
|
|
||||||
var obj = _buckets[name].Rent();
|
|
||||||
if (_rented == null) _rented = _dictPool.Rent();
|
|
||||||
_rented.Add(obj, name);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
public void Return(RealtimeMotionValue obj) {
|
|
||||||
_buckets[_rented[obj]].Return(obj);
|
|
||||||
_rented.Remove(obj);
|
|
||||||
}
|
|
||||||
public void ReturnAll() {
|
|
||||||
if (_rented == null) return;
|
|
||||||
foreach (var obj in _rented)
|
|
||||||
_buckets[obj.Value].Return(obj.Key);
|
|
||||||
_rented.Clear();
|
|
||||||
_dictPool.Return(_rented);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ namespace Cryville.Crtr.Extensions.osu {
|
|||||||
public class osuChartConverter : ResourceConverter {
|
public class osuChartConverter : ResourceConverter {
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
static readonly string[] SUPPORTED_FORMATS = { ".osu" };
|
static readonly string[] SUPPORTED_FORMATS = { ".osu" };
|
||||||
const double OFFSET = 0.07;
|
const double OFFSET = 0.05;
|
||||||
|
|
||||||
public override string[] GetSupportedFormats() {
|
public override string[] GetSupportedFormats() {
|
||||||
return SUPPORTED_FORMATS;
|
return SUPPORTED_FORMATS;
|
||||||
|
@@ -104,16 +104,16 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChartPlayer.motionRegistry = new Dictionary<Identifier, MotionRegistry> {
|
ChartPlayer.motionRegistry = new Dictionary<Identifier, MotionRegistry> {
|
||||||
{ "pt" , new MotionRegistry(typeof(VecPt)) },
|
{ new Identifier("pt") , new MotionRegistry(typeof(VecPt)) },
|
||||||
{ "dir" , new MotionRegistry(typeof(Vec3)) },
|
{ new Identifier("dir") , new MotionRegistry(typeof(Vec3)) },
|
||||||
{ "normal" , new MotionRegistry(typeof(Vec3)) },
|
{ new Identifier("normal") , new MotionRegistry(typeof(Vec3)) },
|
||||||
{ "sv" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, 1f)) },
|
{ new Identifier("sv") , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, 1f)) },
|
||||||
{ "svm" , new MotionRegistry(new Vec1m(1f)) },
|
{ new Identifier("svm") , new MotionRegistry(new Vec1m(1f)) },
|
||||||
{ "dist" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, float.PositiveInfinity)) },
|
{ new Identifier("dist") , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, float.PositiveInfinity)) },
|
||||||
{ "corner" , new MotionRegistry(typeof(VecI1)) },
|
{ new Identifier("corner") , new MotionRegistry(typeof(VecI1)) },
|
||||||
{ "ctrl0" , new MotionRegistry(typeof(VecCtrl)) },
|
{ new Identifier("ctrl0") , new MotionRegistry(typeof(VecCtrl)) },
|
||||||
{ "ctrl1" , new MotionRegistry(typeof(VecCtrl)) },
|
{ new Identifier("ctrl1") , new MotionRegistry(typeof(VecCtrl)) },
|
||||||
{ "track" , new MotionRegistry(typeof(Vec1)) },
|
{ new Identifier("track") , new MotionRegistry(typeof(Vec1)) },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts");
|
var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts");
|
||||||
|
@@ -18,6 +18,7 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public static void LoadDefault() {
|
public static void LoadDefault() {
|
||||||
if (loaded) return;
|
if (loaded) return;
|
||||||
|
Components.Add("anim", typeof(SkinAnimation));
|
||||||
Components.Add("image", typeof(SpritePlane));
|
Components.Add("image", typeof(SpritePlane));
|
||||||
Components.Add("mesh", typeof(MeshBase));
|
Components.Add("mesh", typeof(MeshBase));
|
||||||
Components.Add("polysec", typeof(PolygonSGO));
|
Components.Add("polysec", typeof(PolygonSGO));
|
||||||
@@ -26,11 +27,10 @@ namespace Cryville.Crtr {
|
|||||||
Components.Add("sprite", typeof(SpriteBase));
|
Components.Add("sprite", typeof(SpriteBase));
|
||||||
Components.Add("text", typeof(SpriteText));
|
Components.Add("text", typeof(SpriteText));
|
||||||
|
|
||||||
Meshes.Add("quad", Resources.Load<Mesh>("quad"));
|
Meshes.Add("quad", Resources.Load<Mesh>("Meshes/quad"));
|
||||||
Meshes.Add("quad_scale3h", Resources.Load<Mesh>("quad_scale3h"));
|
Meshes.Add("quad_scale3h", Resources.Load<Mesh>("Meshes/quad_scale3h"));
|
||||||
Meshes.Add("quad_scale9", Resources.Load<Mesh>("quad_scale9"));
|
|
||||||
|
|
||||||
Materials.Add("-SpriteMat", Resources.Load<Material>("SpriteMat"));
|
Materials.Add("-SpriteMat", Resources.Load<Material>("Materials/SpriteMat"));
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
using Cryville.Common.Math;
|
using Cryville.Common.Math;
|
||||||
using Cryville.Crtr.Event;
|
using Cryville.Crtr.Event;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
@@ -10,6 +9,7 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
SquareMatrix matFrame;
|
SquareMatrix matFrame;
|
||||||
ContainerState[] tracks;
|
ContainerState[] tracks;
|
||||||
|
public int TrackCount { get { return tracks.Length; } }
|
||||||
|
|
||||||
public GroupHandler(Chart.Group tg, ChartHandler ch) : base() {
|
public GroupHandler(Chart.Group tg, ChartHandler ch) : base() {
|
||||||
this.ch = ch;
|
this.ch = ch;
|
||||||
@@ -19,20 +19,19 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public override void PreInit() {
|
public override void PreInit() {
|
||||||
base.PreInit();
|
base.PreInit();
|
||||||
tracks = (
|
tracks = cs.TypedChildren[typeof(Chart.Track)].ToArray();
|
||||||
from c in cs.Children
|
|
||||||
where c.Value.Container is Chart.Track
|
|
||||||
select c.Value
|
|
||||||
).ToArray();
|
|
||||||
matFrame = SquareMatrix.WithPolynomialCoefficients(tracks.Length);
|
matFrame = SquareMatrix.WithPolynomialCoefficients(tracks.Length);
|
||||||
frame = new ColumnVector<Vector3>(tracks.Length);
|
frame1 = new ColumnVector<Vector3>(tracks.Length);
|
||||||
|
frame2 = new ColumnVector<Vector3>(tracks.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnVector<Vector3> frame;
|
ColumnVector<Vector3> frame1;
|
||||||
|
ColumnVector<Vector3> frame2;
|
||||||
public ColumnVector<Vector3> GetCurrentFrame(Func<ContainerState, Vector3> func) {
|
public ColumnVector<Vector3> GetCurrentFrame(Func<ContainerState, Vector3> func) {
|
||||||
for (int i = 0; i < tracks.Length; i++)
|
for (int i = 0; i < tracks.Length; i++)
|
||||||
frame[i] = func(tracks[i]);
|
frame1[i] = func(tracks[i]);
|
||||||
return matFrame.Eliminate(frame, Vector3Operator.Instance);
|
matFrame.Eliminate(frame1, frame2, Vector3Operator.Instance);
|
||||||
|
return frame2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ namespace Cryville.Crtr {
|
|||||||
_judge = judge;
|
_judge = judge;
|
||||||
foreach (var i in ruleset.inputs) {
|
foreach (var i in ruleset.inputs) {
|
||||||
_use.Add(i.Key, 0);
|
_use.Add(i.Key, 0);
|
||||||
_rev.Add(i.Key, new List<string>());
|
_rev.Add(i.Key, new List<Identifier>());
|
||||||
}
|
}
|
||||||
foreach (var i in ruleset.inputs) {
|
foreach (var i in ruleset.inputs) {
|
||||||
if (i.Value.pass != null) {
|
if (i.Value.pass != null) {
|
||||||
@@ -33,15 +33,15 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#region Settings
|
#region Settings
|
||||||
readonly Dictionary<string, InputProxyEntry> _tproxies = new Dictionary<string, InputProxyEntry>();
|
readonly Dictionary<Identifier, InputProxyEntry> _tproxies = new Dictionary<Identifier, InputProxyEntry>();
|
||||||
readonly Dictionary<InputSource, InputProxyEntry> _sproxies = new Dictionary<InputSource, InputProxyEntry>();
|
readonly Dictionary<InputSource, InputProxyEntry> _sproxies = new Dictionary<InputSource, InputProxyEntry>();
|
||||||
readonly Dictionary<string, int> _use = new Dictionary<string, int>();
|
readonly Dictionary<Identifier, int> _use = new Dictionary<Identifier, int>();
|
||||||
readonly Dictionary<string, List<string>> _rev = new Dictionary<string, List<string>>();
|
readonly Dictionary<Identifier, List<Identifier>> _rev = new Dictionary<Identifier, List<Identifier>>();
|
||||||
public event EventHandler<ProxyChangedEventArgs> ProxyChanged;
|
public event EventHandler<ProxyChangedEventArgs> ProxyChanged;
|
||||||
public void LoadFrom(Dictionary<string, RulesetConfig.InputEntry> 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 = new Identifier(cfg.Key),
|
||||||
Source = new InputSource {
|
Source = new InputSource {
|
||||||
Handler = Game.InputManager.GetHandler(cfg.Value.handler),
|
Handler = Game.InputManager.GetHandler(cfg.Value.handler),
|
||||||
Type = cfg.Value.type
|
Type = cfg.Value.type
|
||||||
@@ -52,7 +52,7 @@ namespace Cryville.Crtr {
|
|||||||
public void SaveTo(Dictionary<string, RulesetConfig.InputEntry> 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 RulesetConfig.InputEntry {
|
config.Add((string)p.Key.Name, 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
|
||||||
});
|
});
|
||||||
@@ -81,14 +81,16 @@ namespace Cryville.Crtr {
|
|||||||
public bool IsUsed(InputSource src) {
|
public bool IsUsed(InputSource src) {
|
||||||
return _sproxies.ContainsKey(src);
|
return _sproxies.ContainsKey(src);
|
||||||
}
|
}
|
||||||
public bool IsCompleted {
|
public bool IsCompleted() {
|
||||||
get {
|
foreach (var i in _use)
|
||||||
foreach (var i in _use)
|
if (!IsCompleted(i.Key)) return false;
|
||||||
if (i.Value == 0 && !_tproxies.ContainsKey(i.Key)) return false;
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void IncrementUseRecursive(string name) {
|
bool IsCompleted(Identifier name) {
|
||||||
|
return name.Key == _var_pause || _use[name] != 0 || _tproxies.ContainsKey(name);
|
||||||
|
}
|
||||||
|
static readonly int _var_pause = IdentifierManager.SharedInstance.Request("pause");
|
||||||
|
void IncrementUseRecursive(Identifier name) {
|
||||||
BroadcastProxyChanged(name);
|
BroadcastProxyChanged(name);
|
||||||
var passes = _ruleset.inputs[name].pass;
|
var passes = _ruleset.inputs[name].pass;
|
||||||
if (passes != null) {
|
if (passes != null) {
|
||||||
@@ -98,14 +100,14 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void IncrementReversedUseRecursive(string name) {
|
void IncrementReversedUseRecursive(Identifier name) {
|
||||||
foreach (var p in _rev[name]) {
|
foreach (var p in _rev[name]) {
|
||||||
_use[p]++;
|
_use[p]++;
|
||||||
BroadcastProxyChanged(p);
|
BroadcastProxyChanged(p);
|
||||||
IncrementReversedUseRecursive(p);
|
IncrementReversedUseRecursive(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DecrementUseRecursive(string name) {
|
void DecrementUseRecursive(Identifier name) {
|
||||||
BroadcastProxyChanged(name);
|
BroadcastProxyChanged(name);
|
||||||
var passes = _ruleset.inputs[name].pass;
|
var passes = _ruleset.inputs[name].pass;
|
||||||
if (passes != null) {
|
if (passes != null) {
|
||||||
@@ -115,20 +117,20 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DecrementReversedUseRecursive(string name) {
|
void DecrementReversedUseRecursive(Identifier name) {
|
||||||
foreach (var p in _rev[name]) {
|
foreach (var p in _rev[name]) {
|
||||||
_use[p]--;
|
_use[p]--;
|
||||||
BroadcastProxyChanged(p);
|
BroadcastProxyChanged(p);
|
||||||
DecrementReversedUseRecursive(p);
|
DecrementReversedUseRecursive(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void BroadcastProxyChanged(string name) {
|
void BroadcastProxyChanged(Identifier name) {
|
||||||
var del = ProxyChanged;
|
var del = ProxyChanged;
|
||||||
if (del != null) del(this, this[name]);
|
if (del != null) del(this, this[name]);
|
||||||
}
|
}
|
||||||
public ProxyChangedEventArgs this[string name] {
|
public ProxyChangedEventArgs this[Identifier name] {
|
||||||
get {
|
get {
|
||||||
return new ProxyChangedEventArgs(name, _tproxies.ContainsKey(name) ? _tproxies[name].Source : null, _use[name] > 0);
|
return new ProxyChangedEventArgs(name, _tproxies.ContainsKey(name) ? _tproxies[name].Source : null, _use[name] > 0, !IsCompleted(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -164,8 +166,8 @@ namespace Cryville.Crtr {
|
|||||||
protected void Dispose(bool disposing) {
|
protected void Dispose(bool disposing) {
|
||||||
if (disposing) {
|
if (disposing) {
|
||||||
Deactivate();
|
Deactivate();
|
||||||
foreach (var proxy in _tproxies.Values) {
|
foreach (var proxy in _tproxies) {
|
||||||
proxy.Source.Value.Handler.OnInput -= OnInput;
|
proxy.Value.Source.Value.Handler.OnInput -= OnInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,12 +182,13 @@ namespace Cryville.Crtr {
|
|||||||
readonly Dictionary<InputIdentifier, float> _vect = new Dictionary<InputIdentifier, float>();
|
readonly Dictionary<InputIdentifier, float> _vect = new Dictionary<InputIdentifier, float>();
|
||||||
readonly Dictionary<ProxiedInputIdentifier, PropSrc> _vecs = new Dictionary<ProxiedInputIdentifier, PropSrc>();
|
readonly Dictionary<ProxiedInputIdentifier, PropSrc> _vecs = new Dictionary<ProxiedInputIdentifier, PropSrc>();
|
||||||
static readonly PropSrc.Arbitrary _nullsrc = new PropSrc.Arbitrary(PdtInternalType.Null, new byte[0]);
|
static readonly PropSrc.Arbitrary _nullsrc = new PropSrc.Arbitrary(PdtInternalType.Null, new byte[0]);
|
||||||
|
double? _lockTime = null;
|
||||||
unsafe void OnInput(InputIdentifier id, InputVector vec) {
|
unsafe void OnInput(InputIdentifier id, InputVector vec) {
|
||||||
lock (_lock) {
|
lock (_lock) {
|
||||||
InputProxyEntry proxy;
|
InputProxyEntry proxy;
|
||||||
if (_sproxies.TryGetValue(id.Source, out proxy)) {
|
if (_sproxies.TryGetValue(id.Source, out proxy)) {
|
||||||
_etor.ContextCascadeInsert();
|
_etor.ContextCascadeInsert();
|
||||||
float ft, tt = (float)(vec.Time - _timeOrigins[id.Source.Handler]);
|
float ft, tt = (float)(_lockTime != null ? _lockTime.Value : (vec.Time - _timeOrigins[id.Source.Handler]));
|
||||||
if (!_vect.TryGetValue(id, out ft)) ft = tt;
|
if (!_vect.TryGetValue(id, out ft)) ft = tt;
|
||||||
if (vec.IsNull) {
|
if (vec.IsNull) {
|
||||||
_etor.ContextCascadeUpdate(_var_value, _nullsrc);
|
_etor.ContextCascadeUpdate(_var_value, _nullsrc);
|
||||||
@@ -235,42 +238,48 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void SyncTime(double time) {
|
public void SyncTime(double time) {
|
||||||
foreach (var s in _sproxies.Keys) {
|
foreach (var s in _sproxies) {
|
||||||
var h = s.Handler;
|
var h = s.Key.Handler;
|
||||||
_timeOrigins[h] = h.GetCurrentTimestamp() - time;
|
_timeOrigins[h] = h.GetCurrentTimestamp() - time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ForceTick() {
|
public void ForceTick() {
|
||||||
foreach (var src in _sproxies.Keys) {
|
foreach (var s in _sproxies) {
|
||||||
|
var src = s.Key;
|
||||||
if (_activeCounts[src] == 0) {
|
if (_activeCounts[src] == 0) {
|
||||||
OnInput(new InputIdentifier { Source = src, Id = 0 }, new InputVector(src.Handler.GetCurrentTimestamp()));
|
OnInput(new InputIdentifier { Source = src, Id = 0 }, new InputVector(_lockTime != null ? _lockTime.Value : src.Handler.GetCurrentTimestamp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double GetTimestampAverage() {
|
public double GetTimestampAverage() {
|
||||||
double result = 0;
|
double result = 0;
|
||||||
foreach (var src in _sproxies.Keys) {
|
foreach (var s in _sproxies) {
|
||||||
|
var src = s.Key;
|
||||||
result += src.Handler.GetCurrentTimestamp() - _timeOrigins[src.Handler];
|
result += src.Handler.GetCurrentTimestamp() - _timeOrigins[src.Handler];
|
||||||
}
|
}
|
||||||
return result / _sproxies.Count;
|
return result / _sproxies.Count;
|
||||||
}
|
}
|
||||||
|
public void LockTime() { _lockTime = GetTimestampAverage(); }
|
||||||
|
public void UnlockTime() { _lockTime = null; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProxyChangedEventArgs : EventArgs {
|
public class ProxyChangedEventArgs : EventArgs {
|
||||||
public string Name { get; private set; }
|
public Identifier Name { get; private set; }
|
||||||
public InputSource? Proxy { get; private set; }
|
public InputSource? Proxy { get; private set; }
|
||||||
public bool Used { get; private set; }
|
public bool Used { get; private set; }
|
||||||
public ProxyChangedEventArgs(string name, InputSource? src, bool used) {
|
public bool Required { get; private set; }
|
||||||
|
public ProxyChangedEventArgs(Identifier name, InputSource? src, bool used, bool required) {
|
||||||
Name = name;
|
Name = name;
|
||||||
Proxy = src;
|
Proxy = src;
|
||||||
Used = used;
|
Used = used;
|
||||||
|
Required = required;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InputProxyEntry {
|
public class InputProxyEntry {
|
||||||
public InputSource? Source { get; set; }
|
public InputSource? Source { get; set; }
|
||||||
public string Target { get; set; }
|
public Identifier Target { get; set; }
|
||||||
public byte[] Mapping { get; private set; }
|
public byte[] Mapping { get; private set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,14 +9,15 @@ using System.Text.Formatting;
|
|||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class Judge {
|
public class Judge {
|
||||||
#region Data
|
#region Data
|
||||||
|
readonly ChartPlayer _sys;
|
||||||
readonly PdtEvaluator _etor;
|
readonly PdtEvaluator _etor;
|
||||||
readonly PdtRuleset _rs;
|
readonly PdtRuleset _rs;
|
||||||
readonly Dictionary<Identifier, float> ct
|
|
||||||
= new Dictionary<Identifier, float>();
|
|
||||||
readonly Dictionary<Identifier, List<JudgeEvent>> evs
|
readonly Dictionary<Identifier, List<JudgeEvent>> evs
|
||||||
= new Dictionary<Identifier, List<JudgeEvent>>();
|
= new Dictionary<Identifier, List<JudgeEvent>>();
|
||||||
readonly Dictionary<Identifier, List<JudgeEvent>> activeEvs
|
readonly Dictionary<Identifier, List<JudgeEvent>> activeEvs
|
||||||
= new Dictionary<Identifier, List<JudgeEvent>>();
|
= new Dictionary<Identifier, List<JudgeEvent>>();
|
||||||
|
static readonly int _var_pause = IdentifierManager.SharedInstance.Request("pause");
|
||||||
|
readonly JudgeDefinition _judgePause;
|
||||||
public struct JudgeEvent {
|
public struct JudgeEvent {
|
||||||
public double StartTime { get; set; }
|
public double StartTime { get; set; }
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
@@ -32,27 +33,38 @@ namespace Cryville.Crtr {
|
|||||||
return x.StartClip.CompareTo(y.StartClip);
|
return x.StartClip.CompareTo(y.StartClip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Judge(PdtRuleset rs) {
|
public Judge(ChartPlayer sys, PdtRuleset rs) {
|
||||||
|
_sys = sys;
|
||||||
_etor = ChartPlayer.etor;
|
_etor = ChartPlayer.etor;
|
||||||
_rs = rs;
|
_rs = rs;
|
||||||
_numsrc1 = new PropSrc.Float(() => _numbuf1);
|
_numsrc1 = new PropSrc.Float(() => _numbuf1);
|
||||||
_numsrc2 = new PropSrc.Float(() => _numbuf2);
|
_numsrc2 = new PropSrc.Float(() => _numbuf2);
|
||||||
_numsrc3 = new PropSrc.Float(() => _numbuf3);
|
_numsrc3 = new PropSrc.Float(() => _numbuf3);
|
||||||
_numsrc4 = new PropSrc.Float(() => _numbuf4);
|
_numsrc4 = new PropSrc.Float(() => _numbuf4);
|
||||||
|
_rs.judges.TryGetValue(new Identifier(_var_pause), out _judgePause);
|
||||||
|
foreach (var i in rs.inputs) {
|
||||||
|
var id = i.Key;
|
||||||
|
var l = new List<JudgeEvent>();
|
||||||
|
evs.Add(id, l);
|
||||||
|
activeEvs.Add(id, new List<JudgeEvent>());
|
||||||
|
if (_judgePause != null && id.Key == _var_pause) {
|
||||||
|
l.Add(new JudgeEvent {
|
||||||
|
StartTime = double.NegativeInfinity, EndTime = double.PositiveInfinity,
|
||||||
|
StartClip = double.NegativeInfinity, EndClip = double.PositiveInfinity,
|
||||||
|
Definition = _judgePause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
InitJudges();
|
InitJudges();
|
||||||
InitScores();
|
InitScores();
|
||||||
}
|
}
|
||||||
public void Prepare(StampedEvent sev, NoteHandler handler) {
|
public void Prepare(StampedEvent sev, NoteHandler handler) {
|
||||||
var tev = (Chart.Judge)sev.Unstamped;
|
var tev = (Chart.Judge)sev.Unstamped;
|
||||||
|
if (tev.Id.Key == _var_pause) throw new InvalidOperationException("Cannot assign the special judge \"pause\" to notes");
|
||||||
Identifier input = default(Identifier);
|
Identifier input = default(Identifier);
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => input = new Identifier(v)), _rs.judges[tev.Id].input);
|
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => input = new Identifier(v)), _rs.judges[tev.Id].input);
|
||||||
double st = sev.Time, et = st + sev.Duration;
|
double st = sev.Time, et = st + sev.Duration;
|
||||||
List<JudgeEvent> list;
|
var list = evs[input];
|
||||||
if (!evs.TryGetValue(input, out list)) {
|
|
||||||
ct.Add(input, 0);
|
|
||||||
evs.Add(input, list = new List<JudgeEvent>());
|
|
||||||
activeEvs.Add(input, new List<JudgeEvent>());
|
|
||||||
}
|
|
||||||
var def = _rs.judges[tev.Id];
|
var def = _rs.judges[tev.Id];
|
||||||
var ev = new JudgeEvent {
|
var ev = new JudgeEvent {
|
||||||
StartTime = st,
|
StartTime = st,
|
||||||
@@ -71,8 +83,9 @@ namespace Cryville.Crtr {
|
|||||||
#region Judge
|
#region Judge
|
||||||
internal readonly Dictionary<int, int> judgeMap = new Dictionary<int, int>();
|
internal readonly Dictionary<int, int> judgeMap = new Dictionary<int, int>();
|
||||||
void InitJudges() {
|
void InitJudges() {
|
||||||
foreach (var i in _rs.judges.Keys) {
|
foreach (var i in _rs.judges) {
|
||||||
judgeMap.Add(i.Key, IdentifierManager.SharedInstance.Request("judge_" + i.Name));
|
var id = i.Key;
|
||||||
|
judgeMap.Add(id.Key, IdentifierManager.SharedInstance.Request("judge_" + id.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static bool _flag;
|
static bool _flag;
|
||||||
@@ -130,9 +143,12 @@ namespace Cryville.Crtr {
|
|||||||
if (def.hit != null) _etor.Evaluate(_flagop, def.hit);
|
if (def.hit != null) _etor.Evaluate(_flagop, def.hit);
|
||||||
else _flag = true;
|
else _flag = true;
|
||||||
if (_flag) {
|
if (_flag) {
|
||||||
|
if (ev.Definition == _judgePause) _sys.TogglePause();
|
||||||
if (def.scores != null) UpdateScore(def.scores);
|
if (def.scores != null) UpdateScore(def.scores);
|
||||||
if (def.pass != null) Pass(ev, (ft + tt) / 2, def.pass);
|
if (def.pass != null) Pass(ev, (ft + tt) / 2, def.pass);
|
||||||
actlist.RemoveAt(index);
|
if (def.persist != null) _etor.Evaluate(_flagop, def.persist);
|
||||||
|
else _flag = false;
|
||||||
|
if (!_flag) actlist.RemoveAt(index);
|
||||||
if (def.prop != 0 && actlist.Count > 0) {
|
if (def.prop != 0 && actlist.Count > 0) {
|
||||||
index = BinarySearchFirst(actlist, (float)ev.StartClip, def.stack - def.prop);
|
index = BinarySearchFirst(actlist, (float)ev.StartClip, def.stack - def.prop);
|
||||||
if (index < 0) index = ~index;
|
if (index < 0) index = ~index;
|
||||||
@@ -203,7 +219,6 @@ namespace Cryville.Crtr {
|
|||||||
readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
||||||
readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
||||||
readonly Dictionary<int, string> scoreStringCache = new Dictionary<int, string>();
|
readonly Dictionary<int, string> scoreStringCache = new Dictionary<int, string>();
|
||||||
readonly Dictionary<int, PropSrc> scoreStringSrcs = new Dictionary<int, PropSrc>();
|
|
||||||
readonly ArrayPool<byte> scoreStringPool = new ArrayPool<byte>();
|
readonly ArrayPool<byte> scoreStringPool = new ArrayPool<byte>();
|
||||||
readonly Dictionary<int, string> scoreFormatCache = new Dictionary<int, string>();
|
readonly Dictionary<int, string> scoreFormatCache = new Dictionary<int, string>();
|
||||||
readonly TargetString scoreFullStr = new TargetString();
|
readonly TargetString scoreFullStr = new TargetString();
|
||||||
@@ -219,27 +234,25 @@ namespace Cryville.Crtr {
|
|||||||
scoreDefs.Add(key, s.Value);
|
scoreDefs.Add(key, s.Value);
|
||||||
scores.Add(key, s.Value.init);
|
scores.Add(key, s.Value.init);
|
||||||
scoreStringCache.Add(scoreStringKeys[key], null);
|
scoreStringCache.Add(scoreStringKeys[key], null);
|
||||||
scoreStringSrcs.Add(scoreStringKeys[key], new ScoreStringSrc(scoreStringPool, () => scores[key], scoreDefs[key].format));
|
scoreSrcs.Add(scoreStringKeys[key], new ScoreStringSrc(scoreStringPool, () => scores[key], scoreDefs[key].format));
|
||||||
scoreFormatCache[key] = string.Format("{{0:{0}}}", s.Value.format);
|
scoreFormatCache[key] = string.Format("{{0:{0}}}", s.Value.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InvalidateScore(int key) {
|
void InvalidateScore(int key) {
|
||||||
scoreSrcs[key].Invalidate();
|
scoreSrcs[key].Invalidate();
|
||||||
scoreStringCache[scoreStringKeys[key]] = null;
|
scoreStringCache[scoreStringKeys[key]] = null;
|
||||||
scoreStringSrcs[scoreStringKeys[key]].Invalidate();
|
scoreSrcs[scoreStringKeys[key]].Invalidate();
|
||||||
}
|
}
|
||||||
public bool TryGetScoreSrc(int key, out PropSrc value) {
|
public bool TryGetScoreSrc(int key, out PropSrc value) {
|
||||||
return scoreSrcs.TryGetValue(key, out value);
|
return scoreSrcs.TryGetValue(key, out value);
|
||||||
}
|
}
|
||||||
public bool TryGetScoreStringSrc(int key, out PropSrc value) {
|
|
||||||
return scoreStringSrcs.TryGetValue(key, out value);
|
|
||||||
}
|
|
||||||
public TargetString GetFullFormattedScoreString() {
|
public TargetString GetFullFormattedScoreString() {
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
scoreFullBuf.Clear();
|
scoreFullBuf.Clear();
|
||||||
foreach (var s in scores.Keys) {
|
foreach (var s in scores) {
|
||||||
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.SharedInstance.Retrieve(s));
|
var id = s.Key;
|
||||||
scoreFullBuf.AppendFormat(scoreFormatCache[s], scores[s]);
|
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.SharedInstance.Retrieve(id));
|
||||||
|
scoreFullBuf.AppendFormat(scoreFormatCache[id], scores[id]);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
scoreFullStr.Length = scoreFullBuf.Count;
|
scoreFullStr.Length = scoreFullBuf.Count;
|
||||||
@@ -289,6 +302,7 @@ namespace Cryville.Crtr {
|
|||||||
public Clip clip;
|
public Clip clip;
|
||||||
public PdtExpression input;
|
public PdtExpression input;
|
||||||
public PdtExpression hit;
|
public PdtExpression hit;
|
||||||
|
public PdtExpression persist;
|
||||||
public Identifier[] pass;
|
public Identifier[] pass;
|
||||||
public Identifier[] miss;
|
public Identifier[] miss;
|
||||||
public Dictionary<ScoreOperation, PdtExpression> scores;
|
public Dictionary<ScoreOperation, PdtExpression> scores;
|
||||||
|
@@ -7,13 +7,8 @@ namespace Cryville.Crtr {
|
|||||||
private GameObject m_menu;
|
private GameObject m_menu;
|
||||||
#pragma warning restore IDE0044
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
internal void ShowMenu() {
|
internal void ShowMenu() { m_menu.SetActive(true); }
|
||||||
m_menu.SetActive(true);
|
internal void HideMenu() { m_menu.SetActive(false); }
|
||||||
}
|
|
||||||
|
|
||||||
internal void HideMenu() {
|
|
||||||
m_menu.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnApplicationQuit() {
|
void OnApplicationQuit() {
|
||||||
Game.Shutdown();
|
Game.Shutdown();
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
using Cryville.Common.Unity.UI;
|
using Cryville.Common.Unity.UI;
|
||||||
using Cryville.Crtr.Browsing;
|
using Cryville.Crtr.Browsing;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
@@ -13,6 +15,10 @@ namespace Cryville.Crtr {
|
|||||||
ProgressBar m_progressBar;
|
ProgressBar m_progressBar;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
SettingsPanel m_settingsPanel;
|
SettingsPanel m_settingsPanel;
|
||||||
|
[SerializeField]
|
||||||
|
TMP_Text m_title;
|
||||||
|
[SerializeField]
|
||||||
|
GameObject[] m_backBlockingObjects;
|
||||||
#pragma warning restore IDE0044
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
int frameIndex = 2;
|
int frameIndex = 2;
|
||||||
@@ -23,6 +29,7 @@ namespace Cryville.Crtr {
|
|||||||
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;
|
m_settingsPanel.Target = Settings.Default;
|
||||||
|
PushTitle("Chart Browser");
|
||||||
}
|
}
|
||||||
void Update() {
|
void Update() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -54,9 +61,20 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
#pragma warning restore IDE0051
|
||||||
|
|
||||||
|
readonly Stack<string> _uiStack = new Stack<string>();
|
||||||
|
public void PushTitle(string title) {
|
||||||
|
_uiStack.Push(title);
|
||||||
|
m_title.SetText(title);
|
||||||
|
}
|
||||||
public void Back() {
|
public void Back() {
|
||||||
|
foreach (var obj in m_backBlockingObjects) {
|
||||||
|
if (obj.activeInHierarchy) return;
|
||||||
|
}
|
||||||
if (m_browserMaster.Back()) return;
|
if (m_browserMaster.Back()) return;
|
||||||
m_targetAnimator.SetTrigger("G_Back");
|
m_targetAnimator.SetTrigger("G_Back");
|
||||||
|
if (_uiStack.Count <= 1) return;
|
||||||
|
_uiStack.Pop();
|
||||||
|
m_title.SetText(_uiStack.Peek());
|
||||||
}
|
}
|
||||||
public void Quit() {
|
public void Quit() {
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
|
@@ -26,10 +26,8 @@ namespace Cryville.Crtr {
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
public Material NewMaterial {
|
public static Material NewMaterial() {
|
||||||
get {
|
return Material.Instantiate(GenericResources.Materials["-SpriteMat"]);
|
||||||
return Material.Instantiate(GenericResources.Materials["-SpriteMat"]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void Init(Transform parent) {
|
public void Init(Transform parent) {
|
||||||
MeshObject = new GameObject("__mesh__");
|
MeshObject = new GameObject("__mesh__");
|
||||||
@@ -41,12 +39,10 @@ namespace Cryville.Crtr {
|
|||||||
MeshObject.AddComponent<MeshRenderer>();
|
MeshObject.AddComponent<MeshRenderer>();
|
||||||
MeshFilter = MeshObject.GetComponent<MeshFilter>();
|
MeshFilter = MeshObject.GetComponent<MeshFilter>();
|
||||||
Renderer = MeshObject.GetComponent<Renderer>();
|
Renderer = MeshObject.GetComponent<Renderer>();
|
||||||
Renderer.material = NewMaterial;
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
public void Destroy() {
|
public void Destroy() {
|
||||||
Mesh.Destroy(Mesh);
|
Mesh.Destroy(Mesh);
|
||||||
if (Renderer.material != null) Material.Destroy(Renderer.material);
|
|
||||||
GameObject.Destroy(MeshObject);
|
GameObject.Destroy(MeshObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -911,11 +911,11 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsZero() {
|
public override bool IsZero() {
|
||||||
if (!xw.Equals(0)) return false;
|
if (xw == null || xw != 0) return false;
|
||||||
if (!xh.Equals(0)) return false;
|
if (xh == null || xh != 0) return false;
|
||||||
if (!yw.Equals(0)) return false;
|
if (yw == null || yw != 0) return false;
|
||||||
if (!yh.Equals(0)) return false;
|
if (xh == null || xh != 0) return false;
|
||||||
if (!z.Equals(0)) return false;
|
if (z == null || z != 0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public override void PreInit() {
|
public override void PreInit() {
|
||||||
base.PreInit();
|
base.PreInit();
|
||||||
|
coeffs = new ColumnVector<float>(gh.TrackCount);
|
||||||
foreach (var j in Event.judges) {
|
foreach (var j in Event.judges) {
|
||||||
judges.Add(j, new JudgeState(this, j.Id.Key));
|
judges.Add(j, new JudgeState(this, j.Id.Key));
|
||||||
}
|
}
|
||||||
@@ -57,7 +58,7 @@ namespace Cryville.Crtr {
|
|||||||
public override void Init() {
|
public override void Init() {
|
||||||
base.Init();
|
base.Init();
|
||||||
sgos = gogroup.GetComponentsInChildren<SectionalGameObject>();
|
sgos = gogroup.GetComponentsInChildren<SectionalGameObject>();
|
||||||
foreach (var judge in judges.Values) judge.InitPropSrcs();
|
foreach (var judge in judges) judge.Value.InitPropSrcs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void StartPhysicalUpdate(ContainerState s) {
|
public override void StartPhysicalUpdate(ContainerState s) {
|
||||||
@@ -66,7 +67,7 @@ namespace Cryville.Crtr {
|
|||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void StartGraphicalUpdate(ContainerState s) {
|
protected override void StartGraphicalUpdate(ContainerState s) {
|
||||||
base.StartGraphicalUpdate(s);
|
base.StartGraphicalUpdate(s);
|
||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
if (gogroup) {
|
if (gogroup) {
|
||||||
@@ -92,12 +93,10 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
|
||||||
if (s.CloneType <= 2) {
|
if (s.CloneType <= 2) {
|
||||||
Position = GetFramePoint(s.Parent, s.Track);
|
Position = GetFramePoint(s.Parent, s.Track);
|
||||||
Rotation = GetFrameRotation(s.Parent, s.Track);
|
Rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
if (s.CloneType == 2) {
|
if (s.CloneType == 2 && gogroup && Event.IsLong) {
|
||||||
if (!gogroup || !Event.IsLong) return;
|
|
||||||
foreach (var i in sgos)
|
foreach (var i in sgos)
|
||||||
i.AppendPoint(Position, Rotation);
|
i.AppendPoint(Position, Rotation);
|
||||||
}
|
}
|
||||||
@@ -113,9 +112,22 @@ namespace Cryville.Crtr {
|
|||||||
ChartPlayer.etor.ContextEvent = null;
|
ChartPlayer.etor.ContextEvent = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (s.CloneType == 2 && ev != null && ev.Unstamped is Chart.Judge) {
|
||||||
|
var anchor = judges[(Chart.Judge)ev.Unstamped].StaticAnchor;
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
anchor.Transform.SetPositionAndRotation(Position, Rotation);
|
||||||
|
#else
|
||||||
|
anchor.Transform.position = Position;
|
||||||
|
anchor.Transform.rotation = Rotation;
|
||||||
|
#endif
|
||||||
|
OpenAnchor(anchor);
|
||||||
|
base.Update(s, ev);
|
||||||
|
CloseAnchor();
|
||||||
|
}
|
||||||
|
else base.Update(s, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EndGraphicalUpdate(ContainerState s) {
|
protected override void EndGraphicalUpdate(ContainerState s) {
|
||||||
if (gogroup) {
|
if (gogroup) {
|
||||||
foreach (var i in sgos) i.Seal();
|
foreach (var i in sgos) i.Seal();
|
||||||
}
|
}
|
||||||
@@ -132,6 +144,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readonly List<Vector3> ctrl = new List<Vector3>(2);
|
readonly List<Vector3> ctrl = new List<Vector3>(2);
|
||||||
|
ColumnVector<float> coeffs;
|
||||||
Vector3 GetFrame(ContainerState state, float track, Func<ContainerState, Vector3> func) {
|
Vector3 GetFrame(ContainerState state, float track, Func<ContainerState, Vector3> func) {
|
||||||
// TODO
|
// TODO
|
||||||
int id = Mathf.FloorToInt(track);
|
int id = Mathf.FloorToInt(track);
|
||||||
@@ -160,12 +173,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
if (ctrl.Count == 0) {
|
if (ctrl.Count == 0) {
|
||||||
var frame = gh.GetCurrentFrame(func);
|
var frame = gh.GetCurrentFrame(func);
|
||||||
return frame.Dot(
|
ColumnVector<float>.FillWithPolynomialCoefficients(coeffs, track);
|
||||||
ColumnVector<float>.WithPolynomialCoefficients(
|
return frame.Dot(coeffs, Vector3Operator.Instance);
|
||||||
frame.Size, track
|
|
||||||
),
|
|
||||||
Vector3Operator.Instance
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (ctrl.Count == 1) {
|
else if (ctrl.Count == 1) {
|
||||||
return nt * (nt * p1 + t * (ctrl[0] + p1)) + t * t * p2;
|
return nt * (nt * p1 + t * (ctrl[0] + p1)) + t * t * p2;
|
||||||
|
91
Assets/Cryville/Crtr/PdtBinder.cs
Normal file
91
Assets/Cryville/Crtr/PdtBinder.cs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
using Cryville.Common;
|
||||||
|
using Cryville.Common.Pdt;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using SIdentifier = Cryville.Common.Identifier;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr {
|
||||||
|
public class PdtBinder : EmptyBinder {
|
||||||
|
public override object ChangeType(object value, Type type, CultureInfo culture) {
|
||||||
|
if (value is PdtExpression) {
|
||||||
|
var exp = (PdtExpression)value;
|
||||||
|
if (type.Equals(typeof(bool))) {
|
||||||
|
bool result = false;
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.Boolean(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(int))) {
|
||||||
|
int result = 0;
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.Integer(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(float))) {
|
||||||
|
float result = 0;
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.Float(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(string))) {
|
||||||
|
string result = default(string);
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.String(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(Clip))) {
|
||||||
|
Clip result = default(Clip);
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.Clip(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(Identifier))) {
|
||||||
|
Identifier result = default(Identifier);
|
||||||
|
ChartPlayer.etor.Evaluate(new pop_identstr(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (type.Equals(typeof(Identifier[]))) {
|
||||||
|
Identifier[] result = null;
|
||||||
|
ChartPlayer.etor.Evaluate(new pop_identstrarr(r => result = r), exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (value is string) {
|
||||||
|
var exp = (string)value;
|
||||||
|
if (type.Equals(typeof(Identifier))) {
|
||||||
|
return new Identifier(exp);
|
||||||
|
}
|
||||||
|
else if (type == typeof(ScoreOperation)) {
|
||||||
|
var m = Regex.Match(exp, @"^(\S+)\s*?(\S+)?$");
|
||||||
|
var name = new Identifier(m.Groups[1].Value);
|
||||||
|
if (!m.Groups[2].Success) return new ScoreOperation { name = name };
|
||||||
|
var op = new Identifier(m.Groups[2].Value);
|
||||||
|
return new ScoreOperation { name = name, op = op };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return base.ChangeType(value, type, culture);
|
||||||
|
}
|
||||||
|
#pragma warning disable IDE1006
|
||||||
|
class pop_identstr : PropOp {
|
||||||
|
readonly Action<SIdentifier> _cb;
|
||||||
|
public pop_identstr(Action<SIdentifier> cb) { _cb = cb; }
|
||||||
|
protected override void Execute() {
|
||||||
|
var op = GetOperand(0);
|
||||||
|
if (op.Type == PdtInternalType.Undefined) _cb(new SIdentifier(op.AsIdentifier()));
|
||||||
|
else if (op.Type == PdtInternalType.String) _cb(new SIdentifier(op.AsString()));
|
||||||
|
else throw new InvalidCastException("Not an identifier or string");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class pop_identstrarr : PdtOperator {
|
||||||
|
readonly Action<SIdentifier[]> _cb;
|
||||||
|
public pop_identstrarr(Action<SIdentifier[]> cb) : base(16) { _cb = cb; }
|
||||||
|
protected override void Execute() {
|
||||||
|
var result = new SIdentifier[LoadedOperandCount];
|
||||||
|
for (int i = 0; i < LoadedOperandCount; i++) {
|
||||||
|
var op = GetOperand(i);
|
||||||
|
if (op.Type != PdtInternalType.Undefined)
|
||||||
|
throw new InvalidCastException("Not an identifier");
|
||||||
|
result[i] = new SIdentifier(op.AsIdentifier());
|
||||||
|
}
|
||||||
|
_cb(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore IDE1006
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/PdtBinder.cs.meta
Normal file
11
Assets/Cryville/Crtr/PdtBinder.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ba16fc9fce48644b9c7bd49f2c9121d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -35,16 +35,11 @@ namespace Cryville.Crtr {
|
|||||||
var vec = ContextState.GetRawValue(id);
|
var vec = ContextState.GetRawValue(id);
|
||||||
VectorSrc.Construct(() => vec).Get(out type, out value);
|
VectorSrc.Construct(() => vec).Get(out type, out value);
|
||||||
}
|
}
|
||||||
else if (ContextState != null && name == _var_current_time) {
|
else if (ContextState != null && ContextState.Handler.PropSrcs.TryGetValue(name, out prop)) {
|
||||||
LoadNum((float)ContextState.rootPrototype.Time);
|
|
||||||
type = PdtInternalType.Number;
|
|
||||||
value = _numbuf;
|
|
||||||
}
|
|
||||||
else if (ContextJudge != null && ContextJudge.TryGetScoreSrc(name, out prop)) {
|
|
||||||
prop.Get(out type, out value);
|
prop.Get(out type, out value);
|
||||||
RevokePotentialConstant();
|
RevokePotentialConstant();
|
||||||
}
|
}
|
||||||
else if (ContextJudge != null && ContextJudge.TryGetScoreStringSrc(name, out prop)) {
|
else if (ContextJudge != null && ContextJudge.TryGetScoreSrc(name, out prop)) {
|
||||||
prop.Get(out type, out value);
|
prop.Get(out type, out value);
|
||||||
RevokePotentialConstant();
|
RevokePotentialConstant();
|
||||||
}
|
}
|
||||||
@@ -109,6 +104,13 @@ namespace Cryville.Crtr {
|
|||||||
public Judge ContextJudge { private get; set; }
|
public Judge ContextJudge { private get; set; }
|
||||||
public PropSrc ContextSelfValue { private get; set; }
|
public PropSrc ContextSelfValue { private get; set; }
|
||||||
|
|
||||||
|
readonly Stack<int> ContextCascadeBlocks = new Stack<int>();
|
||||||
|
public void ContextCascadeInsertBlock() {
|
||||||
|
ContextCascadeBlocks.Push(_cascadeHeight);
|
||||||
|
}
|
||||||
|
public void ContextCascadeDiscardBlock() {
|
||||||
|
ContextCascadeBlocks.Pop();
|
||||||
|
}
|
||||||
readonly Dictionary<int, PropSrc>[] ContextCascade = new Dictionary<int, PropSrc>[256];
|
readonly Dictionary<int, PropSrc>[] ContextCascade = new Dictionary<int, PropSrc>[256];
|
||||||
int _cascadeHeight;
|
int _cascadeHeight;
|
||||||
public void ContextCascadeInsert() {
|
public void ContextCascadeInsert() {
|
||||||
@@ -123,7 +125,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
public PropSrc ContextCascadeLookup(int name) {
|
public PropSrc ContextCascadeLookup(int name) {
|
||||||
PropSrc result;
|
PropSrc result;
|
||||||
for (int i = _cascadeHeight - 1; i >= 0; i--) {
|
for (int i = _cascadeHeight - 1; i >= ContextCascadeBlocks.Peek(); i--) {
|
||||||
Dictionary<int, PropSrc> cas = ContextCascade[i];
|
Dictionary<int, PropSrc> cas = ContextCascade[i];
|
||||||
if (cas.TryGetValue(name, out result)) {
|
if (cas.TryGetValue(name, out result)) {
|
||||||
return result;
|
return result;
|
||||||
@@ -136,6 +138,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PdtEvaluator() {
|
public PdtEvaluator() {
|
||||||
|
ContextCascadeBlocks.Push(0);
|
||||||
for (int i = 0; i < ContextCascade.Length; i++) ContextCascade[i] = new Dictionary<int, PropSrc>();
|
for (int i = 0; i < ContextCascade.Length; i++) ContextCascade[i] = new Dictionary<int, PropSrc>();
|
||||||
|
|
||||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
|
_ctxops.Add(IdentifierManager.SharedInstance.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
|
||||||
@@ -172,6 +175,7 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
_shortops.Add(new PdtOperatorSignature("frame_seq", 3), new func_frame_seq());
|
_shortops.Add(new PdtOperatorSignature("frame_seq", 3), new func_frame_seq());
|
||||||
_shortops.Add(new PdtOperatorSignature("in_area", 1), new func_in_area());
|
_shortops.Add(new PdtOperatorSignature("in_area", 1), new func_in_area());
|
||||||
|
_shortops.Add(new PdtOperatorSignature("interval", 3), new func_interval());
|
||||||
_shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
|
_shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
|
||||||
}
|
}
|
||||||
#region Operators
|
#region Operators
|
||||||
@@ -355,6 +359,16 @@ namespace Cryville.Crtr {
|
|||||||
hit.CopyTo(ret);
|
hit.CopyTo(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class func_interval : PdtOperator {
|
||||||
|
public func_interval() : base(3) { }
|
||||||
|
protected override unsafe void Execute() {
|
||||||
|
var value = GetOperand(0).AsNumber();
|
||||||
|
var min = GetOperand(1).AsNumber();
|
||||||
|
var max = GetOperand(2).AsNumber();
|
||||||
|
var ret = GetReturnFrame(PdtInternalType.Number, sizeof(float));
|
||||||
|
ret.SetNumber((value - min) * (max - value));
|
||||||
|
}
|
||||||
|
}
|
||||||
class func_is : PdtOperator {
|
class func_is : PdtOperator {
|
||||||
public func_is() : base(2) { }
|
public func_is() : base(2) { }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
@@ -379,9 +393,8 @@ namespace Cryville.Crtr {
|
|||||||
var ray = new Ray(ctx.position, ctx.rotation * Vector3.forward);
|
var ray = new Ray(ctx.position, ctx.rotation * Vector3.forward);
|
||||||
ChartPlayer.frustumPlanes[(int)GetOperand(0).AsNumber()].Raycast(ray, out dist);
|
ChartPlayer.frustumPlanes[(int)GetOperand(0).AsNumber()].Raycast(ray, out dist);
|
||||||
var ret = GetReturnFrame(PdtInternalType.Vector, sizeof(Vector3) + sizeof(int));
|
var ret = GetReturnFrame(PdtInternalType.Vector, sizeof(Vector3) + sizeof(int));
|
||||||
var ptr = (Vector3*)ret.TrustedAsOfLength(sizeof(Vector3) + sizeof(int));
|
ret.Set(ray.GetPoint(dist));
|
||||||
*ptr++ = ray.GetPoint(dist);
|
ret.SetArraySuffix(PdtInternalType.Number);
|
||||||
*(int*)ptr = PdtInternalType.Number;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_int : PdtOperator {
|
class func_int : PdtOperator {
|
||||||
|
@@ -5,7 +5,10 @@ using System.Collections.Generic;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using RBeatTime = Cryville.Crtr.BeatTime;
|
using RBeatTime = Cryville.Crtr.BeatTime;
|
||||||
using RClip = Cryville.Crtr.Clip;
|
using RClip = Cryville.Crtr.Clip;
|
||||||
|
using RColor = UnityEngine.Color;
|
||||||
using RTargetString = Cryville.Common.Buffers.TargetString;
|
using RTargetString = Cryville.Common.Buffers.TargetString;
|
||||||
|
using RVector2 = UnityEngine.Vector2;
|
||||||
|
using RVector3 = UnityEngine.Vector3;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public abstract class PropOp : PdtOperator {
|
public abstract class PropOp : PdtOperator {
|
||||||
@@ -57,19 +60,35 @@ namespace Cryville.Crtr {
|
|||||||
_cb(GetOperand(0).AsString());
|
_cb(GetOperand(0).AsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class StringArray : PropOp {
|
||||||
|
readonly Action<string[]> _cb;
|
||||||
|
public StringArray(Action<string[]> cb) { _cb = cb; }
|
||||||
|
protected unsafe override void Execute() {
|
||||||
|
var op = GetOperand(0);
|
||||||
|
int arrtype; int len;
|
||||||
|
op.GetArraySuffix(out arrtype, out len);
|
||||||
|
if (arrtype != PdtInternalType.String) throw new InvalidCastException("Not an array of strings");
|
||||||
|
var result = new string[len];
|
||||||
|
int o = 0;
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
string v = op.AsString(o);
|
||||||
|
o += v.Length * sizeof(char) + sizeof(int);
|
||||||
|
result[i] = v;
|
||||||
|
}
|
||||||
|
_cb(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
public class TargetString : PropOp {
|
public class TargetString : PropOp {
|
||||||
readonly Func<RTargetString> _cb;
|
readonly Func<RTargetString> _cb;
|
||||||
public TargetString(Func<RTargetString> cb) { _cb = cb; }
|
public TargetString(Func<RTargetString> cb) { _cb = cb; }
|
||||||
protected override unsafe void Execute() {
|
protected override void Execute() {
|
||||||
var target = _cb();
|
var target = _cb();
|
||||||
var op = GetOperand(0);
|
var op = GetOperand(0);
|
||||||
if (op.Type != PdtInternalType.String) throw new ArgumentException("Not a string");
|
if (op.Type != PdtInternalType.String) throw new ArgumentException("Not a string");
|
||||||
var ptr = (byte*)op.TrustedAsOfLength(op.Length);
|
int len = op.As<int>();
|
||||||
var len = *(int*)ptr;
|
|
||||||
target.Length = len;
|
target.Length = len;
|
||||||
var cptr = (char*)(ptr + sizeof(int));
|
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
target[i] = cptr[i];
|
target[i] = op.As<char>(sizeof(int) + i * sizeof(char));
|
||||||
target.Validate();
|
target.Validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,22 +124,22 @@ namespace Cryville.Crtr {
|
|||||||
public BeatTime(Action<RBeatTime> cb) { _cb = cb; }
|
public BeatTime(Action<RBeatTime> cb) { _cb = cb; }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
_cb(*(RBeatTime*)o.TrustedAsOfLength(sizeof(RBeatTime)));
|
_cb(o.As<RBeatTime>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Vector2 : PropOp {
|
public class Vector2 : PropOp {
|
||||||
readonly Action<UnityEngine.Vector2> _cb;
|
readonly Action<RVector2> _cb;
|
||||||
public Vector2(Action<UnityEngine.Vector2> cb) { _cb = cb; }
|
public Vector2(Action<RVector2> cb) { _cb = cb; }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
switch ((o.Length - 4) / 4) {
|
switch ((o.Length - 4) / 4) {
|
||||||
case 0: // Number
|
case 0: // Number
|
||||||
case 1: // Array[1]
|
case 1: // Array[1]
|
||||||
float num = o.AsNumber();
|
float num = o.AsNumber();
|
||||||
_cb(new UnityEngine.Vector2(num, num));
|
_cb(new RVector2(num, num));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_cb(*(UnityEngine.Vector2*)o.TrustedAsOfLength(sizeof(UnityEngine.Vector2)));
|
_cb(o.As<RVector2>());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Invalid array size");
|
throw new InvalidOperationException("Invalid array size");
|
||||||
@@ -128,21 +147,21 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Vector3 : PropOp {
|
public class Vector3 : PropOp {
|
||||||
readonly Action<UnityEngine.Vector3> _cb;
|
readonly Action<RVector3> _cb;
|
||||||
public Vector3(Action<UnityEngine.Vector3> cb) { _cb = cb; }
|
public Vector3(Action<RVector3> cb) { _cb = cb; }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
switch ((o.Length - 4) / 4) {
|
switch ((o.Length - 4) / 4) {
|
||||||
case 0: // Number
|
case 0: // Number
|
||||||
case 1: // Array[1]
|
case 1: // Array[1]
|
||||||
float num = o.AsNumber();
|
float num = o.AsNumber();
|
||||||
_cb(new UnityEngine.Vector3(num, num));
|
_cb(new RVector3(num, num));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_cb(*(UnityEngine.Vector2*)o.TrustedAsOfLength(sizeof(UnityEngine.Vector2)));
|
_cb(o.As<RVector2>());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_cb(*(UnityEngine.Vector3*)o.TrustedAsOfLength(sizeof(UnityEngine.Vector3)));
|
_cb(o.As<RVector3>());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Invalid array size");
|
throw new InvalidOperationException("Invalid array size");
|
||||||
@@ -150,17 +169,16 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Color : PropOp {
|
public class Color : PropOp {
|
||||||
readonly Action<UnityEngine.Color> _cb;
|
readonly Action<RColor> _cb;
|
||||||
public Color(Action<UnityEngine.Color> cb) { _cb = cb; }
|
public Color(Action<RColor> cb) { _cb = cb; }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
switch ((o.Length - 4) / 4) {
|
switch ((o.Length - 4) / 4) {
|
||||||
case 3:
|
case 3:
|
||||||
var ptr = (float*)o.TrustedAsOfLength(sizeof(float) * 3);
|
_cb(new RColor(o.As<float>(), o.As<float>(sizeof(float)), o.As<float>(2 * sizeof(float))));
|
||||||
_cb(new UnityEngine.Color(ptr[0], ptr[1], ptr[2]));
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
_cb(*(UnityEngine.Color*)o.TrustedAsOfLength(sizeof(UnityEngine.Color)));
|
_cb(o.As<RColor>());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Invalid array size");
|
throw new InvalidOperationException("Invalid array size");
|
||||||
|
@@ -43,6 +43,7 @@ namespace Cryville.Crtr {
|
|||||||
buf[0] = _cb() ? (byte)1 : (byte)0;
|
buf[0] = _cb() ? (byte)1 : (byte)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static readonly PropSrc Error = new Arbitrary(PdtInternalType.Error, new byte[0]);
|
||||||
public class Float : FixedBuffer {
|
public class Float : FixedBuffer {
|
||||||
readonly Func<float> _cb;
|
readonly Func<float> _cb;
|
||||||
public Float(Func<float> cb) : base(PdtInternalType.Number, 4) { _cb = cb; }
|
public Float(Func<float> cb) : base(PdtInternalType.Number, 4) { _cb = cb; }
|
||||||
|
@@ -4,11 +4,8 @@ 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.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using SIdentifier = Cryville.Common.Identifier;
|
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class Ruleset : MetaInfo {
|
public class Ruleset : MetaInfo {
|
||||||
@@ -25,35 +22,38 @@ namespace Cryville.Crtr {
|
|||||||
public void LoadPdt(DirectoryInfo dir) {
|
public void LoadPdt(DirectoryInfo dir) {
|
||||||
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
||||||
var src = pdtreader.ReadToEnd();
|
var src = pdtreader.ReadToEnd();
|
||||||
Root = (PdtRuleset)new RulesetInterpreter(src, null).Interpret();
|
Root = (PdtRuleset)new RulesetInterpreter(src, null).Interpret(typeof(PdtRuleset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Binder(typeof(PdtRulesetBinder))]
|
[Binder(typeof(PdtBinder))]
|
||||||
public class PdtRuleset {
|
public class PdtRuleset {
|
||||||
public Dictionary<Identifier, InputDefinition> inputs;
|
public Dictionary<Identifier, InputDefinition> inputs;
|
||||||
public Dictionary<Identifier, JudgeDefinition> judges;
|
public Dictionary<Identifier, JudgeDefinition> judges;
|
||||||
public Dictionary<Identifier, ScoreDefinition> scores;
|
public Dictionary<Identifier, ScoreDefinition> scores;
|
||||||
public Constraint constraints;
|
public Constraint constraints;
|
||||||
public void Optimize(PdtEvaluatorBase etor) {
|
public void Optimize(PdtEvaluatorBase etor) {
|
||||||
foreach (var i in inputs.Values) {
|
foreach (var i in inputs) {
|
||||||
if (i.pass != null) foreach (var e in i.pass.Values) {
|
var input = i.Value;
|
||||||
etor.Optimize(e);
|
if (input.pass != null) foreach (var e in input.pass) {
|
||||||
|
etor.Optimize(e.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var j in judges.Values) {
|
foreach (var j in judges) {
|
||||||
if (j.hit != null) etor.Optimize(j.hit);
|
var judge = j.Value;
|
||||||
if (j.scores != null) {
|
if (judge.hit != null) etor.Optimize(judge.hit);
|
||||||
foreach (var s in j.scores) {
|
if (judge.scores != null) {
|
||||||
|
foreach (var s in judge.scores) {
|
||||||
if (s.Key.op != default(Identifier))
|
if (s.Key.op != default(Identifier))
|
||||||
etor.PatchCompound(s.Key.name.Key, s.Key.op.Key, s.Value);
|
etor.PatchCompound(s.Key.name.Key, s.Key.op.Key, s.Value);
|
||||||
etor.Optimize(s.Value);
|
etor.Optimize(s.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var s in scores.Values) {
|
foreach (var s in scores) {
|
||||||
if (s.value != null) etor.Optimize(s.value);
|
var score = s.Value;
|
||||||
|
if (score.value != null) etor.Optimize(score.value);
|
||||||
}
|
}
|
||||||
constraints.Optimize(etor);
|
constraints.Optimize(etor);
|
||||||
}
|
}
|
||||||
@@ -68,8 +68,8 @@ namespace Cryville.Crtr {
|
|||||||
[PropertyList]
|
[PropertyList]
|
||||||
public Dictionary<PropertyKey, PdtExpression> Properties = new Dictionary<PropertyKey, PdtExpression>();
|
public Dictionary<PropertyKey, PdtExpression> Properties = new Dictionary<PropertyKey, PdtExpression>();
|
||||||
public void Optimize(PdtEvaluatorBase etor) {
|
public void Optimize(PdtEvaluatorBase etor) {
|
||||||
foreach (var e in Properties.Values) {
|
foreach (var e in Properties) {
|
||||||
etor.Optimize(e);
|
etor.Optimize(e.Value);
|
||||||
}
|
}
|
||||||
foreach (var e in Elements) {
|
foreach (var e in Elements) {
|
||||||
e.Key.Optimize(etor);
|
e.Key.Optimize(etor);
|
||||||
@@ -126,88 +126,6 @@ namespace Cryville.Crtr {
|
|||||||
Property,
|
Property,
|
||||||
Variable,
|
Variable,
|
||||||
}
|
}
|
||||||
public class PdtRulesetBinder : EmptyBinder {
|
|
||||||
public override object ChangeType(object value, Type type, CultureInfo culture) {
|
|
||||||
if (value is PdtExpression) {
|
|
||||||
var exp = (PdtExpression)value;
|
|
||||||
if (type.Equals(typeof(bool))) {
|
|
||||||
bool result = false;
|
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Boolean(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(int))) {
|
|
||||||
int result = 0;
|
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Integer(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(float))) {
|
|
||||||
float result = 0;
|
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Float(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(string))) {
|
|
||||||
string result = default(string);
|
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.String(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(Clip))) {
|
|
||||||
Clip result = default(Clip);
|
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Clip(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(Identifier))) {
|
|
||||||
Identifier result = default(Identifier);
|
|
||||||
ChartPlayer.etor.Evaluate(new pop_identstr(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else if (type.Equals(typeof(Identifier[]))) {
|
|
||||||
Identifier[] result = null;
|
|
||||||
ChartPlayer.etor.Evaluate(new pop_identstrarr(r => result = r), exp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (value is string) {
|
|
||||||
var exp = (string)value;
|
|
||||||
if (type.Equals(typeof(Identifier))) {
|
|
||||||
return (Identifier)exp;
|
|
||||||
}
|
|
||||||
else if (type == typeof(ScoreOperation)) {
|
|
||||||
var m = Regex.Match(exp, @"^(\S+)\s*?(\S+)?$");
|
|
||||||
var name = new Identifier(m.Groups[1].Value);
|
|
||||||
if (!m.Groups[2].Success) return new ScoreOperation { name = name };
|
|
||||||
var op = new Identifier(m.Groups[2].Value);
|
|
||||||
return new ScoreOperation { name = name, op = op };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return base.ChangeType(value, type, culture);
|
|
||||||
}
|
|
||||||
#pragma warning disable IDE1006
|
|
||||||
class pop_identstr : PropOp {
|
|
||||||
readonly Action<SIdentifier> _cb;
|
|
||||||
public pop_identstr(Action<SIdentifier> cb) { _cb = cb; }
|
|
||||||
protected override void Execute() {
|
|
||||||
var op = GetOperand(0);
|
|
||||||
if (op.Type == PdtInternalType.Undefined) _cb(new SIdentifier(op.AsIdentifier()));
|
|
||||||
else if (op.Type == PdtInternalType.String) _cb(new SIdentifier(op.AsString()));
|
|
||||||
else throw new InvalidCastException("Not an identifier or string");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class pop_identstrarr : PdtOperator {
|
|
||||||
readonly Action<SIdentifier[]> _cb;
|
|
||||||
public pop_identstrarr(Action<SIdentifier[]> cb) : base(16) { _cb = cb; }
|
|
||||||
protected override void Execute() {
|
|
||||||
var result = new SIdentifier[LoadedOperandCount];
|
|
||||||
for (int i = 0; i < LoadedOperandCount; i++) {
|
|
||||||
var op = GetOperand(i);
|
|
||||||
if (op.Type != PdtInternalType.Undefined)
|
|
||||||
throw new InvalidCastException("Not an identifier");
|
|
||||||
result[i] = new SIdentifier(op.AsIdentifier());
|
|
||||||
}
|
|
||||||
_cb(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE1006
|
|
||||||
}
|
|
||||||
public class RulesetViolationException : Exception {
|
public class RulesetViolationException : Exception {
|
||||||
public RulesetViolationException() { }
|
public RulesetViolationException() { }
|
||||||
public RulesetViolationException(string message) : base(message) { }
|
public RulesetViolationException(string message) : base(message) { }
|
||||||
|
@@ -5,7 +5,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
internal class RulesetInterpreter : PdtInterpreter {
|
internal class RulesetInterpreter : PdtInterpreter {
|
||||||
public RulesetInterpreter(string src, Binder binder) : base(src, typeof(PdtRuleset), binder) { }
|
public RulesetInterpreter(string src, Binder binder) : base(src, binder) { }
|
||||||
|
|
||||||
readonly List<RulesetSelector> s = new List<RulesetSelector>();
|
readonly List<RulesetSelector> s = new List<RulesetSelector>();
|
||||||
readonly List<string> a = new List<string>();
|
readonly List<string> a = new List<string>();
|
||||||
|
@@ -61,6 +61,18 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Category("gameplay")]
|
||||||
|
[Step(0.01f)]
|
||||||
|
[Precision(1e-3)]
|
||||||
|
public float GraphicalOffset {
|
||||||
|
get {
|
||||||
|
return PlayerPrefs.GetFloat("GraphicalOffset", 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
PlayerPrefs.SetFloat("GraphicalOffset", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public string LastRunVersion {
|
public string LastRunVersion {
|
||||||
get {
|
get {
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
|
using Cryville.Common;
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using Cryville.Crtr.Browsing;
|
using Cryville.Crtr.Browsing;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -25,12 +27,45 @@ namespace Cryville.Crtr {
|
|||||||
public void LoadPdt(DirectoryInfo dir) {
|
public void LoadPdt(DirectoryInfo dir) {
|
||||||
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
||||||
var src = pdtreader.ReadToEnd();
|
var src = pdtreader.ReadToEnd();
|
||||||
Root = (PdtSkin)new SkinInterpreter(src, null).Interpret();
|
var interpreter = new SkinInterpreter(src, null);
|
||||||
|
var format = interpreter.GetFormatVersion();
|
||||||
|
if (format.Length == 1) {
|
||||||
|
Root = new PdtSkin();
|
||||||
|
Root.elements = (SkinElement)new SkinInterpreter(src, new PdtBinder()).Interpret(typeof(SkinElement));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (format[1]) {
|
||||||
|
case 1:
|
||||||
|
Root = (PdtSkin)new SkinInterpreter(src, new PdtBinder()).Interpret(typeof(PdtSkin));
|
||||||
|
break;
|
||||||
|
default: throw new NotSupportedException("Unsupported skin format");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PdtSkin : SkinElement { }
|
public class PdtSkin {
|
||||||
|
public Dictionary<Identifier, AnimationSpan> animations
|
||||||
|
= new Dictionary<Identifier, AnimationSpan>();
|
||||||
|
public Dictionary<Identifier, EffectDefinition> effects
|
||||||
|
= new Dictionary<Identifier, EffectDefinition>();
|
||||||
|
public SkinElement elements;
|
||||||
|
|
||||||
|
public void Optimize(PdtEvaluator etor) {
|
||||||
|
foreach (var a in animations) {
|
||||||
|
a.Value.Optimize(etor);
|
||||||
|
}
|
||||||
|
foreach (var e in effects) {
|
||||||
|
var effect = e.Value;
|
||||||
|
etor.ContextCascadeInsert();
|
||||||
|
etor.Optimize(effect.duration);
|
||||||
|
effect.elements.Optimize(etor);
|
||||||
|
etor.ContextCascadeDiscard();
|
||||||
|
}
|
||||||
|
elements.Optimize(etor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class SkinElement {
|
public class SkinElement {
|
||||||
[ElementList]
|
[ElementList]
|
||||||
@@ -48,9 +83,9 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public void Optimize(PdtEvaluatorBase etor) {
|
public void Optimize(PdtEvaluatorBase etor) {
|
||||||
IsDynamic = true;
|
IsDynamic = true;
|
||||||
foreach (var e in properties.Values) {
|
foreach (var e in properties) {
|
||||||
etor.Optimize(e);
|
etor.Optimize(e.Value);
|
||||||
if (!e.IsConstant)
|
if (!e.Value.IsConstant)
|
||||||
IsDynamic = true;
|
IsDynamic = true;
|
||||||
}
|
}
|
||||||
foreach (var e in elements) {
|
foreach (var e in elements) {
|
||||||
@@ -61,4 +96,28 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EffectDefinition {
|
||||||
|
public PdtExpression duration;
|
||||||
|
public SkinElement elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AnimationSpan {
|
||||||
|
[ElementList]
|
||||||
|
public Dictionary<Clip, AnimationSpan> spans
|
||||||
|
= new Dictionary<Clip, AnimationSpan>();
|
||||||
|
|
||||||
|
[PropertyList]
|
||||||
|
public Dictionary<SkinPropertyKey, PdtExpression> properties
|
||||||
|
= new Dictionary<SkinPropertyKey, PdtExpression>();
|
||||||
|
|
||||||
|
public void Optimize(PdtEvaluator etor) {
|
||||||
|
foreach (var p in properties) {
|
||||||
|
etor.Optimize(p.Value);
|
||||||
|
}
|
||||||
|
foreach (var e in spans) {
|
||||||
|
e.Value.Optimize(etor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ using UnityEngine.Profiling;
|
|||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class SkinContainer {
|
public class SkinContainer {
|
||||||
readonly PdtSkin skin;
|
readonly SkinElement _rootElement;
|
||||||
readonly DynamicStack[] _stacks = new DynamicStack[2];
|
readonly DynamicStack[] _stacks = new DynamicStack[2];
|
||||||
class DynamicStack {
|
class DynamicStack {
|
||||||
public readonly List<DynamicProperty> Properties = new List<DynamicProperty>();
|
public readonly List<DynamicProperty> Properties = new List<DynamicProperty>();
|
||||||
@@ -26,25 +26,21 @@ namespace Cryville.Crtr {
|
|||||||
public SkinSelectors Selectors { get; set; }
|
public SkinSelectors Selectors { get; set; }
|
||||||
public SkinElement Element { get; set; }
|
public SkinElement Element { get; set; }
|
||||||
}
|
}
|
||||||
public SkinContainer(PdtSkin _skin) {
|
public SkinContainer(SkinElement rootElement) {
|
||||||
skin = _skin;
|
_rootElement = rootElement;
|
||||||
for (int i = 0; i < _stacks.Length; i++) _stacks[i] = new DynamicStack();
|
for (int i = 0; i < _stacks.Length; i++) _stacks[i] = new DynamicStack();
|
||||||
}
|
}
|
||||||
public void MatchStatic(ContainerState state) {
|
public void MatchStatic(ISkinnableGroup group) {
|
||||||
var stack = _stacks[0];
|
var stack = _stacks[0];
|
||||||
stack.Clear();
|
stack.Clear();
|
||||||
ChartPlayer.etor.ContextState = state;
|
MatchStatic(_rootElement, group, stack, new RuntimeSkinContext(group.SkinContext));
|
||||||
ChartPlayer.etor.ContextEvent = state.Container;
|
|
||||||
MatchStatic(skin, state, stack, new RuntimeSkinContext(state.Handler.SkinContext));
|
|
||||||
ChartPlayer.etor.ContextEvent = null;
|
|
||||||
ChartPlayer.etor.ContextState = null;
|
|
||||||
}
|
}
|
||||||
void MatchStatic(SkinElement rel, ContainerState state, DynamicStack stack, RuntimeSkinContext ctx) {
|
void MatchStatic(SkinElement rel, ISkinnableGroup group, DynamicStack stack, RuntimeSkinContext ctx) {
|
||||||
var rc = ctx.ReadContext;
|
var rc = ctx.ReadContext;
|
||||||
ChartPlayer.etor.ContextTransform = rc.Transform;
|
ChartPlayer.etor.ContextTransform = rc.Transform;
|
||||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeInsert(rc.PropSrcs);
|
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeInsert(rc.PropSrcs);
|
||||||
foreach (var p in rel.properties) {
|
foreach (var p in rel.properties) {
|
||||||
p.Key.ExecuteStatic(state, ctx, p.Value);
|
p.Key.ExecuteStatic(group, ctx, p.Value);
|
||||||
if (p.Key.IsValueRequired && !p.Value.IsConstant) stack.Properties.Add(
|
if (p.Key.IsValueRequired && !p.Value.IsConstant) stack.Properties.Add(
|
||||||
new DynamicProperty { Context = ctx, Key = p.Key, Value = p.Value }
|
new DynamicProperty { Context = ctx, Key = p.Key, Value = p.Value }
|
||||||
);
|
);
|
||||||
@@ -52,13 +48,13 @@ namespace Cryville.Crtr {
|
|||||||
ChartPlayer.etor.ContextTransform = null;
|
ChartPlayer.etor.ContextTransform = null;
|
||||||
foreach (var e in rel.elements) {
|
foreach (var e in rel.elements) {
|
||||||
try {
|
try {
|
||||||
var nctxs = e.Key.MatchStatic(state, rc);
|
var nctxs = e.Key.MatchStatic(group, rc);
|
||||||
if (nctxs != null) {
|
if (nctxs != null) {
|
||||||
var roflag = e.Key.annotations.Contains("if");
|
var roflag = e.Key.annotations.Contains("if");
|
||||||
var woflag = e.Key.annotations.Contains("then");
|
var woflag = e.Key.annotations.Contains("then");
|
||||||
foreach (var nctx in nctxs) {
|
foreach (var nctx in nctxs) {
|
||||||
var nrctx = new RuntimeSkinContext(nctx, ctx, roflag, woflag);
|
var nrctx = new RuntimeSkinContext(nctx, ctx, roflag, woflag);
|
||||||
MatchStatic(e.Value, state, stack, nrctx);
|
MatchStatic(e.Value, group, stack, nrctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,17 +66,15 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||||
}
|
}
|
||||||
public void MatchDynamic(ContainerState state) {
|
public void MatchDynamic(ISkinnableGroup group, int dl) {
|
||||||
var stack = _stacks[state.CloneType >> 1];
|
var stack = _stacks[dl];
|
||||||
var nstack = (state.CloneType >> 1) + 1 < _stacks.Length ? _stacks[(state.CloneType >> 1) + 1] : null;
|
|
||||||
if (nstack != null) nstack.Clear();
|
|
||||||
if (stack.Properties.Count == 0 && stack.Elements.Count == 0) return;
|
if (stack.Properties.Count == 0 && stack.Elements.Count == 0) return;
|
||||||
|
var nstack = dl + 1 < _stacks.Length ? _stacks[dl + 1] : null;
|
||||||
|
if (nstack != null) nstack.Clear();
|
||||||
Profiler.BeginSample("SkinContainer.MatchDynamic");
|
Profiler.BeginSample("SkinContainer.MatchDynamic");
|
||||||
ChartPlayer.etor.ContextState = state;
|
|
||||||
ChartPlayer.etor.ContextEvent = state.Container;
|
|
||||||
for (int i = 0; i < stack.Properties.Count; i++) {
|
for (int i = 0; i < stack.Properties.Count; i++) {
|
||||||
DynamicProperty p = stack.Properties[i];
|
DynamicProperty p = stack.Properties[i];
|
||||||
p.Key.ExecuteDynamic(state, p.Context, p.Value);
|
p.Key.ExecuteDynamic(group, p.Context, p.Value, dl);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < stack.Elements.Count; i++) {
|
for (int i = 0; i < stack.Elements.Count; i++) {
|
||||||
DynamicElement e = stack.Elements[i];
|
DynamicElement e = stack.Elements[i];
|
||||||
@@ -88,33 +82,36 @@ namespace Cryville.Crtr {
|
|||||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||||
SkinContext nctx = null;
|
SkinContext nctx = null;
|
||||||
try {
|
try {
|
||||||
nctx = e.Selectors.MatchDynamic(state, e.Context.ReadContext);
|
nctx = e.Selectors.MatchDynamic(group, e.Context.ReadContext);
|
||||||
}
|
}
|
||||||
catch (SelectorNotAvailableException) {
|
catch (SelectorNotAvailableException) {
|
||||||
if (nstack == null) throw;
|
if (nstack == null) throw;
|
||||||
nstack.Elements.Add(e);
|
nstack.Elements.Add(e);
|
||||||
}
|
}
|
||||||
if (nctx != null) MatchDynamic(e.Element, state, nstack, new RuntimeSkinContext(
|
if (nctx != null) {
|
||||||
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
MatchDynamic(e.Element, group, dl, nstack, new RuntimeSkinContext(
|
||||||
));
|
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
||||||
|
));
|
||||||
|
if (e.Selectors.annotations.Contains("once")) {
|
||||||
|
stack.Elements.RemoveAt(i--);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||||
}
|
}
|
||||||
ChartPlayer.etor.ContextEvent = null;
|
|
||||||
ChartPlayer.etor.ContextState = null;
|
|
||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
}
|
}
|
||||||
void MatchDynamic(SkinElement rel, ContainerState state, DynamicStack stack, RuntimeSkinContext ctx) {
|
void MatchDynamic(SkinElement rel, ISkinnableGroup group, int dl, DynamicStack stack, RuntimeSkinContext ctx) {
|
||||||
var rc = ctx.ReadContext;
|
var rc = ctx.ReadContext;
|
||||||
ChartPlayer.etor.ContextTransform = rc.Transform;
|
ChartPlayer.etor.ContextTransform = rc.Transform;
|
||||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeInsert(rc.PropSrcs);
|
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeInsert(rc.PropSrcs);
|
||||||
foreach (var p in rel.properties) {
|
foreach (var p in rel.properties) {
|
||||||
p.Key.ExecuteDynamic(state, ctx, p.Value);
|
p.Key.ExecuteDynamic(group, ctx, p.Value, dl);
|
||||||
}
|
}
|
||||||
ChartPlayer.etor.ContextTransform = null;
|
ChartPlayer.etor.ContextTransform = null;
|
||||||
foreach (var e in rel.elements) {
|
foreach (var e in rel.elements) {
|
||||||
if (e.Key.IsUpdatable(state)) {
|
if (e.Key.IsUpdatable(group, dl)) {
|
||||||
SkinContext nctx = e.Key.MatchDynamic(state, rc);
|
SkinContext nctx = e.Key.MatchDynamic(group, rc);
|
||||||
if (nctx != null) MatchDynamic(e.Value, state, stack, new RuntimeSkinContext(
|
if (nctx != null) MatchDynamic(e.Value, group, dl, stack, new RuntimeSkinContext(
|
||||||
nctx, ctx, e.Key.annotations.Contains("if"), e.Key.annotations.Contains("then")
|
nctx, ctx, e.Key.annotations.Contains("if"), e.Key.annotations.Contains("then")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -162,4 +159,12 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public interface ISkinnableGroup {
|
||||||
|
string TypeName { get; }
|
||||||
|
SkinContext SkinContext { get; }
|
||||||
|
Anchor OpenedAnchor { get; }
|
||||||
|
bool TryGetAnchorsByName(int name, out IReadOnlyCollection<Anchor> result);
|
||||||
|
void RegisterAnchor(int name);
|
||||||
|
void PushAnchorEvent(double time, int name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,12 +7,20 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class SkinInterpreter : PdtInterpreter {
|
public class SkinInterpreter : PdtInterpreter {
|
||||||
public SkinInterpreter(string src, Binder binder) : base(src, typeof(PdtSkin), binder) { }
|
public SkinInterpreter(string src, Binder binder) : base(src, binder) { }
|
||||||
|
|
||||||
readonly List<SkinSelector> s = new List<SkinSelector>();
|
readonly List<SkinSelector> s = new List<SkinSelector>();
|
||||||
readonly HashSet<string> a = new HashSet<string>();
|
readonly HashSet<string> a = new HashSet<string>();
|
||||||
readonly List<string> k = new List<string>(2);
|
readonly List<string> k = new List<string>(2);
|
||||||
protected override object InterpretKey(Type type) {
|
protected override object InterpretKey(Type type) {
|
||||||
|
if (typeof(SkinElement).IsAssignableFrom(type))
|
||||||
|
return InterpretSkinElementKey();
|
||||||
|
else if (typeof(AnimationSpan).IsAssignableFrom(type))
|
||||||
|
return InterpretAnimationSpanKey();
|
||||||
|
else
|
||||||
|
return base.InterpretKey(type);
|
||||||
|
}
|
||||||
|
object InterpretSkinElementKey() {
|
||||||
s.Clear(); a.Clear(); k.Clear();
|
s.Clear(); a.Clear(); k.Clear();
|
||||||
bool invalidKeyFlag = false, compKeyFlag = false;
|
bool invalidKeyFlag = false, compKeyFlag = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -62,6 +70,12 @@ namespace Cryville.Crtr {
|
|||||||
Name = IdentifierManager.SharedInstance.Request(k[0])
|
Name = IdentifierManager.SharedInstance.Request(k[0])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (a.Contains("emit")) {
|
||||||
|
if (k.Count != 1) throw new FormatException("Invalid effect name");
|
||||||
|
return new SkinPropertyKey.EmitEffect {
|
||||||
|
Name = IdentifierManager.SharedInstance.Request(k[0])
|
||||||
|
};
|
||||||
|
}
|
||||||
switch (k.Count) {
|
switch (k.Count) {
|
||||||
case 1:
|
case 1:
|
||||||
if (compKeyFlag) return new SkinPropertyKey.CreateComponent {
|
if (compKeyFlag) return new SkinPropertyKey.CreateComponent {
|
||||||
@@ -82,7 +96,7 @@ namespace Cryville.Crtr {
|
|||||||
case '{':
|
case '{':
|
||||||
return new SkinSelectors(s, a);
|
return new SkinSelectors(s, a);
|
||||||
case '}':
|
case '}':
|
||||||
return null;
|
throw new FormatException("Invalid token");
|
||||||
case '*':
|
case '*':
|
||||||
GetChar();
|
GetChar();
|
||||||
compKeyFlag = true;
|
compKeyFlag = true;
|
||||||
@@ -100,6 +114,59 @@ namespace Cryville.Crtr {
|
|||||||
if (Position == pp) throw new FormatException("Invalid selector or key format");
|
if (Position == pp) throw new FormatException("Invalid selector or key format");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
object InterpretAnimationSpanKey() {
|
||||||
|
if ((ct & 0x0040) != 0 || cc == ',') {
|
||||||
|
float start = 0, end = 1;
|
||||||
|
if (cc != ',') {
|
||||||
|
start = float.Parse(GetNumber());
|
||||||
|
ws(); if (cc != ',') throw new FormatException("Invalid span format");
|
||||||
|
}
|
||||||
|
GetChar(); ws();
|
||||||
|
if (cc != '{') end = float.Parse(GetNumber());
|
||||||
|
ws();
|
||||||
|
if (cc != '{') throw new FormatException("Invalid span format");
|
||||||
|
return new Clip(start, end);
|
||||||
|
}
|
||||||
|
k.Clear();
|
||||||
|
while (true) {
|
||||||
|
int pp = Position;
|
||||||
|
switch (cc) {
|
||||||
|
case '.':
|
||||||
|
GetChar();
|
||||||
|
if (k.Count != 1)
|
||||||
|
throw new FormatException("Invalid key format");
|
||||||
|
k.Add(GetIdentifier());
|
||||||
|
break;
|
||||||
|
case ';':
|
||||||
|
case ':':
|
||||||
|
switch (k.Count) {
|
||||||
|
case 1:
|
||||||
|
return new SkinPropertyKey.SetProperty {
|
||||||
|
Component = typeof(TransformInterface),
|
||||||
|
Name = IdentifierManager.SharedInstance.Request(k[0])
|
||||||
|
};
|
||||||
|
case 2:
|
||||||
|
return new SkinPropertyKey.SetProperty {
|
||||||
|
Component = GetComponentByName(k[0]),
|
||||||
|
Name = IdentifierManager.SharedInstance.Request(k[1])
|
||||||
|
};
|
||||||
|
default:
|
||||||
|
throw new FormatException("Unknown error"); // Unreachable
|
||||||
|
}
|
||||||
|
case '{':
|
||||||
|
throw new FormatException("Invalid token");
|
||||||
|
case '}':
|
||||||
|
throw new FormatException("Invalid token");
|
||||||
|
default:
|
||||||
|
if (k.Count != 0)
|
||||||
|
throw new FormatException("Invalid key format");
|
||||||
|
k.Add(GetIdentifier());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ws();
|
||||||
|
if (Position == pp) throw new FormatException("Invalid selector or key format");
|
||||||
|
}
|
||||||
|
}
|
||||||
static Type GetComponentByName(string name) {
|
static Type GetComponentByName(string name) {
|
||||||
Type result;
|
Type result;
|
||||||
if (GenericResources.Components.TryGetValue(name, out result)) return result;
|
if (GenericResources.Components.TryGetValue(name, out result)) return result;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using Cryville.Crtr.Components;
|
using Cryville.Crtr.Components;
|
||||||
using Cryville.Crtr.Event;
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -9,18 +8,18 @@ namespace Cryville.Crtr {
|
|||||||
public abstract class SkinPropertyKey {
|
public abstract class SkinPropertyKey {
|
||||||
public abstract override string ToString();
|
public abstract override string ToString();
|
||||||
public abstract bool IsValueRequired { get; }
|
public abstract bool IsValueRequired { get; }
|
||||||
public abstract void ExecuteStatic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp);
|
public abstract void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp);
|
||||||
public abstract void ExecuteDynamic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp);
|
public abstract void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl);
|
||||||
public class CreateComponent : SkinPropertyKey {
|
public class CreateComponent : SkinPropertyKey {
|
||||||
public Type Component { get; set; }
|
public Type Component { get; set; }
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return string.Format("*{0}", Component.Name);
|
return string.Format("*{0}", Component.Name);
|
||||||
}
|
}
|
||||||
public override bool IsValueRequired { get { return false; } }
|
public override bool IsValueRequired { get { return false; } }
|
||||||
public override void ExecuteStatic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp) {
|
||||||
ctx.ReadContext.Transform.gameObject.AddComponent(Component);
|
ctx.WriteTransform.gameObject.AddComponent(Component);
|
||||||
}
|
}
|
||||||
public override void ExecuteDynamic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl) {
|
||||||
throw new InvalidOperationException("Component creation in dynamic context is not allowed");
|
throw new InvalidOperationException("Component creation in dynamic context is not allowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,12 +30,12 @@ namespace Cryville.Crtr {
|
|||||||
return string.Format("{0}.{1}", Component.Name, IdentifierManager.SharedInstance.Retrieve(Name));
|
return string.Format("{0}.{1}", Component.Name, IdentifierManager.SharedInstance.Retrieve(Name));
|
||||||
}
|
}
|
||||||
public override bool IsValueRequired { get { return true; } }
|
public override bool IsValueRequired { get { return true; } }
|
||||||
public override void ExecuteStatic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp) {
|
||||||
Execute(ctx, GetPropOp(ctx.WriteTransform).Operator, exp);
|
Execute(ctx, GetPropOp(ctx.WriteTransform).Operator, exp);
|
||||||
}
|
}
|
||||||
public override void ExecuteDynamic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl) {
|
||||||
var prop = GetPropOp(ctx.WriteTransform);
|
var prop = GetPropOp(ctx.WriteTransform);
|
||||||
if (state.CloneType > prop.UpdateCloneType) return;
|
if (dl > prop.UpdateDynamicLevel) return;
|
||||||
Execute(ctx, prop.Operator, exp);
|
Execute(ctx, prop.Operator, exp);
|
||||||
}
|
}
|
||||||
void Execute(RuntimeSkinContext ctx, PdtOperator op, PdtExpression exp) {
|
void Execute(RuntimeSkinContext ctx, PdtOperator op, PdtExpression exp) {
|
||||||
@@ -67,10 +66,10 @@ namespace Cryville.Crtr {
|
|||||||
return string.Format("@has {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
return string.Format("@has {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||||
}
|
}
|
||||||
public override bool IsValueRequired { get { return false; } }
|
public override bool IsValueRequired { get { return false; } }
|
||||||
public override void ExecuteStatic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp) {
|
||||||
state.Handler.RegisterAnchor(Name, true);
|
group.RegisterAnchor(Name);
|
||||||
}
|
}
|
||||||
public override void ExecuteDynamic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl) {
|
||||||
throw new InvalidOperationException("Anchor creation in dynamic context is not allowed");
|
throw new InvalidOperationException("Anchor creation in dynamic context is not allowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,18 +82,37 @@ namespace Cryville.Crtr {
|
|||||||
return string.Format("@at {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
return string.Format("@at {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||||
}
|
}
|
||||||
public override bool IsValueRequired { get { return true; } }
|
public override bool IsValueRequired { get { return true; } }
|
||||||
public override void ExecuteStatic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp) {
|
||||||
throw new InvalidOperationException("Setting anchor in static context is not allowed");
|
throw new InvalidOperationException("Setting anchor in static context is not allowed");
|
||||||
}
|
}
|
||||||
float _time;
|
float _time;
|
||||||
readonly PropOp _timeOp;
|
readonly PropOp _timeOp;
|
||||||
public override void ExecuteDynamic(ContainerState state, RuntimeSkinContext ctx, PdtExpression exp) {
|
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl) {
|
||||||
if (state.CloneType > 1) return;
|
if (dl > 0) return;
|
||||||
var psrcs = ctx.ReadContext.PropSrcs;
|
var psrcs = ctx.ReadContext.PropSrcs;
|
||||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||||
ChartPlayer.etor.Evaluate(_timeOp, exp);
|
ChartPlayer.etor.Evaluate(_timeOp, exp);
|
||||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||||
state.Handler.PushAnchorEvent(_time, Name);
|
group.PushAnchorEvent(_time, Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EmitEffect : SkinPropertyKey {
|
||||||
|
public int Name { get; set; }
|
||||||
|
public EmitEffect() {
|
||||||
|
_op = new PropOp.Float(v => _index = v);
|
||||||
|
}
|
||||||
|
public override string ToString() {
|
||||||
|
return string.Format("@emit {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||||
|
}
|
||||||
|
public override bool IsValueRequired { get { return true; } }
|
||||||
|
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp) {
|
||||||
|
throw new InvalidOperationException("Emitting effect in static context is not allowed");
|
||||||
|
}
|
||||||
|
float _index;
|
||||||
|
readonly PropOp _op;
|
||||||
|
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, int dl) {
|
||||||
|
ChartPlayer.etor.Evaluate(_op, exp);
|
||||||
|
ChartPlayer.effectManager.Emit(Name, _index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using Cryville.Crtr.Components;
|
using Cryville.Crtr.Components;
|
||||||
using Cryville.Crtr.Event;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -37,21 +36,21 @@ namespace Cryville.Crtr {
|
|||||||
selectors[i].Optimize(etor);
|
selectors[i].Optimize(etor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext ctx) {
|
public IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext ctx) {
|
||||||
IEnumerable<SkinContext> result = new SkinContext[] { ctx };
|
IEnumerable<SkinContext> result = new SkinContext[] { ctx };
|
||||||
foreach (var s in selectors) {
|
foreach (var s in selectors) {
|
||||||
result = result.SelectMany(l => s.MatchStatic(h, l));
|
result = result.SelectMany(l => s.MatchStatic(g, l));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public bool IsUpdatable(ContainerState h) {
|
public bool IsUpdatable(ISkinnableGroup g, int dl) {
|
||||||
foreach (var s in selectors)
|
foreach (var s in selectors)
|
||||||
if (!s.IsUpdatable(h)) return false;
|
if (!s.IsUpdatable(g, dl)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public SkinContext MatchDynamic(ContainerState h, SkinContext ctx) {
|
public SkinContext MatchDynamic(ISkinnableGroup g, SkinContext ctx) {
|
||||||
foreach (var s in selectors) {
|
foreach (var s in selectors) {
|
||||||
ctx = s.MatchDynamic(h, ctx);
|
ctx = s.MatchDynamic(g, ctx);
|
||||||
if (ctx == null) return null;
|
if (ctx == null) return null;
|
||||||
}
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
@@ -63,16 +62,16 @@ namespace Cryville.Crtr {
|
|||||||
public abstract override string ToString();
|
public abstract override string ToString();
|
||||||
|
|
||||||
public virtual void Optimize(PdtEvaluatorBase etor) { }
|
public virtual void Optimize(PdtEvaluatorBase etor) { }
|
||||||
public virtual IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext c) { throw new SelectorNotAvailableException(); }
|
public virtual IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) { throw new SelectorNotAvailableException(); }
|
||||||
public virtual SkinContext MatchDynamic(ContainerState h, SkinContext c) { throw new SelectorNotAvailableException(); }
|
public virtual SkinContext MatchDynamic(ISkinnableGroup g, SkinContext c) { throw new SelectorNotAvailableException(); }
|
||||||
public virtual bool IsUpdatable(ContainerState h) {
|
public virtual bool IsUpdatable(ISkinnableGroup g, int dl) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public class CreateObject : SkinSelector {
|
public class CreateObject : SkinSelector {
|
||||||
public CreateObject() { }
|
public CreateObject() { }
|
||||||
public override string ToString() { return "$"; }
|
public override string ToString() { return "$"; }
|
||||||
|
|
||||||
public override IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext c) {
|
public override IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) {
|
||||||
var obj = new GameObject("__obj__");
|
var obj = new GameObject("__obj__");
|
||||||
obj.transform.SetParent(c.Transform, false);
|
obj.transform.SetParent(c.Transform, false);
|
||||||
obj.AddComponent<TransformInterface>();
|
obj.AddComponent<TransformInterface>();
|
||||||
@@ -86,9 +85,9 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
public override string ToString() { return string.Format(".{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
|
public override string ToString() { return string.Format(".{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
|
||||||
|
|
||||||
public override IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext c) {
|
public override IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) {
|
||||||
List<CAnchor> anchors;
|
IReadOnlyCollection<CAnchor> anchors;
|
||||||
if (h.Handler.Anchors.TryGetValue(Name, out anchors)) {
|
if (g.TryGetAnchorsByName(Name, out anchors)) {
|
||||||
return anchors.Select(a => a.SkinContext);
|
return anchors.Select(a => a.SkinContext);
|
||||||
}
|
}
|
||||||
else return Enumerable.Empty<SkinContext>();
|
else return Enumerable.Empty<SkinContext>();
|
||||||
@@ -101,11 +100,11 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
public override string ToString() { return string.Format("..{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
|
public override string ToString() { return string.Format("..{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
|
||||||
|
|
||||||
public override SkinContext MatchDynamic(ContainerState h, SkinContext c) {
|
public override SkinContext MatchDynamic(ISkinnableGroup g, SkinContext c) {
|
||||||
return h.Handler.OpenedAnchor != null && h.Handler.OpenedAnchor.Name == Name ? c : null;
|
return g.OpenedAnchor != null && g.OpenedAnchor.Name == Name ? c : null;
|
||||||
}
|
}
|
||||||
public override bool IsUpdatable(ContainerState h) {
|
public override bool IsUpdatable(ISkinnableGroup g, int dl) {
|
||||||
return h.CloneType >= 2;
|
return dl >= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Property : SkinSelector {
|
public class Property : SkinSelector {
|
||||||
@@ -121,12 +120,12 @@ namespace Cryville.Crtr {
|
|||||||
public override void Optimize(PdtEvaluatorBase etor) {
|
public override void Optimize(PdtEvaluatorBase etor) {
|
||||||
etor.Optimize(_exp);
|
etor.Optimize(_exp);
|
||||||
}
|
}
|
||||||
public override IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext c) {
|
public override IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) {
|
||||||
var result = Match(c);
|
var result = Match(c);
|
||||||
if (result != null) return new SkinContext[] { result };
|
if (result != null) return new SkinContext[] { result };
|
||||||
else return Enumerable.Empty<SkinContext>();
|
else return Enumerable.Empty<SkinContext>();
|
||||||
}
|
}
|
||||||
public override SkinContext MatchDynamic(ContainerState h, SkinContext c) {
|
public override SkinContext MatchDynamic(ISkinnableGroup g, SkinContext c) {
|
||||||
return Match(c);
|
return Match(c);
|
||||||
}
|
}
|
||||||
public SkinContext Match(SkinContext a) {
|
public SkinContext Match(SkinContext a) {
|
||||||
@@ -148,8 +147,8 @@ namespace Cryville.Crtr {
|
|||||||
public ElementType(string type) { _type = type; }
|
public ElementType(string type) { _type = type; }
|
||||||
public override string ToString() { return _type; }
|
public override string ToString() { return _type; }
|
||||||
|
|
||||||
public override IEnumerable<SkinContext> MatchStatic(ContainerState h, SkinContext c) {
|
public override IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) {
|
||||||
return h.Handler.TypeName == _type ? new SkinContext[] { c } : Enumerable.Empty<SkinContext>();
|
return g.TypeName == _type ? new SkinContext[] { c } : Enumerable.Empty<SkinContext>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,10 +61,9 @@ namespace Cryville.Crtr {
|
|||||||
return new Vector2(Texture.width, Texture.height);
|
return new Vector2(Texture.width, Texture.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public SpriteFrame(Texture2D tex) {
|
||||||
public void Init() {
|
if (tex == null) throw new ArgumentNullException("tex");
|
||||||
if (Texture == null)
|
Texture = tex;
|
||||||
throw new InvalidOperationException("Missing texture");
|
|
||||||
m_frame = new Rect(Vector2.zero, Size);
|
m_frame = new Rect(Vector2.zero, Size);
|
||||||
var w = m_frame.width;
|
var w = m_frame.width;
|
||||||
var h = m_frame.height;
|
var h = m_frame.height;
|
||||||
@@ -75,10 +74,5 @@ namespace Cryville.Crtr {
|
|||||||
if (m_rotated) UV = new Rect(x, y, tw, -th);
|
if (m_rotated) UV = new Rect(x, y, tw, -th);
|
||||||
else UV = new Rect(x, y, tw, -th);
|
else UV = new Rect(x, y, tw, -th);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpriteFrame() { }
|
|
||||||
public SpriteFrame(Texture2D tex) {
|
|
||||||
Texture = tex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,11 +27,11 @@ namespace Cryville.Crtr {
|
|||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void StartPreGraphicalUpdate(ContainerState s) {
|
protected override void StartPreGraphicalUpdate(ContainerState s) {
|
||||||
base.StartPreGraphicalUpdate(s);
|
base.StartPreGraphicalUpdate(s);
|
||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
}
|
}
|
||||||
public override void StartGraphicalUpdate(ContainerState s) {
|
protected override void StartGraphicalUpdate(ContainerState s) {
|
||||||
base.StartGraphicalUpdate(s);
|
base.StartGraphicalUpdate(s);
|
||||||
if (gogroup) {
|
if (gogroup) {
|
||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
@@ -105,7 +105,7 @@ namespace Cryville.Crtr {
|
|||||||
spos = bpos - GetCurrentWorldPoint();
|
spos = bpos - GetCurrentWorldPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EndGraphicalUpdate(ContainerState s) {
|
protected override void EndGraphicalUpdate(ContainerState s) {
|
||||||
base.EndGraphicalUpdate(s);
|
base.EndGraphicalUpdate(s);
|
||||||
EndUpdatePosition(s);
|
EndUpdatePosition(s);
|
||||||
var p = GetCurrentWorldPoint();
|
var p = GetCurrentWorldPoint();
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -211,7 +211,7 @@ namespace System.Text.Formatting {
|
|||||||
remainingDigitsInGroup -= groupSize;
|
remainingDigitsInGroup -= groupSize;
|
||||||
groupIndex++;
|
groupIndex++;
|
||||||
}
|
}
|
||||||
bool appendingDigitFlag = false;
|
bool appendingDigitFlag = false, outOfPrecisionFlag = false;
|
||||||
decimalFlag = false;
|
decimalFlag = false;
|
||||||
for (index = start; index < end; index++) {
|
for (index = start; index < end; index++) {
|
||||||
switch (ptr[index]) {
|
switch (ptr[index]) {
|
||||||
@@ -229,13 +229,20 @@ namespace System.Text.Formatting {
|
|||||||
case '#':
|
case '#':
|
||||||
if (!appendingDigitFlag) {
|
if (!appendingDigitFlag) {
|
||||||
if (number.Scale > integralDigits) while (currentDigitIndex < number.Scale - integralDigits)
|
if (number.Scale > integralDigits) while (currentDigitIndex < number.Scale - integralDigits)
|
||||||
formatter.AppendIntegralDigit(ref number, ref currentDigitIndex, culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
formatter.AppendIntegralDigit(ref number, ref currentDigitIndex, culture, groupFlag, ref outOfPrecisionFlag, ref groupIndex, ref remainingDigitsInGroup);
|
||||||
appendingDigitFlag = true;
|
appendingDigitFlag = true;
|
||||||
}
|
}
|
||||||
if (decimalFlag) {
|
if (decimalFlag) {
|
||||||
if (currentDigitIndex < number.Precision) {
|
char digit = '0';
|
||||||
char digit = number.Digits[currentDigitIndex++];
|
if (!outOfPrecisionFlag) {
|
||||||
if (digit == '\0') digit = '0';
|
if (currentDigitIndex >= number.Precision) outOfPrecisionFlag = true;
|
||||||
|
else {
|
||||||
|
digit = number.Digits[currentDigitIndex++];
|
||||||
|
if (digit == '\0') {
|
||||||
|
outOfPrecisionFlag = true;
|
||||||
|
digit = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
formatter.Append(digit);
|
formatter.Append(digit);
|
||||||
}
|
}
|
||||||
else if (decimalZeros > 0)
|
else if (decimalZeros > 0)
|
||||||
@@ -245,7 +252,7 @@ namespace System.Text.Formatting {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (integralDigits <= number.Scale)
|
if (integralDigits <= number.Scale)
|
||||||
formatter.AppendIntegralDigit(ref number, ref currentDigitIndex, culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
formatter.AppendIntegralDigit(ref number, ref currentDigitIndex, culture, groupFlag, ref outOfPrecisionFlag, ref groupIndex, ref remainingDigitsInGroup);
|
||||||
else if (integralDigits <= integralZeros)
|
else if (integralDigits <= integralZeros)
|
||||||
formatter.AppendIntegralDigit('0', culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
formatter.AppendIntegralDigit('0', culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
||||||
--integralDigits;
|
--integralDigits;
|
||||||
@@ -295,11 +302,18 @@ namespace System.Text.Formatting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void AppendIntegralDigit(this StringBuffer self, ref Number number, ref int index, CachedCulture culture, bool groupFlag, ref int groupIndex, ref int remainingDigitsInGroup) {
|
static void AppendIntegralDigit(this StringBuffer self, ref Number number, ref int index, CachedCulture culture, bool groupFlag, ref bool outOfPrecisionFlag, ref int groupIndex, ref int remainingDigitsInGroup) {
|
||||||
char digit;
|
char digit = '0';
|
||||||
if (index >= number.Precision) digit = '0';
|
if (!outOfPrecisionFlag) {
|
||||||
else digit = number.Digits[index];
|
if (index >= number.Precision) outOfPrecisionFlag = true;
|
||||||
if (digit == '\0') digit = '0';
|
else {
|
||||||
|
digit = number.Digits[index];
|
||||||
|
if (digit == '\0') {
|
||||||
|
outOfPrecisionFlag = true;
|
||||||
|
digit = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
self.AppendIntegralDigit(digit, culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
self.AppendIntegralDigit(digit, culture, groupFlag, ref groupIndex, ref remainingDigitsInGroup);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@@ -410,8 +410,16 @@ namespace System.Text.Formatting {
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void CheckCapacity (int count) {
|
void CheckCapacity (int count) {
|
||||||
if (currentCount + count > buffer.Length)
|
int newCount = currentCount + count;
|
||||||
Array.Resize(ref buffer, buffer.Length * 2);
|
if (newCount > buffer.Length) {
|
||||||
|
int newCapacity = buffer.Length * 2;
|
||||||
|
if (newCapacity < newCount) newCapacity = newCount;
|
||||||
|
char[] newBuffer = new char[newCapacity];
|
||||||
|
fixed (void* nptr = newBuffer, ptr = buffer) {
|
||||||
|
Unsafe.CopyBlock(nptr, ptr, (uint)(currentCount * sizeof(char)));
|
||||||
|
}
|
||||||
|
buffer = newBuffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppendSegment<T>(ref char* currRef, char* end, char* dest, ref int prevArgIndex, ref T args) where T : IArgSet {
|
bool AppendSegment<T>(ref char* currRef, char* end, char* dest, ref int prevArgIndex, ref T args) where T : IArgSet {
|
||||||
|
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d927992f95b82f740a0a95bb6d617d73
|
guid: 1313487c790be7545a3e1e2ca59e986e
|
||||||
PluginImporter:
|
PluginImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 215ebdd4cb9187741a2e24f5e7d8511d
|
guid: 73d1fd2fcd7807645a0025ce7844ec21
|
||||||
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user