Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
superlancelot committed Jun 27, 2014
2 parents 077b96b + 8b72d19 commit 155c3cb
Show file tree
Hide file tree
Showing 33 changed files with 3,555 additions and 1,854 deletions.
Binary file modified ASLibraryDemos/assets/Cyborg_AnimationMixing.dbswf
Binary file not shown.
Binary file added ASLibraryDemos/assets/Robot.dbswf
Binary file not shown.
Binary file removed ASLibraryDemos/assets/Robot_output.swf
Binary file not shown.
Binary file added ASLibraryDemos/assets/SpringBrother.dbswf
Binary file not shown.
1,638 changes: 1,049 additions & 589 deletions ASLibraryDemos/assets/Warrior_output/skeleton.xml

Large diffs are not rendered by default.

Binary file modified ASLibraryDemos/assets/Warrior_output/texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions ASLibraryDemos/assets/Warrior_output/texture.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<TextureAtlas name="Warrior" width="512" height="512">
<SubTexture name="warriorFolder/outerarm_upper" width="71" height="110" x="41" y="144"/>
<SubTexture name="warriorFolder/outerarm_lower" width="61" height="81" x="449" y="0"/>
<SubTexture name="warriorFolder/outerarm_hand" width="44" height="45" x="449" y="127"/>
<SubTexture name="warriorFolder/lowerbody" width="106" height="126" x="247" y="0"/>
<SubTexture name="warriorFolder/outerleg_foot" width="86" height="60" x="379" y="229"/>
<SubTexture name="warriorFolder/outerleg_lower" width="66" height="125" x="311" y="131"/>
<SubTexture name="warriorFolder/outerleg_upper" width="109" height="142" x="41" y="0"/>
<SubTexture name="warriorFolder/upperbody" width="92" height="129" x="355" y="0"/>
<SubTexture name="warriorFolder/head" width="65" height="96" x="379" y="131"/>
<SubTexture name="warriorFolder/innerleg_foot" width="86" height="58" x="114" y="250"/>
<SubTexture name="warriorFolder/innerleg_lower" width="62" height="131" x="247" y="128"/>
<SubTexture name="warriorFolder/innerleg_upper" width="93" height="153" x="152" y="0"/>
<SubTexture name="warriorFolder/innerweapon" width="39" height="333" x="0" y="0"/>
<SubTexture name="warriorFolder/innerarm_upper" width="75" height="93" x="114" y="155"/>
<SubTexture name="warriorFolder/innerarm_lower" width="80" height="57" x="202" y="261"/>
<SubTexture name="warriorFolder/innerarm_hand" width="47" height="42" x="449" y="83"/>
<TextureAtlas name="Warrior" imagePath="texture.png">
<SubTexture name="warriorFolder/outerarm_upper" x="312" y="130" width="71" height="110"/>
<SubTexture name="warriorFolder/outerarm_lower" x="385" y="227" width="61" height="81"/>
<SubTexture name="warriorFolder/outerarm_hand" x="193" y="155" width="44" height="45"/>
<SubTexture name="warriorFolder/lowerbody" x="244" y="0" width="106" height="126"/>
<SubTexture name="warriorFolder/outerleg_foot" x="106" y="155" width="86" height="60"/>
<SubTexture name="warriorFolder/outerleg_lower" x="244" y="127" width="66" height="125"/>
<SubTexture name="warriorFolder/outerleg_upper" x="40" y="0" width="109" height="142"/>
<SubTexture name="warriorFolder/upperbody" x="351" y="0" width="92" height="129"/>
<SubTexture name="warriorFolder/head" x="40" y="144" width="65" height="96"/>
<SubTexture name="warriorFolder/innerleg_foot" x="106" y="216" width="86" height="58"/>
<SubTexture name="warriorFolder/innerleg_lower" x="444" y="0" width="62" height="131"/>
<SubTexture name="warriorFolder/innerleg_upper" x="150" y="0" width="93" height="153"/>
<SubTexture name="warriorFolder/innerweapon" x="0" y="0" width="39" height="333"/>
<SubTexture name="warriorFolder/innerarm_upper" x="433" y="132" width="75" height="93"/>
<SubTexture name="warriorFolder/innerarm_lower" x="193" y="253" width="80" height="57"/>
<SubTexture name="warriorFolder/innerarm_hand" x="385" y="130" width="47" height="42"/>
</TextureAtlas>
Binary file modified ASLibraryDemos/assets/Warrior_output/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions ASLibraryDemos/assets/Warrior_output/[email protected]
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<TextureAtlas name="Warrior" width="128" height="128">
<SubTexture name="warriorFolder/outerarm_upper" width="22" height="33" x="78" y="81"/>
<SubTexture name="warriorFolder/outerarm_lower" width="19" height="25" x="57" y="79"/>
<SubTexture name="warriorFolder/outerarm_hand" width="14" height="14" x="109" y="55"/>
<SubTexture name="warriorFolder/lowerbody" width="32" height="38" x="79" y="0"/>
<SubTexture name="warriorFolder/outerleg_foot" width="26" height="18" x="14" y="88"/>
<SubTexture name="warriorFolder/outerleg_lower" width="20" height="38" x="35" y="48"/>
<SubTexture name="warriorFolder/outerleg_upper" width="33" height="43" x="14" y="0"/>
<SubTexture name="warriorFolder/upperbody" width="28" height="39" x="79" y="40"/>
<SubTexture name="warriorFolder/head" width="20" height="29" x="57" y="48"/>
<SubTexture name="warriorFolder/innerleg_foot" width="26" height="18" x="42" y="106"/>
<SubTexture name="warriorFolder/innerleg_lower" width="19" height="40" x="14" y="45"/>
<SubTexture name="warriorFolder/innerleg_upper" width="28" height="46" x="49" y="0"/>
<SubTexture name="warriorFolder/innerweapon" width="12" height="100" x="0" y="0"/>
<SubTexture name="warriorFolder/innerarm_upper" width="23" height="28" x="102" y="81"/>
<SubTexture name="warriorFolder/innerarm_lower" width="24" height="18" x="0" y="108"/>
<SubTexture name="warriorFolder/innerarm_hand" width="15" height="13" x="109" y="40"/>
<TextureAtlas name="Warrior" imagePath="texture.png">
<SubTexture name="warriorFolder/outerarm_upper" x="78" y="81" width="22" height="33"/>
<SubTexture name="warriorFolder/outerarm_lower" x="57" y="79" width="19" height="25"/>
<SubTexture name="warriorFolder/outerarm_hand" x="109" y="55" width="14" height="14"/>
<SubTexture name="warriorFolder/lowerbody" x="79" y="0" width="32" height="38"/>
<SubTexture name="warriorFolder/outerleg_foot" x="42" y="106" width="26" height="18"/>
<SubTexture name="warriorFolder/outerleg_lower" x="35" y="48" width="20" height="38"/>
<SubTexture name="warriorFolder/outerleg_upper" x="14" y="0" width="33" height="43"/>
<SubTexture name="warriorFolder/upperbody" x="79" y="40" width="28" height="39"/>
<SubTexture name="warriorFolder/head" x="57" y="48" width="20" height="29"/>
<SubTexture name="warriorFolder/innerleg_foot" x="14" y="88" width="26" height="18"/>
<SubTexture name="warriorFolder/innerleg_lower" x="14" y="45" width="19" height="40"/>
<SubTexture name="warriorFolder/innerleg_upper" x="49" y="0" width="28" height="46"/>
<SubTexture name="warriorFolder/innerweapon" x="0" y="0" width="12" height="100"/>
<SubTexture name="warriorFolder/innerarm_upper" x="102" y="81" width="23" height="28"/>
<SubTexture name="warriorFolder/innerarm_lower" x="0" y="108" width="24" height="18"/>
<SubTexture name="warriorFolder/innerarm_hand" x="109" y="40" width="15" height="13"/>
</TextureAtlas>
Binary file modified ASLibraryDemos/assets/Warrior_output/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ASLibraryDemos/assets/Warrior_output/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions ASLibraryDemos/assets/Warrior_output/[email protected]
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<TextureAtlas name="Warrior" width="1024" height="1024">
<SubTexture name="warriorFolder/outerarm_upper" width="142" height="220" x="622" y="260"/>
<SubTexture name="warriorFolder/outerarm_lower" width="122" height="162" x="766" y="452"/>
<SubTexture name="warriorFolder/outerarm_hand" width="88" height="90" x="386" y="308"/>
<SubTexture name="warriorFolder/lowerbody" width="212" height="252" x="488" y="0"/>
<SubTexture name="warriorFolder/outerleg_foot" width="172" height="120" x="212" y="308"/>
<SubTexture name="warriorFolder/outerleg_lower" width="132" height="250" x="488" y="254"/>
<SubTexture name="warriorFolder/outerleg_upper" width="218" height="284" x="80" y="0"/>
<SubTexture name="warriorFolder/upperbody" width="184" height="258" x="702" y="0"/>
<SubTexture name="warriorFolder/head" width="130" height="192" x="80" y="286"/>
<SubTexture name="warriorFolder/innerleg_foot" width="172" height="116" x="212" y="430"/>
<SubTexture name="warriorFolder/innerleg_lower" width="124" height="262" x="888" y="0"/>
<SubTexture name="warriorFolder/innerleg_upper" width="186" height="306" x="300" y="0"/>
<SubTexture name="warriorFolder/innerweapon" width="78" height="666" x="0" y="0"/>
<SubTexture name="warriorFolder/innerarm_upper" width="150" height="186" x="862" y="264"/>
<SubTexture name="warriorFolder/innerarm_lower" width="160" height="114" x="386" y="506"/>
<SubTexture name="warriorFolder/innerarm_hand" width="94" height="84" x="766" y="260"/>
<TextureAtlas name="Warrior" imagePath="texture.png">
<SubTexture name="warriorFolder/outerarm_upper" x="622" y="260" width="142" height="220"/>
<SubTexture name="warriorFolder/outerarm_lower" x="766" y="452" width="122" height="162"/>
<SubTexture name="warriorFolder/outerarm_hand" x="386" y="308" width="88" height="90"/>
<SubTexture name="warriorFolder/lowerbody" x="488" y="0" width="212" height="252"/>
<SubTexture name="warriorFolder/outerleg_foot" x="212" y="308" width="172" height="120"/>
<SubTexture name="warriorFolder/outerleg_lower" x="488" y="254" width="132" height="250"/>
<SubTexture name="warriorFolder/outerleg_upper" x="80" y="0" width="218" height="284"/>
<SubTexture name="warriorFolder/upperbody" x="702" y="0" width="184" height="258"/>
<SubTexture name="warriorFolder/head" x="80" y="286" width="130" height="192"/>
<SubTexture name="warriorFolder/innerleg_foot" x="212" y="430" width="172" height="116"/>
<SubTexture name="warriorFolder/innerleg_lower" x="888" y="0" width="124" height="262"/>
<SubTexture name="warriorFolder/innerleg_upper" x="300" y="0" width="186" height="306"/>
<SubTexture name="warriorFolder/innerweapon" x="0" y="0" width="78" height="666"/>
<SubTexture name="warriorFolder/innerarm_upper" x="862" y="264" width="150" height="186"/>
<SubTexture name="warriorFolder/innerarm_lower" x="386" y="506" width="160" height="114"/>
<SubTexture name="warriorFolder/innerarm_hand" x="766" y="260" width="94" height="84"/>
</TextureAtlas>
Binary file modified ASLibraryDemos/assets/Zombie_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ASLibraryDemos/libs/feathers.swc
Binary file not shown.
Binary file modified ASLibraryDemos/libs/starling.swc
Binary file not shown.
198 changes: 198 additions & 0 deletions ASLibraryDemos/src/CPU_Warrior_MultiResolution.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;

