Add frame list in skin data structure. Remove Cocos2d Plist support.
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 925f95cb7c6644a4695b2701d42e1ea2
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1606989037
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Cryville.Common.Plist {
|
|
||||||
public class PlistConvert {
|
|
||||||
public static T Deserialize<T>(string file) {
|
|
||||||
return (T)Deserialize(typeof(T), PlistCS.Plist.readPlist(file));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static object Deserialize(Type type, object obj, Binder binder = null) {
|
|
||||||
if (binder == null)
|
|
||||||
binder = BinderAttribute.CreateBinderOfType(type);
|
|
||||||
if (obj is IList) {
|
|
||||||
var lobj = (List<object>)obj;
|
|
||||||
foreach (var i in lobj) {
|
|
||||||
throw new NotImplementedException(); // TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (obj is IDictionary) {
|
|
||||||
var dobj = (Dictionary<string, object>)obj;
|
|
||||||
if (typeof(IDictionary).IsAssignableFrom(type)) {
|
|
||||||
var result = (IDictionary)ReflectionHelper.InvokeEmptyConstructor(type);
|
|
||||||
var it = type.GetGenericArguments()[1];
|
|
||||||
foreach (var i in dobj) {
|
|
||||||
var value = Deserialize(it, i.Value, binder);
|
|
||||||
result.Add(i.Key, value);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var result = ReflectionHelper.InvokeEmptyConstructor(type);
|
|
||||||
foreach (var i in dobj) {
|
|
||||||
var imis = type.GetMember(i.Key);
|
|
||||||
if (imis.Length == 0) continue;
|
|
||||||
var imi = imis[0];
|
|
||||||
var it = ReflectionHelper.GetMemberType(imi);
|
|
||||||
var value = Deserialize(it, i.Value, binder);
|
|
||||||
ReflectionHelper.SetValue(imi, result, value, binder);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else return obj;
|
|
||||||
throw new Exception(); // TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3bc71e8b62d4022409aa5518bbf3a7d8
|
|
||||||
timeCreated: 1608801352
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#define BUILD
|
#define BUILD
|
||||||
|
|
||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Plist;
|
|
||||||
using Cryville.Crtr.Config;
|
using Cryville.Crtr.Config;
|
||||||
using Cryville.Crtr.Event;
|
using Cryville.Crtr.Event;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -26,8 +25,7 @@ namespace Cryville.Crtr {
|
|||||||
Ruleset ruleset;
|
Ruleset ruleset;
|
||||||
PdtRuleset pruleset;
|
PdtRuleset pruleset;
|
||||||
Dictionary<string, Texture2D> texs;
|
Dictionary<string, Texture2D> texs;
|
||||||
public static Dictionary<string, Cocos2dFrames.Frame> frames;
|
public static Dictionary<string, SpriteFrame> frames;
|
||||||
List<Cocos2dFrames> plists;
|
|
||||||
|
|
||||||
readonly Queue<string> texLoadQueue = new Queue<string>();
|
readonly Queue<string> texLoadQueue = new Queue<string>();
|
||||||
#if UNITY_5_4_OR_NEWER
|
#if UNITY_5_4_OR_NEWER
|
||||||
@@ -353,6 +351,13 @@ namespace Cryville.Crtr {
|
|||||||
string.Format("{0}/skins/{1}/{2}/.umgs", Game.GameDataPath, rulesetFile.Directory.Name, _rscfg.generic.Skin)
|
string.Format("{0}/skins/{1}/{2}/.umgs", Game.GameDataPath, rulesetFile.Directory.Name, _rscfg.generic.Skin)
|
||||||
);
|
);
|
||||||
if (!skinFile.Exists) throw new FileNotFoundException("Skin not found\nPlease specify an available skin in the config");
|
if (!skinFile.Exists) throw new FileNotFoundException("Skin not found\nPlease specify an available skin in the config");
|
||||||
|
using (StreamReader reader = new StreamReader(skinFile.FullName, Encoding.UTF8)) {
|
||||||
|
skin = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||||
|
MissingMemberHandling = MissingMemberHandling.Error
|
||||||
|
});
|
||||||
|
if (skin.format != 1) throw new FormatException("Invalid skin file version");
|
||||||
|
}
|
||||||
|
|
||||||
loadThread = new Thread(new ParameterizedThreadStart(Load));
|
loadThread = new Thread(new ParameterizedThreadStart(Load));
|
||||||
loadThread.Start(new LoadInfo() {
|
loadThread.Start(new LoadInfo() {
|
||||||
chartFile = chartFile,
|
chartFile = chartFile,
|
||||||
@@ -363,10 +368,10 @@ namespace Cryville.Crtr {
|
|||||||
Logger.Log("main", 0, "Load/MainThread", "Loading textures...");
|
Logger.Log("main", 0, "Load/MainThread", "Loading textures...");
|
||||||
texloadtimer = new diag::Stopwatch();
|
texloadtimer = new diag::Stopwatch();
|
||||||
texloadtimer.Start();
|
texloadtimer.Start();
|
||||||
|
frames = new Dictionary<string, SpriteFrame>();
|
||||||
texs = new Dictionary<string, Texture2D>();
|
texs = new Dictionary<string, Texture2D>();
|
||||||
var flist = skinFile.Directory.GetFiles("*.png");
|
foreach (var f in skin.frames) {
|
||||||
foreach (FileInfo f in flist) {
|
texLoadQueue.Enqueue(Path.Combine(skinFile.Directory.FullName, f));
|
||||||
texLoadQueue.Enqueue(f.FullName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,13 +380,12 @@ namespace Cryville.Crtr {
|
|||||||
diag::Stopwatch timer = new diag::Stopwatch();
|
diag::Stopwatch timer = new diag::Stopwatch();
|
||||||
timer.Reset(); timer.Start();
|
timer.Reset(); timer.Start();
|
||||||
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)");
|
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)");
|
||||||
foreach (var i in plists) i.Init(texs);
|
|
||||||
foreach (var t in texs) {
|
foreach (var t in texs) {
|
||||||
if (frames.ContainsKey(t.Key)) {
|
if (frames.ContainsKey(t.Key)) {
|
||||||
Logger.Log("main", 3, "Load/Prehandle", "Duplicated texture name: {0}", t.Key);
|
Logger.Log("main", 3, "Load/Prehandle", "Duplicated texture name: {0}", t.Key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var f = new Cocos2dFrames.Frame(t.Value);
|
var f = new SpriteFrame(t.Value);
|
||||||
f.Init();
|
f.Init();
|
||||||
frames.Add(t.Key, f);
|
frames.Add(t.Key, f);
|
||||||
}
|
}
|
||||||
@@ -559,23 +563,9 @@ namespace Cryville.Crtr {
|
|||||||
void LoadSkin(FileInfo file) {
|
void LoadSkin(FileInfo file) {
|
||||||
DirectoryInfo dir = file.Directory;
|
DirectoryInfo dir = file.Directory;
|
||||||
Logger.Log("main", 0, "Load/WorkerThread", "Loading skin: {0}", file);
|
Logger.Log("main", 0, "Load/WorkerThread", "Loading skin: {0}", file);
|
||||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
skin.LoadPdt(dir);
|
||||||
skin = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
pskin = skin.Root;
|
||||||
MissingMemberHandling = MissingMemberHandling.Error
|
pskin.Optimize(etor);
|
||||||
});
|
|
||||||
if (skin.format != 1) throw new FormatException("Invalid skin file version");
|
|
||||||
skin.LoadPdt(dir);
|
|
||||||
pskin = skin.Root;
|
|
||||||
pskin.Optimize(etor);
|
|
||||||
}
|
|
||||||
plists = new List<Cocos2dFrames>();
|
|
||||||
frames = new Dictionary<string, Cocos2dFrames.Frame>();
|
|
||||||
foreach (FileInfo f in file.Directory.GetFiles("*.plist")) {
|
|
||||||
var pobj = PlistConvert.Deserialize<Cocos2dFrames>(f.FullName);
|
|
||||||
plists.Add(pobj);
|
|
||||||
foreach (var i in pobj.frames)
|
|
||||||
frames.Add(StringUtils.TrimExt(i.Key), i.Value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,176 +0,0 @@
|
|||||||
using Cryville.Common;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
|
||||||
[BinderAttribute(typeof(Cocos2dFramesBinder))]
|
|
||||||
public class Cocos2dFrames {
|
|
||||||
public Metadata metadata;
|
|
||||||
public class Metadata {
|
|
||||||
public int format;
|
|
||||||
public Vector2 size;
|
|
||||||
public string textureFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<string, Frame> frames;
|
|
||||||
public class Frame {
|
|
||||||
#pragma warning disable IDE1006
|
|
||||||
Rect _frame;
|
|
||||||
public Rect frame {
|
|
||||||
get { return _frame; }
|
|
||||||
set { _frame = value; }
|
|
||||||
}
|
|
||||||
public Rect textureRect {
|
|
||||||
get { return _frame; }
|
|
||||||
set { _frame = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _rotated = false;
|
|
||||||
public bool rotated {
|
|
||||||
get { return _rotated; }
|
|
||||||
set { _rotated = value; }
|
|
||||||
}
|
|
||||||
public bool textureRotated {
|
|
||||||
get { return _rotated; }
|
|
||||||
set { _rotated = value; }
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE1006
|
|
||||||
|
|
||||||
public Vector2 offset;
|
|
||||||
|
|
||||||
public Rect sourceColorRect;
|
|
||||||
public Vector2 sourceSize;
|
|
||||||
private Rect _uv;
|
|
||||||
private Vector2[] cuv;
|
|
||||||
public Rect UV {
|
|
||||||
get {
|
|
||||||
return _uv;
|
|
||||||
}
|
|
||||||
private set {
|
|
||||||
_uv = value;
|
|
||||||
float x0 = Mathf.Min(_uv.xMin, _uv.xMax);
|
|
||||||
float x1 = Mathf.Max(_uv.xMin, _uv.xMax);
|
|
||||||
float y0 = Mathf.Min(_uv.yMin, _uv.yMax);
|
|
||||||
float y1 = Mathf.Max(_uv.yMin, _uv.yMax);
|
|
||||||
if (_rotated) cuv = new Vector2[]{
|
|
||||||
new Vector2(x0, y1),
|
|
||||||
new Vector2(x1, y0),
|
|
||||||
new Vector2(x0, y0),
|
|
||||||
new Vector2(x1, y1),
|
|
||||||
};
|
|
||||||
else cuv = new Vector2[]{
|
|
||||||
new Vector2(x0, y0),
|
|
||||||
new Vector2(x1, y1),
|
|
||||||
new Vector2(x1, y0),
|
|
||||||
new Vector2(x0, y1),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public Vector2 GetUV(Vector2 uv) {
|
|
||||||
return GetUV(uv.x, uv.y);
|
|
||||||
}
|
|
||||||
public Vector2 GetUV(float u, float v) {
|
|
||||||
Vector2 uv00 = cuv[0], uv11 = cuv[1],
|
|
||||||
uv10 = cuv[2], uv01 = cuv[3];
|
|
||||||
return (1 - u - v) * uv00
|
|
||||||
+ u * uv10
|
|
||||||
+ v * uv01
|
|
||||||
+ u * v * (uv00 + uv11 - uv10 - uv01);
|
|
||||||
}
|
|
||||||
public Texture2D Texture {
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
public Vector2 Size {
|
|
||||||
get {
|
|
||||||
return new Vector2(Texture.width, Texture.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init() {
|
|
||||||
if (Texture == null)
|
|
||||||
throw new InvalidOperationException(); // TODO
|
|
||||||
_frame = new Rect(Vector2.zero, Size);
|
|
||||||
var w = _frame.width;
|
|
||||||
var h = _frame.height;
|
|
||||||
float x = _frame.x / w;
|
|
||||||
float y = 1 - _frame.y / h;
|
|
||||||
float tw = (_rotated ? _frame.height : _frame.width) / w;
|
|
||||||
float th = (_rotated ? _frame.width : _frame.height) / h;
|
|
||||||
if (_rotated) UV = new Rect(x, y, tw, -th);
|
|
||||||
else UV = new Rect(x, y, tw, -th);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init(int w, int h, Texture2D _base) {
|
|
||||||
if (Texture != null)
|
|
||||||
throw new InvalidOperationException(); // TODO
|
|
||||||
Texture = _base;
|
|
||||||
float x = _frame.x / w;
|
|
||||||
float y = 1 - _frame.y / h;
|
|
||||||
float tw = (_rotated ? _frame.height : _frame.width) / w;
|
|
||||||
float th = (_rotated ? _frame.width : _frame.height) / h;
|
|
||||||
if (_rotated) UV = new Rect(x, y, tw, -th);
|
|
||||||
else UV = new Rect(x, y, tw, -th);
|
|
||||||
}
|
|
||||||
public Frame() { }
|
|
||||||
public Frame(Texture2D tex) {
|
|
||||||
Texture = tex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Texture2D _base;
|
|
||||||
|
|
||||||
public void Init(Dictionary<string, Texture2D> texs) {
|
|
||||||
_base = texs[StringUtils.TrimExt(metadata.textureFileName)];
|
|
||||||
var w = (int)metadata.size.x;
|
|
||||||
var h = (int)metadata.size.y;
|
|
||||||
if (w == 0 || h == 0) {
|
|
||||||
w = _base.width;
|
|
||||||
h = _base.height;
|
|
||||||
}
|
|
||||||
foreach (var f in frames) {
|
|
||||||
f.Value.Init(w, h, _base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Cocos2dFramesBinder : EmptyBinder {
|
|
||||||
public override object ChangeType(object value, Type type, CultureInfo culture) {
|
|
||||||
if (value is string) {
|
|
||||||
var str = (string)value;
|
|
||||||
if (type == typeof(Rect)) {
|
|
||||||
var m = Regex.Match(str, @"^{({.*?}),({.*?})}$");
|
|
||||||
var p = (Vector2)ChangeType(m.Groups[1].Value, typeof(Vector2), culture);
|
|
||||||
var s = (Vector2)ChangeType(m.Groups[2].Value, typeof(Vector2), culture);
|
|
||||||
return new Rect(p, s);
|
|
||||||
}
|
|
||||||
else if (type == typeof(Vector2)) {
|
|
||||||
var m = Regex.Match(str, @"^{(.*?),(.*?)}$");
|
|
||||||
var w = float.Parse(m.Groups[1].Value);
|
|
||||||
var h = float.Parse(m.Groups[2].Value);
|
|
||||||
return new Vector2(w, h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (typeof(IDictionary).IsAssignableFrom(value.GetType())) {
|
|
||||||
var dict = (IDictionary)value;
|
|
||||||
if (type == typeof(Rect)) {
|
|
||||||
var x = float.Parse((string)dict["x"]);
|
|
||||||
var y = float.Parse((string)dict["y"]);
|
|
||||||
var w = float.Parse((string)dict["w"]);
|
|
||||||
var h = float.Parse((string)dict["h"]);
|
|
||||||
return new Rect(x, y, w, h);
|
|
||||||
}
|
|
||||||
else if (type == typeof(Vector2)) {
|
|
||||||
var w = float.Parse((string)dict["w"]);
|
|
||||||
var h = float.Parse((string)dict["h"]);
|
|
||||||
return new Vector2(w, h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return base.ChangeType(value, type, culture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ using Logger = Cryville.Common.Logger;
|
|||||||
namespace Cryville.Crtr.Components {
|
namespace Cryville.Crtr.Components {
|
||||||
public class SpriteInfo {
|
public class SpriteInfo {
|
||||||
public string FrameName;
|
public string FrameName;
|
||||||
public Cocos2dFrames.Frame Frame {
|
public SpriteFrame Frame {
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace Cryville.Crtr {
|
|||||||
[JsonRequired]
|
[JsonRequired]
|
||||||
public string pdt;
|
public string pdt;
|
||||||
|
|
||||||
|
public List<string> frames = new List<string>();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public PdtSkin Root { get; private set; }
|
public PdtSkin Root { get; private set; }
|
||||||
|
|
||||||
|
|||||||
109
Assets/Cryville/Crtr/SpriteFrame.cs
Normal file
109
Assets/Cryville/Crtr/SpriteFrame.cs
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr {
|
||||||
|
public class SpriteFrame {
|
||||||
|
#pragma warning disable IDE1006
|
||||||
|
Rect _frame;
|
||||||
|
public Rect frame {
|
||||||
|
get { return _frame; }
|
||||||
|
set { _frame = value; }
|
||||||
|
}
|
||||||
|
public Rect textureRect {
|
||||||
|
get { return _frame; }
|
||||||
|
set { _frame = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _rotated = false;
|
||||||
|
public bool rotated {
|
||||||
|
get { return _rotated; }
|
||||||
|
set { _rotated = value; }
|
||||||
|
}
|
||||||
|
public bool textureRotated {
|
||||||
|
get { return _rotated; }
|
||||||
|
set { _rotated = value; }
|
||||||
|
}
|
||||||
|
#pragma warning restore IDE1006
|
||||||
|
|
||||||
|
public Vector2 offset;
|
||||||
|
|
||||||
|
public Rect sourceColorRect;
|
||||||
|
public Vector2 sourceSize;
|
||||||
|
private Rect _uv;
|
||||||
|
private Vector2[] cuv;
|
||||||
|
public Rect UV {
|
||||||
|
get {
|
||||||
|
return _uv;
|
||||||
|
}
|
||||||
|
private set {
|
||||||
|
_uv = value;
|
||||||
|
float x0 = Mathf.Min(_uv.xMin, _uv.xMax);
|
||||||
|
float x1 = Mathf.Max(_uv.xMin, _uv.xMax);
|
||||||
|
float y0 = Mathf.Min(_uv.yMin, _uv.yMax);
|
||||||
|
float y1 = Mathf.Max(_uv.yMin, _uv.yMax);
|
||||||
|
if (_rotated) cuv = new Vector2[]{
|
||||||
|
new Vector2(x0, y1),
|
||||||
|
new Vector2(x1, y0),
|
||||||
|
new Vector2(x0, y0),
|
||||||
|
new Vector2(x1, y1),
|
||||||
|
};
|
||||||
|
else cuv = new Vector2[]{
|
||||||
|
new Vector2(x0, y0),
|
||||||
|
new Vector2(x1, y1),
|
||||||
|
new Vector2(x1, y0),
|
||||||
|
new Vector2(x0, y1),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Vector2 GetUV(Vector2 uv) {
|
||||||
|
return GetUV(uv.x, uv.y);
|
||||||
|
}
|
||||||
|
public Vector2 GetUV(float u, float v) {
|
||||||
|
Vector2 uv00 = cuv[0], uv11 = cuv[1],
|
||||||
|
uv10 = cuv[2], uv01 = cuv[3];
|
||||||
|
return (1 - u - v) * uv00
|
||||||
|
+ u * uv10
|
||||||
|
+ v * uv01
|
||||||
|
+ u * v * (uv00 + uv11 - uv10 - uv01);
|
||||||
|
}
|
||||||
|
public Texture2D Texture {
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
public Vector2 Size {
|
||||||
|
get {
|
||||||
|
return new Vector2(Texture.width, Texture.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init() {
|
||||||
|
if (Texture == null)
|
||||||
|
throw new InvalidOperationException(); // TODO
|
||||||
|
_frame = new Rect(Vector2.zero, Size);
|
||||||
|
var w = _frame.width;
|
||||||
|
var h = _frame.height;
|
||||||
|
float x = _frame.x / w;
|
||||||
|
float y = 1 - _frame.y / h;
|
||||||
|
float tw = (_rotated ? _frame.height : _frame.width) / w;
|
||||||
|
float th = (_rotated ? _frame.width : _frame.height) / h;
|
||||||
|
if (_rotated) UV = new Rect(x, y, tw, -th);
|
||||||
|
else UV = new Rect(x, y, tw, -th);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(int w, int h, Texture2D _base) {
|
||||||
|
if (Texture != null)
|
||||||
|
throw new InvalidOperationException(); // TODO
|
||||||
|
Texture = _base;
|
||||||
|
float x = _frame.x / w;
|
||||||
|
float y = 1 - _frame.y / h;
|
||||||
|
float tw = (_rotated ? _frame.height : _frame.width) / w;
|
||||||
|
float th = (_rotated ? _frame.width : _frame.height) / h;
|
||||||
|
if (_rotated) UV = new Rect(x, y, tw, -th);
|
||||||
|
else UV = new Rect(x, y, tw, -th);
|
||||||
|
}
|
||||||
|
public SpriteFrame() { }
|
||||||
|
public SpriteFrame(Texture2D tex) {
|
||||||
|
Texture = tex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 71d5ddaf108e0014c98c206ed5135ded
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1605077401
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8f21b229422310b40a4d539f7319bd1f
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1605077401
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: da665e46f8c2b5b46ad8e3bf5cd34007
|
|
||||||
timeCreated: 1605077404
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Reference in New Issue
Block a user