Removed constants.

Constants weren't used for all names found the in the JSON, no point in doing it only for a few.
This commit is contained in:
NathanSweet 2014-01-13 18:09:48 +01:00
parent 7c99cbd6d2
commit 525ba52a6c
2 changed files with 10 additions and 25 deletions

View File

@ -37,15 +37,6 @@ using Windows.Storage;
namespace Spine {
public class SkeletonJson {
static public String TIMELINE_SCALE = "scale";
static public String TIMELINE_ROTATE = "rotate";
static public String TIMELINE_TRANSLATE = "translate";
static public String TIMELINE_ATTACHMENT = "attachment";
static public String TIMELINE_COLOR = "color";
static public String ATTACHMENT_REGION = "region";
static public String ATTACHMENT_REGION_SEQUENCE = "regionSequence";
private AttachmentLoader attachmentLoader;
public float Scale { get; set; }
@ -265,7 +256,7 @@ namespace Spine {
foreach (KeyValuePair<String, Object> timelineEntry in timelineMap) {
var values = (List<Object>)timelineEntry.Value;
String timelineName = (String)timelineEntry.Key;
if (timelineName.Equals(TIMELINE_ROTATE)) {
if (timelineName.Equals("rotate")) {
RotateTimeline timeline = new RotateTimeline(values.Count);
timeline.boneIndex = boneIndex;
@ -279,10 +270,10 @@ namespace Spine {
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 2 - 2]);
} else if (timelineName.Equals(TIMELINE_TRANSLATE) || timelineName.Equals(TIMELINE_SCALE)) {
} else if (timelineName.Equals("translate") || timelineName.Equals("scale")) {
TranslateTimeline timeline;
float timelineScale = 1;
if (timelineName.Equals(TIMELINE_SCALE))
if (timelineName.Equals("scale"))
timeline = new ScaleTimeline(values.Count);
else {
timeline = new TranslateTimeline(values.Count);
@ -317,7 +308,7 @@ namespace Spine {
foreach (KeyValuePair<String, Object> timelineEntry in timelineMap) {
var values = (List<Object>)timelineEntry.Value;
String timelineName = (String)timelineEntry.Key;
if (timelineName.Equals(TIMELINE_COLOR)) {
if (timelineName.Equals("color")) {
ColorTimeline timeline = new ColorTimeline(values.Count);
timeline.slotIndex = slotIndex;
@ -332,7 +323,7 @@ namespace Spine {
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 5 - 5]);
} else if (timelineName.Equals(TIMELINE_ATTACHMENT)) {
} else if (timelineName.Equals("attachment")) {
AttachmentTimeline timeline = new AttachmentTimeline(values.Count);
timeline.slotIndex = slotIndex;

View File

@ -36,12 +36,6 @@ local EventData = require "spine-lua.EventData"
local Event = require "spine-lua.Event"
local AttachmentType = require "spine-lua.AttachmentType"
local TIMELINE_SCALE = "scale"
local TIMELINE_ROTATE = "rotate"
local TIMELINE_TRANSLATE = "translate"
local TIMELINE_ATTACHMENT = "attachment"
local TIMELINE_COLOR = "color"
local SkeletonJson = {}
function SkeletonJson.new (attachmentLoader)
if not attachmentLoader then attachmentLoader = AttachmentLoader.new() end
@ -199,7 +193,7 @@ function SkeletonJson.new (attachmentLoader)
if boneIndex == -1 then error("Bone not found: " .. boneName) end
for timelineName,values in pairs(timelineMap) do
if timelineName == TIMELINE_ROTATE then
if timelineName == "rotate" then
local timeline = Animation.RotateTimeline.new()
timeline.boneIndex = boneIndex
@ -213,10 +207,10 @@ function SkeletonJson.new (attachmentLoader)
table.insert(timelines, timeline)
duration = math.max(duration, timeline:getDuration())
elseif timelineName == TIMELINE_TRANSLATE or timelineName == TIMELINE_SCALE then
elseif timelineName == "translate" or timelineName == "scale" then
local timeline
local timelineScale = 1
if timelineName == TIMELINE_SCALE then
if timelineName == "scale" then
timeline = Animation.ScaleTimeline.new()
else
timeline = Animation.TranslateTimeline.new()
@ -249,7 +243,7 @@ function SkeletonJson.new (attachmentLoader)
local slotIndex = skeletonData.slotNameIndices[slotName]
for timelineName,values in pairs(timelineMap) do
if timelineName == TIMELINE_COLOR then
if timelineName == "color" then
local timeline = Animation.ColorTimeline.new()
timeline.slotIndex = slotIndex
@ -270,7 +264,7 @@ function SkeletonJson.new (attachmentLoader)
table.insert(timelines, timeline)
duration = math.max(duration, timeline:getDuration())
elseif timelineName == TIMELINE_ATTACHMENT then
elseif timelineName == "attachment" then
local timeline = Animation.AttachmentTimeline.new()
timeline.slotName = slotName