From 525ba52a6ca8193176db8cec445357b77b13ff81 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 13 Jan 2014 18:09:48 +0100 Subject: [PATCH] Removed constants. Constants weren't used for all names found the in the JSON, no point in doing it only for a few. --- spine-csharp/src/SkeletonJson.cs | 19 +++++-------------- spine-lua/SkeletonJson.lua | 16 +++++----------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/spine-csharp/src/SkeletonJson.cs b/spine-csharp/src/SkeletonJson.cs index 52993e8d0..0c414bc17 100644 --- a/spine-csharp/src/SkeletonJson.cs +++ b/spine-csharp/src/SkeletonJson.cs @@ -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 timelineEntry in timelineMap) { var values = (List)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 timelineEntry in timelineMap) { var values = (List)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; diff --git a/spine-lua/SkeletonJson.lua b/spine-lua/SkeletonJson.lua index ea3e62dcb..c1b1e06b8 100755 --- a/spine-lua/SkeletonJson.lua +++ b/spine-lua/SkeletonJson.lua @@ -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