mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f44d6260ab
@ -1,533 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Calvin Rien
|
||||
*
|
||||
* Based on the JSON parser by Patrick van Bergen
|
||||
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
|
||||
*
|
||||
* Simplified it so that it doesn't throw exceptions
|
||||
* and can be used in Unity iPhone with maximum code stripping.
|
||||
*
|
||||
* 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;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Spine {
|
||||
// Example usage:
|
||||
//
|
||||
// using UnityEngine;
|
||||
// using System.Collections;
|
||||
// using System.Collections.Generic;
|
||||
// using MiniJSON;
|
||||
//
|
||||
// public class MiniJSONTest : MonoBehaviour {
|
||||
// void Start () {
|
||||
// var jsonString = "{ \"array\": [1.44,2,3], " +
|
||||
// "\"object\": {\"key1\":\"value1\", \"key2\":256}, " +
|
||||
// "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " +
|
||||
// "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " +
|
||||
// "\"int\": 65536, " +
|
||||
// "\"float\": 3.1415926, " +
|
||||
// "\"bool\": true, " +
|
||||
// "\"null\": null }";
|
||||
//
|
||||
// var dict = Json.Deserialize(jsonString) as Dictionary<string,object>;
|
||||
//
|
||||
// Debug.Log("deserialized: " + dict.GetType());
|
||||
// Debug.Log("dict['array'][0]: " + ((List<object>) dict["array"])[0]);
|
||||
// Debug.Log("dict['string']: " + (string) dict["string"]);
|
||||
// Debug.Log("dict['float']: " + (float) dict["float"]);
|
||||
// Debug.Log("dict['int']: " + (long) dict["int"]); // ints come out as longs
|
||||
// Debug.Log("dict['unicode']: " + (string) dict["unicode"]);
|
||||
//
|
||||
// var str = Json.Serialize(dict);
|
||||
//
|
||||
// Debug.Log("serialized: " + str);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// This class encodes and decodes JSON strings.
|
||||
/// Spec. details, see http://www.json.org/
|
||||
///
|
||||
/// JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary.
|
||||
/// All numbers are parsed to floats.
|
||||
/// </summary>
|
||||
public static class Json {
|
||||
/// <summary>
|
||||
/// Parses the string json into a value
|
||||
/// </summary>
|
||||
/// <param name="json">A JSON string.</param>
|
||||
/// <returns>An List<object>, a Dictionary<string, object>, a float, an integer,a string, null, true, or false</returns>
|
||||
public static object Deserialize (TextReader json) {
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
return Parser.Parse(json);
|
||||
|
||||
static readonly SharpJson.JsonDecoder parser;
|
||||
|
||||
static Json () {
|
||||
parser = new SharpJson.JsonDecoder();
|
||||
parser.parseNumbersAsFloat = true;
|
||||
}
|
||||
|
||||
sealed class Parser : IDisposable {
|
||||
const string WHITE_SPACE = " \t\n\r";
|
||||
const string WORD_BREAK = " \t\n\r{}[],:\"";
|
||||
|
||||
enum TOKEN {
|
||||
NONE,
|
||||
CURLY_OPEN,
|
||||
CURLY_CLOSE,
|
||||
SQUARED_OPEN,
|
||||
SQUARED_CLOSE,
|
||||
COLON,
|
||||
COMMA,
|
||||
STRING,
|
||||
NUMBER,
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL
|
||||
};
|
||||
|
||||
TextReader json;
|
||||
|
||||
Parser (TextReader reader) {
|
||||
json = reader;
|
||||
}
|
||||
|
||||
public static object Parse (TextReader reader) {
|
||||
using (var instance = new Parser(reader)) {
|
||||
return instance.ParseValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose () {
|
||||
json.Dispose();
|
||||
json = null;
|
||||
}
|
||||
|
||||
Dictionary<string, object> ParseObject () {
|
||||
Dictionary<string, object> table = new Dictionary<string, object>();
|
||||
|
||||
// ditch opening brace
|
||||
json.Read();
|
||||
|
||||
// {
|
||||
while (true) {
|
||||
switch (NextToken) {
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.CURLY_CLOSE:
|
||||
return table;
|
||||
default:
|
||||
// name
|
||||
string name = ParseString();
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// :
|
||||
if (NextToken != TOKEN.COLON) {
|
||||
return null;
|
||||
}
|
||||
// ditch the colon
|
||||
json.Read();
|
||||
|
||||
// value
|
||||
table[name] = ParseValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<object> ParseArray () {
|
||||
List<object> array = new List<object>();
|
||||
|
||||
// ditch opening bracket
|
||||
json.Read();
|
||||
|
||||
// [
|
||||
var parsing = true;
|
||||
while (parsing) {
|
||||
TOKEN nextToken = NextToken;
|
||||
|
||||
switch (nextToken) {
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.SQUARED_CLOSE:
|
||||
parsing = false;
|
||||
break;
|
||||
default:
|
||||
object value = ParseByToken(nextToken);
|
||||
|
||||
array.Add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
object ParseValue () {
|
||||
TOKEN nextToken = NextToken;
|
||||
return ParseByToken(nextToken);
|
||||
}
|
||||
|
||||
object ParseByToken (TOKEN token) {
|
||||
switch (token) {
|
||||
case TOKEN.STRING:
|
||||
return ParseString();
|
||||
case TOKEN.NUMBER:
|
||||
return ParseNumber();
|
||||
case TOKEN.CURLY_OPEN:
|
||||
return ParseObject();
|
||||
case TOKEN.SQUARED_OPEN:
|
||||
return ParseArray();
|
||||
case TOKEN.TRUE:
|
||||
return true;
|
||||
case TOKEN.FALSE:
|
||||
return false;
|
||||
case TOKEN.NULL:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
string ParseString () {
|
||||
StringBuilder s = new StringBuilder();
|
||||
char c;
|
||||
|
||||
// ditch opening quote
|
||||
json.Read();
|
||||
|
||||
bool parsing = true;
|
||||
while (parsing) {
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c) {
|
||||
case '"':
|
||||
parsing = false;
|
||||
break;
|
||||
case '\\':
|
||||
if (json.Peek() == -1) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c) {
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
s.Append(c);
|
||||
break;
|
||||
case 'b':
|
||||
s.Append('\b');
|
||||
break;
|
||||
case 'f':
|
||||
s.Append('\f');
|
||||
break;
|
||||
case 'n':
|
||||
s.Append('\n');
|
||||
break;
|
||||
case 'r':
|
||||
s.Append('\r');
|
||||
break;
|
||||
case 't':
|
||||
s.Append('\t');
|
||||
break;
|
||||
case 'u':
|
||||
var hex = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
hex.Append(NextChar);
|
||||
}
|
||||
|
||||
s.Append((char)Convert.ToInt32(hex.ToString(), 16));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s.Append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
object ParseNumber () {
|
||||
string number = NextWord;
|
||||
float parsedFloat;
|
||||
float.TryParse(number, NumberStyles.Float, CultureInfo.InvariantCulture, out parsedFloat);
|
||||
return parsedFloat;
|
||||
}
|
||||
|
||||
void EatWhitespace () {
|
||||
while (WHITE_SPACE.IndexOf(PeekChar) != -1) {
|
||||
json.Read();
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char PeekChar {
|
||||
get {
|
||||
return Convert.ToChar(json.Peek());
|
||||
}
|
||||
}
|
||||
|
||||
char NextChar {
|
||||
get {
|
||||
return Convert.ToChar(json.Read());
|
||||
}
|
||||
}
|
||||
|
||||
string NextWord {
|
||||
get {
|
||||
StringBuilder word = new StringBuilder();
|
||||
|
||||
while (WORD_BREAK.IndexOf(PeekChar) == -1) {
|
||||
word.Append(NextChar);
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return word.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
TOKEN NextToken {
|
||||
get {
|
||||
EatWhitespace();
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
|
||||
char c = PeekChar;
|
||||
switch (c) {
|
||||
case '{':
|
||||
return TOKEN.CURLY_OPEN;
|
||||
case '}':
|
||||
json.Read();
|
||||
return TOKEN.CURLY_CLOSE;
|
||||
case '[':
|
||||
return TOKEN.SQUARED_OPEN;
|
||||
case ']':
|
||||
json.Read();
|
||||
return TOKEN.SQUARED_CLOSE;
|
||||
case ',':
|
||||
json.Read();
|
||||
return TOKEN.COMMA;
|
||||
case '"':
|
||||
return TOKEN.STRING;
|
||||
case ':':
|
||||
return TOKEN.COLON;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
return TOKEN.NUMBER;
|
||||
}
|
||||
|
||||
string word = NextWord;
|
||||
|
||||
switch (word) {
|
||||
case "false":
|
||||
return TOKEN.FALSE;
|
||||
case "true":
|
||||
return TOKEN.TRUE;
|
||||
case "null":
|
||||
return TOKEN.NULL;
|
||||
}
|
||||
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
|
||||
/// </summary>
|
||||
/// <param name="json">A Dictionary<string, object> / List<object></param>
|
||||
/// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
|
||||
public static string Serialize (object obj) {
|
||||
return Serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
sealed class Serializer {
|
||||
StringBuilder builder;
|
||||
|
||||
Serializer () {
|
||||
builder = new StringBuilder();
|
||||
}
|
||||
|
||||
public static string Serialize (object obj) {
|
||||
var instance = new Serializer();
|
||||
|
||||
instance.SerializeValue(obj);
|
||||
|
||||
return instance.builder.ToString();
|
||||
}
|
||||
|
||||
void SerializeValue (object value) {
|
||||
IList asList;
|
||||
IDictionary asDict;
|
||||
string asStr;
|
||||
|
||||
if (value == null) {
|
||||
builder.Append("null");
|
||||
} else if ((asStr = value as string) != null) {
|
||||
SerializeString(asStr);
|
||||
} else if (value is bool) {
|
||||
builder.Append(value.ToString().ToLower());
|
||||
} else if ((asList = value as IList) != null) {
|
||||
SerializeArray(asList);
|
||||
} else if ((asDict = value as IDictionary) != null) {
|
||||
SerializeObject(asDict);
|
||||
} else if (value is char) {
|
||||
SerializeString(value.ToString());
|
||||
} else {
|
||||
SerializeOther(value);
|
||||
}
|
||||
}
|
||||
|
||||
void SerializeObject (IDictionary obj) {
|
||||
bool first = true;
|
||||
|
||||
builder.Append('{');
|
||||
|
||||
foreach (object e in obj.Keys) {
|
||||
if (!first) {
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeString(e.ToString());
|
||||
builder.Append(':');
|
||||
|
||||
SerializeValue(obj[e]);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append('}');
|
||||
}
|
||||
|
||||
void SerializeArray (IList anArray) {
|
||||
builder.Append('[');
|
||||
|
||||
bool first = true;
|
||||
|
||||
foreach (object obj in anArray) {
|
||||
if (!first) {
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeValue(obj);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append(']');
|
||||
}
|
||||
|
||||
void SerializeString (string str) {
|
||||
builder.Append('\"');
|
||||
|
||||
char[] charArray = str.ToCharArray();
|
||||
foreach (var c in charArray) {
|
||||
switch (c) {
|
||||
case '"':
|
||||
builder.Append("\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
builder.Append("\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
builder.Append("\\b");
|
||||
break;
|
||||
case '\f':
|
||||
builder.Append("\\f");
|
||||
break;
|
||||
case '\n':
|
||||
builder.Append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.Append("\\r");
|
||||
break;
|
||||
case '\t':
|
||||
builder.Append("\\t");
|
||||
break;
|
||||
default:
|
||||
int codepoint = Convert.ToInt32(c);
|
||||
if ((codepoint >= 32) && (codepoint <= 126)) {
|
||||
builder.Append(c);
|
||||
} else {
|
||||
builder.Append("\\u" + Convert.ToString(codepoint, 16).PadLeft(4, '0'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
builder.Append('\"');
|
||||
}
|
||||
|
||||
void SerializeOther (object value) {
|
||||
if (value is float
|
||||
|| value is int
|
||||
|| value is uint
|
||||
|| value is long
|
||||
|| value is float
|
||||
|| value is sbyte
|
||||
|| value is byte
|
||||
|| value is short
|
||||
|| value is ushort
|
||||
|| value is ulong
|
||||
|| value is decimal) {
|
||||
builder.Append(value.ToString());
|
||||
} else {
|
||||
SerializeString(value.ToString());
|
||||
}
|
||||
}
|
||||
public static object Deserialize (TextReader text) {
|
||||
return parser.Decode(text.ReadToEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,18 +32,18 @@
|
||||
using System;
|
||||
|
||||
namespace Spine {
|
||||
public class MathUtils {
|
||||
static public float PI = 3.1415927f;
|
||||
static public float radDeg = 180f / PI;
|
||||
static public float degRad = PI / 180;
|
||||
public static class MathUtils {
|
||||
public const float PI = 3.1415927f;
|
||||
public const float radDeg = 180f / PI;
|
||||
public const float degRad = PI / 180;
|
||||
|
||||
static private int SIN_BITS = 14; // 16KB. Adjust for accuracy.
|
||||
static private int SIN_MASK = ~(-1 << SIN_BITS);
|
||||
static private int SIN_COUNT = SIN_MASK + 1;
|
||||
static private float radFull = PI * 2;
|
||||
static private float degFull = 360;
|
||||
static private float radToIndex = SIN_COUNT / radFull;
|
||||
static private float degToIndex = SIN_COUNT / degFull;
|
||||
const int SIN_BITS = 14; // 16KB. Adjust for accuracy.
|
||||
const int SIN_MASK = ~(-1 << SIN_BITS);
|
||||
const int SIN_COUNT = SIN_MASK + 1;
|
||||
const float radFull = PI * 2;
|
||||
const float degFull = 360;
|
||||
const float radToIndex = SIN_COUNT / radFull;
|
||||
const float degToIndex = SIN_COUNT / degFull;
|
||||
static float[] sin = new float[SIN_COUNT];
|
||||
|
||||
static MathUtils () {
|
||||
|
||||
495
spine-csharp/src/SharpJson.cs
Normal file
495
spine-csharp/src/SharpJson.cs
Normal file
@ -0,0 +1,495 @@
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2016 Adriano Tinoco d'Oliveira Rezende
|
||||
*
|
||||
* Based on the JSON parser by Patrick van Bergen
|
||||
* http://techblog.procurios.nl/k/news/view/14605/14863/how-do-i-write-my-own-parser-(for-json).html
|
||||
*
|
||||
* Changes made:
|
||||
*
|
||||
* - Optimized parser speed (deserialize roughly near 3x faster than original)
|
||||
* - Added support to handle lexer/parser error messages with line numbers
|
||||
* - Added more fine grained control over type conversions during the parsing
|
||||
* - Refactory API (Separate Lexer code from Parser code and the Encoder from Decoder)
|
||||
*
|
||||
*
|
||||
* 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;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SharpJson
|
||||
{
|
||||
class Lexer
|
||||
{
|
||||
public enum Token {
|
||||
None,
|
||||
Null,
|
||||
True,
|
||||
False,
|
||||
Colon,
|
||||
Comma,
|
||||
String,
|
||||
Number,
|
||||
CurlyOpen,
|
||||
CurlyClose,
|
||||
SquaredOpen,
|
||||
SquaredClose,
|
||||
};
|
||||
|
||||
public bool hasError {
|
||||
get {
|
||||
return !success;
|
||||
}
|
||||
}
|
||||
|
||||
public int lineNumber {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool parseNumbersAsFloat {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
char[] json;
|
||||
int index = 0;
|
||||
bool success = true;
|
||||
char[] stringBuffer = new char[4096];
|
||||
|
||||
public Lexer(string text)
|
||||
{
|
||||
Reset();
|
||||
|
||||
json = text.ToCharArray();
|
||||
parseNumbersAsFloat = false;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
index = 0;
|
||||
lineNumber = 1;
|
||||
success = true;
|
||||
}
|
||||
|
||||
public string ParseString()
|
||||
{
|
||||
int idx = 0;
|
||||
StringBuilder builder = null;
|
||||
|
||||
SkipWhiteSpaces();
|
||||
|
||||
// "
|
||||
char c = json[index++];
|
||||
|
||||
bool failed = false;
|
||||
bool complete = false;
|
||||
|
||||
while (!complete && !failed) {
|
||||
if (index == json.Length)
|
||||
break;
|
||||
|
||||
c = json[index++];
|
||||
if (c == '"') {
|
||||
complete = true;
|
||||
break;
|
||||
} else if (c == '\\') {
|
||||
if (index == json.Length)
|
||||
break;
|
||||
|
||||
c = json[index++];
|
||||
|
||||
switch (c) {
|
||||
case '"':
|
||||
stringBuffer[idx++] = '"';
|
||||
break;
|
||||
case '\\':
|
||||
stringBuffer[idx++] = '\\';
|
||||
break;
|
||||
case '/':
|
||||
stringBuffer[idx++] = '/';
|
||||
break;
|
||||
case 'b':
|
||||
stringBuffer[idx++] = '\b';
|
||||
break;
|
||||
case'f':
|
||||
stringBuffer[idx++] = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
stringBuffer[idx++] = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
stringBuffer[idx++] = '\r';
|
||||
break;
|
||||
case 't':
|
||||
stringBuffer[idx++] = '\t';
|
||||
break;
|
||||
case 'u':
|
||||
int remainingLength = json.Length - index;
|
||||
if (remainingLength >= 4) {
|
||||
var hex = new string(json, index, 4);
|
||||
|
||||
// XXX: handle UTF
|
||||
stringBuffer[idx++] = (char) Convert.ToInt32(hex, 16);
|
||||
|
||||
// skip 4 chars
|
||||
index += 4;
|
||||
} else {
|
||||
failed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
stringBuffer[idx++] = c;
|
||||
}
|
||||
|
||||
if (idx >= stringBuffer.Length) {
|
||||
if (builder == null)
|
||||
builder = new StringBuilder();
|
||||
|
||||
builder.Append(stringBuffer, 0, idx);
|
||||
idx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!complete) {
|
||||
success = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (builder != null)
|
||||
return builder.ToString ();
|
||||
else
|
||||
return new string (stringBuffer, 0, idx);
|
||||
}
|
||||
|
||||
string GetNumberString()
|
||||
{
|
||||
SkipWhiteSpaces();
|
||||
|
||||
int lastIndex = GetLastIndexOfNumber(index);
|
||||
int charLength = (lastIndex - index) + 1;
|
||||
|
||||
var result = new string (json, index, charLength);
|
||||
|
||||
index = lastIndex + 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public float ParseFloatNumber()
|
||||
{
|
||||
float number;
|
||||
var str = GetNumberString ();
|
||||
|
||||
if (!float.TryParse (str, NumberStyles.Float, CultureInfo.InvariantCulture, out number))
|
||||
return 0;
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
public double ParseDoubleNumber()
|
||||
{
|
||||
double number;
|
||||
var str = GetNumberString ();
|
||||
|
||||
if (!double.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out number))
|
||||
return 0;
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
int GetLastIndexOfNumber(int index)
|
||||
{
|
||||
int lastIndex;
|
||||
|
||||
for (lastIndex = index; lastIndex < json.Length; lastIndex++) {
|
||||
char ch = json[lastIndex];
|
||||
|
||||
if ((ch < '0' || ch > '9') && ch != '+' && ch != '-'
|
||||
&& ch != '.' && ch != 'e' && ch != 'E')
|
||||
break;
|
||||
}
|
||||
|
||||
return lastIndex - 1;
|
||||
}
|
||||
|
||||
void SkipWhiteSpaces()
|
||||
{
|
||||
for (; index < json.Length; index++) {
|
||||
char ch = json[index];
|
||||
|
||||
if (ch == '\n')
|
||||
lineNumber++;
|
||||
|
||||
if (!char.IsWhiteSpace(json[index]))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Token LookAhead()
|
||||
{
|
||||
SkipWhiteSpaces();
|
||||
|
||||
int savedIndex = index;
|
||||
return NextToken(json, ref savedIndex);
|
||||
}
|
||||
|
||||
public Token NextToken()
|
||||
{
|
||||
SkipWhiteSpaces();
|
||||
return NextToken(json, ref index);
|
||||
}
|
||||
|
||||
static Token NextToken(char[] json, ref int index)
|
||||
{
|
||||
if (index == json.Length)
|
||||
return Token.None;
|
||||
|
||||
char c = json[index++];
|
||||
|
||||
switch (c) {
|
||||
case '{':
|
||||
return Token.CurlyOpen;
|
||||
case '}':
|
||||
return Token.CurlyClose;
|
||||
case '[':
|
||||
return Token.SquaredOpen;
|
||||
case ']':
|
||||
return Token.SquaredClose;
|
||||
case ',':
|
||||
return Token.Comma;
|
||||
case '"':
|
||||
return Token.String;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '-':
|
||||
return Token.Number;
|
||||
case ':':
|
||||
return Token.Colon;
|
||||
}
|
||||
|
||||
index--;
|
||||
|
||||
int remainingLength = json.Length - index;
|
||||
|
||||
// false
|
||||
if (remainingLength >= 5) {
|
||||
if (json[index] == 'f' &&
|
||||
json[index + 1] == 'a' &&
|
||||
json[index + 2] == 'l' &&
|
||||
json[index + 3] == 's' &&
|
||||
json[index + 4] == 'e') {
|
||||
index += 5;
|
||||
return Token.False;
|
||||
}
|
||||
}
|
||||
|
||||
// true
|
||||
if (remainingLength >= 4) {
|
||||
if (json[index] == 't' &&
|
||||
json[index + 1] == 'r' &&
|
||||
json[index + 2] == 'u' &&
|
||||
json[index + 3] == 'e') {
|
||||
index += 4;
|
||||
return Token.True;
|
||||
}
|
||||
}
|
||||
|
||||
// null
|
||||
if (remainingLength >= 4) {
|
||||
if (json[index] == 'n' &&
|
||||
json[index + 1] == 'u' &&
|
||||
json[index + 2] == 'l' &&
|
||||
json[index + 3] == 'l') {
|
||||
index += 4;
|
||||
return Token.Null;
|
||||
}
|
||||
}
|
||||
|
||||
return Token.None;
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonDecoder
|
||||
{
|
||||
public string errorMessage {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool parseNumbersAsFloat {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
Lexer lexer;
|
||||
|
||||
public JsonDecoder()
|
||||
{
|
||||
errorMessage = null;
|
||||
parseNumbersAsFloat = false;
|
||||
}
|
||||
|
||||
public object Decode(string text)
|
||||
{
|
||||
errorMessage = null;
|
||||
|
||||
lexer = new Lexer(text);
|
||||
lexer.parseNumbersAsFloat = parseNumbersAsFloat;
|
||||
|
||||
return ParseValue();
|
||||
}
|
||||
|
||||
public static object DecodeText(string text)
|
||||
{
|
||||
var builder = new JsonDecoder();
|
||||
return builder.Decode(text);
|
||||
}
|
||||
|
||||
IDictionary<string, object> ParseObject()
|
||||
{
|
||||
var table = new Dictionary<string, object>();
|
||||
|
||||
// {
|
||||
lexer.NextToken();
|
||||
|
||||
while (true) {
|
||||
var token = lexer.LookAhead();
|
||||
|
||||
switch (token) {
|
||||
case Lexer.Token.None:
|
||||
TriggerError("Invalid token");
|
||||
return null;
|
||||
case Lexer.Token.Comma:
|
||||
lexer.NextToken();
|
||||
break;
|
||||
case Lexer.Token.CurlyClose:
|
||||
lexer.NextToken();
|
||||
return table;
|
||||
default:
|
||||
// name
|
||||
string name = EvalLexer(lexer.ParseString());
|
||||
|
||||
if (errorMessage != null)
|
||||
return null;
|
||||
|
||||
// :
|
||||
token = lexer.NextToken();
|
||||
|
||||
if (token != Lexer.Token.Colon) {
|
||||
TriggerError("Invalid token; expected ':'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// value
|
||||
object value = ParseValue();
|
||||
|
||||
if (errorMessage != null)
|
||||
return null;
|
||||
|
||||
table[name] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//return null; // Unreachable code
|
||||
}
|
||||
|
||||
IList<object> ParseArray()
|
||||
{
|
||||
var array = new List<object>();
|
||||
|
||||
// [
|
||||
lexer.NextToken();
|
||||
|
||||
while (true) {
|
||||
var token = lexer.LookAhead();
|
||||
|
||||
switch (token) {
|
||||
case Lexer.Token.None:
|
||||
TriggerError("Invalid token");
|
||||
return null;
|
||||
case Lexer.Token.Comma:
|
||||
lexer.NextToken();
|
||||
break;
|
||||
case Lexer.Token.SquaredClose:
|
||||
lexer.NextToken();
|
||||
return array;
|
||||
default:
|
||||
object value = ParseValue();
|
||||
|
||||
if (errorMessage != null)
|
||||
return null;
|
||||
|
||||
array.Add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//return null; // Unreachable code
|
||||
}
|
||||
|
||||
object ParseValue()
|
||||
{
|
||||
switch (lexer.LookAhead()) {
|
||||
case Lexer.Token.String:
|
||||
return EvalLexer(lexer.ParseString());
|
||||
case Lexer.Token.Number:
|
||||
if (parseNumbersAsFloat)
|
||||
return EvalLexer(lexer.ParseFloatNumber());
|
||||
else
|
||||
return EvalLexer(lexer.ParseDoubleNumber());
|
||||
case Lexer.Token.CurlyOpen:
|
||||
return ParseObject();
|
||||
case Lexer.Token.SquaredOpen:
|
||||
return ParseArray();
|
||||
case Lexer.Token.True:
|
||||
lexer.NextToken();
|
||||
return true;
|
||||
case Lexer.Token.False:
|
||||
lexer.NextToken();
|
||||
return false;
|
||||
case Lexer.Token.Null:
|
||||
lexer.NextToken();
|
||||
return null;
|
||||
case Lexer.Token.None:
|
||||
break;
|
||||
}
|
||||
|
||||
TriggerError("Unable to parse value");
|
||||
return null;
|
||||
}
|
||||
|
||||
void TriggerError(string message)
|
||||
{
|
||||
errorMessage = string.Format("Error: '{0}' at line {1}",
|
||||
message, lexer.lineNumber);
|
||||
}
|
||||
|
||||
T EvalLexer<T>(T value)
|
||||
{
|
||||
if (lexer.hasError)
|
||||
TriggerError("Lexical error ocurred");
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
spine-unity/Assets/Examples/Getting Started.meta
Normal file
9
spine-unity/Assets/Examples/Getting Started.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb68fe44ae68d834b8be5d854b2b402e
|
||||
folderAsset: yes
|
||||
timeCreated: 1452591237
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fff6e9ad77d93024a9a87f6f2c0a6b3e
|
||||
timeCreated: 1452591252
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c66a9c1bbf922d4ab082694f19536c7
|
||||
timeCreated: 1452592098
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47344a855c1c167499dbb9bf28d1368b
|
||||
timeCreated: 1452594655
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa77f7a2c74add54eb0eb29f88e080dc
|
||||
timeCreated: 1455501626
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
spine-unity/Assets/Examples/Getting Started/Scripts.meta
Normal file
9
spine-unity/Assets/Examples/Getting Started/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a34eef132f2b4da45aa8023dbe5934e7
|
||||
folderAsset: yes
|
||||
timeCreated: 1452593684
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -86,6 +86,7 @@ public class BasicPlatformerController : MonoBehaviour {
|
||||
//play some sound if footstep event fired
|
||||
if (e.Data.Name == footstepEventName) {
|
||||
footstepAudioSource.Stop();
|
||||
footstepAudioSource.pitch = GetRandomPitch(0.2f);
|
||||
footstepAudioSource.Play();
|
||||
}
|
||||
}
|
||||
@ -107,8 +108,8 @@ public class BasicPlatformerController : MonoBehaviour {
|
||||
velocity.y = jumpSpeed;
|
||||
jumpEndTime = Time.time + jumpDuration;
|
||||
} else if (Time.time < jumpEndTime && Input.GetButtonUp(JumpButton)) {
|
||||
jumpInterrupt = true;
|
||||
}
|
||||
jumpInterrupt = true;
|
||||
}
|
||||
|
||||
|
||||
if (x != 0) {
|
||||
@ -182,4 +183,10 @@ public class BasicPlatformerController : MonoBehaviour {
|
||||
lastVelocity = velocity;
|
||||
lastGrounded = controller.isGrounded;
|
||||
}
|
||||
|
||||
#region Utility
|
||||
static float GetRandomPitch (float maxOffset) {
|
||||
return 1f + Random.Range(-maxOffset, maxOffset);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@ -14,12 +14,7 @@ public class ConstrainedCamera : MonoBehaviour {
|
||||
public Vector3 min;
|
||||
public Vector3 max;
|
||||
public float smoothing = 5f;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void LateUpdate () {
|
||||
Vector3 goalPoint = target.position + offset;
|
||||
@ -33,12 +33,53 @@ using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Raptor : MonoBehaviour {
|
||||
public void Start () {
|
||||
// Get the SkeletonAnimation component for the GameObject this script is attached to.
|
||||
SkeletonAnimation skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
// Set an animation on track 1 that does nothing to be played first.
|
||||
skeletonAnimation.state.SetAnimation(1, "empty", false);
|
||||
// Queue gun grab to be played on track 1 two seconds later.
|
||||
skeletonAnimation.state.AddAnimation(1, "gungrab", false, 2);
|
||||
|
||||
#region Inspector
|
||||
[SpineAnimation]
|
||||
public string walk = "walk";
|
||||
|
||||
[SpineAnimation]
|
||||
public string gungrab = "gungrab";
|
||||
|
||||
[SpineAnimation]
|
||||
public string gunkeep = "gunkeep";
|
||||
|
||||
[SpineEvent]
|
||||
public string footstepEvent = "footstep";
|
||||
|
||||
public AudioSource footstepAudioSource;
|
||||
#endregion
|
||||
|
||||
SkeletonAnimation skeletonAnimation;
|
||||
|
||||
void Start () {
|
||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
skeletonAnimation.state.Event += HandleEvent;
|
||||
StartCoroutine(GunGrabRoutine());
|
||||
}
|
||||
|
||||
void HandleEvent (Spine.AnimationState state, int trackIndex, Spine.Event e) {
|
||||
if (e.Data.Name == footstepEvent) {
|
||||
footstepAudioSource.pitch = 0.5f + Random.Range(-0.2f, 0.2f);
|
||||
footstepAudioSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator GunGrabRoutine () {
|
||||
// Play the walk animation on track 0.
|
||||
skeletonAnimation.state.SetAnimation(0, walk, true);
|
||||
|
||||
// Repeatedly play the gungrab and gunkeep animation on track 1.
|
||||
while (true) {
|
||||
|
||||
yield return new WaitForSeconds(Random.Range(0.5f, 3f));
|
||||
skeletonAnimation.state.SetAnimation(1, gungrab, false);
|
||||
|
||||
yield return new WaitForSeconds(Random.Range(0.5f, 3f));
|
||||
skeletonAnimation.state.SetAnimation(1, gunkeep, false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SpineBeginnerTwo : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
// [SpineAnimation] attribute allows an Inspector dropdown of Spine animation names coming form SkeletonAnimation.
|
||||
[SpineAnimation]
|
||||
public string runAnimationName;
|
||||
|
||||
[SpineAnimation]
|
||||
public string idleAnimationName;
|
||||
|
||||
[SpineAnimation]
|
||||
public string walkAnimationName;
|
||||
|
||||
[SpineAnimation]
|
||||
public string shootAnimationName;
|
||||
#endregion
|
||||
|
||||
SkeletonAnimation skeletonAnimation;
|
||||
|
||||
// Spine.AnimationState and Spine.Skeleton are not Unity-serialized objects. You will not see them as fields in the inspector.
|
||||
public Spine.AnimationState spineAnimationState;
|
||||
public Spine.Skeleton skeleton;
|
||||
|
||||
void Start () {
|
||||
// Make sure you get these AnimationState and Skeleton references in Start or Later. Getting and using them in Awake is not guaranteed by default execution order.
|
||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
spineAnimationState = skeletonAnimation.state;
|
||||
skeleton = skeletonAnimation.skeleton;
|
||||
|
||||
StartCoroutine(DoDemoRoutine());
|
||||
}
|
||||
|
||||
/// <summary>This is an infinitely repeating Unity Coroutine. Read the Unity documentation on Coroutines to learn more.</summary>
|
||||
IEnumerator DoDemoRoutine () {
|
||||
|
||||
while (true) {
|
||||
// SetAnimation is the basic way to set an animation.
|
||||
// SetAnimation sets the animation and starts playing it from the beginning.
|
||||
// Common Mistake: If you keep calling it in Update, it will keep showing the first pose of the animation, do don't do that.
|
||||
|
||||
spineAnimationState.SetAnimation(0, walkAnimationName, true);
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
|
||||
// skeletonAnimation.AnimationName = runAnimationName; // this line also works for quick testing/simple uses.
|
||||
spineAnimationState.SetAnimation(0, runAnimationName, true);
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
|
||||
spineAnimationState.SetAnimation(0, idleAnimationName, true);
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
skeleton.FlipX = true; // skeleton allows you to flip the skeleton.
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
skeleton.FlipX = false;
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef0903d879ea9ca49a1fd44d707beb9d
|
||||
guid: a57fe3aaf2b1f964182d90c5546754d1
|
||||
timeCreated: 1452593662
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SpineboyBeginnerInput : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
public string horizontalAxis = "Horizontal";
|
||||
public string attackButton = "Fire1";
|
||||
public string jumpButton = "Jump";
|
||||
|
||||
public SpineboyBeginnerModel model;
|
||||
|
||||
void OnValidate () {
|
||||
if (model == null)
|
||||
model = GetComponent<SpineboyBeginnerModel>();
|
||||
}
|
||||
#endregion
|
||||
|
||||
void Update () {
|
||||
if (model == null) return;
|
||||
|
||||
float currentHorizontal = Input.GetAxisRaw(horizontalAxis);
|
||||
model.TryMove(currentHorizontal);
|
||||
|
||||
if (Input.GetButton(attackButton))
|
||||
model.TryShoot();
|
||||
|
||||
if (Input.GetButtonDown(jumpButton))
|
||||
model.TryJump();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f685123e0610c347a7b2c03c8a19535
|
||||
timeCreated: 1452595430
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,65 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[SelectionBase]
|
||||
public class SpineboyBeginnerModel : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
[Header("Current State")]
|
||||
public SpineBeginnerBodyState state;
|
||||
public bool facingLeft;
|
||||
[Range(-1f, 1f)]
|
||||
public float currentSpeed;
|
||||
|
||||
[Header("Balance")]
|
||||
public float shootInterval = 0.12f;
|
||||
#endregion
|
||||
|
||||
float lastShootTime;
|
||||
public event System.Action ShootEvent; // Lets other scripts know when Spineboy is shooting. Check C# Documentation to learn more about events and delegates.
|
||||
|
||||
#region API
|
||||
public void TryJump () {
|
||||
StartCoroutine(JumpRoutine());
|
||||
}
|
||||
|
||||
public void TryShoot () {
|
||||
float currentTime = Time.time;
|
||||
|
||||
if (currentTime - lastShootTime > shootInterval) {
|
||||
lastShootTime = currentTime;
|
||||
if (ShootEvent != null) ShootEvent(); // Fire the "ShootEvent" event.
|
||||
}
|
||||
}
|
||||
|
||||
public void TryMove (float speed) {
|
||||
currentSpeed = speed; // show the "speed" in the Inspector.
|
||||
|
||||
if (speed != 0) {
|
||||
bool speedIsNegative = (speed < 0f);
|
||||
facingLeft = speedIsNegative; // Change facing direction whenever speed is not 0.
|
||||
}
|
||||
|
||||
if (state != SpineBeginnerBodyState.Jumping) {
|
||||
state = (speed == 0) ? SpineBeginnerBodyState.Idle : SpineBeginnerBodyState.Running;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
IEnumerator JumpRoutine () {
|
||||
if (state == SpineBeginnerBodyState.Jumping) yield break; // Don't jump when already jumping.
|
||||
|
||||
// Fake jumping.
|
||||
state = SpineBeginnerBodyState.Jumping;
|
||||
yield return new WaitForSeconds(1.2f);
|
||||
state = SpineBeginnerBodyState.Idle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum SpineBeginnerBodyState {
|
||||
Idle,
|
||||
Running,
|
||||
Jumping
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f999dde27e9711a45b0ee1b0d25217ec
|
||||
timeCreated: 1452594812
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,105 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SpineboyBeginnerView : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
[Header("Components")]
|
||||
public SpineboyBeginnerModel model;
|
||||
public SkeletonAnimation skeletonAnimation;
|
||||
//public ParticleSystem gunParticles;
|
||||
|
||||
[SpineAnimation] public string run, idle, shoot, jump;
|
||||
[SpineEvent] public string footstepEventName;
|
||||
|
||||
[Header("Audio")]
|
||||
public float footstepPitchOffset = 0.2f;
|
||||
public float gunsoundPitchOffset = 0.13f;
|
||||
public AudioSource footstepSource, gunSource, jumpSource;
|
||||
|
||||
[Header("Effects")]
|
||||
public ParticleSystem gunParticles;
|
||||
#endregion
|
||||
|
||||
SpineBeginnerBodyState previousViewState;
|
||||
|
||||
void Start () {
|
||||
if (skeletonAnimation == null) return;
|
||||
model.ShootEvent += PlayShoot;
|
||||
skeletonAnimation.state.Event += HandleEvent;
|
||||
}
|
||||
|
||||
void HandleEvent (Spine.AnimationState state, int trackIndex, Spine.Event e) {
|
||||
if (e.Data.Name == footstepEventName) {
|
||||
PlayFootstepSound();
|
||||
}
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (skeletonAnimation == null) return;
|
||||
if (model == null) return;
|
||||
|
||||
if (skeletonAnimation.skeleton.FlipX != model.facingLeft) { // Detect changes in model.facingLeft
|
||||
Turn(model.facingLeft);
|
||||
}
|
||||
|
||||
// Detect changes in model.state
|
||||
var currentModelState = model.state;
|
||||
|
||||
if (previousViewState != currentModelState) {
|
||||
PlayNewStableAnimation();
|
||||
}
|
||||
|
||||
previousViewState = currentModelState;
|
||||
}
|
||||
|
||||
void PlayNewStableAnimation () {
|
||||
var newModelState = model.state;
|
||||
string nextAnimation;
|
||||
|
||||
// Add conditionals to not interrupt transient animations.
|
||||
|
||||
if (previousViewState == SpineBeginnerBodyState.Jumping && newModelState != SpineBeginnerBodyState.Jumping) {
|
||||
PlayFootstepSound();
|
||||
}
|
||||
|
||||
if (newModelState == SpineBeginnerBodyState.Jumping) {
|
||||
jumpSource.Play();
|
||||
nextAnimation = jump;
|
||||
} else {
|
||||
if (newModelState == SpineBeginnerBodyState.Running) {
|
||||
nextAnimation = run;
|
||||
} else {
|
||||
nextAnimation = idle;
|
||||
}
|
||||
}
|
||||
|
||||
skeletonAnimation.state.SetAnimation(0, nextAnimation, true);
|
||||
}
|
||||
|
||||
void PlayFootstepSound () {
|
||||
footstepSource.Play();
|
||||
footstepSource.pitch = GetRandomPitch(footstepPitchOffset);
|
||||
}
|
||||
|
||||
#region Transient Actions
|
||||
public void PlayShoot () {
|
||||
// Play the shoot animation on track 1.
|
||||
skeletonAnimation.state.SetAnimation(1, shoot, false);
|
||||
gunSource.pitch = GetRandomPitch(gunsoundPitchOffset);
|
||||
gunSource.Play();
|
||||
gunParticles.Play();
|
||||
}
|
||||
|
||||
public void Turn (bool facingLeft) {
|
||||
skeletonAnimation.skeleton.FlipX = facingLeft;
|
||||
// Maybe play a transient turning animation too, then call ChangeStableAnimation.
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Utility
|
||||
public float GetRandomPitch (float maxPitchOffset) {
|
||||
return 1f + Random.Range(-maxPitchOffset, maxPitchOffset);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b59f510ae90fd1a419f19ed805e6e229
|
||||
timeCreated: 1452594730
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
spine-unity/Assets/Examples/Other Examples/Dragon.unity
Normal file
BIN
spine-unity/Assets/Examples/Other Examples/Dragon.unity
Normal file
Binary file not shown.
BIN
spine-unity/Assets/Examples/Other Examples/Mix and Match.unity
Normal file
BIN
spine-unity/Assets/Examples/Other Examples/Mix and Match.unity
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
spine-unity/Assets/Examples/Other Examples/SpineGauge.unity
Normal file
BIN
spine-unity/Assets/Examples/Other Examples/SpineGauge.unity
Normal file
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a88cb6ea6a9bd94e8513bd8b866934b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
Binary file not shown.
Binary file not shown.
@ -1,47 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fadfb38fe9b3ecc4db70956f425e4720
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 3
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 1
|
||||
compressionQuality: 100
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: 6
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 624423be326fb1047bb3fc6624faec9e
|
||||
DefaultImporter:
|
||||
userData:
|
||||
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 561b2daf45857734dbad43f0b809d884
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@ -29,13 +29,17 @@ public class FootSoldierExample : MonoBehaviour {
|
||||
[Range(0, 0.2f)]
|
||||
public float blinkDuration = 0.05f;
|
||||
|
||||
public KeyCode attackKey = KeyCode.Mouse0;
|
||||
public KeyCode rightKey = KeyCode.D;
|
||||
public KeyCode leftKey = KeyCode.A;
|
||||
|
||||
public float moveSpeed = 3;
|
||||
|
||||
private SkeletonAnimation skeletonAnimation;
|
||||
|
||||
void Awake() {
|
||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
skeletonAnimation.OnReset += Apply;
|
||||
skeletonAnimation.OnRebuild += Apply;
|
||||
}
|
||||
|
||||
void Apply(SkeletonRenderer skeletonRenderer) {
|
||||
@ -43,14 +47,14 @@ public class FootSoldierExample : MonoBehaviour {
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKey(KeyCode.Space)) {
|
||||
if (Input.GetKey(attackKey)) {
|
||||
skeletonAnimation.AnimationName = attackAnimation;
|
||||
} else {
|
||||
if (Input.GetKey(KeyCode.RightArrow)) {
|
||||
if (Input.GetKey(rightKey)) {
|
||||
skeletonAnimation.AnimationName = moveAnimation;
|
||||
skeletonAnimation.skeleton.FlipX = false;
|
||||
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
|
||||
} else if(Input.GetKey(KeyCode.LeftArrow)) {
|
||||
} else if(Input.GetKey(leftKey)) {
|
||||
skeletonAnimation.AnimationName = moveAnimation;
|
||||
skeletonAnimation.skeleton.FlipX = true;
|
||||
transform.Translate(-moveSpeed * Time.deltaTime, 0, 0);
|
||||
|
||||
@ -45,7 +45,7 @@ public class Goblins : MonoBehaviour {
|
||||
}
|
||||
|
||||
// This is called after the animation is applied to the skeleton and can be used to adjust the bones dynamically.
|
||||
public void UpdateLocal (SkeletonRenderer skeletonRenderer) {
|
||||
public void UpdateLocal (ISkeletonAnimation skeletonRenderer) {
|
||||
headBone.Rotation += 15;
|
||||
}
|
||||
|
||||
|
||||
@ -3,35 +3,40 @@ using System.Collections;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SpineGauge : MonoBehaviour{
|
||||
public class SpineGauge : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
[Range(0,1)]
|
||||
public float fill = 0;
|
||||
public float fillPercent = 0;
|
||||
|
||||
[SpineAnimation]
|
||||
public string fillAnimationName;
|
||||
Spine.Animation fillAnimation;
|
||||
#endregion
|
||||
|
||||
SkeletonRenderer skeletonRenderer;
|
||||
Spine.Animation fillAnimation;
|
||||
|
||||
void Start () {
|
||||
void Awake () {
|
||||
skeletonRenderer = GetComponent<SkeletonRenderer>();
|
||||
|
||||
}
|
||||
|
||||
void Update () {
|
||||
|
||||
var skeleton = skeletonRenderer.skeleton;
|
||||
SetGaugePercent(fillPercent);
|
||||
}
|
||||
|
||||
if (skeleton == null)
|
||||
return;
|
||||
public void SetGaugePercent (float x) {
|
||||
if (skeletonRenderer == null) return;
|
||||
var skeleton = skeletonRenderer.skeleton; if (skeleton == null) return;
|
||||
|
||||
// Make super-sure that fillAnimation isn't null. Early exit if it is.
|
||||
if (fillAnimation == null) {
|
||||
fillAnimation = skeleton.Data.FindAnimation(fillAnimationName);
|
||||
if (fillAnimation == null)
|
||||
return;
|
||||
if (fillAnimation == null) return;
|
||||
}
|
||||
|
||||
fillAnimation.Apply(skeleton, 0, x, false, null);
|
||||
|
||||
fillAnimation.Apply(skeleton, 0, fill, false, null);
|
||||
skeleton.Update(Time.deltaTime);
|
||||
skeleton.UpdateWorldTransform();
|
||||
}
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* SpineboyController created by Mitch Thompson
|
||||
* Full irrevocable rights and permissions granted to Esoteric Software
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[RequireComponent(typeof(SkeletonAnimation), typeof(Rigidbody2D))]
|
||||
public class SpineboyController : MonoBehaviour {
|
||||
|
||||
SkeletonAnimation skeletonAnimation;
|
||||
[SpineAnimation] public string idleAnimation = "idle";
|
||||
[SpineAnimation] public string walkAnimation = "walk";
|
||||
[SpineAnimation] public string runAnimation = "run";
|
||||
[SpineAnimation] public string hitAnimation = "hit";
|
||||
[SpineAnimation] public string deathAnimation = "death";
|
||||
public float walkVelocity = 1;
|
||||
public float runVelocity = 3;
|
||||
public int hp = 10;
|
||||
string currentAnimation = "";
|
||||
bool hit = false;
|
||||
bool dead = false;
|
||||
|
||||
void Start () {
|
||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (!dead) {
|
||||
float x = Input.GetAxis("Horizontal");
|
||||
float absX = Mathf.Abs(x);
|
||||
|
||||
if (!hit) {
|
||||
if (x > 0)
|
||||
skeletonAnimation.skeleton.FlipX = false;
|
||||
else if (x < 0)
|
||||
skeletonAnimation.skeleton.FlipX = true;
|
||||
|
||||
if (absX > 0.7f) {
|
||||
SetAnimation(runAnimation, true);
|
||||
GetComponent<Rigidbody2D>().velocity = new Vector2(runVelocity * Mathf.Sign(x), GetComponent<Rigidbody2D>().velocity.y);
|
||||
} else if (absX > 0) {
|
||||
SetAnimation(walkAnimation, true);
|
||||
GetComponent<Rigidbody2D>().velocity = new Vector2(walkVelocity * Mathf.Sign(x), GetComponent<Rigidbody2D>().velocity.y);
|
||||
} else {
|
||||
SetAnimation(idleAnimation, true);
|
||||
GetComponent<Rigidbody2D>().velocity = new Vector2(0, GetComponent<Rigidbody2D>().velocity.y);
|
||||
}
|
||||
} else {
|
||||
if (skeletonAnimation.state.GetCurrent(0).Animation.Name != hitAnimation)
|
||||
hit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetAnimation (string anim, bool loop) {
|
||||
if (currentAnimation != anim) {
|
||||
skeletonAnimation.state.SetAnimation(0, anim, loop);
|
||||
currentAnimation = anim;
|
||||
}
|
||||
}
|
||||
|
||||
void OnMouseUp () {
|
||||
|
||||
if (hp > 0) {
|
||||
hp--;
|
||||
|
||||
if (hp == 0) {
|
||||
SetAnimation(deathAnimation, false);
|
||||
dead = true;
|
||||
} else {
|
||||
skeletonAnimation.state.SetAnimation(0, hitAnimation, false);
|
||||
skeletonAnimation.state.AddAnimation(0, currentAnimation, true, 0);
|
||||
GetComponent<Rigidbody2D>().velocity = new Vector2(0, GetComponent<Rigidbody2D>().velocity.y);
|
||||
hit = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
spine-unity/Assets/Examples/Sound/Footstep.ogg
Normal file
BIN
spine-unity/Assets/Examples/Sound/Footstep.ogg
Normal file
Binary file not shown.
22
spine-unity/Assets/Examples/Sound/Footstep.ogg.meta
Normal file
22
spine-unity/Assets/Examples/Sound/Footstep.ogg.meta
Normal file
@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e885484e1bc99fb47a0ac3f6bfa586b1
|
||||
timeCreated: 1452628222
|
||||
licenseType: Free
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 0.9
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c34d92bb58dd1a14db9e89d6188087ea
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: -1
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 0
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
BIN
spine-unity/Assets/Examples/Sound/Hardfall.ogg
Normal file
BIN
spine-unity/Assets/Examples/Sound/Hardfall.ogg
Normal file
Binary file not shown.
22
spine-unity/Assets/Examples/Sound/Hardfall.ogg.meta
Normal file
22
spine-unity/Assets/Examples/Sound/Hardfall.ogg.meta
Normal file
@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 532e417ffa3f95747908419a00be3780
|
||||
timeCreated: 1452621190
|
||||
licenseType: Free
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf832d4a857c27545bff51681de106c0
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: -1
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 0
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
BIN
spine-unity/Assets/Examples/Sound/Jump.ogg
Normal file
BIN
spine-unity/Assets/Examples/Sound/Jump.ogg
Normal file
Binary file not shown.
22
spine-unity/Assets/Examples/Sound/Jump.ogg.meta
Normal file
22
spine-unity/Assets/Examples/Sound/Jump.ogg.meta
Normal file
@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51f0c54706b53c14c9c24bbd63bb18a6
|
||||
timeCreated: 1452620503
|
||||
licenseType: Free
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9afdb740ae0deb74a8906a353b597a03
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: -1
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 0
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
BIN
spine-unity/Assets/Examples/Sound/Spineboygun.ogg
Normal file
BIN
spine-unity/Assets/Examples/Sound/Spineboygun.ogg
Normal file
Binary file not shown.
22
spine-unity/Assets/Examples/Sound/Spineboygun.ogg.meta
Normal file
22
spine-unity/Assets/Examples/Sound/Spineboygun.ogg.meta
Normal file
@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e986056f914f4974896a49527ca80041
|
||||
timeCreated: 1452601827
|
||||
licenseType: Free
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bc52290ef03f2846ba38d67e2823598
|
||||
timeCreated: 1455501336
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,18 +35,23 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12c126994123f12468cf4c5a2684078a
|
||||
timeCreated: 1455501336
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,18 +35,23 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49441e5a1682e564694545bd9b509785
|
||||
timeCreated: 1455501336
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,18 +35,23 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddb89f63d0296cf4f8572b0448bb6b30
|
||||
timeCreated: 1455501337
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,18 +35,23 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57b57f94df266f94ea0981915a4472e1
|
||||
timeCreated: 1455501336
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,18 +35,23 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a11301aad15ed6b4995485a02a81b132
|
||||
timeCreated: 1455501336
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
@ -15,11 +17,14 @@ TextureImporter:
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
@ -30,12 +35,14 @@ TextureImporter:
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
@ -43,5 +50,8 @@ TextureImporter:
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user