/*
* pettanR peta.apps.js
- * version 0.5.6
+ * version 0.5.7
*
* author:
* itozyun
function getPanelElementByTiming(){
var i, l = panelElementArray.length;
- while( timing < l * 2){
+ while( timing < l * 2 ){
for( i=0; i<l; ++i ){
if( timing === panelElementArray[ i ].timing ){
+ // console.log( timing + ' , ' + panelElementArray[ i ].timing );
++timing;
return panelElementArray[ i ];
};
'}'
].join( '');
};
- function imageToJson( _imageElement ){
+ function imageToJson( _imageElement, _timing ){
var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
return [
'{', cr,
'"picture_id": ', _imageElement.resourcePicture().id, ',', cr,
'"x": ', _imageElement.x, ',', cr,
'"y": ', _imageElement.y, ',', cr,
- '"z": ', _imageElement.z, ',', cr,
- '"t": ', timing, ',', cr,
+ '"z": ', _imageElement.z + 1, ',', cr,
+ '"t": ', _timing, ',', cr,
'"width": ', _imageElement.flipH() * _imageElement.w, ',', cr,
'"height": ', _imageElement.flipV() * _imageElement.h, cr,
'}'
].join( '');
};
- function balloonToJson( _textElement ){
+ function balloonToJson( _textElement, _timing ){
var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
return [
'{', cr,
'"tail": ', _textElement.angle(), ',', cr,
'"x": ', _textElement.x, ',', cr,
'"y": ', _textElement.y, ',', cr,
- '"z": ', _textElement.z, ',', cr,
- '"t": ', timing, ',', cr,
+ '"z": ', _textElement.z + 1, ',', cr,
+ '"t": ', _timing, ',', cr,
'"width": ', _textElement.w, ',', cr,
'"height": ', _textElement.h, ',', cr,
'"speeches_attributes": {', cr,
IMAGE_ARRAY = [],
BALLOON_ARRAY = [],
l = panelElementArray.length,
- _panelElement,
+ _panelElement, n,
cr = pettanr.LINE_FEED_CODE_TEXTAREA;
while( IMAGE_ARRAY.length + BALLOON_ARRAY.length <= l ){
_panelElement = getPanelElementByTiming();
if( _panelElement === null) break;
+ n = IMAGE_ARRAY.length + BALLOON_ARRAY.length;
_panelElement.type === 0 ?
- IMAGE_ARRAY.push( [ '"new', timing, '": ', imageToJson( _panelElement ) ].join( '' ) ) :
- BALLOON_ARRAY.push( [ '"new', timing, '": ', balloonToJson( _panelElement ) ].join( '' ) );
+ IMAGE_ARRAY.push( [ '"new', n, '": ', imageToJson( _panelElement, n ) ].join( '' ) ) :
+ BALLOON_ARRAY.push( [ '"new', n, '": ', balloonToJson( _panelElement, n ) ].join( '' ) );
};
return [
'{', cr,
// '"picture_id": 1,', cr,
'"x": ', 0, ',', cr,
'"y": ', 0, ',', cr,
- '"z": ', 0, ',', cr,
+ '"z": ', 1, ',', cr,
// '"t": ', panelTimming, ',', cr,
'"panel_pictures_attributes": {', cr,
IMAGE_ARRAY.join( ',' + cr ), cr,
// '"picture_id": 1,', cr,
'"x": ', 0, ',', cr,
'"y": ', 0, ',', cr,
- '"z": ', 0, ',', cr,
+ '"z": ', 1, ',', cr,
// panelTimming !== -1 ? ( '"t": ' + panelTimming + ',' + cr ) : '',
'"width": ', panelW, ',', cr,
'"height": ', panelH, ',', cr,