Permalink
Browse files

Particle Developでのsubmoduleでの取り込みをやめたため、必要なクラスの書き出しを少し増やした。

  • Loading branch information...
ics-nohara committed Feb 26, 2016
1 parent c00b64d commit 100548447507d9b9ad65339aaa178ff64ccc9d3d
View
Binary file not shown.
@@ -0,0 +1,36 @@
/**
* Created by nyamogera on 2016/01/20.
*/
function exportAssets() {
var pathArr = fl.getDocumentDOM().pathURI.split("/");
var flaName = pathArr.pop();
pathArr.pop();
var exportClassPath = pathArr.join("/");
var exportShapeClassPath = exportClassPath + "/core/app/assets/";
var exportShapeDataClassPath = exportClassPath + "/core/app/data/";
var exportPNGPath = pathArr.join("/");
exportPNGPath = exportPNGPath + "/core/images/shape/";
fl.trace(exportPNGPath);
var assetList = new Array();
var assetHash = "";
var lib = fl.getDocumentDOM().library;
var i = 0;
for (var i = 0; i < lib.items.length; i++) {
var o = lib.items[i];
var name_1 = o.name.replace("assets/", "");
if (o.itemType == "movie clip") {
var pngPath = exportPNGPath + name_1 + ".png";
o.exportToPNGSequence(pngPath);
assetHash += " this.shapeObjects[\"" + name_1 + "\"] = lib." + name_1 + "\n";
assetList.push("\"" + name_1 + "\"");
}
}
var date = new Date().toDateString();
var assetArrayString = "[" + assetList.join(",") + "]";
var generatingClass = "/**\n * Created by \u300C" + flaName + "\u300D/\u300Cgenerate-assets.jsfl\u300D on " + date + "\n * !!!!!\u3053\u306E\u30B3\u30FC\u30C9\u306FJSFL\u304B\u3089\u81EA\u52D5\u751F\u6210\u3055\u308C\u305F\u30B3\u30FC\u30C9\u3067\u3059\u3002\u4FEE\u6B63\u3059\u308B\u5834\u5408\u306F\u3054\u6CE8\u610F\u304F\u3060\u3055\u3044\u3002!!!!!\n */\n\nexport class ShapeGenerator {\n shapeObjects:Object;\n\n constructor () {\n this.shapeObjects = new Object();\n" + assetHash + "\n }\n\n generateShape(id:string) {\n return new this.shapeObjects[id]();\n }\n}";
FLfile.write(exportShapeClassPath + "shape-generator.ts", generatingClass);
var generatingDataClass = "/**\n * Created by \u300C" + flaName + "\u300D/\u300Cgenerate-assets.jsfl\u300D on " + date + "\n * !!!!!\u3053\u306E\u30B3\u30FC\u30C9\u306FJSFL\u304B\u3089\u81EA\u52D5\u751F\u6210\u3055\u308C\u305F\u30B3\u30FC\u30C9\u3067\u3059\u3002\u4FEE\u6B63\u3059\u308B\u5834\u5408\u306F\u3054\u6CE8\u610F\u304F\u3060\u3055\u3044\u3002!!!!!\n */\n\nexport class ShapeData {\n public assetList:string[];\n\n constructor () {\n this.assetList = " + assetArrayString + ";\n }\n}";
FLfile.write(exportShapeDataClassPath + "data-shape.ts", generatingDataClass);
}
exportAssets();
//# sourceMappingURL=generate-assets.js.map
View
@@ -0,0 +1,84 @@
declare class fl{
public static trace(str:string) : void;
public static getDocumentDOM() : any;
}
declare class FLfile{
public static write(path:string,value:string):void;
}
/**
* Created by nyamogera on 2016/01/20.
*/
function exportAssets(){
var pathArr = fl.getDocumentDOM().pathURI.split("/");
let flaName = pathArr.pop();
pathArr.pop();
var exportClassPath = pathArr.join("/");
let exportShapeClassPath = exportClassPath + "/core/app/assets/";
let exportShapeDataClassPath = exportClassPath + "/core/app/data/";
var exportPNGPath = pathArr.join("/");
exportPNGPath = exportPNGPath + "/core/images/shape/";
fl.trace(exportPNGPath);
let assetList:string[] = new Array();
let assetHash:string = "";
var lib = fl.getDocumentDOM().library;
var i=0;
for(var i=0; i<lib.items.length; i++){
let o = lib.items[i];
let name = o.name.replace("assets/","");
if(o.itemType == "movie clip"){
var pngPath = exportPNGPath + name + ".png";
o.exportToPNGSequence( pngPath );
assetHash += ` this.shapeObjects["${name}"] = lib.${name}
`;
assetList.push( `"${name}"` );
}
}
let date = new Date().toDateString();
let assetArrayString = "[" + assetList.join(",") + "]";
let generatingClass = `/**
* Created by 「${flaName}」/「generate-assets.jsfl」 on ${date}
* !!!!!このコードはJSFLから自動生成されたコードです。修正する場合はご注意ください。!!!!!
*/
export class ShapeGenerator {
shapeObjects:Object;
constructor () {
this.shapeObjects = new Object();
${assetHash}
}
generateShape(id:string) {
return new this.shapeObjects[id]();
}
}`
FLfile.write(exportShapeClassPath + "shape-generator.ts", generatingClass );
let generatingDataClass = `/**
* Created by 「${flaName}」/「generate-assets.jsfl」 on ${date}
* !!!!!このコードはJSFLから自動生成されたコードです。修正する場合はご注意ください。!!!!!
*/
export class ShapeData {
public assetList:string[];
constructor () {
this.assetList = ${assetArrayString};
}
}`
FLfile.write(exportShapeDataClassPath + "data-shape.ts", generatingDataClass );
}
exportAssets();
View
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"out": "generate-assets.jsfl",
},
"files": [
"generate-assets.ts"
]
"exclude": [
"node_modules"
]
}
@@ -21,7 +21,7 @@ declare module effects {
/**
* パーティクルの設定データをJson形式のオブジェクトで取り込みます。
*/
importFromJson(jsonObject:any);
importFromJson(jsonObject:any):void;
/**
* パーティクルシステムの更新を行います。
@@ -160,6 +160,16 @@ declare module effects {
}
export class DrawingData {
/** 設定された背景の幅です。 */
width:number;
/** 設定された背景の高さです。 */
height:number;
/** 背景職です。 */
bgColor:string;
/** 1秒あたりの発生数です。 */
emitFrequency:number;
/** 発生基準位置 - X座標 (px)です。 */
@@ -218,6 +228,12 @@ declare module effects {
* @param json
*/
importFromJson(json:any):void;
/**
* データを取り込みます。
* @param json
*/
importData(data:effects.DrawingData):void;
}
/**
@@ -327,4 +343,8 @@ declare module effects {
*/
static TRIANGLE:string;
}
export class ShapeData {
assetList:string[];
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -4,6 +4,7 @@
import {ParticleEmitter} from "./particle/particle-emitter";
import {DrawingData} from "./data/data-drawing";
import {ColorData} from "./data/data-color";
import {ShapeData} from "./data/data-shape";
import {AlphaCurveType} from "./enum/alpha-curve-type";
import {ShapeType} from "./enum/shape-type";
@@ -12,4 +13,5 @@ import {ShapeType} from "./enum/shape-type";
(<any>window).effects.DrawingData = DrawingData;
(<any>window).effects.ColorData = ColorData;
(<any>window).effects.AlphaCurveType = AlphaCurveType;
(<any>window).effects.ShapeType = ShapeType;
(<any>window).effects.ShapeType = ShapeType;
(<any>window).effects.ShapeData = ShapeData;

0 comments on commit 1005484

Please sign in to comment.