summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-05-30 14:27:59 +0800
committerchai <215380520@qq.com>2023-05-30 14:27:59 +0800
commit2fcb4625389b1594bbefdbaf2e038b2cfffa8ead (patch)
tree87f57dbfdaf3d11ebf33869b76f12cc475c9a033
parent38e177b0fdf130d6a361ab51c80b5b56ee83f28e (diff)
+ json extends
-rw-r--r--WorldlineKeepers/Assets/Scripts/Common/Common.cs348
-rw-r--r--WorldlineKeepers/Assets/Scripts/Common/Common.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs317
-rw-r--r--WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs8
-rw-r--r--WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs1
-rw-r--r--WorldlineKeepers/Assets/Scripts/Utils/LogHelper.cs25
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in18
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in.meta7
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs105
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs.meta11
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj82
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs24
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs.meta11
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.pngbin3356 -> 0 bytes
-rw-r--r--WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png.meta98
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson.meta)0
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs)2
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs)135
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs)9
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs144
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs)390
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs)249
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs)179
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs)18
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs)6
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs.meta)5
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj.meta)3
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs37
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs750
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs300
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs618
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs54
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs107
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs171
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs.meta12
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs53
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs.meta (renamed from WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs.meta)2
-rw-r--r--WorldlineKeepers/ProjectSettings/ProjectSettings.asset2
53 files changed, 3646 insertions, 805 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Common/Common.cs b/WorldlineKeepers/Assets/Scripts/Common/Common.cs
new file mode 100644
index 0000000..13a9f58
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Common/Common.cs
@@ -0,0 +1,348 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// author: hanjun
+// date: 2018/12/03 16:31:57
+// desc: 某类
+//
+//
+//
+//
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+using UnityEngine;
+using System.Collections;
+
+namespace DNA
+{
+ [System.Serializable]
+ public struct IntVector2
+ {
+ public int x;
+ public int y;
+
+ public IntVector2(int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ static IntVector2 mZero = new IntVector2(0, 0);
+ static IntVector2 mOne = new IntVector2(1, 1);
+ public static IntVector2 Zero
+ {
+ get
+ {
+ return mZero;
+ }
+ }
+
+ public static IntVector2 One
+ {
+ get
+ {
+ return mOne;
+ }
+ }
+ public int ConstCount
+ {
+ get
+ {
+ return 2;
+ }
+ }
+ public int this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector2索引越界");
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ break;
+ case 1:
+ y = value;
+ break;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector2索引越界");
+ }
+ }
+ }
+ public static implicit operator Vector2(IntVector2 v)
+ {
+ return new Vector2(v.x, v.y);
+ }
+ public static IntVector2 operator *(int d, IntVector2 a)
+ {
+ a.x *= d;
+ a.y *= d;
+ return a;
+ }
+ public static bool operator ==(IntVector2 lhs, IntVector2 rhs)
+ {
+ return (lhs.x == rhs.x && lhs.y == rhs.y);
+ }
+
+ public static bool operator !=(IntVector2 lhs, IntVector2 rhs)
+ {
+ return (lhs.x != rhs.x || lhs.y != rhs.y);
+ }
+ public override string ToString()
+ {
+ return StringUtil.Concat(x.ToTempString(), ",", y.ToTempString());
+ }
+ public override bool Equals(object obj)
+ {
+ if (obj is IntVector2)
+ {
+ IntVector2 other = (IntVector2)obj;
+ return other.x == x && other.y == y;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ public struct IntVector3
+ {
+ public int x;
+ public int y;
+ public int z;
+
+ public IntVector3(int x, int y, int z)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ static IntVector3 mZero = new IntVector3(0, 0, 0);
+ public static IntVector3 Zero
+ {
+ get
+ {
+ return mZero;
+ }
+ }
+ public int ConstCount
+ {
+ get
+ {
+ return 3;
+ }
+ }
+ public int this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector3索引越界");
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ break;
+ case 1:
+ y = value;
+ break;
+ case 2:
+ z = value;
+ break;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector3索引越界");
+ }
+ }
+ }
+ public static implicit operator Vector3(IntVector3 v)
+ {
+ return new Vector3(v.x, v.y, v.z);
+ }
+ public static IntVector3 operator *(int d, IntVector3 a)
+ {
+ a.x *= d;
+ a.y *= d;
+ a.z *= d;
+ return a;
+ }
+ public static bool operator ==(IntVector3 lhs, IntVector3 rhs)
+ {
+ return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
+ }
+ public static bool operator !=(IntVector3 lhs, IntVector3 rhs)
+ {
+ return (lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z);
+ }
+ public override string ToString()
+ {
+ return StringUtil.Concat(x.ToTempString(), ",", y.ToTempString(), ",", z.ToTempString());
+ }
+ public override bool Equals(object obj)
+ {
+ if (obj is IntVector3)
+ {
+ IntVector3 other = (IntVector3)obj;
+ return other.x == x && other.y == y && other.z == z;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public bool Contains(int a)
+ {
+ if (x == a || y == a || z == a)
+ return true;
+ return false;
+ }
+ }
+
+ public struct IntVector4
+ {
+ public int x;
+ public int y;
+ public int z;
+ public int w;
+
+ public IntVector4(int x, int y, int z, int w)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ static IntVector4 mZero = new IntVector4(0, 0, 0, 0);
+ public static IntVector4 Zero
+ {
+ get
+ {
+ return mZero;
+ }
+ }
+ public static int ConstCount
+ {
+ get
+ {
+ return 4;
+ }
+ }
+ public int this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ case 3:
+ return w;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector4索引越界");
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ break;
+ case 1:
+ y = value;
+ break;
+ case 2:
+ z = value;
+ break;
+ case 3:
+ w = value;
+ break;
+ default:
+ throw new System.ArgumentOutOfRangeException("IntVector4索引越界");
+ }
+ }
+ }
+ public static implicit operator Vector4(IntVector4 v)
+ {
+ return new Vector4(v.x, v.y, v.z, v.w);
+ }
+ public static IntVector4 operator *(int d, IntVector4 a)
+ {
+ a.x *= d;
+ a.y *= d;
+ a.z *= d;
+ a.w *= d;
+ return a;
+ }
+ public static bool operator ==(IntVector4 lhs, IntVector4 rhs)
+ {
+ return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z && lhs.w == rhs.w);
+ }
+ public static bool operator !=(IntVector4 lhs, IntVector4 rhs)
+ {
+ return (lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z || lhs.w != rhs.w);
+ }
+
+ public override string ToString()
+ {
+ return StringUtil.Concat(x.ToTempString(), ",", y.ToTempString(), ",", z.ToTempString(), ",", w.ToTempString());
+ }
+ public override bool Equals(object obj)
+ {
+ if (obj is IntVector4)
+ {
+ IntVector4 other = (IntVector4)obj;
+ return other.x == x && other.y == y && other.z == z && other.w == w;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/Scripts/Common/Common.cs.meta b/WorldlineKeepers/Assets/Scripts/Common/Common.cs.meta
new file mode 100644
index 0000000..e738e0b
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Common/Common.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c2cff652623bdff42acbdbfe57c4b998
+timeCreated: 1543825917
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs
new file mode 100644
index 0000000..6d06eff
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs
@@ -0,0 +1,317 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// author: hanjun
+// date: 2018/12/03 16:33:35
+// desc: 某类
+//
+//
+//
+//
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+using UnityEngine;
+using System.Collections;
+using System;
+using LitJson;
+
+namespace DNA
+{
+ public class CommonParse
+ {
+ public static float ParseFloat(string str)
+ {
+ float target = 0f;
+ ParseFloat(ref target, str, 0f);
+ return target;
+ }
+ public static void ParseFloat(ref float target, string str)
+ {
+ ParseFloat(ref target, str, 0f);
+ }
+ public static void ParseFloat(ref float target, string str, float defaultValue)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ target = defaultValue;
+ return;
+ }
+ str = str.Replace("(", "");
+ str = str.Replace(")", "");
+ float result = defaultValue;//使用默认值
+ if (float.TryParse(str, out result))
+ {
+ target = result;
+ }
+ else
+ {
+ LogHelper.LogEditorError("ParseFloat Error at field : " + str);
+ target = defaultValue;
+ }
+ }
+ public static int ParseInt(string str)
+ {
+ int target = 0;
+ ParseInt(ref target, str, 0);
+ return target;
+ }
+ public static void ParseInt(ref int target, string str)
+ {
+ ParseInt(ref target, str, 0);
+ }
+ public static void ParseInt(ref int target, string str, int defaultValue)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ target = defaultValue;
+ return;
+ }
+
+ int result = defaultValue;//使用默认值
+ if (int.TryParse(str, out result))
+ {
+ target = result;
+ }
+ else
+ {
+ if (str.Contains("0x"))
+ {
+ target = Convert.ToInt32(str, 16);
+ }
+ else
+ {
+ LogHelper.LogEditorError("ParseInt Error at field : " + str);
+ target = defaultValue;
+ }
+ }
+ }
+ public static byte ParseByte(string str)
+ {
+ byte target = 0;
+ ParseByte(ref target, str, 0);
+ return target;
+ }
+ public static void ParseByte(ref byte target, string str)
+ {
+ ParseByte(ref target, str, 0);
+ }
+ public static void ParseByte(ref byte target, string str, byte defaultValue)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ target = defaultValue;
+ return;
+ }
+
+ byte result = defaultValue;//使用默认值
+ if (byte.TryParse(str, out result))
+ {
+ target = result;
+ }
+ else
+ {
+ if (str.Contains("0x"))
+ {
+ target = Convert.ToByte(str, 16);
+ }
+ else
+ {
+ LogHelper.LogEditorError("ParseByte Error at field : " + str);
+ target = defaultValue;
+ }
+ }
+ }
+
+ public static void ParseVector2(ref Vector2 v2, string str)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ v2 = Vector2.zero;
+ return;
+ }
+
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseFloat(ref v2.x, array[0]);
+ if (array.Length >= 2)
+ ParseFloat(ref v2.y, array[1]);
+
+ //if (array.Length == 2)
+ //{
+ // ParseFloat(ref v2.x, array[0]);
+ // ParseFloat(ref v2.y, array[1]);
+ //}
+ //else
+ //{
+ // LogHelper.LogError("解析ParseVector2失败," + str);
+ //}
+ }
+ public static void ParseVector3(ref Vector3 v3, string str)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ v3 = Vector3.zero;
+ return;
+ }
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseFloat(ref v3.x, array[0]);
+ if (array.Length >= 2)
+ ParseFloat(ref v3.y, array[1]);
+ if (array.Length >= 3)
+ ParseFloat(ref v3.z, array[2]);
+
+ //if (array.Length == 3)
+ //{
+ // ParseFloat(ref v3.x, array[0]);
+ // ParseFloat(ref v3.y, array[1]);
+ // ParseFloat(ref v3.z, array[2]);
+ //}
+ //else
+ //{
+ // LogHelper.LogError("解析ParseVector3失败," + str);
+ //}
+ }
+ public static void ParseVector4(ref Vector4 v4, string str)
+ {
+ if (string.IsNullOrEmpty(str))
+ {
+ v4 = Vector4.zero;
+ return;
+ }
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseFloat(ref v4.x, array[0]);
+ if (array.Length >= 2)
+ ParseFloat(ref v4.y, array[1]);
+ if (array.Length >= 3)
+ ParseFloat(ref v4.z, array[2]);
+ if (array.Length >= 4)
+ ParseFloat(ref v4.w, array[3]);
+
+ //if (array.Length == 4)
+ //{
+ // ParseFloat(ref v4.x, array[0]);
+ // ParseFloat(ref v4.y, array[1]);
+ // ParseFloat(ref v4.z, array[2]);
+ // ParseFloat(ref v4.w, array[3]);
+ //}
+ //else
+ //{
+ // LogHelper.LogError("解析ParseVector4失败," + str);
+ //}
+ }
+
+ #region Json序列化
+ public static Vector3 ParseVector4(string str)
+ {
+ Vector4 v = Vector4.zero;
+ ParseVector4(ref v, str);
+ return v;
+ }
+
+ public static Vector3 ParseVector3(string str)
+ {
+ Vector3 v = Vector3.zero;
+ ParseVector3(ref v, str);
+ return v;
+ }
+
+ public static Vector2 ParseVector2(string str)
+ {
+ Vector2 v = Vector2.zero;
+ ParseVector2(ref v, str);
+ return v;
+ }
+
+ public static IntVector2 ParseIntVector2(string str)
+ {
+ IntVector2 iv2 = IntVector2.Zero;
+ if (string.IsNullOrEmpty(str))
+ {
+ return iv2;
+ }
+
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseInt(ref iv2.x, array[0]);
+ if (array.Length >= 2)
+ ParseInt(ref iv2.y, array[1]);
+
+ return iv2;
+ }
+
+ public static IntVector3 ParseIntVector3(string str)
+ {
+ IntVector3 iv3 = IntVector3.Zero;
+ if (string.IsNullOrEmpty(str))
+ {
+ return iv3;
+ }
+
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseInt(ref iv3.x, array[0]);
+ if (array.Length >= 2)
+ ParseInt(ref iv3.y, array[1]);
+ if (array.Length >= 3)
+ ParseInt(ref iv3.z, array[2]);
+
+ return iv3;
+ }
+
+ public static IntVector4 ParseIntVector4(string str)
+ {
+ IntVector4 iv4 = IntVector4.Zero;
+ if (string.IsNullOrEmpty(str))
+ {
+ return iv4;
+ }
+
+ string[] array = str.Split(',', ';', '=');
+ if (array.Length >= 1)
+ ParseInt(ref iv4.x, array[0]);
+ if (array.Length >= 2)
+ ParseInt(ref iv4.y, array[1]);
+ if (array.Length >= 3)
+ ParseInt(ref iv4.z, array[2]);
+ if (array.Length >= 4)
+ ParseInt(ref iv4.w, array[3]);
+ return iv4;
+ }
+
+ public static Color ParseColor(string str)
+ {
+ Color col = Color.white;
+ string[] array = str.Split(',', ';', '=');
+ int i = array.Length;
+ if (i > 0) col.r = ParseFloat(array[0]);
+ if (i > 1) col.g = ParseFloat(array[1]);
+ if (i > 2) col.b = ParseFloat(array[2]);
+ if (i > 3) col.a = ParseFloat(array[3]);
+ return col;
+ }
+
+ public static Color32 ParseColor32(string str)
+ {
+ Color32 col = new Color32(255,255,255,255);
+ string[] array = str.Split(',', ';', '=');
+ int i = array.Length;
+ if (i > 0) col.r = ParseByte(array[0]);
+ if (i > 1) col.g = ParseByte(array[1]);
+ if (i > 2) col.b = ParseByte(array[2]);
+ if (i > 3) col.a = ParseByte(array[3]);
+ return col;
+ }
+ #endregion
+
+ public static string ToJsonByFormat(System.Object obj)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ JsonWriter jw = new JsonWriter(sb);
+ jw.PrettyPrint = true;
+ JsonMapper.ToJson(obj, jw);
+ return sb.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs.meta b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs.meta
new file mode 100644
index 0000000..0573243
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d52e289ce1c1b5d4c836a2f671dca346
+timeCreated: 1543826015
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs
index 75de5f3..811f5b4 100644
--- a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs
+++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs
@@ -34,15 +34,7 @@ namespace WK.Data
TextAsset text = ResourceManager.Instance.LoadAsset<TextAsset>(StaticDefine.FileList);
string content = text.text;
List<MetadataFile> files = CSVReader.Read<MetadataFile>(content);
- //for (int i = 0; i < files.Count; ++i)
- //{
- // MetadataFile file = files[i];
- // int key = (int)Enum.Parse(typeof(EFileKey), file.key);
- // m_Filelist.Add(key, file);
- //}
-
CSVReader.ReadDictionary<EFileKey, MetadataFile>(m_Filelist, content, "key");
-
Debug.Log(m_Filelist.Count);
}
diff --git a/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs b/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs
index 182ea16..b8f1ec2 100644
--- a/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs
+++ b/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs
@@ -20,6 +20,7 @@ public partial class PhysicsManager : Singleton<PhysicsManager>
{
m_CollisionQuadtree = new PhysicsQuadtree(new Vector4(0, 0, 30, 30));
m_HurtboxQuadtree = new PhysicsQuadtree(new Vector4(0, 0, 30, 30));
+ m_StaticCollisionQuadtree = new PhysicsQuadtree(new Vector4(0, 0, 30, 30));
}
public System.Func<Vector4, bool> GetRetriverByType(ColliderType type)
diff --git a/WorldlineKeepers/Assets/Scripts/Utils/LogHelper.cs b/WorldlineKeepers/Assets/Scripts/Utils/LogHelper.cs
index e019695..9d8b3e6 100644
--- a/WorldlineKeepers/Assets/Scripts/Utils/LogHelper.cs
+++ b/WorldlineKeepers/Assets/Scripts/Utils/LogHelper.cs
@@ -6,19 +6,24 @@ using UnityEngine;
namespace WK
{
- public static class LogHelper
- {
+}
- public static void LogError(object msg)
- {
- Debug.LogError(msg);
- }
+public static class LogHelper
+{
- public static void Log(object msg)
- {
- Debug.Log(msg);
- }
+ public static void LogError(object msg)
+ {
+ Debug.LogError(msg);
+ }
+ public static void Log(object msg)
+ {
+ Debug.Log(msg);
+ }
+
+ public static void LogEditorError(object msg)
+ {
+ Debug.Log(msg);
}
}
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in b/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in
deleted file mode 100644
index 2cd1f90..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-
-[assembly: CLSCompliant (true)]
-
-[assembly: AssemblyTitle ("LitJson")]
-[assembly: AssemblyDescription ("LitJSON library")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("")]
-[assembly: AssemblyProduct ("LitJSON")]
-[assembly: AssemblyCopyright (
- "The authors disclaim copyright to this source code")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: AssemblyVersion ("@ASSEMBLY_VERSION@")]
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in.meta b/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in.meta
deleted file mode 100644
index cad42a0..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/AssemblyInfo.cs.in.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 059367c3b7b889346a0830ae29aafa6f
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs b/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs
deleted file mode 100644
index dfe7adb..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-#region Header
-/**
- * JsonMockWrapper.cs
- * Mock object implementing IJsonWrapper, to facilitate actions like
- * skipping data more efficiently.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections;
-using System.Collections.Specialized;
-
-
-namespace LitJson
-{
- public class JsonMockWrapper : IJsonWrapper
- {
- public bool IsArray { get { return false; } }
- public bool IsBoolean { get { return false; } }
- public bool IsDouble { get { return false; } }
- public bool IsInt { get { return false; } }
- public bool IsLong { get { return false; } }
- public bool IsObject { get { return false; } }
- public bool IsString { get { return false; } }
-
- public bool GetBoolean () { return false; }
- public double GetDouble () { return 0.0; }
- public int GetInt () { return 0; }
- public JsonType GetJsonType () { return JsonType.None; }
- public long GetLong () { return 0L; }
- public string GetString () { return ""; }
-
- public void SetBoolean (bool val) {}
- public void SetDouble (double val) {}
- public void SetInt (int val) {}
- public void SetJsonType (JsonType type) {}
- public void SetLong (long val) {}
- public void SetString (string val) {}
-
- public string ToJson () { return ""; }
- public void ToJson (JsonWriter writer) {}
-
-
- bool IList.IsFixedSize { get { return true; } }
- bool IList.IsReadOnly { get { return true; } }
-
- object IList.this[int index] {
- get { return null; }
- set {}
- }
-
- int IList.Add (object value) { return 0; }
- void IList.Clear () {}
- bool IList.Contains (object value) { return false; }
- int IList.IndexOf (object value) { return -1; }
- void IList.Insert (int i, object v) {}
- void IList.Remove (object value) {}
- void IList.RemoveAt (int index) {}
-
-
- int ICollection.Count { get { return 0; } }
- bool ICollection.IsSynchronized { get { return false; } }
- object ICollection.SyncRoot { get { return null; } }
-
- void ICollection.CopyTo (Array array, int index) {}
-
-
- IEnumerator IEnumerable.GetEnumerator () { return null; }
-
-
- bool IDictionary.IsFixedSize { get { return true; } }
- bool IDictionary.IsReadOnly { get { return true; } }
-
- ICollection IDictionary.Keys { get { return null; } }
- ICollection IDictionary.Values { get { return null; } }
-
- object IDictionary.this[object key] {
- get { return null; }
- set {}
- }
-
- void IDictionary.Add (object k, object v) {}
- void IDictionary.Clear () {}
- bool IDictionary.Contains (object key) { return false; }
- void IDictionary.Remove (object key) {}
-
- IDictionaryEnumerator IDictionary.GetEnumerator () { return null; }
-
-
- object IOrderedDictionary.this[int idx] {
- get { return null; }
- set {}
- }
-
- IDictionaryEnumerator IOrderedDictionary.GetEnumerator () {
- return null;
- }
- void IOrderedDictionary.Insert (int i, object k, object v) {}
- void IOrderedDictionary.RemoveAt (int i) {}
- }
-}
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs.meta b/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs.meta
deleted file mode 100644
index 4c61ee5..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMockWrapper.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 792be869f37582544adeef13fc998eed
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj b/WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj
deleted file mode 100644
index 5840e20..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj
+++ /dev/null
@@ -1,82 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFrameworks>netstandard2.1;netstandard2.0;net45;net48;netstandard1.5;net40;net35;net20;net6.0</TargetFrameworks>
- </PropertyGroup>
-
- <PropertyGroup>
- <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <DebugType>embedded</DebugType>
- <EmbedUntrackedSources>true</EmbedUntrackedSources>
- <PublishRepositoryUrl>true</PublishRepositoryUrl>
- <SourceLinkCreate Condition="'$(OS)' == 'Windows_NT'">true</SourceLinkCreate>
- </PropertyGroup>
-
- <ItemGroup Condition="'$(OS)' == 'Windows_NT'">
- <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
- <DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
- <DotNetCliToolReference Include="dotnet-sourcelink" Version="2.8.3" />
- </ItemGroup>
-
- <PropertyGroup>
- <PackageId>LitJson</PackageId>
- <Description>A .NET library to handle conversions from and to JSON (JavaScript Object Notation) strings. Written in C#, and it’s intended to be small, fast and easy to use.
-It's quick and lean, without external dependencies.</Description>
- <Copyright>The authors disclaim copyright to this source code.</Copyright>
- <Authors>Leonardo Boshell, Mattias Karlsson and contributors</Authors>
- <Company>Leonardo Boshell, Mattias Karlsson and contributors</Company>
- <PackageLicenseExpression>Unlicense</PackageLicenseExpression>
- <PackageIcon>litjson.png</PackageIcon>
- <RepositoryUrl>https://github.com/LitJSON/litjson</RepositoryUrl>
- <RepositoryType>git</RepositoryType>
- <PackageTags>JSON;Serializer</PackageTags>
- <IncludeSource>true</IncludeSource>
- </PropertyGroup>
-
- <ItemGroup>
- <None Include="litjson.png" Pack="true" PackagePath="" />
- </ItemGroup>
-
- <PropertyGroup Condition="'$(TargetFramework)' == 'net20' ">
- <DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(TargetFramework)' == 'net35' ">
- <DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(TargetFramework)' == 'net40' ">
- <DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
- <PackageReference Include="System.Collections.NonGeneric" Version="4.0.1" />
- <PackageReference Include="System.Collections.Specialized" Version="4.0.1" />
- <PackageReference Include="System.Reflection" Version="4.3.0" />
- <PackageReference Include="System.Reflection.TypeExtensions" Version="4.1.0" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net20" Version="1.0.3" Condition="'$(TargetFramework)' == 'net20' ">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net35" Version="1.0.3" Condition="'$(TargetFramework)' == 'net35' ">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net40" Version="1.0.3" Condition="'$(TargetFramework)' == 'net40' ">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net45" Version="1.0.3" Condition="'$(TargetFramework)' == 'net45' ">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3" Condition="'$(TargetFramework)' == 'net48' ">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
- </PackageReference>
- </ItemGroup>
-
-</Project>
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs b/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs
deleted file mode 100644
index 55b02a2..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-#if NETSTANDARD1_5
-using System;
-using System.Reflection;
-namespace LitJson
-{
- internal static class Netstandard15Polyfill
- {
- internal static Type GetInterface(this Type type, string name)
- {
- return type.GetTypeInfo().GetInterface(name);
- }
-
- internal static bool IsClass(this Type type)
- {
- return type.GetTypeInfo().IsClass;
- }
-
- internal static bool IsEnum(this Type type)
- {
- return type.GetTypeInfo().IsEnum;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs.meta b/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs.meta
deleted file mode 100644
index f87da4f..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/Netstandard15Polyfill.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7c453cdd2005fc241b26114aca0c98af
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png b/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png
deleted file mode 100644
index a4c15e5..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png
+++ /dev/null
Binary files differ
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png.meta b/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png.meta
deleted file mode 100644
index 1331b28..0000000
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/litjson.png.meta
+++ /dev/null
@@ -1,98 +0,0 @@
-fileFormatVersion: 2
-guid: 41507efea6a71044a9a6353ab9e7f770
-TextureImporter:
- internalIDToNameTable: []
- externalObjects: {}
- serializedVersion: 11
- mipmaps:
- mipMapMode: 0
- enableMipMap: 0
- sRGBTexture: 1
- linearTexture: 0
- fadeOut: 0
- borderMipMap: 0
- mipMapsPreserveCoverage: 0
- alphaTestReferenceValue: 0.5
- mipMapFadeDistanceStart: 1
- mipMapFadeDistanceEnd: 3
- bumpmap:
- convertToNormalMap: 0
- externalNormalMap: 0
- heightScale: 0.25
- normalMapFilter: 0
- isReadable: 0
- streamingMipmaps: 0
- streamingMipmapsPriority: 0
- vTOnly: 0
- ignoreMasterTextureLimit: 0
- grayScaleToAlpha: 0
- generateCubemap: 6
- cubemapConvolution: 0
- seamlessCubemap: 0
- textureFormat: 1
- maxTextureSize: 2048
- textureSettings:
- serializedVersion: 2
- filterMode: 1
- aniso: 1
- mipBias: 0
- wrapU: 1
- wrapV: 1
- wrapW: 1
- nPOTScale: 0
- lightmap: 0
- compressionQuality: 50
- spriteMode: 1
- spriteExtrude: 1
- spriteMeshType: 1
- alignment: 0
- spritePivot: {x: 0.5, y: 0.5}
- spritePixelsToUnits: 100
- spriteBorder: {x: 0, y: 0, z: 0, w: 0}
- spriteGenerateFallbackPhysicsShape: 1
- alphaUsage: 1
- alphaIsTransparency: 1
- spriteTessellationDetail: -1
- textureType: 8
- textureShape: 1
- singleChannelComponent: 0
- flipbookRows: 1
- flipbookColumns: 1
- maxTextureSizeSet: 0
- compressionQualitySet: 0
- textureFormatSet: 0
- ignorePngGamma: 0
- applyGammaDecoding: 0
- platformSettings:
- - serializedVersion: 3
- buildTarget: DefaultTexturePlatform
- maxTextureSize: 2048
- resizeAlgorithm: 0
- textureFormat: -1
- textureCompression: 1
- compressionQuality: 50
- crunchedCompression: 0
- allowsAlphaSplitting: 0
- overridden: 0
- androidETC2FallbackOverride: 0
- forceMaximumCompressionQuality_BC6H_BC7: 0
- spriteSheet:
- serializedVersion: 2
- sprites: []
- outline: []
- physicsShape: []
- bones: []
- spriteID: 5e97eb03825dee720800000000000000
- internalID: 0
- vertices: []
- indices:
- edges: []
- weights: []
- secondaryTextures: []
- nameFileIdTable: {}
- spritePackingTag:
- pSDRemoveMatte: 0
- pSDShowRemoveMatteOption: 0
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson.meta
index 662dc44..662dc44 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson.meta
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs
index 9b7e2d1..db0963a 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* IJsonWrapper.cs
* Interface that represents a type capable of handling all kinds of JSON
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs.meta
index 77db7f8..14fc748 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/IJsonWrapper.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/IJsonWrapper.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: 6404856db9d78cf439362703c3133fec
+guid: de017f99299ca2e45adc9613360567df
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs
index e89e4b1..fd34425 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* JsonData.cs
* Generic type to hold JSON data (objects, arrays, and so on). This is
@@ -19,7 +19,7 @@ using System.IO;
namespace LitJson
{
- public class JsonData : IJsonWrapper, IEquatable<JsonData>
+ public sealed class JsonData : IJsonWrapper, IEquatable<JsonData>
{
#region Fields
private IList<JsonData> inst_array;
@@ -70,18 +70,14 @@ namespace LitJson
get { return type == JsonType.String; }
}
- public ICollection<string> Keys {
- get { EnsureDictionary (); return inst_object.Keys; }
- }
-
- /// <summary>
- /// Determines whether the json contains an element that has the specified key.
- /// </summary>
- /// <param name="key">The key to locate in the json.</param>
- /// <returns>true if the json contains an element that has the specified key; otherwise, false.</returns>
- public Boolean ContainsKey(String key) {
- EnsureDictionary();
- return this.inst_object.Keys.Contains(key);
+ public IDictionary<String, JsonData> Inst_Object
+ {
+ get {
+ if (type == JsonType.Object)
+ return inst_object;
+ else
+ return null;
+ }
}
#endregion
@@ -421,7 +417,7 @@ namespace LitJson
{
if (data.type != JsonType.Boolean)
throw new InvalidCastException (
- "Instance of JsonData doesn't hold a double");
+ "Instance of JsonData doesn't hold a boolean, type is " + data.type);
return data.inst_boolean;
}
@@ -430,39 +426,50 @@ namespace LitJson
{
if (data.type != JsonType.Double)
throw new InvalidCastException (
- "Instance of JsonData doesn't hold a double");
+ "Instance of JsonData doesn't hold a double, type is " + data.type);
return data.inst_double;
}
- public static explicit operator Int32(JsonData data)
+ public static explicit operator Single (JsonData data)
{
- if (data.type != JsonType.Int && data.type != JsonType.Long)
+ if(data.type == JsonType.Double)
{
- throw new InvalidCastException(
- "Instance of JsonData doesn't hold an int");
+ return (Single)data.inst_double;
}
- // cast may truncate data... but that's up to the user to consider
- return data.type == JsonType.Int ? data.inst_int : (int)data.inst_long;
+ if(data.type == JsonType.Int)
+ {
+ return (Single)data.inst_int;
+ }
+
+ throw new InvalidCastException(
+ "Instance of JsonData doesn't hold a Single, type is " + data.type);
}
- public static explicit operator Int64(JsonData data)
+ public static explicit operator Int32 (JsonData data)
{
- if (data.type != JsonType.Long && data.type != JsonType.Int)
- {
- throw new InvalidCastException(
- "Instance of JsonData doesn't hold a long");
- }
+ if (data.type != JsonType.Int)
+ throw new InvalidCastException (
+ "Instance of JsonData doesn't hold an int, type is "+ data.type);
- return data.type == JsonType.Long ? data.inst_long : data.inst_int;
+ return data.inst_int;
+ }
+
+ public static explicit operator Int64 (JsonData data)
+ {
+ if (data.type != JsonType.Long)
+ throw new InvalidCastException (
+ "Instance of JsonData doesn't hold an int64, type is " + data.type);
+
+ return data.inst_long;
}
public static explicit operator String (JsonData data)
{
if (data.type != JsonType.String)
throw new InvalidCastException (
- "Instance of JsonData doesn't hold a string");
+ "Instance of JsonData doesn't hold a string, type is " + data.type);
return data.inst_string;
}
@@ -537,7 +544,7 @@ namespace LitJson
{
if (type != JsonType.Boolean)
throw new InvalidOperationException (
- "JsonData instance doesn't hold a boolean");
+ "JsonData instance doesn't hold a boolean, type is " + type);
return inst_boolean;
}
@@ -546,7 +553,7 @@ namespace LitJson
{
if (type != JsonType.Double)
throw new InvalidOperationException (
- "JsonData instance doesn't hold a double");
+ "JsonData instance doesn't hold a double, type is " + type);
return inst_double;
}
@@ -555,7 +562,7 @@ namespace LitJson
{
if (type != JsonType.Int)
throw new InvalidOperationException (
- "JsonData instance doesn't hold an int");
+ "JsonData instance doesn't hold an int, type is " + type);
return inst_int;
}
@@ -564,7 +571,7 @@ namespace LitJson
{
if (type != JsonType.Long)
throw new InvalidOperationException (
- "JsonData instance doesn't hold a long");
+ "JsonData instance doesn't hold a long, type is " + type);
return inst_long;
}
@@ -573,7 +580,7 @@ namespace LitJson
{
if (type != JsonType.String)
throw new InvalidOperationException (
- "JsonData instance doesn't hold a string");
+ "JsonData instance doesn't hold a string, type is " + type);
return inst_string;
}
@@ -756,8 +763,9 @@ namespace LitJson
private static void WriteJson (IJsonWrapper obj, JsonWriter writer)
{
- if (obj == null) {
- writer.Write (null);
+ if (null == obj)
+ {
+ writer.Write(null);
return;
}
@@ -819,23 +827,9 @@ namespace LitJson
return EnsureList ().Add (data);
}
- public bool Remove(object obj)
+ public void MakeArray()
{
- json = null;
- if(IsObject)
- {
- JsonData value = null;
- if (inst_object.TryGetValue((string)obj, out value))
- return inst_object.Remove((string)obj) && object_list.Remove(new KeyValuePair<string, JsonData>((string)obj, value));
- else
- throw new KeyNotFoundException("The specified key was not found in the JsonData object.");
- }
- if(IsArray)
- {
- return inst_array.Remove(ToJsonData(obj));
- }
- throw new InvalidOperationException (
- "Instance of JsonData is not an object or a list.");
+ EnsureList();
}
public void Clear ()
@@ -857,14 +851,7 @@ namespace LitJson
return false;
if (x.type != this.type)
- {
- // further check to see if this is a long to int comparison
- if ((x.type != JsonType.Int && x.type != JsonType.Long)
- || (this.type != JsonType.Int && this.type != JsonType.Long))
- {
- return false;
- }
- }
+ return false;
switch (this.type) {
case JsonType.None:
@@ -880,26 +867,10 @@ namespace LitJson
return this.inst_string.Equals (x.inst_string);
case JsonType.Int:
- {
- if (x.IsLong)
- {
- if (x.inst_long < Int32.MinValue || x.inst_long > Int32.MaxValue)
- return false;
- return this.inst_int.Equals((int)x.inst_long);
- }
- return this.inst_int.Equals(x.inst_int);
- }
+ return this.inst_int.Equals (x.inst_int);
case JsonType.Long:
- {
- if (x.IsInt)
- {
- if (this.inst_long < Int32.MinValue || this.inst_long > Int32.MaxValue)
- return false;
- return x.inst_int.Equals((int)this.inst_long);
- }
- return this.inst_long.Equals(x.inst_long);
- }
+ return this.inst_long.Equals (x.inst_long);
case JsonType.Double:
return this.inst_double.Equals (x.inst_double);
@@ -964,8 +935,10 @@ namespace LitJson
return json;
StringWriter sw = new StringWriter ();
- JsonWriter writer = new JsonWriter (sw);
- writer.Validate = false;
+ JsonWriter writer = new JsonWriter(sw)
+ {
+ Validate = false
+ };
WriteJson (this, writer);
json = sw.ToString ();
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs.meta
index 0680c43..e9f4732 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonData.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonData.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: d1978a8f8daac0947a97a36e63503d04
+guid: f80de13689cd2ed4d921eea0e26c6d63
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs
index 4efd890..cbf7ae3 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* JsonException.cs
* Base class throwed by LitJSON when a parsing error occurs.
@@ -14,12 +14,7 @@ using System;
namespace LitJson
{
- public class JsonException :
-#if NETSTANDARD1_5
- Exception
-#else
- ApplicationException
-#endif
+ public class JsonException : ApplicationException
{
public JsonException () : base ()
{
diff --git a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs.meta
new file mode 100644
index 0000000..b9c077f
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonException.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8c99017edfc479b44aafcc84674b178c
+timeCreated: 1474349755
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs
new file mode 100644
index 0000000..4d5f9c7
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs
@@ -0,0 +1,144 @@
+using System.Text;
+using System.Collections.Generic;
+
+public class JsonFormatter
+{
+ #region class members
+ const string Space = " ";
+ const int DefaultIndent = 0;
+ const string Indent = Space + Space + Space + Space;
+ static readonly string NewLine = "\n";
+ #endregion
+
+ static bool inDoubleString = false;
+ static bool inSingleString = false;
+ static bool inVariableAssignment = false;
+ static char prevChar = '\0';
+
+ static Stack<JsonContextType> context = new Stack<JsonContextType>();
+
+ private enum JsonContextType
+ {
+ Object, Array
+ }
+
+ static void BuildIndents(int indents, StringBuilder output)
+ {
+ indents += DefaultIndent;
+ for (; indents > 0; indents--)
+ output.Append(Indent);
+ }
+
+ static bool InString()
+ {
+ return inDoubleString || inSingleString;
+ }
+
+ public static string PrettyPrint(string input)
+ {
+ // Clear all states
+ inDoubleString = false;
+ inSingleString = false;
+ inVariableAssignment = false;
+ prevChar = '\0';
+ context.Clear();
+
+ var output = new StringBuilder(input.Length * 2);
+ char c;
+
+ for (int i = 0; i < input.Length; i++)
+ {
+ c = input[i];
+
+ switch (c)
+ {
+ case '[':
+ case '{':
+ if (!InString())
+ {
+ if (inVariableAssignment || (context.Count > 0 && context.Peek() != JsonContextType.Array))
+ {
+ output.Append(NewLine);
+ BuildIndents(context.Count, output);
+ }
+ output.Append(c);
+ context.Push(JsonContextType.Object);
+ output.Append(NewLine);
+ BuildIndents(context.Count, output);
+ }
+ else
+ output.Append(c);
+
+ break;
+
+ case ']':
+ case '}':
+ if (!InString())
+ {
+ output.Append(NewLine);
+ context.Pop();
+ BuildIndents(context.Count, output);
+ output.Append(c);
+ }
+ else
+ output.Append(c);
+
+ break;
+ case '=':
+ output.Append(c);
+ break;
+
+ case ',':
+ output.Append(c);
+
+ if (!InString())
+ {
+ BuildIndents(context.Count, output);
+ output.Append(NewLine);
+ BuildIndents(context.Count, output);
+ inVariableAssignment = false;
+ }
+
+ break;
+
+ case '\'':
+ if (!inDoubleString && prevChar != '\\')
+ inSingleString = !inSingleString;
+
+ output.Append(c);
+ break;
+
+ case ':':
+ if (!InString())
+ {
+ inVariableAssignment = true;
+ output.Append(Space);
+ output.Append(c);
+ output.Append(Space);
+ }
+ else
+ output.Append(c);
+
+ break;
+
+ case '"':
+ if (!inSingleString && prevChar != '\\')
+ inDoubleString = !inDoubleString;
+
+ output.Append(c);
+ break;
+ case ' ':
+ if (InString())
+ output.Append(c);
+ break;
+
+ default:
+ output.Append(c);
+ break;
+ }
+ prevChar = c;
+ }
+
+ return output.ToString();
+ }
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs.meta
new file mode 100644
index 0000000..02bdada
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonFormatter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cdcb71cedd669b947bd44cfa54439994
+timeCreated: 1474349755
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs
index 99946cf..3a09a87 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* JsonMapper.cs
* JSON to .Net object and object to JSON conversions.
@@ -85,6 +85,20 @@ namespace LitJson
get { return properties; }
set { properties = value; }
}
+
+
+ private Type genericKeyType;
+ public Type GenericKeyType
+ {
+ get
+ {
+ return genericKeyType;
+ }
+ set
+ {
+ genericKeyType = value;
+ }
+ }
}
@@ -100,62 +114,66 @@ namespace LitJson
public class JsonMapper
{
#region Fields
- private static readonly int max_nesting_depth;
+ private static int max_nesting_depth;
- private static readonly IFormatProvider datetime_format;
+ private static IFormatProvider datetime_format;
- private static readonly IDictionary<Type, ExporterFunc> base_exporters_table;
- private static readonly IDictionary<Type, ExporterFunc> custom_exporters_table;
+ private static IDictionary<Type, ExporterFunc> base_exporters_table;
+ private static IDictionary<Type, ExporterFunc> custom_exporters_table;
- private static readonly IDictionary<Type,
+ private static IDictionary<Type,
IDictionary<Type, ImporterFunc>> base_importers_table;
- private static readonly IDictionary<Type,
+ private static IDictionary<Type,
IDictionary<Type, ImporterFunc>> custom_importers_table;
- private static readonly IDictionary<Type, ArrayMetadata> array_metadata;
+ private static IDictionary<Type, ArrayMetadata> array_metadata;
private static readonly object array_metadata_lock = new Object ();
- private static readonly IDictionary<Type,
+ private static IDictionary<Type,
IDictionary<Type, MethodInfo>> conv_ops;
private static readonly object conv_ops_lock = new Object ();
- private static readonly IDictionary<Type, ObjectMetadata> object_metadata;
+ private static IDictionary<Type, ObjectMetadata> object_metadata;
private static readonly object object_metadata_lock = new Object ();
- private static readonly IDictionary<Type,
+ private static IDictionary<Type,
IList<PropertyMetadata>> type_properties;
private static readonly object type_properties_lock = new Object ();
- private static readonly JsonWriter static_writer;
+ private static JsonWriter static_writer;
private static readonly object static_writer_lock = new Object ();
#endregion
#region Constructors
- static JsonMapper ()
+ public static void ResetStatic()
{
max_nesting_depth = 100;
- array_metadata = new Dictionary<Type, ArrayMetadata> ();
- conv_ops = new Dictionary<Type, IDictionary<Type, MethodInfo>> ();
- object_metadata = new Dictionary<Type, ObjectMetadata> ();
+ array_metadata = new Dictionary<Type, ArrayMetadata>();
+ conv_ops = new Dictionary<Type, IDictionary<Type, MethodInfo>>();
+ object_metadata = new Dictionary<Type, ObjectMetadata>();
type_properties = new Dictionary<Type,
- IList<PropertyMetadata>> ();
+ IList<PropertyMetadata>>();
- static_writer = new JsonWriter ();
+ static_writer = new JsonWriter();
datetime_format = DateTimeFormatInfo.InvariantInfo;
- base_exporters_table = new Dictionary<Type, ExporterFunc> ();
- custom_exporters_table = new Dictionary<Type, ExporterFunc> ();
+ base_exporters_table = new Dictionary<Type, ExporterFunc>();
+ custom_exporters_table = new Dictionary<Type, ExporterFunc>();
base_importers_table = new Dictionary<Type,
- IDictionary<Type, ImporterFunc>> ();
+ IDictionary<Type, ImporterFunc>>();
custom_importers_table = new Dictionary<Type,
- IDictionary<Type, ImporterFunc>> ();
+ IDictionary<Type, ImporterFunc>>();
- RegisterBaseExporters ();
- RegisterBaseImporters ();
+ RegisterBaseExporters();
+ RegisterBaseImporters();
+ }
+ static JsonMapper ()
+ {
+ ResetStatic();
}
#endregion
@@ -166,9 +184,10 @@ namespace LitJson
if (array_metadata.ContainsKey (type))
return;
- ArrayMetadata data = new ArrayMetadata ();
-
- data.IsArray = type.IsArray;
+ ArrayMetadata data = new ArrayMetadata
+ {
+ IsArray = type.IsArray
+ };
if (type.GetInterface ("System.Collections.IList") != null)
data.IsList = true;
@@ -214,28 +233,44 @@ namespace LitJson
if (parameters.Length != 1)
continue;
- if (parameters[0].ParameterType == typeof (string))
+ if (data.IsDictionary)
+ {
data.ElementType = p_info.PropertyType;
+ }
+ else
+ {
+ if (parameters[0].ParameterType == typeof(string))
+ data.ElementType = p_info.PropertyType;
+ }
continue;
}
- PropertyMetadata p_data = new PropertyMetadata ();
- p_data.Info = p_info;
- p_data.Type = p_info.PropertyType;
+ PropertyMetadata p_data = new PropertyMetadata
+ {
+ Info = p_info,
+ Type = p_info.PropertyType
+ };
data.Properties.Add (p_info.Name, p_data);
}
foreach (FieldInfo f_info in type.GetFields ()) {
- PropertyMetadata p_data = new PropertyMetadata ();
- p_data.Info = f_info;
- p_data.IsField = true;
- p_data.Type = f_info.FieldType;
+ PropertyMetadata p_data = new PropertyMetadata
+ {
+ Info = f_info,
+ IsField = true,
+ Type = f_info.FieldType
+ };
data.Properties.Add (f_info.Name, p_data);
}
+ if (type.IsGenericType)
+ {
+ data.GenericKeyType = type.GetGenericArguments()[0];
+ }
+
lock (object_metadata_lock) {
try {
object_metadata.Add (type, data);
@@ -256,16 +291,20 @@ namespace LitJson
if (p_info.Name == "Item")
continue;
- PropertyMetadata p_data = new PropertyMetadata ();
- p_data.Info = p_info;
- p_data.IsField = false;
+ PropertyMetadata p_data = new PropertyMetadata
+ {
+ Info = p_info,
+ IsField = false
+ };
props.Add (p_data);
}
foreach (FieldInfo f_info in type.GetFields ()) {
- PropertyMetadata p_data = new PropertyMetadata ();
- p_data.Info = f_info;
- p_data.IsField = true;
+ PropertyMetadata p_data = new PropertyMetadata
+ {
+ Info = f_info,
+ IsField = true
+ };
props.Add (p_data);
}
@@ -310,23 +349,14 @@ namespace LitJson
if (reader.Token == JsonToken.ArrayEnd)
return null;
- Type underlying_type = Nullable.GetUnderlyingType(inst_type);
- Type value_type = underlying_type ?? inst_type;
-
if (reader.Token == JsonToken.Null) {
- #if NETSTANDARD1_5
- if (inst_type.IsClass() || underlying_type != null) {
- return null;
- }
- #else
- if (inst_type.IsClass || underlying_type != null) {
- return null;
- }
- #endif
- throw new JsonException (String.Format (
+ if (! inst_type.IsClass)
+ throw new JsonException (String.Format (
"Can't assign null to an instance of type {0}",
inst_type));
+
+ return null;
}
if (reader.Token == JsonToken.Double ||
@@ -337,16 +367,16 @@ namespace LitJson
Type json_type = reader.Value.GetType ();
- if (value_type.IsAssignableFrom (json_type))
+ if (inst_type.IsAssignableFrom (json_type))
return reader.Value;
// If there's a custom importer that fits, use it
if (custom_importers_table.ContainsKey (json_type) &&
custom_importers_table[json_type].ContainsKey (
- value_type)) {
+ inst_type)) {
ImporterFunc importer =
- custom_importers_table[json_type][value_type];
+ custom_importers_table[json_type][inst_type];
return importer (reader.Value);
}
@@ -354,29 +384,68 @@ namespace LitJson
// Maybe there's a base importer that works
if (base_importers_table.ContainsKey (json_type) &&
base_importers_table[json_type].ContainsKey (
- value_type)) {
-
+ inst_type)) {
+
ImporterFunc importer =
- base_importers_table[json_type][value_type];
+ base_importers_table[json_type][inst_type];
return importer (reader.Value);
}
// Maybe it's an enum
- #if NETSTANDARD1_5
- if (value_type.IsEnum())
- return Enum.ToObject (value_type, reader.Value);
- #else
- if (value_type.IsEnum)
- return Enum.ToObject (value_type, reader.Value);
- #endif
+ if (inst_type.IsEnum)
+ return Enum.ToObject (inst_type, reader.Value);
+
// Try using an implicit conversion operator
- MethodInfo conv_op = GetConvOp (value_type, json_type);
+ MethodInfo conv_op = GetConvOp (inst_type, json_type);
if (conv_op != null)
return conv_op.Invoke (null,
new object[] { reader.Value });
+ //=====================扩展=====================
+ if (json_type == typeof(Double) && inst_type == typeof(System.Single))
+ {
+ return Convert.ToSingle(reader.Value);
+ }
+ if (json_type == typeof(int) && inst_type == typeof(bool))
+ {
+ return (int)reader.Value == 1;
+ }
+ if (inst_type == typeof(UnityEngine.Vector4))
+ {
+ return DNA.CommonParse.ParseVector4(reader.Value.ToString());
+ }
+ if (inst_type == typeof(UnityEngine.Vector3))
+ {
+ return DNA.CommonParse.ParseVector3(reader.Value.ToString());
+ }
+ if (inst_type == typeof(UnityEngine.Vector2))
+ {
+ return DNA.CommonParse.ParseVector2(reader.Value.ToString());
+ }
+ if (inst_type == typeof(DNA.IntVector4))
+ {
+ return DNA.CommonParse.ParseIntVector4(reader.Value.ToString());
+ }
+ if (inst_type == typeof(DNA.IntVector3))
+ {
+ return DNA.CommonParse.ParseIntVector3(reader.Value.ToString());
+ }
+ if (inst_type == typeof(DNA.IntVector2))
+ {
+ return DNA.CommonParse.ParseIntVector2(reader.Value.ToString());
+ }
+ if (inst_type == typeof(UnityEngine.Color))
+ {
+ return DNA.CommonParse.ParseColor(reader.Value.ToString());
+ }
+ if (inst_type == typeof(UnityEngine.Color32))
+ {
+ return DNA.CommonParse.ParseColor32(reader.Value.ToString());
+ }
+ //==========================================
+
// No luck
throw new JsonException (String.Format (
"Can't assign value '{0}' (type {1}) to type {2}",
@@ -406,11 +475,9 @@ namespace LitJson
elem_type = inst_type.GetElementType ();
}
- list.Clear();
-
while (true) {
object item = ReadValue (elem_type, reader);
- if (item == null && reader.Token == JsonToken.ArrayEnd)
+ if (reader.Token == JsonToken.ArrayEnd)
break;
list.Add (item);
@@ -426,10 +493,11 @@ namespace LitJson
instance = list;
} else if (reader.Token == JsonToken.ObjectStart) {
- AddObjectMetadata (value_type);
- ObjectMetadata t_data = object_metadata[value_type];
- instance = Activator.CreateInstance (value_type);
+ AddObjectMetadata (inst_type);
+ ObjectMetadata t_data = object_metadata[inst_type];
+
+ instance = Activator.CreateInstance (inst_type);
while (true) {
reader.Read ();
@@ -437,6 +505,13 @@ namespace LitJson
if (reader.Token == JsonToken.ObjectEnd)
break;
+ //====修改新增逻辑====
+ if (reader.Token != JsonToken.PropertyName)
+ {
+ continue;
+ }
+ //====修改新增逻辑====
+
string property = (string) reader.Value;
if (t_data.Properties.ContainsKey (property)) {
@@ -444,8 +519,13 @@ namespace LitJson
t_data.Properties[property];
if (prop_data.IsField) {
- ((FieldInfo) prop_data.Info).SetValue (
- instance, ReadValue (prop_data.Type, reader));
+ FieldInfo fi = (FieldInfo)prop_data.Info;
+ object obj = ReadValue(prop_data.Type, reader);
+ //过滤const标记
+ if (!fi.IsLiteral)
+ {
+ fi.SetValue(instance, obj);
+ }
} else {
PropertyInfo p_info =
(PropertyInfo) prop_data.Info;
@@ -460,21 +540,31 @@ namespace LitJson
}
} else {
- if (! t_data.IsDictionary) {
-
- if (! reader.SkipNonMembers) {
- throw new JsonException (String.Format (
- "The type {0} doesn't have the " +
- "property '{1}'",
- inst_type, property));
- } else {
- ReadSkip (reader);
- continue;
- }
+ if (!t_data.IsDictionary)
+ {
+ //====修改注释掉====
+ //throw new JsonException(String.Format(
+ // "The type {0} doesn't have the " +
+ // "property '{1}'", inst_type, property));
+ //====修改注释掉====
+
+ //====修改新增逻辑====
+ //报错,并暂停编辑器UI
+ LogHelper.LogError(String.Format(
+ "The type {0} doesn't have the " +
+ "property '{1}'", inst_type, property));
+ UnityEngine.Debug.Break();
+ continue;
+ //====修改新增逻辑====
+ }
+ object keyObj = property;
+ if (t_data.GenericKeyType == typeof(int))
+ {
+ keyObj = DNA.CommonParse.ParseInt(property);
}
((IDictionary) instance).Add (
- property, ReadValue (
+ keyObj, ReadValue (
t_data.ElementType, reader));
}
@@ -526,7 +616,7 @@ namespace LitJson
while (true) {
IJsonWrapper item = ReadValue (factory, reader);
- if (item == null && reader.Token == JsonToken.ArrayEnd)
+ if (reader.Token == JsonToken.ArrayEnd)
break;
((IList) instance).Add (item);
@@ -552,12 +642,6 @@ namespace LitJson
return instance;
}
- private static void ReadSkip (JsonReader reader)
- {
- ToWrapper (
- delegate { return new JsonMockWrapper (); }, reader);
- }
-
private static void RegisterBaseExporters ()
{
base_exporters_table[typeof (byte)] =
@@ -605,11 +689,6 @@ namespace LitJson
delegate (object obj, JsonWriter writer) {
writer.Write ((ulong) obj);
};
-
- base_exporters_table[typeof(DateTimeOffset)] =
- delegate (object obj, JsonWriter writer) {
- writer.Write(((DateTimeOffset)obj).ToString("yyyy-MM-ddTHH:mm:ss.fffffffzzz", datetime_format));
- };
}
private static void RegisterBaseImporters ()
@@ -623,16 +702,16 @@ namespace LitJson
typeof (byte), importer);
importer = delegate (object input) {
- return Convert.ToUInt64 ((int) input);
+ return Convert.ToInt64 ((int) input);
};
RegisterImporter (base_importers_table, typeof (int),
- typeof (ulong), importer);
-
+ typeof (long), importer);
+
importer = delegate (object input) {
- return Convert.ToInt64((int)input);
+ return Convert.ToUInt64 ((int) input);
};
- RegisterImporter(base_importers_table, typeof(int),
- typeof(long), importer);
+ RegisterImporter (base_importers_table, typeof (int),
+ typeof (ulong), importer);
importer = delegate (object input) {
return Convert.ToSByte ((int) input);
@@ -676,11 +755,6 @@ namespace LitJson
RegisterImporter (base_importers_table, typeof (double),
typeof (decimal), importer);
- importer = delegate (object input) {
- return Convert.ToSingle((double)input);
- };
- RegisterImporter(base_importers_table, typeof(double),
- typeof(float), importer);
importer = delegate (object input) {
return Convert.ToUInt32 ((long) input);
@@ -699,12 +773,6 @@ namespace LitJson
};
RegisterImporter (base_importers_table, typeof (string),
typeof (DateTime), importer);
-
- importer = delegate (object input) {
- return DateTimeOffset.Parse((string)input, datetime_format);
- };
- RegisterImporter(base_importers_table, typeof(string),
- typeof(DateTimeOffset), importer);
}
private static void RegisterImporter (
@@ -725,7 +793,7 @@ namespace LitJson
throw new JsonException (
String.Format ("Max allowed object depth reached while " +
"trying to export from type {0}",
- obj.GetType ()));
+ null != obj ? obj.GetType ().ToString() : "null"));
if (obj == null) {
writer.Write (null);
@@ -741,19 +809,68 @@ namespace LitJson
return;
}
+ //=====================扩展开始=====================
+ if (obj is UnityEngine.Vector4)
+ {
+ writer.Write((UnityEngine.Vector4)obj);
+ return;
+ }
+
+ if (obj is UnityEngine.Vector3)
+ {
+ writer.Write((UnityEngine.Vector3)obj);
+ return;
+ }
+
+ if (obj is UnityEngine.Vector2)
+ {
+ writer.Write((UnityEngine.Vector2)obj);
+ return;
+ }
+ if (obj is DNA.IntVector4)
+ {
+ writer.Write((DNA.IntVector4)obj);
+ return;
+ }
+
+ if (obj is DNA.IntVector3)
+ {
+ writer.Write((DNA.IntVector3)obj);
+ return;
+ }
+
+ if (obj is DNA.IntVector2)
+ {
+ writer.Write((DNA.IntVector2)obj);
+ return;
+ }
+
+ if (obj is System.Single) //float
+ {
+ writer.Write((System.Single)obj);
+ return;
+ }
+
if (obj is String) {
writer.Write ((string) obj);
return;
}
- if (obj is Double) {
- writer.Write ((double) obj);
+ if (obj is UnityEngine.Color)
+ {
+ writer.Write((UnityEngine.Color)obj);
return;
}
- if (obj is Single)
+ if (obj is UnityEngine.Color32)
{
- writer.Write((float)obj);
+ writer.Write((UnityEngine.Color32)obj);
+ return;
+ }
+ //=====================扩展结束=====================
+
+ if (obj is Double) {
+ writer.Write ((double) obj);
return;
}
@@ -792,13 +909,10 @@ namespace LitJson
return;
}
- if (obj is IDictionary dictionary) {
+ if (obj is IDictionary) {
writer.WriteObjectStart ();
- foreach (DictionaryEntry entry in dictionary) {
- var propertyName = entry.Key is string key ?
- key
- : Convert.ToString(entry.Key, CultureInfo.InvariantCulture);
- writer.WritePropertyName (propertyName);
+ foreach (DictionaryEntry entry in (IDictionary) obj) {
+ writer.WritePropertyName (entry.Key.ToString());
WriteValue (entry.Value, writer, writer_is_private,
depth + 1);
}
@@ -829,20 +943,10 @@ namespace LitJson
if (obj is Enum) {
Type e_type = Enum.GetUnderlyingType (obj_type);
- if (e_type == typeof (long))
- writer.Write ((long) obj);
- else if (e_type == typeof (uint))
- writer.Write ((uint) obj);
- else if (e_type == typeof (ulong))
+ if (e_type == typeof (long)
+ || e_type == typeof (uint)
+ || e_type == typeof (ulong))
writer.Write ((ulong) obj);
- else if (e_type == typeof(ushort))
- writer.Write ((ushort)obj);
- else if (e_type == typeof(short))
- writer.Write ((short)obj);
- else if (e_type == typeof(byte))
- writer.Write ((byte)obj);
- else if (e_type == typeof(sbyte))
- writer.Write ((sbyte)obj);
else
writer.Write ((int) obj);
@@ -931,11 +1035,11 @@ namespace LitJson
return (T) ReadValue (typeof (T), reader);
}
- public static object ToObject(string json, Type ConvertType )
+ public static object ToObject(Type t, string json)
{
JsonReader reader = new JsonReader(json);
- return ReadValue(ConvertType, reader);
+ return ReadValue(t, reader);
}
public static IJsonWrapper ToWrapper (WrapperFactory factory,
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs.meta
index b3aaf8c..1f88d0a 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonMapper.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: eee18851e387ee44eb4d6970153cb573
+guid: 0d00865104600c7449d358a6cbb3d9e7
+timeCreated: 1474349754
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs
index e47eabc..4616864 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* JsonReader.cs
* Stream-like access to JSON text.
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Text;
@@ -43,7 +42,7 @@ namespace LitJson
public class JsonReader
{
#region Fields
- private static readonly IDictionary<int, IDictionary<int, int[]>> parse_table;
+ private static IDictionary<int, IDictionary<int, int[]>> parse_table;
private Stack<int> automaton_stack;
private int current_input;
@@ -56,7 +55,6 @@ namespace LitJson
private bool read_started;
private TextReader reader;
private bool reader_is_owned;
- private bool skip_non_members;
private object token_value;
private JsonToken token;
#endregion
@@ -73,11 +71,6 @@ namespace LitJson
set { lexer.AllowSingleQuotedStrings = value; }
}
- public bool SkipNonMembers {
- get { return skip_non_members; }
- set { skip_non_members = value; }
- }
-
public bool EndOfInput {
get { return end_of_input; }
}
@@ -99,7 +92,7 @@ namespace LitJson
#region Constructors
static JsonReader ()
{
- parse_table = PopulateParseTable ();
+ PopulateParseTable ();
}
public JsonReader (string json_text) :
@@ -118,7 +111,7 @@ namespace LitJson
throw new ArgumentNullException ("reader");
parser_in_string = false;
- parser_return = false;
+ parser_return = false;
read_started = false;
automaton_stack = new Stack<int> ();
@@ -130,8 +123,6 @@ namespace LitJson
end_of_input = false;
end_of_json = false;
- skip_non_members = true;
-
this.reader = reader;
reader_is_owned = owned;
}
@@ -139,122 +130,119 @@ namespace LitJson
#region Static Methods
- private static IDictionary<int, IDictionary<int, int[]>> PopulateParseTable ()
+ private static void PopulateParseTable ()
{
- // See section A.2. of the manual for details
- IDictionary<int, IDictionary<int, int[]>> parse_table = new Dictionary<int, IDictionary<int, int[]>> ();
-
- TableAddRow (parse_table, ParserToken.Array);
- TableAddCol (parse_table, ParserToken.Array, '[',
- '[',
- (int) ParserToken.ArrayPrime);
-
- TableAddRow (parse_table, ParserToken.ArrayPrime);
- TableAddCol (parse_table, ParserToken.ArrayPrime, '"',
- (int) ParserToken.Value,
-
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, '[',
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, ']',
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, '{',
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Number,
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.True,
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.False,
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
- TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Null,
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest,
- ']');
-
- TableAddRow (parse_table, ParserToken.Object);
- TableAddCol (parse_table, ParserToken.Object, '{',
- '{',
- (int) ParserToken.ObjectPrime);
-
- TableAddRow (parse_table, ParserToken.ObjectPrime);
- TableAddCol (parse_table, ParserToken.ObjectPrime, '"',
- (int) ParserToken.Pair,
- (int) ParserToken.PairRest,
- '}');
- TableAddCol (parse_table, ParserToken.ObjectPrime, '}',
- '}');
-
- TableAddRow (parse_table, ParserToken.Pair);
- TableAddCol (parse_table, ParserToken.Pair, '"',
- (int) ParserToken.String,
- ':',
- (int) ParserToken.Value);
-
- TableAddRow (parse_table, ParserToken.PairRest);
- TableAddCol (parse_table, ParserToken.PairRest, ',',
- ',',
- (int) ParserToken.Pair,
- (int) ParserToken.PairRest);
- TableAddCol (parse_table, ParserToken.PairRest, '}',
- (int) ParserToken.Epsilon);
-
- TableAddRow (parse_table, ParserToken.String);
- TableAddCol (parse_table, ParserToken.String, '"',
- '"',
- (int) ParserToken.CharSeq,
- '"');
-
- TableAddRow (parse_table, ParserToken.Text);
- TableAddCol (parse_table, ParserToken.Text, '[',
- (int) ParserToken.Array);
- TableAddCol (parse_table, ParserToken.Text, '{',
- (int) ParserToken.Object);
-
- TableAddRow (parse_table, ParserToken.Value);
- TableAddCol (parse_table, ParserToken.Value, '"',
- (int) ParserToken.String);
- TableAddCol (parse_table, ParserToken.Value, '[',
- (int) ParserToken.Array);
- TableAddCol (parse_table, ParserToken.Value, '{',
- (int) ParserToken.Object);
- TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Number,
- (int) ParserToken.Number);
- TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.True,
- (int) ParserToken.True);
- TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.False,
- (int) ParserToken.False);
- TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Null,
- (int) ParserToken.Null);
-
- TableAddRow (parse_table, ParserToken.ValueRest);
- TableAddCol (parse_table, ParserToken.ValueRest, ',',
- ',',
- (int) ParserToken.Value,
- (int) ParserToken.ValueRest);
- TableAddCol (parse_table, ParserToken.ValueRest, ']',
- (int) ParserToken.Epsilon);
-
- return parse_table;
+ parse_table = new Dictionary<int, IDictionary<int, int[]>> ();
+
+ TableAddRow (ParserToken.Array);
+ TableAddCol (ParserToken.Array, '[',
+ '[',
+ (int) ParserToken.ArrayPrime);
+
+ TableAddRow (ParserToken.ArrayPrime);
+ TableAddCol (ParserToken.ArrayPrime, '"',
+ (int) ParserToken.Value,
+
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, '[',
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, ']',
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, '{',
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Number,
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.True,
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.False,
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+ TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Null,
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest,
+ ']');
+
+ TableAddRow (ParserToken.Object);
+ TableAddCol (ParserToken.Object, '{',
+ '{',
+ (int) ParserToken.ObjectPrime);
+
+ TableAddRow (ParserToken.ObjectPrime);
+ TableAddCol (ParserToken.ObjectPrime, '"',
+ (int) ParserToken.Pair,
+ (int) ParserToken.PairRest,
+ '}');
+ TableAddCol (ParserToken.ObjectPrime, '}',
+ '}');
+
+ TableAddRow (ParserToken.Pair);
+ TableAddCol (ParserToken.Pair, '"',
+ (int) ParserToken.String,
+ ':',
+ (int) ParserToken.Value);
+
+ TableAddRow (ParserToken.PairRest);
+ TableAddCol (ParserToken.PairRest, ',',
+ ',',
+ (int) ParserToken.Pair,
+ (int) ParserToken.PairRest);
+ TableAddCol (ParserToken.PairRest, '}',
+ (int) ParserToken.Epsilon);
+
+ TableAddRow (ParserToken.String);
+ TableAddCol (ParserToken.String, '"',
+ '"',
+ (int) ParserToken.CharSeq,
+ '"');
+
+ TableAddRow (ParserToken.Text);
+ TableAddCol (ParserToken.Text, '[',
+ (int) ParserToken.Array);
+ TableAddCol (ParserToken.Text, '{',
+ (int) ParserToken.Object);
+
+ TableAddRow (ParserToken.Value);
+ TableAddCol (ParserToken.Value, '"',
+ (int) ParserToken.String);
+ TableAddCol (ParserToken.Value, '[',
+ (int) ParserToken.Array);
+ TableAddCol (ParserToken.Value, '{',
+ (int) ParserToken.Object);
+ TableAddCol (ParserToken.Value, (int) ParserToken.Number,
+ (int) ParserToken.Number);
+ TableAddCol (ParserToken.Value, (int) ParserToken.True,
+ (int) ParserToken.True);
+ TableAddCol (ParserToken.Value, (int) ParserToken.False,
+ (int) ParserToken.False);
+ TableAddCol (ParserToken.Value, (int) ParserToken.Null,
+ (int) ParserToken.Null);
+
+ TableAddRow (ParserToken.ValueRest);
+ TableAddCol (ParserToken.ValueRest, ',',
+ ',',
+ (int) ParserToken.Value,
+ (int) ParserToken.ValueRest);
+ TableAddCol (ParserToken.ValueRest, ']',
+ (int) ParserToken.Epsilon);
}
- private static void TableAddCol (IDictionary<int, IDictionary<int, int[]>> parse_table, ParserToken row, int col,
+ private static void TableAddCol (ParserToken row, int col,
params int[] symbols)
{
parse_table[(int) row].Add (col, symbols);
}
- private static void TableAddRow (IDictionary<int, IDictionary<int, int[]>> parse_table, ParserToken rule)
+ private static void TableAddRow (ParserToken rule)
{
parse_table.Add ((int) rule, new Dictionary<int, int[]> ());
}
@@ -269,7 +257,7 @@ namespace LitJson
number.IndexOf ('E') != -1) {
double n_double;
- if (double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out n_double)) {
+ if (Double.TryParse (number, out n_double)) {
token = JsonToken.Double;
token_value = n_double;
@@ -278,7 +266,7 @@ namespace LitJson
}
int n_int32;
- if (int.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int32)) {
+ if (Int32.TryParse (number, out n_int32)) {
token = JsonToken.Int;
token_value = n_int32;
@@ -286,22 +274,13 @@ namespace LitJson
}
long n_int64;
- if (long.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int64)) {
+ if (Int64.TryParse (number, out n_int64)) {
token = JsonToken.Long;
token_value = n_int64;
return;
}
- ulong n_uint64;
- if (ulong.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_uint64))
- {
- token = JsonToken.Long;
- token_value = n_uint64;
-
- return;
- }
-
// Shouldn't happen, but just in case, return something
token = JsonToken.Int;
token_value = 0;
@@ -395,9 +374,7 @@ namespace LitJson
end_of_json = true;
if (reader_is_owned)
- {
- using(reader){}
- }
+ reader.Close ();
reader = null;
}
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs.meta
index 461265c..2090450 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonReader.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonReader.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: 8172348d84be41e43a9baa039c08bf7a
+guid: 8d4fad23f0c1df8488cd1ce850b1b88e
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs
index 4bfaaac..40324e9 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* JsonWriter.cs
* Stream-like facility to output JSON text.
@@ -39,7 +39,7 @@ namespace LitJson
public class JsonWriter
{
#region Fields
- private static readonly NumberFormatInfo number_format;
+ private static NumberFormatInfo number_format;
private WriterContext context;
private Stack<WriterContext> ctx_stack;
@@ -50,7 +50,6 @@ namespace LitJson
private StringBuilder inst_string_builder;
private bool pretty_print;
private bool validate;
- private bool lower_case_properties;
private TextWriter writer;
#endregion
@@ -77,11 +76,6 @@ namespace LitJson
get { return validate; }
set { validate = value; }
}
-
- public bool LowerCaseProperties {
- get { return lower_case_properties; }
- set { lower_case_properties = value; }
- }
#endregion
@@ -172,7 +166,6 @@ namespace LitJson
indent_value = 4;
pretty_print = false;
validate = true;
- lower_case_properties = false;
ctx_stack = new Stack<WriterContext> ();
context = new WriterContext ();
@@ -223,7 +216,7 @@ namespace LitJson
writer.Write (',');
if (pretty_print && ! context.ExpectingValue)
- writer.Write (Environment.NewLine);
+ writer.Write ('\n');
}
private void PutString (string str)
@@ -304,6 +297,120 @@ namespace LitJson
inst_string_builder.Remove (0, inst_string_builder.Length);
}
+ //=====================扩展开始=====================
+ public void Write(UnityEngine.Vector4 v4)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ Put("\"");
+ Put(v4.x.ToString()); Put(",");
+ Put(v4.y.ToString()); Put(",");
+ Put(v4.z.ToString()); Put(",");
+ Put(v4.w.ToString());
+ Put("\"");
+
+ context.ExpectingValue = false;
+ }
+
+ public void Write(UnityEngine.Vector3 v3)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ Put("\"");
+ Put(v3.x.ToString()); Put(",");
+ Put(v3.y.ToString()); Put(",");
+ Put(v3.z.ToString());
+ Put("\"");
+
+ context.ExpectingValue = false;
+ }
+
+ public void Write(UnityEngine.Vector2 v2)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ Put("\"");
+ Put(v2.x.ToString()); Put(",");
+ Put(v2.y.ToString());
+ Put("\"");
+
+ context.ExpectingValue = false;
+ }
+
+ //public void Write(DNA.IntVector4 v4)
+ //{
+ // DoValidation(Condition.Value);
+ // PutNewline();
+
+ // context.ExpectingValue = false;
+ // Put("\"");
+ // Put(v4.ToString());
+ // Put("\"");
+
+ // context.ExpectingValue = false;
+ //}
+
+ //public void Write(DNA.IntVector3 v3)
+ //{
+ // DoValidation(Condition.Value);
+ // PutNewline();
+
+ // context.ExpectingValue = false;
+ // Put("\"");
+ // Put(v3.ToString());
+ // Put("\"");
+
+ // context.ExpectingValue = false;
+ //}
+
+ //public void Write(DNA.IntVector2 v2)
+ //{
+ // DoValidation(Condition.Value);
+ // PutNewline();
+
+ // context.ExpectingValue = false;
+ // Put("\"");
+ // Put(v2.ToString());
+ // Put("\"");
+
+ // context.ExpectingValue = false;
+ //}
+
+ public void Write(UnityEngine.Color color)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ Put("\"");
+ Put(color.r.ToString()); Put(",");
+ Put(color.g.ToString()); Put(",");
+ Put(color.b.ToString()); Put(",");
+ Put(color.a.ToString());
+ Put("\"");
+
+ context.ExpectingValue = false;
+ }
+
+ public void Write(UnityEngine.Color32 color)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ Put("\"");
+ Put(color.r.ToString()); Put(",");
+ Put(color.g.ToString()); Put(",");
+ Put(color.b.ToString()); Put(",");
+ Put(color.a.ToString());
+ Put("\"");
+
+ context.ExpectingValue = false;
+ }
+
+ //=====================扩展结束=====================
+
public void Write (bool boolean)
{
DoValidation (Condition.Value);
@@ -324,6 +431,21 @@ namespace LitJson
context.ExpectingValue = false;
}
+ public void Write(float number)
+ {
+ DoValidation(Condition.Value);
+ PutNewline();
+
+ string str = Convert.ToString(number, number_format);
+ Put(str);
+
+ if (str.IndexOf('.') == -1 &&
+ str.IndexOf('E') == -1)
+ writer.Write(".0");
+
+ context.ExpectingValue = false;
+ }
+
public void Write (double number)
{
DoValidation (Condition.Value);
@@ -339,17 +461,6 @@ namespace LitJson
context.ExpectingValue = false;
}
- public void Write(float number)
- {
- DoValidation(Condition.Value);
- PutNewline();
-
- string str = Convert.ToString(number, number_format);
- Put(str);
-
- context.ExpectingValue = false;
- }
-
public void Write (int number)
{
DoValidation (Condition.Value);
@@ -366,7 +477,6 @@ namespace LitJson
PutNewline ();
Put (Convert.ToString (number, number_format));
-
context.ExpectingValue = false;
}
@@ -383,7 +493,7 @@ namespace LitJson
context.ExpectingValue = false;
}
- [CLSCompliant(false)]
+ //[CLSCompliant(false)] Todisable warring CS3021
public void Write (ulong number)
{
DoValidation (Condition.Value);
@@ -418,8 +528,10 @@ namespace LitJson
Put ("[");
- context = new WriterContext ();
- context.InArray = true;
+ context = new WriterContext
+ {
+ InArray = true
+ };
ctx_stack.Push (context);
Indent ();
@@ -449,8 +561,10 @@ namespace LitJson
Put ("{");
- context = new WriterContext ();
- context.InObject = true;
+ context = new WriterContext
+ {
+ InObject = true
+ };
ctx_stack.Push (context);
Indent ();
@@ -460,17 +574,14 @@ namespace LitJson
{
DoValidation (Condition.Property);
PutNewline ();
- string propertyName = (property_name == null || !lower_case_properties)
- ? property_name
- : property_name.ToLowerInvariant();
- PutString (propertyName);
+ PutString (property_name);
if (pretty_print) {
- if (propertyName.Length > context.Padding)
- context.Padding = propertyName.Length;
+ if (property_name.Length > context.Padding)
+ context.Padding = property_name.Length;
- for (int i = context.Padding - propertyName.Length;
+ for (int i = context.Padding - property_name.Length;
i >= 0; i--)
writer.Write (' ');
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs.meta
index 06e050d..ad597f9 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonWriter.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: 57f2d5d9c46c3a24ca93e6bbcd66bab0
+guid: b8439c843e82dfe48b235906797bcda7
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs
index cb62d55..37534bb 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* Lexer.cs
* JSON lexer implementation based on a finite state machine.
@@ -31,8 +31,8 @@ namespace LitJson
#region Fields
private delegate bool StateHandler (FsmContext ctx);
- private static readonly int[] fsm_return_table;
- private static readonly StateHandler[] fsm_handler_table;
+ private static int[] fsm_return_table;
+ private static StateHandler[] fsm_handler_table;
private bool allow_comments;
private bool allow_single_quoted_strings;
@@ -77,7 +77,7 @@ namespace LitJson
#region Constructors
static Lexer ()
{
- PopulateFsmTables (out fsm_handler_table, out fsm_return_table);
+ PopulateFsmTables ();
}
public Lexer (TextReader reader)
@@ -91,8 +91,10 @@ namespace LitJson
end_of_input = false;
this.reader = reader;
- fsm_context = new FsmContext ();
- fsm_context.L = this;
+ fsm_context = new FsmContext
+ {
+ L = this
+ };
}
#endregion
@@ -130,10 +132,8 @@ namespace LitJson
}
}
- private static void PopulateFsmTables (out StateHandler[] fsm_handler_table, out int[] fsm_return_table)
+ private static void PopulateFsmTables ()
{
- // See section A.1. of the manual for details of the finite
- // state machine.
fsm_handler_table = new StateHandler[28] {
State1,
State2,
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs.meta
index 2ab619c..5468201 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/Lexer.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/Lexer.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: bfa419e8f64767640a5dace002948765
+guid: c044d0a258f8a014f9c13b83ed68d346
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs
index e23d477..01174df 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs
@@ -1,4 +1,4 @@
-#region Header
+#region Header
/**
* ParserToken.cs
* Internal representation of the tokens used by the lexer and the parser.
@@ -13,7 +13,7 @@ namespace LitJson
{
internal enum ParserToken
{
- // Lexer tokens (see section A.1.1. of the manual)
+ // Lexer tokens
None = System.Char.MaxValue + 1,
Number,
True,
@@ -23,7 +23,7 @@ namespace LitJson
// Single char
Char,
- // Parser Rules (see section A.2.1 of the manual)
+ // Parser Rules
Text,
Object,
ObjectPrime,
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs.meta b/WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs.meta
index a312ce8..3766b80 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/ParserToken.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/ParserToken.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: dad2aebdd150e9f47b4cf679ede86953
+guid: 712024c872ac84c4a99a7e6479b8cb99
+timeCreated: 1474349755
+licenseType: Pro
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil.meta
index 1892928..878753e 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/LitJSON.csproj.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil.meta
@@ -1,5 +1,6 @@
fileFormatVersion: 2
-guid: f685021b13e261c4ab073d8315dd85fc
+guid: 8f5ab78f3fb911749afba18449589ba4
+folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
new file mode 100644
index 0000000..5d9c6e8
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+/// <summary>
+/// 给UI.Text使用的double buffer string
+/// </summary>
+public class DoubleVString
+{
+ private int index;
+ private VString stringA;
+ private VString stringB;
+
+ public DoubleVString(int maxCount)
+ {
+ stringA = new VString(maxCount);
+ stringB = new VString(maxCount);
+ }
+
+ public VString GetCurrentVString()
+ {
+ return (index % 2) == 0 ? stringA : stringB;
+ }
+
+ public VString GetNextVString()
+ {
+ return (index % 2) == 0 ? stringB : stringA;
+ }
+
+
+ //交换current 和Next string对象
+ public void SwapVString()
+ {
+ index = (index + 1) % 2;
+ }
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs.meta
new file mode 100644
index 0000000..5e79416
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9a865a66c8bd9444f9b481e3a62e500e
+timeCreated: 1526353967
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs
new file mode 100644
index 0000000..1b885bd
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs
@@ -0,0 +1,750 @@
+using UnityEngine;
+using System.Collections;
+using System.Text;
+using System;
+using System.Collections.Generic;
+
+public partial class StringUtil
+{
+ //自定义字符串函数公用的StringBuilder
+ static StringBuilder _customSB = new StringBuilder();
+ //共享的StringBuilder
+ static StringBuilder shareSB = new StringBuilder();
+
+ #region Concat
+ /// <summary>
+ /// 拼接字符串(2个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(3个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(4个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(5个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(6个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(7个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(8个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(9个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(10个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <param name="a10"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(11个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <param name="a10"></param>
+ /// <param name="a11"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(12个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <param name="a10"></param>
+ /// <param name="a11"></param>
+ /// <param name="a12"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(13个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <param name="a10"></param>
+ /// <param name="a11"></param>
+ /// <param name="a12"></param>
+ /// <param name="a13"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ return _customSB.ToString();
+ }
+
+ /// <summary>
+ /// 拼接字符串(14个)
+ /// </summary>
+ /// <param name="a1"></param>
+ /// <param name="a2"></param>
+ /// <param name="a3"></param>
+ /// <param name="a4"></param>
+ /// <param name="a5"></param>
+ /// <param name="a6"></param>
+ /// <param name="a7"></param>
+ /// <param name="a8"></param>
+ /// <param name="a9"></param>
+ /// <param name="a10"></param>
+ /// <param name="a11"></param>
+ /// <param name="a12"></param>
+ /// <param name="a13"></param>
+ /// <param name="a14"></param>
+ /// <returns></returns>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(15个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(16个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15,
+ string a16)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ _customSB.Append(a16);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(17个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15,
+ string a16, string a17)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ _customSB.Append(a16);
+ _customSB.Append(a17);
+ return _customSB.ToString();
+ }
+
+ /// <summary>
+ /// 拼接字符串(18个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15,
+ string a16, string a17, string a18)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ _customSB.Append(a16);
+ _customSB.Append(a17);
+ _customSB.Append(a18);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(19个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15,
+ string a16, string a17, string a18, string a19)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ _customSB.Append(a16);
+ _customSB.Append(a17);
+ _customSB.Append(a18);
+ _customSB.Append(a19);
+ return _customSB.ToString();
+ }
+ /// <summary>
+ /// 拼接字符串(20个)
+ /// </summary>
+ public static string Concat(string a1, string a2, string a3, string a4, string a5,
+ string a6, string a7, string a8, string a9, string a10,
+ string a11, string a12, string a13, string a14, string a15,
+ string a16, string a17, string a18, string a19, string a20)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.Append(a1);
+ _customSB.Append(a2);
+ _customSB.Append(a3);
+ _customSB.Append(a4);
+ _customSB.Append(a5);
+ _customSB.Append(a6);
+ _customSB.Append(a7);
+ _customSB.Append(a8);
+ _customSB.Append(a9);
+ _customSB.Append(a10);
+ _customSB.Append(a11);
+ _customSB.Append(a12);
+ _customSB.Append(a13);
+ _customSB.Append(a14);
+ _customSB.Append(a15);
+ _customSB.Append(a16);
+ _customSB.Append(a17);
+ _customSB.Append(a18);
+ _customSB.Append(a19);
+ _customSB.Append(a20);
+ return _customSB.ToString();
+ }
+ #endregion
+
+ /// <summary>
+ /// 获得公用的StringBuilder
+ /// </summary>
+ /// <returns></returns>
+ public static StringBuilder GetShareStringBuilder(bool bReset = true)
+ {
+ if (bReset)
+ {
+ shareSB.Remove(0, shareSB.Length);
+ }
+ return shareSB;
+ }
+
+ /// <summary>
+ /// 格式化字符串
+ /// </summary>
+ /// <param name="format"></param>
+ /// <param name="args"></param>
+ /// <returns></returns>
+ public static string Format(string format, params object[] args)
+ {
+ try
+ {
+ _customSB.Remove(0, _customSB.Length);
+ _customSB.AppendFormat(format, args);
+ return _customSB.ToString();
+ }
+ catch (Exception e)
+ {
+ LogHelper.LogError(e.Message);
+ return format;
+ }
+ }
+
+ /// <summary>
+ /// 替换\\n 为\n
+ /// </summary>
+ /// <param name="baseStr"></param>
+ /// <returns></returns>
+ public static string ReplaceNewLineChar(string baseStr)
+ {
+ //if (!baseStr.Contains("\\n"))
+ //{
+ // return baseStr;
+ //}
+ return baseStr.Replace("\\n", "\n");
+ }
+
+ /// <summary>
+ /// 替换转义字符
+ /// </summary>
+ /// <param name="baseStr"></param>
+ /// <returns></returns>
+ public static string ReplaceTranslateChar(string baseStr)
+ {
+ baseStr = baseStr.Replace("\\n", "\n");
+ baseStr = baseStr.Replace("\\t", "\t");
+ baseStr = baseStr.Replace("\\b", " ");
+ return baseStr;
+ }
+
+ /// <summary>
+ /// 替换\\s 为(全角)空格
+ /// </summary>
+ /// <param name="baseStr"></param>
+ /// <returns></returns>
+ public static string ReplaceNewBlankSpaceChar(string baseStr)
+ {
+ //if (!baseStr.Contains("\\s"))
+ //{
+ // return baseStr;
+ //}
+ return baseStr.Replace("\\s", " ");
+ }
+
+ // 正则匹配空格规则
+ static System.Text.RegularExpressions.Regex SpaceRgx = null;
+ private static string GetSpacePattern()
+ {
+ return "\\s(?![a-z]|\\s)";
+ }
+
+ public static System.Text.RegularExpressions.Regex GetSpaceRgx()
+ {
+ if(SpaceRgx == null)
+ {
+ SpaceRgx = new System.Text.RegularExpressions.Regex(GetSpacePattern(), System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+ }
+ return SpaceRgx;
+ }
+ // 处理英文混排时空格换行的问题
+ public static string ProSpace(string value)
+ {
+ if (string.IsNullOrEmpty(value))
+ return value;
+ return ProSpaceSp(value);
+ }
+ private static string ProSpaceSp(string value)
+ {
+ return value.Replace("{sp}", "\u00A0");
+ }
+ private static string ProSpaceNormal(string value)
+ {
+ return GetSpaceRgx().Replace(value, "\u00A0");
+ }
+
+
+ /// <summary>
+ /// 文本加持颜色
+ /// </summary>
+ /// <param name="color"></param>
+ /// <param name="text"></param>
+ /// <returns></returns>
+ public static string UITextColor(string color, string text)
+ {
+ return StringUtil.Format("<color=#{0}>{1}</color>", color, text);
+ }
+
+ /// <summary>
+ /// 文本加持颜色
+ /// </summary>
+ /// <param name="color"></param>
+ /// <param name="text"></param>
+ /// <returns></returns>
+ public static string UITextColor(Color color, string text)
+ {
+ return UITextColor(ColorUtility.ToHtmlStringRGBA(color), text);
+ }
+
+ /// <summary>
+ /// 整数转字符串
+ /// </summary>
+ /// <param name="num"></param>
+ /// <param name="limit"></param>
+ /// <param name="param"></param>
+ /// <returns></returns>
+ public static string Int2StringLimit(int num, int limit, string param = "")
+ {
+ if (num < limit)
+ {
+ return num.ToString(param);
+ }
+ else
+ {
+ return limit.ToString(param);
+ }
+ }
+
+ /// <summary>
+ /// 替换为linux的斜杠
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string StringSlashOfLinux(string str)
+ {
+ return str.Replace('\\', '/'); ;
+ }
+
+ /// <summary>
+ /// 替换为win的斜杠
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string StringSlashOfWin(string str)
+ {
+ return str.Replace('/', '\\'); ;
+ }
+
+ /// <summary>
+ /// 服务器接收的字符串不可有竖线
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string ToServerSafeString(string str)
+ {
+ return str.Replace("|", "/");
+ }
+
+ public static string DictionaryConvertString(Dictionary<int, int> dic)
+ {
+ _customSB.Remove(0, _customSB.Length);
+ if(dic != null)
+ {
+ Dictionary<int, int>.Enumerator itor = dic.GetEnumerator();
+ while(itor.MoveNext())
+ {
+ _customSB.Append(itor.Current.Key);
+ _customSB.Append(",");
+ _customSB.Append(itor.Current.Value);
+ _customSB.Append(";");
+ }
+ }
+ return _customSB.ToString();
+ }
+ #region 数字转美式字符串
+#if VERSION_OVERSEA_GAIYA && !(GAIYA_BURNING_GAME ||GAIYA_MYCARD_GAME)
+ public static string Num2US(float num)
+ {
+ return num.ToString("n2");
+ }
+ public static string Num2US(int num)
+ {
+ return num.ToString("n0");
+ }
+ public static string Num2US(long num)
+ {
+ return num.ToString("n0");
+ }
+#else
+ public static string Num2US(float num)
+ {
+ return num.ToString("n2").Replace(',',' ');
+ }
+ public static string Num2US(int num)
+ {
+ return num.ToString("n0").Replace(',', ' ');
+ }
+ public static string Num2US(long num)
+ {
+ return num.ToString("n0").Replace(',', ' ');
+ }
+#endif
+ #endregion
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs.meta
new file mode 100644
index 0000000..ad52d51
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 657e94996dc5d074a9944a0c4f8df3c9
+timeCreated: 1493006408
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs
new file mode 100644
index 0000000..d9d0616
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs
@@ -0,0 +1,300 @@
+using UnityEngine;
+using System.Collections;
+using System.Text;
+using System;
+
+public partial class StringUtil
+{
+ /// <summary>
+ /// 计算字符串的长度(包含处理中文字符)
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ public static int CalcStringLetterNum(string input)
+ {
+ int counter = 0;
+ for (int i = 0, imax = input.Length; i < imax; ++i)
+ {
+ if (IsChineseLetter(input, i))
+ {
+ counter += 2;
+ }
+ else
+ {
+ counter += 1;
+ }
+ }
+
+ return counter;
+ }
+
+ /// <summary>
+ /// 截断字符串(包含处理中文字符)
+ /// </summary>
+ /// <param name="input"></param>
+ /// <param name="maxEnglishLength"></param>
+ /// <returns></returns>
+ public static string TrancString(string input, int maxEnglishLength)
+ {
+ int counter = 0;
+ for (int i = 0, imax = input.Length; i < imax; ++i)
+ {
+ if (IsChineseLetter(input, i))
+ {
+ if (counter <= maxEnglishLength && maxEnglishLength < (counter + 2))
+ return input.Substring(0, i);
+ counter += 2;
+ }
+ else
+ {
+ if (counter <= maxEnglishLength && maxEnglishLength < (counter + 1))
+ return input.Substring(0, i);
+ counter += 1;
+ }
+ }
+
+ return input;
+ }
+
+ /// <summary>
+ /// 是不是中文字符
+ /// </summary>
+ /// <param name="input"></param>
+ /// <param name="index"></param>
+ /// <returns></returns>
+ public static bool IsChineseLetter(string input, int index)
+ {
+ int code = 0;
+ int chfrom = System.Convert.ToInt32("4e00", 16);
+ int chend = System.Convert.ToInt32("9fff", 16);
+ if (input != "")
+ {
+ code = System.Char.ConvertToUtf32(input, index);
+
+ if (code >= chfrom && code <= chend)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 缩减字符串
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string ShrinkString(string str)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, imax = str.Length; i < imax; i++)
+ {
+ if (str[i] == '\0')
+ break;
+ sb.Append(str[i]);
+ }
+
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// 自定义的字符串比较
+ /// </summary>
+ /// <param name="left"></param>
+ /// <param name="right"></param>
+ /// <returns></returns>
+ public static bool IsStringEqual(string left, string right)
+ {
+ if (System.Object.ReferenceEquals(left, right))
+ {
+ return true;
+ }
+
+ if (left == null && right == null)
+ return true;
+ if (left == null)
+ return false;
+ if (right == null)
+ return false;
+
+ int leftLen = left.Length;
+ int rightLen = right.Length;
+ int count = Mathf.Min(leftLen, rightLen);
+ for (int index = 0; index < count; ++index)
+ {
+ char leftChar = left[index];
+ char rightChar = right[index];
+ if (leftChar != rightChar)
+ return false;
+ }
+
+ if (leftLen > count && left[count] == '\0')
+ return true;
+ if (rightLen > count && right[count] == '\0')
+ return true;
+ if (leftLen == rightLen)
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Bytes数组转utf8字符串
+ /// </summary>
+ /// <param name="buffer"></param>
+ /// <param name="fromIndex"></param>
+ /// <param name="count"></param>
+ /// <param name="bufferSize"></param>
+ /// <returns></returns>
+ public static string GetUtf8StringFromByteBuffer(ref byte[] buffer, int fromIndex, int count, int bufferSize)
+ {
+ if (buffer == null)
+ return string.Empty;
+ if (fromIndex < bufferSize)
+ {
+ int maxCount = bufferSize - fromIndex;
+ count = Mathf.Min(maxCount, count);
+
+ string str = ShrinkString(System.Text.Encoding.UTF8.GetString(buffer, fromIndex, count));
+ return str;
+ }
+
+ LogHelper.LogError("fromIndex over flow.");
+ return "";
+ }
+
+ /// <summary>
+ /// Bytes数组转utf8字符串
+ /// </summary>
+ /// <param name="buffer"></param>
+ /// <returns></returns>
+ public static string GetUtf8StringFromByteBuffer(ref byte[] buffer)
+ {
+ return GetUtf8StringFromByteBuffer(ref buffer, 0, buffer.Length, buffer.Length);
+ }
+
+ /// <summary>
+ /// Utf8字符串转Byte数组
+ /// </summary>
+ /// <param name="srcStr"></param>
+ /// <param name="srcOffset"></param>
+ /// <param name="dstBuffer"></param>
+ /// <param name="dstOffset"></param>
+ /// <param name="dstBufferSize"></param>
+ public static void CopyByteBufferFromUtf8String(string srcStr, int srcOffset, ref byte[] dstBuffer, int dstOffset, int dstBufferSize)
+ {
+ int copyCount;
+ CopyByteBufferFromUtf8String(srcStr, srcOffset, ref dstBuffer, dstOffset, dstBufferSize, out copyCount);
+ }
+
+ /// <summary>
+ /// Utf8字符串转Byte数组
+ /// </summary>
+ /// <param name="srcStr"></param>
+ /// <param name="srcOffset"></param>
+ /// <param name="dstBuffer"></param>
+ /// <param name="dstOffset"></param>
+ /// <param name="dstBufferSize"></param>
+ /// <param name="copyCount"></param>
+ public static void CopyByteBufferFromUtf8String(string srcStr, int srcOffset, ref byte[] dstBuffer, int dstOffset, int dstBufferSize, out int copyCount)
+ {
+ byte[] srcBuffer = System.Text.Encoding.UTF8.GetBytes(srcStr);
+ int srcLen = srcBuffer.Length;
+ srcLen = Mathf.Max(srcLen - srcOffset, 0);
+ int dstMaxCopyCount = dstBufferSize - dstOffset;
+ dstMaxCopyCount = Mathf.Max(dstMaxCopyCount, 0);
+ dstMaxCopyCount = Mathf.Min(dstMaxCopyCount, srcLen);
+ System.Buffer.BlockCopy(srcBuffer, srcOffset, dstBuffer, dstOffset, dstMaxCopyCount);
+
+ copyCount = dstMaxCopyCount;
+ }
+
+ /// <summary>
+ /// Byte数组复制
+ /// </summary>
+ /// <param name="srcBuffer"></param>
+ /// <param name="srcOffset"></param>
+ /// <param name="dstBuffer"></param>
+ /// <param name="dstOffset"></param>
+ /// <param name="dstBufferSize"></param>
+ public static void CopyByteBuffer(ref byte[] srcBuffer, int srcOffset, ref byte[] dstBuffer, int dstOffset, int dstBufferSize)
+ {
+ int copyCount;
+ CopyByteBuffer(ref srcBuffer, srcOffset, ref dstBuffer, dstOffset, dstBufferSize, out copyCount);
+ }
+
+ /// <summary>
+ /// Byte数组复制
+ /// </summary>
+ /// <param name="srcBuffer"></param>
+ /// <param name="srcOffset"></param>
+ /// <param name="dstBuffer"></param>
+ /// <param name="dstOffset"></param>
+ /// <param name="dstBufferSize"></param>
+ /// <param name="copyCount"></param>
+ public static void CopyByteBuffer(ref byte[] srcBuffer, int srcOffset, ref byte[] dstBuffer, int dstOffset, int dstBufferSize, out int copyCount)
+ {
+ int srcLen = srcBuffer.Length;
+ srcLen = Mathf.Max(srcLen - srcOffset, 0);
+ int dstMaxCopyCount = dstBufferSize - dstOffset;
+ dstMaxCopyCount = Mathf.Max(dstMaxCopyCount, 0);
+ dstMaxCopyCount = Mathf.Min(dstMaxCopyCount, srcLen);
+ System.Buffer.BlockCopy(srcBuffer, srcOffset, dstBuffer, dstOffset, dstMaxCopyCount);
+
+ copyCount = dstMaxCopyCount;
+ }
+
+ /// <summary>
+ /// Byte数组转十六进制字符串
+ /// </summary>
+ /// <param name="bytes"></param>
+ /// <returns></returns>
+ public static string BytesToHex(byte[] bytes)
+ {
+ char[] c = new char[bytes.Length * 2];
+
+ byte b;
+
+ for (int bx = 0, cx = 0; bx < bytes.Length; ++bx, ++cx)
+ {
+ b = ((byte)(bytes[bx] >> 4));
+ c[cx] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30);
+
+ b = ((byte)(bytes[bx] & 0x0F));
+ c[++cx] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30);
+ }
+
+ return new string(c);
+ }
+
+ /// <summary>
+ /// 十六进制字符串转Byte数组
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static byte[] HexToBytes(string str)
+ {
+ if (str.Length == 0 || str.Length % 2 != 0)
+ return new byte[0];
+
+ byte[] buffer = new byte[str.Length / 2];
+ char c;
+ for (int bx = 0, sx = 0; bx < buffer.Length; ++bx, ++sx)
+ {
+ // Convert first half of byte
+ c = str[sx];
+ buffer[bx] = (byte)((c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0')) << 4);
+
+ // Convert second half of byte
+ c = str[++sx];
+ buffer[bx] |= (byte)(c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0'));
+ }
+
+ return buffer;
+ }
+
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs.meta
new file mode 100644
index 0000000..6db4c41
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/StringUtil_Other.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5ae4f16a2f4c7254da9d834963922b33
+timeCreated: 1493352224
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs
new file mode 100644
index 0000000..9563280
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs
@@ -0,0 +1,618 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+
+public static class StringExtend
+{
+ private static volatile object lockThis = new object();
+
+ public static string ToTempString(this int i)
+ {
+ lock (lockThis)
+ {
+ return VString.IntToString(i);
+ }
+ }
+
+ public static string ToTempString(this float f, int digits = 2)
+ {
+ lock (lockThis)
+ {
+ return VString.FloatToString(f, digits);
+ }
+ }
+
+ public static string ToTempString(this long l)
+ {
+ lock (lockThis)
+ {
+ return VString.LongToString(l);
+ }
+ }
+
+ public static string ToTempStringLower(this string str)
+ {
+ lock (lockThis)
+ {
+ return VString.ToLower(str);
+ }
+ }
+
+ public static string ToTempStringUpper(this string str)
+ {
+ lock (lockThis)
+ {
+ return VString.ToUpper(str);
+ }
+ }
+
+ public static string ToTempSubString(this string str, int index, int count)
+ {
+ lock (lockThis)
+ {
+ return VString.ToTempSubString(str, index, count);
+ }
+ }
+
+
+
+ #region 转美式数字
+ public static string ToStringUS(this float f)
+ {
+ return StringUtil.Num2US(f);
+ }
+ public static string ToStringUS(this int i)
+ {
+ return StringUtil.Num2US(i);
+ }
+ public static string ToStringUS(this long i)
+ {
+ return StringUtil.Num2US(i);
+ }
+ #endregion
+
+}
+
+
+
+
+
+
+/// <summary>
+/// 内容可变的字符串
+/// !!!只能作为临时变量使用,绝对不可以在逻辑中存储引用,包含VString和返回的string对象
+/// </summary>
+public class VString
+{
+ private string _data;
+ private int maxCount;
+
+ private static int _internalVsIndex;
+ private static VString[] _internalVSArray = new VString[]
+ {
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64),
+ new VString(64)
+ };
+ private static string[] digitalNumberArray = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+
+
+ public VString(int maxCount = 1024)
+ {
+ this.maxCount = maxCount + 1; //多加一个,用于留1个给字符串结束符
+ _data = new string('\0', this.maxCount);
+ Clear();
+ }
+
+ public string GetString()
+ {
+ return _data;
+ }
+
+
+
+ /// <summary>
+ /// int转string,无GC,注意生成的string一定不能进行存贮
+ /// </summary>
+ /// <param name="val"></param>
+ /// <returns></returns>
+ public static string IntToString(int val)
+ {
+ return LongToString(val);
+ }
+
+ /// <summary>
+ /// long转string,无GC,注意生成的string一定不能进行存贮
+ /// </summary>
+ /// <param name="val"></param>
+ /// <returns></returns>
+ public static string LongToString(long val)
+ {
+ if (val == 0)
+ {
+ return "0";
+ }
+
+ VString tempVS = GetInternalVString();
+ bool isNegative = false;
+ if (val < 0)
+ {
+ val = -val;
+ isNegative = true;
+ }
+
+ while (val != 0)
+ {
+ long mod = val % 10;
+ val = val / 10;
+ tempVS.Push(digitalNumberArray[mod]);
+ }
+
+ if (isNegative)
+ {
+ tempVS.Push("-");
+ }
+
+ tempVS.ReverseString();
+ return tempVS.GetString();
+ }
+
+ /// <summary>
+ /// float转string,无GC,注意生成的string一定不能进行存贮
+ /// </summary>
+ /// <param name="f"></param>
+ /// <param name="digits">小数的位数</param>
+ /// <returns></returns>
+ public static string FloatToString(float f, int digits = 2)
+ {
+ bool isNegative = false;
+ if (f < 0)
+ {
+ f = -f;
+ isNegative = true;
+ }
+
+ int iPart = Mathf.FloorToInt(f);
+ float fPart = f - iPart;
+
+ VString tempVS0 = GetInternalVString();
+
+
+ if (iPart != 0)
+ {
+ while (iPart != 0)
+ {
+ long mod = iPart % 10;
+ iPart = iPart / 10;
+ tempVS0.Push(digitalNumberArray[mod]);
+ }
+ }
+ else
+ {
+ tempVS0.Push("0");
+ }
+
+ if (isNegative)
+ {
+ tempVS0.Push("-");
+ }
+ tempVS0.ReverseString();
+
+
+ if (digits != 0)
+ {
+ VString tempVS1 = GetInternalVString();
+ fPart = fPart * Mathf.Pow(10, digits);
+ int iPart2 = Mathf.RoundToInt(fPart);
+
+ int i = 0;
+ while (iPart2 != 0 && i < digits)
+ {
+ long mod = iPart2 % 10;
+ iPart2 = iPart2 / 10;
+ i++;
+ tempVS1.Push(digitalNumberArray[mod]);
+ }
+ tempVS1.ReverseString();
+
+ tempVS0.Push(".");
+ tempVS0.Push(tempVS1.GetString());
+ while (i < digits)
+ {
+ i++;
+ tempVS0.Push("0");
+ }
+ }
+ else
+ {
+ tempVS0.Push(".");
+ for (int i = 0; i < digits; ++i)
+ {
+ tempVS0.Push("0");
+ }
+ }
+
+ return tempVS0.GetString();
+ }
+
+
+ /// <summary>
+ /// 把一个字符串拷贝后,转换为lower case,,注意生成的string一定不能进行存贮
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string ToLower(string str)
+ {
+ if (!string.IsNullOrEmpty(str))
+ {
+ VString tempVS = VStringShareObject.GetShareVString();
+ tempVS.Push(str);
+ tempVS.ToLower();
+ return tempVS.GetString();
+ }
+ return str;
+ }
+
+ /// <summary>
+ /// 把一个字符串拷贝后,转换为upper case,,注意生成的string一定不能进行存贮
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string ToUpper(string str)
+ {
+ if (!string.IsNullOrEmpty(str))
+ {
+ VString tempVS = VStringShareObject.GetShareVString();
+ tempVS.Push(str);
+ tempVS.ToUpper();
+ return tempVS.GetString();
+ }
+ return str;
+ }
+
+ public static string ToTempSubString(string str, int index, int count)
+ {
+ if (string.IsNullOrEmpty(str) || count <= 0 || index < 0)
+ {
+ LogHelper.LogError(VStringUtil.Concat("ToTempSubString IsNullOrEmpty ", index.ToTempString(), "/", count.ToTempString()));
+ return str;
+ }
+
+ if (index + count > str.Length)
+ {
+ LogHelper.LogError(VStringUtil.Concat("ToTempSubString ", str, index.ToTempString(), "/", count.ToTempString()));
+ return str;
+ }
+
+ VString tempVS1 = VStringShareObject.GetShareVString();
+ tempVS1.Push(str);
+ VString tempVS2 = VStringShareObject.GetShareVString();
+ tempVS2.CopyFrom(tempVS1, index, count);
+ return tempVS2.GetString();
+ }
+
+
+ /// <summary>
+ /// 拼接两个字符串
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ /// <param name="clear"></param>
+ /// <returns></returns>
+ public string Concat(string a, string b, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ return _data;
+ }
+
+
+
+ public string Concat(string a, string b, string c, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, string f, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ Push(f);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, string f, string g, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ Push(f);
+ Push(g);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, string f, string g, string h, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ Push(f);
+ Push(g);
+ Push(h);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, string f, string g, string h, string i, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ Push(f);
+ Push(g);
+ Push(h);
+ Push(i);
+ return _data;
+ }
+ public string Concat(string a, string b, string c, string d, string e, string f, string g, string h, string i, string j, bool clear = true)
+ {
+ if (clear)
+ {
+ Clear();
+ }
+
+ Push(a);
+ Push(b);
+ Push(c);
+ Push(d);
+ Push(e);
+ Push(f);
+ Push(g);
+ Push(h);
+ Push(i);
+ Push(j);
+ return _data;
+ }
+
+
+ public static bool UseShareObject(string str)
+ {
+ for (int i = 0; i < _internalVSArray.Length; ++i)
+ {
+ if (string.ReferenceEquals(str, _internalVSArray[i].GetString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ //往当前的字符串中添加字符串
+ public unsafe void Push(string newStr)
+ {
+ if (string.IsNullOrEmpty(newStr))
+ {
+ return;
+ }
+
+ int copyLen = newStr.Length;
+ int newLen = _data.Length + copyLen;
+ if ((newLen + 1) > maxCount) //留1个给字符串结束符
+ {
+ int len = newLen;
+ copyLen = maxCount - _data.Length - 1;
+ newLen = maxCount - 1; //设置新的长度
+ //这个地方不使用VstringUtil.Concat避免死循环
+ LogHelper.LogEditorError(StringUtil.Concat("超过了最大添加长度 ", maxCount.ToTempString(), " ", len.ToTempString()));
+ }
+
+ if (copyLen <= 0)
+ {
+ return;
+ }
+
+ fixed (char* src = newStr)
+ {
+ fixed (char* dst = _data)
+ {
+ UnsafeFunction.memcpyimpl((byte*)src, (byte*)(dst + _data.Length), copyLen * 2); //system.string的存储每个元素两个字节
+
+ int* iDst = (int*)dst;
+ iDst = iDst - 1; //字符串的长度在第一个元素的前面4个字节
+ *iDst = newLen;
+
+ char* iEnd = (char*)(dst + newLen);
+ *iEnd = (char)0;//设置字符串结束符
+ }
+ }
+ }
+
+
+ public unsafe void Clear()
+ {
+ fixed (char* p = _data)
+ {
+ int* pSize = (int*)p;
+ pSize = pSize - 1;
+ *pSize = 0;
+ }
+ }
+
+ public unsafe void CopyFrom(VString srcVstring, int startIndex, int count)
+ {
+ if ((count + 1) > maxCount) //留1个给字符串结束符
+ {
+ throw new ArgumentException(VStringUtil.Concat("copy count is larger then maxCount ",
+ count.ToTempString(), " ", maxCount.ToTempString()));
+ }
+
+ string srcStr = srcVstring.GetString();
+ if (startIndex + count > srcStr.Length)
+ {
+ throw new ArgumentException(VStringUtil.Concat("copy count is larger then srcString len ",
+ count.ToTempString(), " ", srcStr.Length.ToTempString(), " ", startIndex.ToTempString()));
+ }
+
+ Clear();
+
+ fixed (char* src = srcStr)
+ {
+ fixed (char* dst = _data)
+ {
+ UnsafeFunction.memcpyimpl((byte*)(src + startIndex), (byte*)dst, count * 2); //system.string的存储每个元素两个字节
+
+ int* iDst = (int*)dst;
+ iDst = iDst - 1; //字符串的长度在第一个元素的前面4个字节
+ *iDst = count;
+
+ char* iEnd = (char*)(dst + _data.Length);
+ *iEnd = (char)0;//设置字符串结束符
+ }
+ }
+ }
+
+ public unsafe void ToLower()
+ {
+ int index = 0;
+ int len = _data.Length;
+ fixed (char* dst = _data)
+ {
+ while (index < len)
+ {
+ char tempChar = *(dst + index);
+ *(dst + index) = char.ToLower(tempChar);
+ ++index;
+ }
+ }
+ }
+
+ public unsafe void ToUpper()
+ {
+ int index = 0;
+ int len = _data.Length;
+ fixed (char* dst = _data)
+ {
+ while (index < len)
+ {
+ char tempChar = *(dst + index);
+ *(dst + index) = char.ToUpper(tempChar);
+ ++index;
+ }
+ }
+ }
+
+ //反转字符串的内容
+ private unsafe string ReverseString()
+ {
+ int len = _data.Length;
+ if (len > 0)
+ {
+ fixed (char* pHead = _data)
+ {
+ int count = len / 2;
+ for (int i = 0; i < count; ++i)
+ {
+ char temp = pHead[i];
+ pHead[i] = pHead[len - 1 - i];
+ pHead[len - 1 - i] = temp;
+ }
+ }
+ }
+ return _data;
+ }
+
+
+ private static VString GetInternalVString()
+ {
+ _internalVsIndex = (_internalVsIndex + 1) % _internalVSArray.Length;
+ VString vString = _internalVSArray[_internalVsIndex];
+ vString.Clear();
+ return vString;
+ }
+
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs.meta
new file mode 100644
index 0000000..1a0afa7
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VString.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 070edb2882bc15d49917028ddea695e2
+timeCreated: 1525942883
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs
new file mode 100644
index 0000000..0cd147d
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs
@@ -0,0 +1,54 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+
+public static class VStringShareObject
+{
+
+ private static volatile object lockThis = new object();
+ private static int _internalVsIndex;
+ private static VString[] _internalVSArray = new VString[]
+ {
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048),
+ new VString(2048)
+ };
+
+
+ public static VString GetShareVString()
+ {
+ lock(lockThis)
+ {
+ _internalVsIndex = (_internalVsIndex + 1) % _internalVSArray.Length;
+ VString vString = _internalVSArray[_internalVsIndex];
+ vString.Clear();
+ return vString;
+ }
+ }
+
+ public static bool UseShareObject(string str)
+ {
+ for (int i = 0; i < _internalVSArray.Length; ++i)
+ {
+ if (string.ReferenceEquals(str, _internalVSArray[i].GetString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs.meta
new file mode 100644
index 0000000..b40aa4a
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringShareObject.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c6d08c5051585094fb4d23fdf6fe4b7b
+timeCreated: 1552276176
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs
new file mode 100644
index 0000000..d8d717c
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs
@@ -0,0 +1,107 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+/// <summary>
+/// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+/// </summary>
+public class VStringUtil
+{
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e, string f)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, f, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e, string f, string g)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, f, g, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e, string f, string g, string h)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, f, g, h, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e, string f, string g, string h, string i)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, f, g, h, i, true);
+ return vString.GetString();
+ }
+ /// <summary>
+ /// 只能作为临时字符串使用,代码任何地方使用只能赋值给临时变量,不可保存
+ /// </summary>
+ public static string Concat(string a, string b, string c, string d, string e, string f, string g, string h, string i, string j)
+ {
+ VString vString = VStringShareObject.GetShareVString();
+ vString.Concat(a, b, c, d, e, f, g, h, i, j, true);
+ return vString.GetString();
+ }
+
+ /// <summary>
+ /// 如果不是共享string,则返回str,如果是共享string则返回copy str
+ /// </summary>
+ /// <param name="str"></param>
+ /// <returns></returns>
+ public static string ConvertToNormalString(string str)
+ {
+ if(VStringShareObject.UseShareObject(str) || VString.UseShareObject(str))
+ {
+ return string.Copy(str);
+ }
+ return str;
+ }
+
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs.meta
new file mode 100644
index 0000000..721f40c
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VStringUtil.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1816e678bcdfdb646b247fb5419f1279
+timeCreated: 1525954142
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs
new file mode 100644
index 0000000..50b63e6
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+/// <summary>
+/// 优化打字功能的字符串
+/// </summary>
+public class VTypingString
+{
+ enum Tags
+ {
+ Color = 0,
+ Size,
+ B,
+ I
+ }
+
+
+ private VString allContentString;
+ private DoubleVString partialDisplayString;
+ private VString willShowString;
+
+ private int _timerMS;
+ private int _factor;
+ private int _miniSecondPerWord;
+
+ private static readonly string[] endTags = new string[] { "</color>", "</size>", "</b>", "</i>" };
+ private static readonly string[] startTags = new string[] { "<color", "<size", "<b", "<i" };
+
+ List<int> endTagCaches = new List<int>();
+
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="text"></param>
+ /// <param name="miniSecondPerWord">出一个字符需要的毫秒时间</param>
+ public VTypingString(string text, int miniSecondPerWord = 240)
+ {
+ if(string.IsNullOrEmpty(text))
+ {
+ throw new ArgumentException("text is null or empty");
+ }
+
+ _miniSecondPerWord = Mathf.Max(miniSecondPerWord, 10);
+ allContentString = new VString(text.Length);
+ allContentString.Push(text);
+ partialDisplayString = new DoubleVString(text.Length);
+ willShowString = new VString(text.Length);
+ JumpToBegin();
+ }
+
+ public bool IsEnd()
+ {
+ return _factor > allContentString.GetString().Length;
+ }
+
+ public string GetString()
+ {
+ return partialDisplayString.GetCurrentVString().GetString();
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="deltaTimeMS"></param>
+ /// <returns>true表示触发了一次打字变化</returns>
+ public bool OnUpdate(int deltaTimeMS)
+ {
+ _timerMS += deltaTimeMS;
+ if(_timerMS >= _miniSecondPerWord)
+ {
+ _timerMS = 0;
+ OnTyping();
+ return true;
+ }
+ return false;
+ }
+
+ private void OnTyping()
+ {
+ if (CheckStart(Tags.Color)) { }
+ else if (CheckStart(Tags.Size)) { }
+ else if (CheckStart(Tags.B)) { }
+ else if (CheckStart(Tags.I)) { }
+ else
+ {
+ partialDisplayString.GetCurrentVString().Clear();
+ partialDisplayString.SwapVString();
+ partialDisplayString.GetCurrentVString().CopyFrom(allContentString, 0, Mathf.Min(_factor, allContentString.GetString().Length));
+ for (int i = endTagCaches.Count - 1; i >= 0; --i)
+ {
+ partialDisplayString.GetCurrentVString().Push(endTags[endTagCaches[i]]);
+ }
+ _factor++;
+ }
+ }
+
+ public void JumpToBegin()
+ {
+ _factor = 0;
+ _timerMS = -_miniSecondPerWord;
+ endTagCaches.Clear();
+ partialDisplayString.GetCurrentVString().Clear();
+ partialDisplayString.GetNextVString().Clear();
+ }
+
+ public void JumpToEnd()
+ {
+ _factor = allContentString.GetString().Length;
+ endTagCaches.Clear();
+ OnTyping();
+ }
+
+
+ bool CheckStart(Tags tag)
+ {
+ if (_factor >= allContentString.GetString().Length)
+ {
+ return false;
+ }
+
+ int iTag = (int)tag;
+ willShowString.CopyFrom(allContentString, _factor, allContentString.GetString().Length - _factor);
+ string willShow = willShowString.GetString();
+ string endTag = endTags[iTag];
+ if (willShow.StartsWith(startTags[iTag]))
+ {
+ int tagLeng = willShow.IndexOf(">") + 1;
+ _factor += tagLeng;
+ endTagCaches.Add(iTag);//倒叙
+
+ if (CheckStart(Tags.Color)) { }
+ else if (CheckStart(Tags.Size)) { }
+ else if (CheckStart(Tags.B)) { }
+ else if (CheckStart(Tags.I)) { }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+ else if (willShow.StartsWith(endTag))
+ {
+ int endleng = endTag.Length;//"</color>"的长度
+ _factor += endleng;
+ for (int i = endTagCaches.Count - 1; i >= 0; --i)
+ {
+ if(iTag == endTagCaches[i])
+ {
+ endTagCaches.RemoveAt(i);
+ }
+ }
+
+ if (CheckStart(Tags.Color)) { }
+ else if (CheckStart(Tags.Size)) { }
+ else if (CheckStart(Tags.B)) { }
+ else if (CheckStart(Tags.I)) { }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+
+}
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs.meta b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs.meta
new file mode 100644
index 0000000..6f7b5ae
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/VTypingString.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 49843f8b3aca65e4ca985d3226e77ad0
+timeCreated: 1542200708
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs
new file mode 100644
index 0000000..3362626
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs
@@ -0,0 +1,53 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+
+public class UnsafeFunction
+{
+
+ public unsafe static void memcpyimpl(byte* src, byte* dest, int len)
+ {
+ if (len >= 16)
+ {
+ do
+ {
+ *(int*)dest = *(int*)src;
+ *(int*)(dest + 4) = *(int*)(src + 4);
+ *(int*)(dest + 8) = *(int*)(src + 8);
+ *(int*)(dest + 12) = *(int*)(src + 12);
+ dest += 16;
+ src += 16;
+ }
+ while ((len -= 16) >= 16);
+ }
+ if (len > 0)
+ {
+ if ((len & 8) != 0)
+ {
+ *(int*)dest = *(int*)src;
+ *(int*)(dest + 4) = *(int*)(src + 4);
+ dest += 8;
+ src += 8;
+ }
+ if ((len & 4) != 0)
+ {
+ *(int*)dest = *(int*)src;
+ dest += 4;
+ src += 4;
+ }
+ if ((len & 2) != 0)
+ {
+ *(short*)dest = *(short*)src;
+ dest += 2;
+ src += 2;
+ }
+ if ((len & 1) != 0)
+ {
+ *(dest++) = *(src++);
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs.meta b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs.meta
index 07d569c..f8daf55 100644
--- a/WorldlineKeepers/Assets/Standard Assets/LitJson/JsonException.cs.meta
+++ b/WorldlineKeepers/Assets/ThirdParty/UnsafeFunction.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: fd6f014aae872a445b18f0bb155b8de2
+guid: e441a31642a642f40a94673eadc379dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/WorldlineKeepers/ProjectSettings/ProjectSettings.asset b/WorldlineKeepers/ProjectSettings/ProjectSettings.asset
index d551e40..80c7d4e 100644
--- a/WorldlineKeepers/ProjectSettings/ProjectSettings.asset
+++ b/WorldlineKeepers/ProjectSettings/ProjectSettings.asset
@@ -732,7 +732,7 @@ PlayerSettings:
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
suppressCommonWarnings: 1
- allowUnsafeCode: 0
+ allowUnsafeCode: 1
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
additionalIl2CppArgs: