热更新:handler监听热更新

This commit is contained in:
qiaoxin
2021-07-16 11:29:26 +08:00
parent dc15862207
commit fc1b2c080e
65 changed files with 321 additions and 254 deletions
@@ -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;
}