static SlotAnimationCollect DecodeSlotAnimationCollect(JSONClass json) { SlotAnimationCollect data = new SlotAnimationCollect(); data.name = json["name"]; JSONArray frames = json["frame"].AsArray; data.frames = new SlotFrameData[frames.Count]; int start = 0; for (int i = 0; i < frames.Count; i++) { JSONClass jd = frames[i].AsObject; SlotFrameData fd = new SlotFrameData(); fd.frameStart = start; fd.duration = TryGetInt(jd, "duration", 1); fd.tweenType = TryGetInt(jd, "tweenType", 0); fd.tweenEasing = TryGetFloat(jd, "tweenEasing", 0); start += fd.duration; JSONArray curve = jd["curve"].AsArray; fd.curve = new Vector2[curve.Count / 2]; for (int j = 0; j < curve.Count; j += 2) { fd.curve[j / 2] = new Vector2(curve[j].AsFloat, curve[j + 1].AsFloat); } fd.displayIndex = TryGetInt(jd, "displayIndex", 0); TryGetColor(jd, ref fd.colorMul, ref fd.colorAdd); data.frames[i] = fd; } return(data); }
internal SlotFrame(int startFrame, SlotFrameData f) { StartFrame = startFrame; DisplayIndex = f.DisplayIndex; ZOrder = f.Z; Color = f.Color; TweenCurve = f.TweenEasing == null ? new NoTweenCurve() : TweenFactory.FromArray(f.TweenCurve); }