@@ -151,17 +151,20 @@ editor.prototype.init = function (callback) {
151
151
editor . airwallImg . src = './project/images/airwall.png' ;
152
152
153
153
main . init ( 'editor' , function ( ) {
154
- editor_util_wrapper ( editor ) ;
155
- editor_game_wrapper ( editor , main , core ) ;
156
- editor_file_wrapper ( editor ) ;
157
- editor_table_wrapper ( editor ) ;
158
- editor_ui_wrapper ( editor ) ;
159
- editor_mappanel_wrapper ( editor ) ;
160
- editor_datapanel_wrapper ( editor ) ;
161
- editor_materialpanel_wrapper ( editor ) ;
162
- editor_listen_wrapper ( editor ) ;
163
- editor . printe = printe ;
164
- afterMainInit ( ) ;
154
+ editor . config = new editor_config ( ) ;
155
+ editor . config . load ( function ( ) {
156
+ editor_util_wrapper ( editor ) ;
157
+ editor_game_wrapper ( editor , main , core ) ;
158
+ editor_file_wrapper ( editor ) ;
159
+ editor_table_wrapper ( editor ) ;
160
+ editor_ui_wrapper ( editor ) ;
161
+ editor_mappanel_wrapper ( editor ) ;
162
+ editor_datapanel_wrapper ( editor ) ;
163
+ editor_materialpanel_wrapper ( editor ) ;
164
+ editor_listen_wrapper ( editor ) ;
165
+ editor . printe = printe ;
166
+ afterMainInit ( ) ;
167
+ } )
165
168
} ) ;
166
169
167
170
var afterMainInit = function ( ) {
@@ -174,7 +177,7 @@ editor.prototype.init = function (callback) {
174
177
editor_mode = editor_mode ( editor ) ;
175
178
editor . mode = editor_mode ;
176
179
core . resetGame ( core . firstData . hero , null , core . firstData . floorId , core . clone ( core . initStatus . maps ) ) ;
177
- var lastFloorId = core . getLocalStorage ( 'editorLastFloorId' , core . status . floorId ) ;
180
+ var lastFloorId = editor . config . get ( 'editorLastFloorId' , core . status . floorId ) ;
178
181
if ( core . floorIds . indexOf ( lastFloorId ) < 0 ) lastFloorId = core . status . floorId ;
179
182
core . changeFloor ( lastFloorId , null , core . firstData . hero . loc , null , function ( ) {
180
183
afterCoreReset ( ) ;
@@ -274,8 +277,9 @@ editor.prototype.changeFloor = function (floorId, callback) {
274
277
var loc = editor . viewportLoc [ floorId ] || [ ] , x = loc [ 0 ] || 0 , y = loc [ 1 ] || 0 ;
275
278
editor . setViewport ( x , y ) ;
276
279
277
- core . setLocalStorage ( 'editorLastFloorId' , floorId ) ;
278
- if ( callback ) callback ( ) ;
280
+ editor . config . set ( 'editorLastFloorId' , floorId , function ( ) {
281
+ if ( callback ) callback ( ) ;
282
+ } ) ;
279
283
} ) ;
280
284
}
281
285
@@ -448,11 +452,11 @@ editor.prototype.drawInitData = function (icons) {
448
452
var maxHeight = 700 ;
449
453
var sumWidth = 0 ;
450
454
editor . widthsX = { } ;
451
- editor . uivalues . folded = core . getLocalStorage ( 'folded' , false ) ;
455
+ editor . uivalues . folded = editor . config . get ( 'folded' , false ) ;
452
456
// editor.uivalues.folded = true;
453
- editor . uivalues . foldPerCol = core . getLocalStorage ( 'foldPerCol' , 50 ) ;
457
+ editor . uivalues . foldPerCol = editor . config . get ( 'foldPerCol' , 50 ) ;
454
458
// var imgNames = Object.keys(images); //还是固定顺序吧;
455
- editor . uivalues . lastUsed = core . getLocalStorage ( "lastUsed" , [ ] ) ;
459
+ editor . uivalues . lastUsed = editor . config . get ( "lastUsed" , [ ] ) ;
456
460
var imgNames = [ "terrains" , "animates" , "enemys" , "enemy48" , "items" , "npcs" , "npc48" , "autotile" ] ;
457
461
458
462
for ( var ii = 0 ; ii < imgNames . length ; ii ++ ) {
0 commit comments