@@ -2,6 +2,7 @@ export default events;
2
2
import functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a from 'exports-loader?functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a!../../project/functions'
3
3
import events_c12a15a8_c380_4b28_8144_256cba95f760 from 'exports-loader?events_c12a15a8_c380_4b28_8144_256cba95f760!../../editor/project/events'
4
4
import route from '../../pixi/scenes/route' ;
5
+ import ui from '../../pixi/ui' ;
5
6
"use strict" ;
6
7
7
8
function events ( ) {
@@ -449,28 +450,39 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
449
450
450
451
events . prototype . _openDoor_animate = function ( id , x , y , callback ) {
451
452
var door = core . material . icons . animates [ id ] ;
452
- var speed = id . endsWith ( "Door" ) ? 30 : 70 ;
453
+ var speed = id . endsWith ( "Door" ) ? 50 : 70 ;
453
454
454
455
var locked = core . status . lockControl ;
455
456
core . lockControl ( ) ;
456
457
core . status . replay . animate = true ;
457
458
core . removeBlock ( x , y ) ;
458
- core . drawImage ( 'event' , core . material . images . animates , 0 , 32 * door , 32 , 32 , 32 * x , 32 * y , 32 , 32 ) ;
459
- var state = 0 ;
460
- var animate = window . setInterval ( function ( ) {
461
- core . clearMap ( 'event' , 32 * x , 32 * y , 32 , 32 ) ;
462
- state ++ ;
463
- if ( state == 4 ) {
464
- clearInterval ( animate ) ;
465
- delete core . animateFrame . asyncId [ animate ] ;
459
+ const event = pixi . game . getScene ( 'event' ) ;
460
+ ui . drawAnimate ( id , event , x * 32 + 16 , y * 32 + 16 , {
461
+ async : true ,
462
+ time : core . status . replay . speed == 24 ? 1 : speed / Math . max ( core . status . replay . speed , 1 ) ,
463
+ onComplete ( ) {
466
464
if ( ! locked ) core . unLockControl ( ) ;
467
465
core . status . replay . animate = false ;
468
466
core . events . afterOpenDoor ( id , x , y , callback ) ;
469
467
return ;
470
468
}
471
- core . drawImage ( 'event' , core . material . images . animates , 32 * state , 32 * door , 32 , 32 , 32 * x , 32 * y , 32 , 32 ) ;
472
- } , core . status . replay . speed == 24 ? 1 : speed / Math . max ( core . status . replay . speed , 1 ) ) ;
473
- core . animateFrame . asyncId [ animate ] = true ;
469
+ } )
470
+ // core.drawImage('event', core.material.images.animates, 0, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
471
+ // var state = 0;
472
+ // var animate = window.setInterval(function () {
473
+ // core.clearMap('event', 32 * x, 32 * y, 32, 32);
474
+ // state++;
475
+ // if (state == 4) {
476
+ // clearInterval(animate);
477
+ // delete core.animateFrame.asyncId[animate];
478
+ // if (!locked) core.unLockControl();
479
+ // core.status.replay.animate = false;
480
+ // core.events.afterOpenDoor(id, x, y, callback);
481
+ // return;
482
+ // }
483
+ // core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
484
+ // }, core.status.replay.speed == 24 ? 1 : speed / Math.max(core.status.replay.speed, 1));
485
+ // core.animateFrame.asyncId[animate] = true;
474
486
}
475
487
476
488
////// 开一个门后触发的事件 //////
@@ -2473,19 +2485,29 @@ events.prototype.closeDoor = function (x, y, id, callback) {
2473
2485
core . playSound ( 'door.mp3' ) ;
2474
2486
var door = core . material . icons . animates [ id ] ;
2475
2487
var speed = id . endsWith ( "Door" ) ? 30 : 70 , state = 0 ;
2476
- var animate = window . setInterval ( function ( ) {
2477
- state ++ ;
2478
- if ( state == 4 ) {
2479
- clearInterval ( animate ) ;
2480
- delete core . animateFrame . asyncId [ animate ] ;
2488
+ const event = pixi . game . getScene ( 'event' ) ;
2489
+ ui . drawAnimate ( id , event , x * 32 + 16 , y * 32 + 16 , {
2490
+ async : true ,
2491
+ reverse : true ,
2492
+ time : core . status . replay . speed == 24 ? 1 : speed / Math . max ( core . status . replay . speed , 1 ) ,
2493
+ onComplete ( ) {
2481
2494
core . setBlock ( core . getNumberById ( id ) , x , y ) ;
2482
2495
if ( callback ) callback ( ) ;
2483
- return ;
2484
2496
}
2485
- core . clearMap ( 'event' , 32 * x , 32 * y , 32 , 32 ) ;
2486
- core . drawImage ( 'event' , core . material . images . animates , 32 * ( 4 - state ) , 32 * door , 32 , 32 , 32 * x , 32 * y , 32 , 32 ) ;
2487
- } , core . status . replay . speed == 24 ? 1 : speed / Math . max ( core . status . replay . speed , 1 ) ) ;
2488
- core . animateFrame . asyncId [ animate ] = true ;
2497
+ } )
2498
+ // var animate = window.setInterval(function () {
2499
+ // state++;
2500
+ // if (state == 4) {
2501
+ // clearInterval(animate);
2502
+ // delete core.animateFrame.asyncId[animate];
2503
+ // core.setBlock(core.getNumberById(id), x, y);
2504
+ // if (callback) callback();
2505
+ // return;
2506
+ // }
2507
+ // core.clearMap('event', 32 * x, 32 * y, 32, 32);
2508
+ // core.drawImage('event', core.material.images.animates, 32 * (4-state), 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
2509
+ // },);
2510
+ // core.animateFrame.asyncId[animate] = true;
2489
2511
}
2490
2512
2491
2513
////// 显示图片 //////
0 commit comments