热更新:handler监听热更新
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
||||
import { Application, ChannelService, FrontendSession, RemoterClass, HandlerService, } from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { STATUS } from '../../../consts';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
return new ComBattleRemote(app);
|
||||
}
|
||||
|
||||
@@ -113,7 +114,7 @@ export class ComBattleRemote {
|
||||
channel.pushMessage('onLeave', resResult(STATUS.SUCCESS, param));
|
||||
}
|
||||
|
||||
public async hurt(uid: string, sid: string, name: string, bossHurt: number, actorHurt: [{actorId: number, actorHurt: number}]) {
|
||||
public async hurt(uid: string, sid: string, name: string, bossHurt: number, actorHurt: [{ actorId: number, actorHurt: number }]) {
|
||||
console.log('hurt channel name: ', name);
|
||||
let channelService = this.app.get('channelService');
|
||||
this.bossHp -= bossHurt;
|
||||
@@ -122,7 +123,7 @@ export class ComBattleRemote {
|
||||
if (this.bossHp < 0) {
|
||||
this.bossHp = 0;
|
||||
}
|
||||
channel.pushMessage('bossHp', resResult(STATUS.SUCCESS, {bossHp: this.bossHp}));
|
||||
channel.pushMessage('bossHp', resResult(STATUS.SUCCESS, { bossHp: this.bossHp }));
|
||||
}
|
||||
return this.bossHp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user