import dragonBones.Armature;
import dragonBones.animation.WorldClock;
import dragonBones.factorys.NativeFactory;
import dragonBones.factorys.StarlingFactory;
import dragonBones.objects.SkeletonData;
import dragonBones.objects.XMLDataParser;
import dragonBones.textures.NativeTextureAtlas;
import dragonBones.textures.StarlingTextureAtlas;

/**
* 模块功能:
* 修改时间:2014-2-24 下午5:13:28
* 程序编制:Rich.Lee
*
*/
public class CPU_Warrior_MultiResolution extends Sprite
{

[Embed(source = "../assets/Warrior_output/skeleton.xml", mimeType = "application/octet-stream")]
public static const WarriorSkeletonXMLData:Class;

[Embed(source = "../assets/Warrior_output/[email protected]", mimeType = "application/octet-stream")]
public static const WarriorTextureHDXMLData:Class;

[Embed(source = "../assets/Warrior_output/texture.xml", mimeType = "application/octet-stream")]
public static const WarriorTextureSDXMLData:Class;

[Embed(source = "../assets/Warrior_output/[email protected]", mimeType = "application/octet-stream")]
public static const WarriorTextureSD2XMLData:Class;

[Embed(source = "../assets/Warrior_output/[email protected]")]
public static const WarriorTextureHDData:Class;

[Embed(source = "../assets/Warrior_output/texture.png")]
public static const WarriorTextureSDData:Class;

[Embed(source = "../assets/Warrior_output/[email protected]")]
public static const WarriorTextureSD1Data:Class;

[Embed(source = "../assets/Warrior_output/[email protected]")]
public static const WarriorTextureSD2Data:Class;

public static var instance:CPU_Warrior_MultiResolution;

private var factory:NativeFactory;
private var armatures:Vector.<Armature>;
private var currentAnimationIndex:int = 0;
private var textField:TextField;

public function CPU_Warrior_MultiResolution()
{
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}

private function onAddedToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 60;
//stage.addChild(new FPS());

stage.addEventListener(MouseEvent.CLICK, onStageClick);

instance = this;

armatures = new Vector.<Armature>;

factory = new NativeFactory();
factory.fillBitmapSmooth = true;

//skeletonData
var skeletonData:SkeletonData = XMLDataParser.parseSkeletonData(XML(new WarriorSkeletonXMLData()));
factory.addSkeletonData(skeletonData, "warrior");

// var textureAtlas:TextureAtlas;
//
// //contentScaleFactor == 2
// //HD 2x(use different textureXML 2x)
// //高清贴图,由面板导出时设置scale为2输出,textureXML与texture对应
// textureAtlas = new StarlingTextureAtlas(Texture.fromBitmapData(new WarriorTextureHDData().bitmapData, false, false, 2), XML(new WarriorTextureHDXMLData()), true);
// /*
// textureAtlas = new TextureAtlas(
// Texture.fromBitmapData(new WarriorTextureHDData().bitmapData, false, false, 2),
// XML(new WarriorTextureHDXMLData())
// );
// */
// factory.addTextureAtlas(textureAtlas, "warriorHD");
//
// //contentScaleFactor == 1
// //SD 1x
// //标准贴图,由面板导出时设置scale为1输出,textureXML与texture对应
// textureAtlas = new StarlingTextureAtlas(Texture.fromBitmapData(new WarriorTextureSDData().bitmapData, false, false, 1), XML(new WarriorTextureSDXMLData()), false);
// factory.addTextureAtlas(textureAtlas, "warriorSD");
//
// //contentScaleFactor == 0.5
// //SD1 0.5x(use same textureXML 1x)
// //缩放为0.5的贴图,由1x的texture缩放直接缩放得到,使用1x的textureXML
// textureAtlas = new StarlingTextureAtlas(Texture.fromBitmapData(new WarriorTextureSD1Data().bitmapData, false, false, 0.5), XML(new WarriorTextureSDXMLData()), false);
// factory.addTextureAtlas(textureAtlas, "warriorSD1");
//
// //contentScaleFactor == 0.3
// //SD2 0.3x(use different textureXML 0.3x)
// //缩放为0.3的贴图,由面板导出时设置scale为0.3输出,textureXML与texture对应
//
// /*textureAtlas = new StarlingTextureAtlas(
// Texture.fromBitmapData(new WarriorTextureSD2Data().bitmapData, false, false, 0.3),
// XML(new WarriorTextureSD2XMLData()),
// true
// );*/
// textureAtlas = new TextureAtlas(Texture.fromBitmapData(new WarriorTextureSD2Data().bitmapData, false, false, 0.3), XML(new WarriorTextureSD2XMLData()));
//
// factory.addTextureAtlas(textureAtlas, "warriorSD2");

factory.addTextureAtlas(new NativeTextureAtlas(new WarriorTextureHDData().bitmapData, XML(new WarriorTextureHDXMLData()), 2, true), "warriorHD");
factory.addTextureAtlas(new NativeTextureAtlas(new WarriorTextureSDData().bitmapData, XML(new WarriorTextureSDXMLData()), 1, false), "warriorSD");
factory.addTextureAtlas(new NativeTextureAtlas(new WarriorTextureSD1Data().bitmapData, XML(new WarriorTextureSDXMLData()), 0.5, false), "warriorSD1");
factory.addTextureAtlas(new NativeTextureAtlas(new WarriorTextureSD2Data().bitmapData, XML(new WarriorTextureSD2XMLData()), 0.3, true), "warriorSD2");

//
var armature:Armature;

armature = factory.buildArmature("warrior", null, "warrior", "warriorHD");
armature.display.x = 150;
armature.display.y = 300;
//armature.display.scaleX = armature.display.scaleY = 0.3;
addChild(armature.display as Sprite);
WorldClock.clock.add(armature);
armatures.push(armature);

armature = factory.buildArmature("warrior", null, "warrior", "warriorSD");
armature.display.x = 300;
armature.display.y = 300;
//armature.display.scaleX = armature.display.scaleY = 0.3;
addChild(armature.display as Sprite);
WorldClock.clock.add(armature);
armatures.push(armature);

armature = factory.buildArmature("warrior", null, "warrior", "warriorSD1");
armature.display.x = 450;
armature.display.y = 300;
//armature.display.scaleX = armature.display.scaleY = 0.5;
addChild(armature.display as Sprite);
WorldClock.clock.add(armature);
armatures.push(armature);

armature = factory.buildArmature("warrior", null, "warrior", "warriorSD2");
armature.display.x = 600;
armature.display.y = 300;
addChild(armature.display as Sprite);
WorldClock.clock.add(armature);
armatures.push(armature);

changeAnimation();

addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);

textField = new TextField();
textField.width = 700;
textField.height = 50;
textField.text = "Multi-Resolution support. Click mouse to switch animation\nHD SD SD1 SD2", "Verdana";
textField.x = 75;
textField.y = 5;
addChild(textField);
}

public function changeAnimation():void
{
var armature:Armature = armatures[0];
var _animationName:String = armature.animation.animationList[currentAnimationIndex % armature.animation.animationList.length];
for each (armature in armatures)
{
armature.animation.gotoAndPlay(_animationName);
}
currentAnimationIndex++;
}

private function onEnterFrameHandler(_e:Event):void
{

WorldClock.clock.advanceTime(-1);
}

private function onStageClick(event:MouseEvent):void
{
changeAnimation();
}
}
}
Loading

0 comments on commit 155c3cb

Please sign in to comment.