@@ -361,25 +361,25 @@ angular.module('workspace').controller("WorkspaceController",
361361
362362 try {
363363 myProject . saveProject ( filePath , function ( e , project_name ) {
364+ $scope . isNowSaving = false ;
364365 if ( e ) {
365366 $scope . doPopupControl ( {
366367 'type' :'hide'
367368 } ) ;
368369 $scope . doPopupControl ( {
369370 'type' :'fail' ,
370371 'msg' : Lang . Workspace . saving_fail_msg
371- } ) ;
372- $scope . isNowSaving = false ;
372+ } ) ;
373+ } else {
374+ Entry . stateManager . addStamp ( ) ;
375+ myProject . isSaved = true ;
376+ myProject . isSavedPath = filePath ;
377+ Entry . toast . success ( Lang . Workspace . saved , project_name + ' ' + Lang . Workspace . saved_msg ) ;
378+ // $scope.hideSpinner();
379+ $scope . doPopupControl ( {
380+ 'type' :'hide'
381+ } ) ;
373382 }
374- Entry . stateManager . addStamp ( ) ;
375- myProject . isSaved = true ;
376- myProject . isSavedPath = filePath ;
377- Entry . toast . success ( Lang . Workspace . saved , project_name + ' ' + Lang . Workspace . saved_msg ) ;
378- // $scope.hideSpinner();
379- $scope . doPopupControl ( {
380- 'type' :'hide'
381- } ) ;
382- $scope . isNowSaving = false ;
383383 } ) ;
384384 } catch ( e ) {
385385 // Entry.toast.success(Lang.Workspace.saved, project_name + ' ' + Lang.Workspace.saved_msg);
@@ -473,43 +473,44 @@ angular.module('workspace').controller("WorkspaceController",
473473 } ) ;
474474 $scope . doPopupControl ( {
475475 'type' :'fail' ,
476- 'msg' : Lang . Workspace . saving_fail_msg
476+ 'msg' : Lang . Workspace . loading_fail_msg
477477 } ) ;
478- }
479- var jsonObj = JSON . parse ( data ) ;
480- jsonObj . path = filePath ;
481-
482- jsonObj . objects . forEach ( function ( object ) {
483- var sprite = object . sprite ;
484- sprite . pictures . forEach ( function ( picture ) {
485- if ( picture . fileurl ) {
486- picture . fileurl = picture . fileurl . replace ( / \\ / gi, '%5C' ) ;
487- picture . fileurl = picture . fileurl . replace ( / % 5 C / gi, '/' ) ;
488- if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
489- picture . fileurl = picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) ;
490- }
491- }
492- } ) ;
493- sprite . sounds . forEach ( function ( sound ) {
494- if ( sound . fileurl ) {
495- sound . fileurl = sound . fileurl . replace ( / \\ / gi, '%5C' ) ;
496- sound . fileurl = sound . fileurl . replace ( / % 5 C / gi, '/' ) ;
497- if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
498- sound . fileurl = sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) ;
478+ } else {
479+ var jsonObj = JSON . parse ( data ) ;
480+ jsonObj . path = filePath ;
481+
482+ jsonObj . objects . forEach ( function ( object ) {
483+ var sprite = object . sprite ;
484+ sprite . pictures . forEach ( function ( picture ) {
485+ if ( picture . fileurl ) {
486+ picture . fileurl = picture . fileurl . replace ( / \\ / gi, '%5C' ) ;
487+ picture . fileurl = picture . fileurl . replace ( / % 5 C / gi, '/' ) ;
488+ if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
489+ picture . fileurl = picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) ;
490+ }
499491 }
500- }
492+ } ) ;
493+ sprite . sounds . forEach ( function ( sound ) {
494+ if ( sound . fileurl ) {
495+ sound . fileurl = sound . fileurl . replace ( / \\ / gi, '%5C' ) ;
496+ sound . fileurl = sound . fileurl . replace ( / % 5 C / gi, '/' ) ;
497+ if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
498+ sound . fileurl = sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) ;
499+ }
500+ }
501+ } ) ;
501502 } ) ;
502- } ) ;
503503
504- if ( jsonObj . objects [ 0 ] &&
505- jsonObj . objects [ 0 ] . script . substr ( 0 , 4 ) === "<xml" ) {
506- blockConverter . convert ( jsonObj , function ( result ) {
507- storage . setItem ( 'nativeLoadProject' , JSON . stringify ( result ) ) ;
504+ if ( jsonObj . objects [ 0 ] &&
505+ jsonObj . objects [ 0 ] . script . substr ( 0 , 4 ) === "<xml" ) {
506+ blockConverter . convert ( jsonObj , function ( result ) {
507+ storage . setItem ( 'nativeLoadProject' , JSON . stringify ( result ) ) ;
508+ Entry . plugin . reloadApplication ( ) ;
509+ } ) ;
510+ } else {
511+ storage . setItem ( 'nativeLoadProject' , JSON . stringify ( jsonObj ) ) ;
508512 Entry . plugin . reloadApplication ( ) ;
509- } ) ;
510- } else {
511- storage . setItem ( 'nativeLoadProject' , JSON . stringify ( jsonObj ) ) ;
512- Entry . plugin . reloadApplication ( ) ;
513+ }
513514 }
514515 } ) ;
515516 }
0 commit comments