Răsfoiți Sursa

[as3] Added event volume and balance, see #1171.

badlogic 7 ani în urmă
părinte
comite
e496bdd6c1

+ 1 - 1
examples/export/runtimes.sh

@@ -248,7 +248,7 @@ cp -f ../raptor/export/raptor-pro.json ../../spine-starling/spine-starling-examp
 cp -f ../raptor/export/raptor.atlas ../../spine-starling/spine-starling-example/src/
 cp -f ../raptor/export/raptor.atlas ../../spine-starling/spine-starling-example/src/
 cp -f ../raptor/export/raptor.png ../../spine-starling/spine-starling-example/src/
 cp -f ../raptor/export/raptor.png ../../spine-starling/spine-starling-example/src/
 
 
-cp -f ../spineboy/export/spineboy-ess.json ../../spine-starling/spine-starling-example/src/
+cp -f ../spineboy/export/spineboy-pro.json ../../spine-starling/spine-starling-example/src/
 cp -f ../spineboy/export/spineboy.atlas ../../spine-starling/spine-starling-example/src/
 cp -f ../spineboy/export/spineboy.atlas ../../spine-starling/spine-starling-example/src/
 cp -f ../spineboy/export/spineboy.png ../../spine-starling/spine-starling-example/src/
 cp -f ../spineboy/export/spineboy.png ../../spine-starling/spine-starling-example/src/
 
 

BIN
spine-as3/spine-as3-example/lib/spine-as3.swc


+ 2 - 0
spine-as3/spine-as3/src/spine/Event.as

@@ -35,6 +35,8 @@ package spine {
 		public var intValue : int;
 		public var intValue : int;
 		public var floatValue : Number;
 		public var floatValue : Number;
 		public var stringValue : String;
 		public var stringValue : String;
+		public var volume: Number = 1;
+		public var balance: Number = 0;
 
 
 		public function Event(time : Number, data : EventData) {
 		public function Event(time : Number, data : EventData) {
 			if (data == null) throw new ArgumentError("data cannot be null.");
 			if (data == null) throw new ArgumentError("data cannot be null.");

+ 4 - 2
spine-as3/spine-as3/src/spine/EventData.as

@@ -31,10 +31,12 @@
 package spine {
 package spine {
 	public class EventData {
 	public class EventData {
 		internal var _name : String;
 		internal var _name : String;
-		public var intValue : int;
-		;
+		public var intValue : int;		
 		public var floatValue : Number;
 		public var floatValue : Number;
 		public var stringValue : String;
 		public var stringValue : String;
+		public var audioPath: String;
+		public var volume: Number = 1;
+		public var balance: Number = 0;
 
 
 		public function EventData(name : String) {
 		public function EventData(name : String) {
 			if (name == null) throw new ArgumentError("name cannot be null.");
 			if (name == null) throw new ArgumentError("name cannot be null.");

+ 9 - 0
spine-as3/spine-as3/src/spine/SkeletonJson.as

@@ -266,6 +266,11 @@ package spine {
 					eventData.intValue = eventMap["int"] || 0;
 					eventData.intValue = eventMap["int"] || 0;
 					eventData.floatValue = eventMap["float"] || 0;
 					eventData.floatValue = eventMap["float"] || 0;
 					eventData.stringValue = eventMap["string"] || "";
 					eventData.stringValue = eventMap["string"] || "";
+					eventData.audioPath = eventMap["audio"] || null;
+					if (eventData.audioPath != null) {
+						eventData.volume = eventMap["volume"] || 1;
+						eventData.balance = eventMap["balance"] || 0;
+					}
 					skeletonData.events.push(eventData);
 					skeletonData.events.push(eventData);
 				}
 				}
 			}
 			}
@@ -714,6 +719,10 @@ package spine {
 					event.intValue = eventMap.hasOwnProperty("int") ? eventMap["int"] : eventData.intValue;
 					event.intValue = eventMap.hasOwnProperty("int") ? eventMap["int"] : eventData.intValue;
 					event.floatValue = eventMap.hasOwnProperty("float") ? eventMap["float"] : eventData.floatValue;
 					event.floatValue = eventMap.hasOwnProperty("float") ? eventMap["float"] : eventData.floatValue;
 					event.stringValue = eventMap.hasOwnProperty("string") ? eventMap["string"] : eventData.stringValue;
 					event.stringValue = eventMap.hasOwnProperty("string") ? eventMap["string"] : eventData.stringValue;
+					if (eventData.audioPath != null) {
+						event.volume = eventMap.hasOwnProperty("volume") ? eventMap["volume"] : 1;
+						event.balance = eventMap.hasOwnProperty("balance") ? eventMap["balance"] : 0;
+					}
 					eventTimeline.setFrame(frameIndex++, event);
 					eventTimeline.setFrame(frameIndex++, event);
 				}
 				}
 				timelines[timelines.length] = eventTimeline;
 				timelines[timelines.length] = eventTimeline;

BIN
spine-starling/spine-starling-example/lib/spine-as3.swc


+ 4 - 3
spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as

@@ -50,7 +50,7 @@ package spine.examples {
 	import starling.events.TouchPhase;
 	import starling.events.TouchPhase;
 
 
 	public class SpineboyExample extends Sprite {
 	public class SpineboyExample extends Sprite {
-		[Embed(source = "/spineboy-ess.json", mimeType = "application/octet-stream")]
+		[Embed(source = "/spineboy-pro.json", mimeType = "application/octet-stream")]
 		static public const SpineboyJson : Class;
 		static public const SpineboyJson : Class;
 
 
 		[Embed(source = "/spineboy.atlas", mimeType = "application/octet-stream")]
 		[Embed(source = "/spineboy.atlas", mimeType = "application/octet-stream")]
@@ -94,11 +94,12 @@ package spine.examples {
 				trace(entry.trackIndex + " dispose: " + entry.animation.name);
 				trace(entry.trackIndex + " dispose: " + entry.animation.name);
 			});
 			});
 			skeleton.state.onEvent.add(function(entry : TrackEntry, event : Event) : void {
 			skeleton.state.onEvent.add(function(entry : TrackEntry, event : Event) : void {
-				trace(entry.trackIndex + " event: " + entry.animation.name + ", " + event.data.name + ": " + event.intValue + ", " + event.floatValue + ", " + event.stringValue);
+				trace(entry.trackIndex + " event: " + entry.animation.name + ", " + event.data.name + ": " + event.intValue + ", " + event.floatValue + ", " + event.stringValue + ", " + event.volume + ", " + event.balance);
 			});
 			});
 
 
 			skeleton.skeleton.setToSetupPose();
 			skeleton.skeleton.setToSetupPose();
-			skeleton.state.setAnimationByName(0, "run", true);
+			skeleton.state.setAnimationByName(0, "walk", true);
+			skeleton.state.addAnimationByName(0, "run", true, 2);
 			skeleton.state.addAnimationByName(0, "jump", false, 3);
 			skeleton.state.addAnimationByName(0, "jump", false, 3);
 			skeleton.state.addAnimationByName(0, "run", true, 0);
 			skeleton.state.addAnimationByName(0, "run", true, 0);
 
 

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
spine-starling/spine-starling-example/src/spineboy-ess.json


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
spine-starling/spine-starling-example/src/spineboy-pro.json


BIN
spine-starling/spine-starling/lib/spine-as3.swc


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff