Skip to content

Commit

Permalink
complete
Browse files Browse the repository at this point in the history
  • Loading branch information
yinqiang committed May 13, 2013
1 parent d758152 commit 58d7e46
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 63 deletions.
106 changes: 53 additions & 53 deletions .actionScriptProperties
@@ -1,53 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="Atf2png.as" projectUUID="bacdd971-679f-4e7d-9556-3121362f5223" version="10">
<compiler additionalCompilerArguments="-locale en_US -swf-version=17" autoRSLOrdering="true" copyDependentFiles="true" flexSDK="Flex 4.6.0 AIR 3.5" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airspark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airframework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Atf2png.as">
<airExcludes/>
</application>
</applications>
<modules/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="" airTimestamp="true" anePathSet="false" version="1">
<airExcludes/>
<anePaths/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
</actionScriptProperties>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="Atf2png.as" projectUUID="bacdd971-679f-4e7d-9556-3121362f5223" version="10">
<compiler additionalCompilerArguments="-locale en_US -swf-version=17" autoRSLOrdering="true" copyDependentFiles="true" flexSDK="Flex 4.6.0 air 3.5" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airspark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airframework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Atf2png.as">
<airExcludes/>
</application>
</applications>
<modules/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="" airTimestamp="true" anePathSet="false" version="1">
<airExcludes/>
<anePaths/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
</actionScriptProperties>
16 changes: 14 additions & 2 deletions src/Atf2png.as
Expand Up @@ -3,19 +3,31 @@ package
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.text.TextField;

import starling.core.Starling;
import starling.core.Starling;

[SWF(width="2048", height="2048")]

public class Atf2png extends Sprite
{
public static var isDebug:Boolean = false;

private var txLog:TextField;
private var mStarling:Starling;

public function Atf2png()
{
if (stage) {
init(null);
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
}
}

private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);

Starling.multitouchEnabled = false;

var viewPort:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
Expand All @@ -26,7 +38,7 @@ package
mStarling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
}

private function onContextCreated(e:Event):void
private function onContextCreated(e:flash.events.Event):void
{
mStarling.start();
}
Expand Down
38 changes: 31 additions & 7 deletions src/Main.as
@@ -1,6 +1,7 @@
package
{
import flash.display.BitmapData;
import flash.events.Event;
import flash.filesystem.File;
import flash.utils.ByteArray;

Expand All @@ -10,18 +11,39 @@ package
import starling.core.Starling;
import starling.display.Image;
import starling.display.Sprite;
import starling.textures.Texture;
import starling.text.TextField;
import starling.textures.Texture;

public class Main extends Sprite
{
private var img:Image;
private var curFileName:String;
private var files:Array;
private var index:int;
private var inportDir:File;
private var exportDir:File;

public function Main()
{
files = File.applicationDirectory.resolvePath('atfs').getDirectoryListing();
inportDir = new File();
inportDir.addEventListener(Event.SELECT, onInportDirSelected);
inportDir.browseForDirectory("导入");
}

private function onInportDirSelected(e:Event):void {
exportDir = new File();
exportDir.addEventListener(Event.SELECT, onExportDirSelected);
exportDir.browseForDirectory("导出");
}

private function onExportDirSelected(e:Event):void {
files = inportDir.getDirectoryListing();
for (var i:int=0; i<files.length; i++) {
if (String(files[i].type).toLowerCase() != '.atf') {
files.splice(i, 1);
i--;
}
}
index = 0;
loadFile(index);
}
Expand Down Expand Up @@ -55,16 +77,18 @@ package

Starling.context.drawToBitmapData(bd);
Starling.context.present();
var f:File = File.desktopDirectory.resolvePath('pngs/' + curFileName + '.png');
FileUtil.savePNGFile(bd, f);
trace('>', curFileName + '.png');
var file:File = exportDir.resolvePath(curFileName + '.png');
FileUtil.savePNGFile(bd, file);
trace('>', file.name);
} catch (e:Error) {
trace('!', curFileName);
trace('!', e);
}
index ++;
if (index == files.length) {
trace('done');

removeChildren();
var tx:TextField = new TextField(300, 50, "全部完成", "微软雅黑", 30, 0, true);
addChild(tx);
} else {
loadFile(index);
}
Expand Down
2 changes: 1 addition & 1 deletion src/polly/atf2png/FileUtil.as
Expand Up @@ -81,7 +81,7 @@ package polly.atf2png
}

var bytes:ByteArray = new ByteArray();
// bytes.endian = Endian.LITTLE_ENDIAN;
bytes.endian = Endian.LITTLE_ENDIAN;
var fs:FileStream = new FileStream();
fs.open(file, FileMode.READ);
fs.readBytes(bytes);
Expand Down

9 comments on commit 58d7e46

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Oct 29, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Oct 29, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Oct 29, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Dec 6, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinqiang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I send Atf2png.air. You can try.

@yinqiang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you ! :-)
I'm commit a new branch(develop-atf0.6) for compatible ATF v6

@yinqiang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, xenocracy!

atf v0.6 depend on Game SDK 1.2+
I'm upgrade FlashBuilder to 4.7, and push all change to master branch
And alliance0.atf tested! :-)

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Dec 18, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinqiang
Copy link
Owner

@yinqiang yinqiang commented on 58d7e46 Dec 19, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.