Prune code.
This commit is contained in:
@@ -1,22 +1,11 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public class SpriteText : SpriteBase {
|
||||
public SpriteText() {
|
||||
/*
|
||||
SubmitProperty("frames", new Property(typeof(TextFrames), () => Frames, v => Frames = (TextFrames)v));
|
||||
SubmitProperty("value", new Property(typeof(string), () => Value, v => Value = (string)v));
|
||||
SubmitProperty("size", new Property(typeof(float), () => Size, v => Size = (float)v));
|
||||
SubmitProperty("spacing", new Property(typeof(float), () => Spacing, v => Spacing = (float)v));
|
||||
SubmitProperty("opacity", new Property(typeof(float), () => Opacity, v => Opacity = (float)v));
|
||||
*/
|
||||
|
||||
SubmitProperty("frames", new op_set_frames(this));
|
||||
SubmitProperty("value", new PropOp.String(v => Value = v));
|
||||
SubmitProperty("size", new PropOp.Float(v => Size = v));
|
||||
@@ -42,7 +31,7 @@ namespace Cryville.Crtr.Components {
|
||||
o += v.Length * sizeof(char) + sizeof(int);
|
||||
result.Add(keys[i], new SpriteInfo { FrameName = v });
|
||||
}
|
||||
_self.Frames = new TextFrames { Frames = result };
|
||||
_self.Frames = result;
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
@@ -53,19 +42,8 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
|
||||
readonly Dictionary<Texture2D, MeshWrapper> meshes = new Dictionary<Texture2D, MeshWrapper>();
|
||||
public struct TextFrames /*: IConstructable*/ {
|
||||
public Dictionary<char, SpriteInfo> Frames;
|
||||
/*public void Load(object data, IEvaluator etor) {
|
||||
var d = (IList)data;
|
||||
var keys = (string)d[0];
|
||||
var values = (List<object>)d[1];
|
||||
Frames = new Dictionary<char, SpriteInfo>(keys.Length);
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
Frames.Add(keys[i], new SpriteInfo() { FrameName = (string)values[i] });
|
||||
}*/
|
||||
}
|
||||
TextFrames m_frames;
|
||||
public TextFrames Frames {
|
||||
Dictionary<char, SpriteInfo> m_frames;
|
||||
public Dictionary<char, SpriteInfo> Frames {
|
||||
get { return m_frames; }
|
||||
set { m_frames = value; UpdateFrames(); UpdateScale(); }
|
||||
}
|
||||
@@ -102,7 +80,7 @@ namespace Cryville.Crtr.Components {
|
||||
float frameHeight = 0;
|
||||
foreach (var m in meshes) m.Value.Destroy();
|
||||
meshes.Clear();
|
||||
foreach (var f in m_frames.Frames) {
|
||||
foreach (var f in m_frames) {
|
||||
f.Value.Load();
|
||||
if (frameHeight == 0) frameHeight = f.Value.Rect.height;
|
||||
else if (frameHeight != f.Value.Rect.height) throw new Exception("Inconsistent frame height");
|
||||
@@ -128,7 +106,7 @@ namespace Cryville.Crtr.Components {
|
||||
uvs.Add(t, new List<Vector2>(vc));
|
||||
}
|
||||
foreach (var c in m_value) {
|
||||
var f = m_frames.Frames[c];
|
||||
var f = m_frames[c];
|
||||
var t = f.Frame.Texture;
|
||||
float w = f.Ratio * m_size;
|
||||
verts[t].Add(new Vector3(sum_x , 0, 0));
|
||||
|
Reference in New Issue
Block a user