refactored save system to JSON
This commit is contained in:
parent
39acb700e1
commit
1d66b7179c
16 changed files with 2081 additions and 156 deletions
1
Assets/AssetSpace/draft.json
Normal file
1
Assets/AssetSpace/draft.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"vectors":[{"x":0.0,"y":0.0,"z":0.0},{"x":-0.30000001192092898,"y":-0.30000001192092898,"z":0.0},{"x":-0.30000001192092898,"y":0.30000001192092898,"z":0.0},{"x":0.30000001192092898,"y":-0.4300000071525574,"z":0.0},{"x":0.0,"y":0.0,"z":0.0}],"quads":[1,2,3]}
|
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4b2183ce9a640ce46990e3029a03496a
|
guid: ef37452489748cc4ca4bc9672b6f40e0
|
||||||
DefaultImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
Binary file not shown.
1
Assets/AssetSpace/missile.json
Normal file
1
Assets/AssetSpace/missile.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 3fd529051a22f6343857011fec566d37
|
guid: c4d3e5cdfa0bf674d816bc9e2a0f9f8d
|
||||||
DefaultImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
Binary file not shown.
1
Assets/AssetSpace/spaceship.json
Normal file
1
Assets/AssetSpace/spaceship.json
Normal file
File diff suppressed because one or more lines are too long
7
Assets/AssetSpace/spaceship.json.meta
Normal file
7
Assets/AssetSpace/spaceship.json.meta
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b87da504c5a8f24a804874d52d004f8
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
1317
Assets/Plugins/SimpleJSON.cs
Normal file
1317
Assets/Plugins/SimpleJSON.cs
Normal file
File diff suppressed because it is too large
Load diff
11
Assets/Plugins/SimpleJSON.cs.meta
Normal file
11
Assets/Plugins/SimpleJSON.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 13180a8ebaa9dba4f8e4950ae8920385
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
301
Assets/Plugins/SimpleJSONBinary.cs
Normal file
301
Assets/Plugins/SimpleJSONBinary.cs
Normal file
|
@ -0,0 +1,301 @@
|
||||||
|
//#define USE_SharpZipLib
|
||||||
|
/* * * * *
|
||||||
|
* This is an extension of the SimpleJSON framework to provide methods to
|
||||||
|
* serialize a JSON object tree into a compact binary format. Optionally the
|
||||||
|
* binary stream can be compressed with the SharpZipLib when using the define
|
||||||
|
* "USE_SharpZipLib"
|
||||||
|
*
|
||||||
|
* Those methods where originally part of the framework but since it's rarely
|
||||||
|
* used I've extracted this part into this seperate module file.
|
||||||
|
*
|
||||||
|
* You can use the define "SimpleJSON_ExcludeBinary" to selectively disable
|
||||||
|
* this extension without the need to remove the file from the project.
|
||||||
|
*
|
||||||
|
* If you want to use compression when saving to file / stream / B64 you have to include
|
||||||
|
* SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) in your project and
|
||||||
|
* define "USE_SharpZipLib" at the top of the file
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2017 Markus Göbel (Bunny83)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* * * * */
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SimpleJSON
|
||||||
|
{
|
||||||
|
#if !SimpleJSON_ExcludeBinary
|
||||||
|
public abstract partial class JSONNode
|
||||||
|
{
|
||||||
|
public abstract void SerializeBinary(System.IO.BinaryWriter aWriter);
|
||||||
|
|
||||||
|
public void SaveToBinaryStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
var W = new System.IO.BinaryWriter(aData);
|
||||||
|
SerializeBinary(W);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if USE_SharpZipLib
|
||||||
|
public void SaveToCompressedStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData))
|
||||||
|
{
|
||||||
|
gzipOut.IsStreamOwner = false;
|
||||||
|
SaveToBinaryStream(gzipOut);
|
||||||
|
gzipOut.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveToCompressedFile(string aFileName)
|
||||||
|
{
|
||||||
|
|
||||||
|
System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName);
|
||||||
|
using(var F = System.IO.File.OpenWrite(aFileName))
|
||||||
|
{
|
||||||
|
SaveToCompressedStream(F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string SaveToCompressedBase64()
|
||||||
|
{
|
||||||
|
using (var stream = new System.IO.MemoryStream())
|
||||||
|
{
|
||||||
|
SaveToCompressedStream(stream);
|
||||||
|
stream.Position = 0;
|
||||||
|
return System.Convert.ToBase64String(stream.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
public void SaveToCompressedStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveToCompressedFile(string aFileName)
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SaveToCompressedBase64()
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public void SaveToBinaryFile(string aFileName)
|
||||||
|
{
|
||||||
|
System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName);
|
||||||
|
using (var F = System.IO.File.OpenWrite(aFileName))
|
||||||
|
{
|
||||||
|
SaveToBinaryStream(F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SaveToBinaryBase64()
|
||||||
|
{
|
||||||
|
using (var stream = new System.IO.MemoryStream())
|
||||||
|
{
|
||||||
|
SaveToBinaryStream(stream);
|
||||||
|
stream.Position = 0;
|
||||||
|
return System.Convert.ToBase64String(stream.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONNode DeserializeBinary(System.IO.BinaryReader aReader)
|
||||||
|
{
|
||||||
|
JSONNodeType type = (JSONNodeType)aReader.ReadByte();
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case JSONNodeType.Array:
|
||||||
|
{
|
||||||
|
int count = aReader.ReadInt32();
|
||||||
|
JSONArray tmp = new JSONArray();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
tmp.Add(DeserializeBinary(aReader));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
case JSONNodeType.Object:
|
||||||
|
{
|
||||||
|
int count = aReader.ReadInt32();
|
||||||
|
JSONObject tmp = new JSONObject();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
string key = aReader.ReadString();
|
||||||
|
var val = DeserializeBinary(aReader);
|
||||||
|
tmp.Add(key, val);
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
case JSONNodeType.String:
|
||||||
|
{
|
||||||
|
return new JSONString(aReader.ReadString());
|
||||||
|
}
|
||||||
|
case JSONNodeType.Number:
|
||||||
|
{
|
||||||
|
return new JSONNumber(aReader.ReadDouble());
|
||||||
|
}
|
||||||
|
case JSONNodeType.Boolean:
|
||||||
|
{
|
||||||
|
return new JSONBool(aReader.ReadBoolean());
|
||||||
|
}
|
||||||
|
case JSONNodeType.NullValue:
|
||||||
|
{
|
||||||
|
return JSONNull.CreateOrGet();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
throw new Exception("Error deserializing JSON. Unknown tag: " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if USE_SharpZipLib
|
||||||
|
public static JSONNode LoadFromCompressedStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData);
|
||||||
|
return LoadFromBinaryStream(zin);
|
||||||
|
}
|
||||||
|
public static JSONNode LoadFromCompressedFile(string aFileName)
|
||||||
|
{
|
||||||
|
using(var F = System.IO.File.OpenRead(aFileName))
|
||||||
|
{
|
||||||
|
return LoadFromCompressedStream(F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static JSONNode LoadFromCompressedBase64(string aBase64)
|
||||||
|
{
|
||||||
|
var tmp = System.Convert.FromBase64String(aBase64);
|
||||||
|
var stream = new System.IO.MemoryStream(tmp);
|
||||||
|
stream.Position = 0;
|
||||||
|
return LoadFromCompressedStream(stream);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
public static JSONNode LoadFromCompressedFile(string aFileName)
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONNode LoadFromCompressedStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONNode LoadFromCompressedBase64(string aBase64)
|
||||||
|
{
|
||||||
|
throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public static JSONNode LoadFromBinaryStream(System.IO.Stream aData)
|
||||||
|
{
|
||||||
|
using (var R = new System.IO.BinaryReader(aData))
|
||||||
|
{
|
||||||
|
return DeserializeBinary(R);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONNode LoadFromBinaryFile(string aFileName)
|
||||||
|
{
|
||||||
|
using (var F = System.IO.File.OpenRead(aFileName))
|
||||||
|
{
|
||||||
|
return LoadFromBinaryStream(F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONNode LoadFromBinaryBase64(string aBase64)
|
||||||
|
{
|
||||||
|
var tmp = System.Convert.FromBase64String(aBase64);
|
||||||
|
var stream = new System.IO.MemoryStream(tmp);
|
||||||
|
stream.Position = 0;
|
||||||
|
return LoadFromBinaryStream(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class JSONArray : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.Array);
|
||||||
|
aWriter.Write(m_List.Count);
|
||||||
|
for (int i = 0; i < m_List.Count; i++)
|
||||||
|
{
|
||||||
|
m_List[i].SerializeBinary(aWriter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class JSONObject : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.Object);
|
||||||
|
aWriter.Write(m_Dict.Count);
|
||||||
|
foreach (string K in m_Dict.Keys)
|
||||||
|
{
|
||||||
|
aWriter.Write(K);
|
||||||
|
m_Dict[K].SerializeBinary(aWriter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class JSONString : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.String);
|
||||||
|
aWriter.Write(m_Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class JSONNumber : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.Number);
|
||||||
|
aWriter.Write(m_Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class JSONBool : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.Boolean);
|
||||||
|
aWriter.Write(m_Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public partial class JSONNull : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
aWriter.Write((byte)JSONNodeType.NullValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal partial class JSONLazyCreator : JSONNode
|
||||||
|
{
|
||||||
|
public override void SerializeBinary(System.IO.BinaryWriter aWriter)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
11
Assets/Plugins/SimpleJSONBinary.cs.meta
Normal file
11
Assets/Plugins/SimpleJSONBinary.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 739df7dcad852b2469ca1d80b2e36a1e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
369
Assets/Plugins/SimpleJSONUnity.cs
Normal file
369
Assets/Plugins/SimpleJSONUnity.cs
Normal file
|
@ -0,0 +1,369 @@
|
||||||
|
#region License and information
|
||||||
|
/* * * * *
|
||||||
|
*
|
||||||
|
* Unity extension for the SimpleJSON framework. It does only work together with
|
||||||
|
* the SimpleJSON.cs
|
||||||
|
* It provides several helpers and conversion operators to serialize/deserialize
|
||||||
|
* common Unity types such as Vector2/3/4, Rect, RectOffset, Quaternion and
|
||||||
|
* Matrix4x4 as JSONObject or JSONArray.
|
||||||
|
* This extension will add 3 static settings to the JSONNode class:
|
||||||
|
* ( VectorContainerType, QuaternionContainerType, RectContainerType ) which
|
||||||
|
* control what node type should be used for serializing the given type. So a
|
||||||
|
* Vector3 as array would look like [12,32,24] and {"x":12, "y":32, "z":24} as
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2017 Markus Göbel (Bunny83)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* * * * */
|
||||||
|
|
||||||
|
#endregion License and information
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace SimpleJSON
|
||||||
|
{
|
||||||
|
public enum JSONContainerType { Array, Object }
|
||||||
|
public partial class JSONNode
|
||||||
|
{
|
||||||
|
public static JSONContainerType VectorContainerType = JSONContainerType.Array;
|
||||||
|
public static JSONContainerType QuaternionContainerType = JSONContainerType.Array;
|
||||||
|
public static JSONContainerType RectContainerType = JSONContainerType.Array;
|
||||||
|
private static JSONNode GetContainer(JSONContainerType aType)
|
||||||
|
{
|
||||||
|
if (aType == JSONContainerType.Array)
|
||||||
|
return new JSONArray();
|
||||||
|
return new JSONObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region implicit conversion operators
|
||||||
|
public static implicit operator JSONNode(Vector2 aVec)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(VectorContainerType);
|
||||||
|
n.WriteVector2(aVec);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
public static implicit operator JSONNode(Vector3 aVec)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(VectorContainerType);
|
||||||
|
n.WriteVector3(aVec);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
public static implicit operator JSONNode(Vector4 aVec)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(VectorContainerType);
|
||||||
|
n.WriteVector4(aVec);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
public static implicit operator JSONNode(Quaternion aRot)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(QuaternionContainerType);
|
||||||
|
n.WriteQuaternion(aRot);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
public static implicit operator JSONNode(Rect aRect)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(RectContainerType);
|
||||||
|
n.WriteRect(aRect);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
public static implicit operator JSONNode(RectOffset aRect)
|
||||||
|
{
|
||||||
|
JSONNode n = GetContainer(RectContainerType);
|
||||||
|
n.WriteRectOffset(aRect);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Vector2(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadVector2();
|
||||||
|
}
|
||||||
|
public static implicit operator Vector3(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadVector3();
|
||||||
|
}
|
||||||
|
public static implicit operator Vector4(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadVector4();
|
||||||
|
}
|
||||||
|
public static implicit operator Quaternion(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadQuaternion();
|
||||||
|
}
|
||||||
|
public static implicit operator Rect(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadRect();
|
||||||
|
}
|
||||||
|
public static implicit operator RectOffset(JSONNode aNode)
|
||||||
|
{
|
||||||
|
return aNode.ReadRectOffset();
|
||||||
|
}
|
||||||
|
#endregion implicit conversion operators
|
||||||
|
|
||||||
|
#region Vector2
|
||||||
|
public Vector2 ReadVector2(Vector2 aDefault)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Vector2(this["x"].AsFloat, this["y"].AsFloat);
|
||||||
|
if (IsArray)
|
||||||
|
return new Vector2(this[0].AsFloat, this[1].AsFloat);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public Vector2 ReadVector2(string aXName, string aYName)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
return new Vector2(this[aXName].AsFloat, this[aYName].AsFloat);
|
||||||
|
}
|
||||||
|
return Vector2.zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2 ReadVector2()
|
||||||
|
{
|
||||||
|
return ReadVector2(Vector2.zero);
|
||||||
|
}
|
||||||
|
public JSONNode WriteVector2(Vector2 aVec, string aXName = "x", string aYName = "y")
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[aXName].AsFloat = aVec.x;
|
||||||
|
this[aYName].AsFloat = aVec.y;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsFloat = aVec.x;
|
||||||
|
this[1].AsFloat = aVec.y;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Vector2
|
||||||
|
|
||||||
|
#region Vector3
|
||||||
|
public Vector3 ReadVector3(Vector3 aDefault)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Vector3(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat);
|
||||||
|
if (IsArray)
|
||||||
|
return new Vector3(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public Vector3 ReadVector3(string aXName, string aYName, string aZName)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Vector3(this[aXName].AsFloat, this[aYName].AsFloat, this[aZName].AsFloat);
|
||||||
|
return Vector3.zero;
|
||||||
|
}
|
||||||
|
public Vector3 ReadVector3()
|
||||||
|
{
|
||||||
|
return ReadVector3(Vector3.zero);
|
||||||
|
}
|
||||||
|
public JSONNode WriteVector3(Vector3 aVec, string aXName = "x", string aYName = "y", string aZName = "z")
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[aXName].AsFloat = aVec.x;
|
||||||
|
this[aYName].AsFloat = aVec.y;
|
||||||
|
this[aZName].AsFloat = aVec.z;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsFloat = aVec.x;
|
||||||
|
this[1].AsFloat = aVec.y;
|
||||||
|
this[2].AsFloat = aVec.z;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Vector3
|
||||||
|
|
||||||
|
#region Vector4
|
||||||
|
public Vector4 ReadVector4(Vector4 aDefault)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Vector4(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat);
|
||||||
|
if (IsArray)
|
||||||
|
return new Vector4(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public Vector4 ReadVector4()
|
||||||
|
{
|
||||||
|
return ReadVector4(Vector4.zero);
|
||||||
|
}
|
||||||
|
public JSONNode WriteVector4(Vector4 aVec)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this["x"].AsFloat = aVec.x;
|
||||||
|
this["y"].AsFloat = aVec.y;
|
||||||
|
this["z"].AsFloat = aVec.z;
|
||||||
|
this["w"].AsFloat = aVec.w;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsFloat = aVec.x;
|
||||||
|
this[1].AsFloat = aVec.y;
|
||||||
|
this[2].AsFloat = aVec.z;
|
||||||
|
this[3].AsFloat = aVec.w;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Vector4
|
||||||
|
|
||||||
|
#region Quaternion
|
||||||
|
public Quaternion ReadQuaternion(Quaternion aDefault)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Quaternion(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat);
|
||||||
|
if (IsArray)
|
||||||
|
return new Quaternion(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public Quaternion ReadQuaternion()
|
||||||
|
{
|
||||||
|
return ReadQuaternion(Quaternion.identity);
|
||||||
|
}
|
||||||
|
public JSONNode WriteQuaternion(Quaternion aRot)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this["x"].AsFloat = aRot.x;
|
||||||
|
this["y"].AsFloat = aRot.y;
|
||||||
|
this["z"].AsFloat = aRot.z;
|
||||||
|
this["w"].AsFloat = aRot.w;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsFloat = aRot.x;
|
||||||
|
this[1].AsFloat = aRot.y;
|
||||||
|
this[2].AsFloat = aRot.z;
|
||||||
|
this[3].AsFloat = aRot.w;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Quaternion
|
||||||
|
|
||||||
|
#region Rect
|
||||||
|
public Rect ReadRect(Rect aDefault)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
return new Rect(this["x"].AsFloat, this["y"].AsFloat, this["width"].AsFloat, this["height"].AsFloat);
|
||||||
|
if (IsArray)
|
||||||
|
return new Rect(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public Rect ReadRect()
|
||||||
|
{
|
||||||
|
return ReadRect(new Rect());
|
||||||
|
}
|
||||||
|
public JSONNode WriteRect(Rect aRect)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this["x"].AsFloat = aRect.x;
|
||||||
|
this["y"].AsFloat = aRect.y;
|
||||||
|
this["width"].AsFloat = aRect.width;
|
||||||
|
this["height"].AsFloat = aRect.height;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsFloat = aRect.x;
|
||||||
|
this[1].AsFloat = aRect.y;
|
||||||
|
this[2].AsFloat = aRect.width;
|
||||||
|
this[3].AsFloat = aRect.height;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Rect
|
||||||
|
|
||||||
|
#region RectOffset
|
||||||
|
public RectOffset ReadRectOffset(RectOffset aDefault)
|
||||||
|
{
|
||||||
|
if (this is JSONObject)
|
||||||
|
return new RectOffset(this["left"].AsInt, this["right"].AsInt, this["top"].AsInt, this["bottom"].AsInt);
|
||||||
|
if (this is JSONArray)
|
||||||
|
return new RectOffset(this[0].AsInt, this[1].AsInt, this[2].AsInt, this[3].AsInt);
|
||||||
|
return aDefault;
|
||||||
|
}
|
||||||
|
public RectOffset ReadRectOffset()
|
||||||
|
{
|
||||||
|
return ReadRectOffset(new RectOffset());
|
||||||
|
}
|
||||||
|
public JSONNode WriteRectOffset(RectOffset aRect)
|
||||||
|
{
|
||||||
|
if (IsObject)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this["left"].AsInt = aRect.left;
|
||||||
|
this["right"].AsInt = aRect.right;
|
||||||
|
this["top"].AsInt = aRect.top;
|
||||||
|
this["bottom"].AsInt = aRect.bottom;
|
||||||
|
}
|
||||||
|
else if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
this[0].AsInt = aRect.left;
|
||||||
|
this[1].AsInt = aRect.right;
|
||||||
|
this[2].AsInt = aRect.top;
|
||||||
|
this[3].AsInt = aRect.bottom;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion RectOffset
|
||||||
|
|
||||||
|
#region Matrix4x4
|
||||||
|
public Matrix4x4 ReadMatrix()
|
||||||
|
{
|
||||||
|
Matrix4x4 result = Matrix4x4.identity;
|
||||||
|
if (IsArray)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
result[i] = this[i].AsFloat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public JSONNode WriteMatrix(Matrix4x4 aMatrix)
|
||||||
|
{
|
||||||
|
if (IsArray)
|
||||||
|
{
|
||||||
|
Inline = true;
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
this[i].AsFloat = aMatrix[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
#endregion Matrix4x4
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Plugins/SimpleJSONUnity.cs.meta
Normal file
11
Assets/Plugins/SimpleJSONUnity.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2661a71996161a247aaea5b3fa900cca
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -198,8 +198,13 @@ MonoBehaviour:
|
||||||
twistCursor: {x: 0, y: 0, z: 0}
|
twistCursor: {x: 0, y: 0, z: 0}
|
||||||
stretchCursor: {x: 0, y: 0, z: 0}
|
stretchCursor: {x: 0, y: 0, z: 0}
|
||||||
pixelgon:
|
pixelgon:
|
||||||
vectors: []
|
vectors:
|
||||||
quads:
|
- {x: 0, y: 0, z: 0}
|
||||||
|
- {x: -0.3, y: -0.3, z: 0}
|
||||||
|
- {x: -0.3, y: 0.3, z: 0}
|
||||||
|
- {x: 0.3, y: -0.43, z: 0}
|
||||||
|
- {x: 0, y: 0, z: 0}
|
||||||
|
quads: 010000000200000003000000
|
||||||
assetSpace:
|
assetSpace:
|
||||||
folderPath: C:/dofdev/Pixelgon/Assets/AssetSpace
|
folderPath: C:/dofdev/Pixelgon/Assets/AssetSpace
|
||||||
name: draft
|
name: draft
|
||||||
|
@ -218,8 +223,6 @@ MonoBehaviour:
|
||||||
cursorPos: {x: 0, y: 0, z: 0}
|
cursorPos: {x: 0, y: 0, z: 0}
|
||||||
indexQuad: 0
|
indexQuad: 0
|
||||||
quad:
|
quad:
|
||||||
tris:
|
|
||||||
uvs: []
|
|
||||||
toolEraser:
|
toolEraser:
|
||||||
cursorPos: {x: 0, y: 0, z: 0}
|
cursorPos: {x: 0, y: 0, z: 0}
|
||||||
selected:
|
selected:
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SerializableTypes;
|
using SimpleJSON;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AssetSpace
|
public class AssetSpace
|
||||||
|
@ -124,45 +123,59 @@ public class AssetSpace
|
||||||
|
|
||||||
public void Save(Pixelgon pixelgon)
|
public void Save(Pixelgon pixelgon)
|
||||||
{
|
{
|
||||||
string destination = folderPath + "/" + name + ".pixelgon";
|
// Cleanup Empty Vectors and re-index quads
|
||||||
FileStream file;
|
int dup = 0;
|
||||||
|
for (int i = pixelgon.vectors.Count - 1; i >= 0; i--)
|
||||||
if (File.Exists(destination)) file = File.OpenWrite(destination);
|
|
||||||
else file = File.Create(destination);
|
|
||||||
|
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
|
||||||
FPixelgon fPixelgon = new FPixelgon();
|
|
||||||
fPixelgon.vectors = new SVector3[pixelgon.vectors.Count];
|
|
||||||
for (int i = 0; i < pixelgon.vectors.Count; i++)
|
|
||||||
{
|
{
|
||||||
SVector3 vec3 = pixelgon.vectors[i];
|
if (pixelgon.vectors[i] == Vector3.zero)
|
||||||
fPixelgon.vectors[i] = vec3;
|
{
|
||||||
|
if (dup++ > 0)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < pixelgon.quads.Count; j++)
|
||||||
|
{
|
||||||
|
if (pixelgon.quads[j] >= i)
|
||||||
|
{
|
||||||
|
pixelgon.quads[j]--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pixelgon.vectors.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dup = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bf.Serialize(file, fPixelgon);
|
|
||||||
file.Close();
|
string destination = folderPath + "/" + name + ".json";
|
||||||
|
File.WriteAllText(destination, JsonUtility.ToJson(pixelgon));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pixelgon Load()
|
public Pixelgon Load()
|
||||||
{
|
{
|
||||||
string destination = folderPath + "/" + name + ".pixelgon";
|
string destination = folderPath + "/" + name + ".json";
|
||||||
FileStream file;
|
if (!File.Exists(destination))
|
||||||
|
|
||||||
if (File.Exists(destination)) file = File.OpenRead(destination);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Debug.LogError("File not found");
|
Debug.LogError("File not found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
JSONNode N = JSON.Parse(File.ReadAllText(destination));
|
||||||
FPixelgon fPixelgon = (FPixelgon)bf.Deserialize(file);
|
|
||||||
Pixelgon pixelgon = new Pixelgon();
|
Pixelgon pixelgon = new Pixelgon();
|
||||||
for (int i = 0; i < fPixelgon.vectors.Length; i++)
|
pixelgon.vectors.Clear();
|
||||||
|
for (int i = 0; i < N["vectors"].Count; i++)
|
||||||
{
|
{
|
||||||
Vector3 vec3 = fPixelgon.vectors[i];
|
pixelgon.vectors.Add(
|
||||||
pixelgon.vectors.Add(vec3);
|
new Vector3(N["vectors"][i][0].AsFloat, N["vectors"][i][1].AsFloat, N["vectors"][i][2].AsFloat)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
pixelgon.quads.Clear();
|
||||||
|
for (int i = 0; i < N["quads"].Count; i++)
|
||||||
|
{
|
||||||
|
pixelgon.quads.Add(N["quads"][i].AsInt);
|
||||||
}
|
}
|
||||||
file.Close();
|
|
||||||
return pixelgon;
|
return pixelgon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,125 +186,4 @@ public class Asset
|
||||||
public Mesh mesh;
|
public Mesh mesh;
|
||||||
public Vector3 pos;
|
public Vector3 pos;
|
||||||
public Quaternion rot;
|
public Quaternion rot;
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public class FAssetSpace
|
|
||||||
{
|
|
||||||
// public class Placement
|
|
||||||
// {
|
|
||||||
// public SerializableVector3 pos
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public class FPixelgon
|
|
||||||
{
|
|
||||||
public SVector3[] vectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace SerializableTypes
|
|
||||||
{
|
|
||||||
/// <summary> Serializable version of UnityEngine.Vector3. </summary>
|
|
||||||
[Serializable]
|
|
||||||
public struct SVector3
|
|
||||||
{
|
|
||||||
public float x;
|
|
||||||
public float y;
|
|
||||||
public float z;
|
|
||||||
|
|
||||||
public SVector3(float x, float y, float z)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> $"[x, y, z]";
|
|
||||||
|
|
||||||
public static implicit operator Vector3(SVector3 s)
|
|
||||||
=> new Vector3(s.x, s.y, s.z);
|
|
||||||
|
|
||||||
public static implicit operator SVector3(Vector3 v)
|
|
||||||
=> new SVector3(v.x, v.y, v.z);
|
|
||||||
|
|
||||||
|
|
||||||
public static SVector3 operator +(SVector3 a, SVector3 b)
|
|
||||||
=> new SVector3(a.x + b.x, a.y + b.y, a.z + b.z);
|
|
||||||
|
|
||||||
public static SVector3 operator -(SVector3 a, SVector3 b)
|
|
||||||
=> new SVector3(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
||||||
|
|
||||||
public static SVector3 operator -(SVector3 a)
|
|
||||||
=> new SVector3(-a.x, -a.y, -a.z);
|
|
||||||
|
|
||||||
public static SVector3 operator *(SVector3 a, float m)
|
|
||||||
=> new SVector3(a.x * m, a.y * m, a.z * m);
|
|
||||||
|
|
||||||
public static SVector3 operator *(float m, SVector3 a)
|
|
||||||
=> new SVector3(a.x * m, a.y * m, a.z * m);
|
|
||||||
|
|
||||||
public static SVector3 operator /(SVector3 a, float d)
|
|
||||||
=> new SVector3(a.x / d, a.y / d, a.z / d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Serializable version of UnityEngine.Quaternion. </summary>
|
|
||||||
[Serializable]
|
|
||||||
public struct SQuaternion
|
|
||||||
{
|
|
||||||
public float x;
|
|
||||||
public float y;
|
|
||||||
public float z;
|
|
||||||
public float w;
|
|
||||||
|
|
||||||
public SQuaternion(float x, float y, float z, float w)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.w = w;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> $"[{x}, {y}, {z}, {w}]";
|
|
||||||
|
|
||||||
public static implicit operator Quaternion(SQuaternion s)
|
|
||||||
=> new Quaternion(s.x, s.y, s.z, s.w);
|
|
||||||
|
|
||||||
public static implicit operator SQuaternion(Quaternion q)
|
|
||||||
=> new SQuaternion(q.x, q.y, q.z, q.w);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Serializable version of UnityEngine.Color32 without transparency. </summary>
|
|
||||||
[Serializable]
|
|
||||||
public struct SColor32
|
|
||||||
{
|
|
||||||
public byte r;
|
|
||||||
public byte g;
|
|
||||||
public byte b;
|
|
||||||
|
|
||||||
public SColor32(byte r, byte g, byte b)
|
|
||||||
{
|
|
||||||
this.r = r;
|
|
||||||
this.g = g;
|
|
||||||
this.b = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SColor32(Color32 c)
|
|
||||||
{
|
|
||||||
r = c.r;
|
|
||||||
g = c.g;
|
|
||||||
b = c.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> $"[{r}, {g}, {b}]";
|
|
||||||
|
|
||||||
public static implicit operator Color32(SColor32 rValue)
|
|
||||||
=> new Color32(rValue.r, rValue.g, rValue.b, a: byte.MaxValue);
|
|
||||||
|
|
||||||
public static implicit operator SColor32(Color32 rValue)
|
|
||||||
=> new SColor32(rValue.r, rValue.g, rValue.b);
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue