接口处理(委婉)
This commit is contained in:
parent
7694c788c8
commit
05c53de3d9
@ -216,7 +216,9 @@ export class BattleHandler {
|
|||||||
* @param fromplayer : 吃别人的牌,自己胡牌时此参数传空
|
* @param fromplayer : 吃别人的牌,自己胡牌时此参数传空
|
||||||
*/
|
*/
|
||||||
public onCardLinkReady(aplayer: Player, fromplayer?: Player){
|
public onCardLinkReady(aplayer: Player, fromplayer?: Player){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
let fromph = this.getPlayer(fromplayer);
|
||||||
|
ph && ph.onCardLinkReady(fromph);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +227,8 @@ export class BattleHandler {
|
|||||||
* @param linkcards :吃到的牌组信息
|
* @param linkcards :吃到的牌组信息
|
||||||
*/
|
*/
|
||||||
public onCardLinkOver(aplayer: Player, linkcards: Card[]){
|
public onCardLinkOver(aplayer: Player, linkcards: Card[]){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
ph && ph.onCardLinkEnd(linkcards);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,7 +238,11 @@ export class BattleHandler {
|
|||||||
public onUseCardEnd(obj:
|
public onUseCardEnd(obj:
|
||||||
{srcplayer: Player, card: number, cardpoint: number, dbpt_cnt: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}
|
{srcplayer: Player, card: number, cardpoint: number, dbpt_cnt: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}
|
||||||
){
|
){
|
||||||
|
if(!obj){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let ph = this.getPlayer(obj.srcplayer);
|
||||||
|
ph && ph.onUseCardEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,7 +252,9 @@ export class BattleHandler {
|
|||||||
* @param dropcards : 弃掉的牌组
|
* @param dropcards : 弃掉的牌组
|
||||||
*/
|
*/
|
||||||
public onCardDroped(aplayer: Player, dropcards: Card[], fromplayer?: Player){
|
public onCardDroped(aplayer: Player, dropcards: Card[], fromplayer?: Player){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
let fromph = this.getPlayer(fromplayer);
|
||||||
|
ph && ph.onCardDroped(dropcards, fromph);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +264,9 @@ export class BattleHandler {
|
|||||||
* @param dropcards : 获得的牌组
|
* @param dropcards : 获得的牌组
|
||||||
*/
|
*/
|
||||||
public onCardGetted(aplayer: Player, getcards: Card[], fromplayer?: Player){
|
public onCardGetted(aplayer: Player, getcards: Card[], fromplayer?: Player){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
let fromph = this.getPlayer(fromplayer);
|
||||||
|
ph && ph.onCardGetted(getcards, fromph);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,7 +274,8 @@ export class BattleHandler {
|
|||||||
* @param aplayer
|
* @param aplayer
|
||||||
*/
|
*/
|
||||||
public onPlayerRoundStart(aplayer: Player){
|
public onPlayerRoundStart(aplayer: Player){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
ph && ph.onRoundStart();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,7 +283,8 @@ export class BattleHandler {
|
|||||||
* @param aplayer
|
* @param aplayer
|
||||||
*/
|
*/
|
||||||
public onPlayerRoundEnd(aplayer: Player){
|
public onPlayerRoundEnd(aplayer: Player){
|
||||||
|
let ph = this.getPlayer(aplayer);
|
||||||
|
ph && ph.onRoundEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
public onAddPetNotify(apet: PetHandler){
|
public onAddPetNotify(apet: PetHandler){
|
||||||
@ -279,7 +292,7 @@ export class BattleHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public onDelPetNotify(apet: PetHandler){
|
public onDelPetNotify(apet: PetHandler){
|
||||||
|
return this._room.bRemovePet(apet.exportRemoveData());
|
||||||
};
|
};
|
||||||
|
|
||||||
public onPlayerAddCard(aplayer: PlayerHandler, count: number, maxcount: number){
|
public onPlayerAddCard(aplayer: PlayerHandler, count: number, maxcount: number){
|
||||||
@ -291,7 +304,6 @@ export class BattleHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public onSkillResult(skillres: SkillTarget[]){
|
public onSkillResult(skillres: SkillTarget[]){
|
||||||
//todo: build skillrest json -> client
|
|
||||||
let lst: SkillInfoMsg[] = [];
|
let lst: SkillInfoMsg[] = [];
|
||||||
skillres.forEach((item: SkillTarget)=>{
|
skillres.forEach((item: SkillTarget)=>{
|
||||||
lst.push(item.exportData());
|
lst.push(item.exportData());
|
||||||
|
@ -9,6 +9,7 @@ import { EnhanceEffectType, PowerValueType } from "../skill/SkillConst";
|
|||||||
import { PlayerHandler } from "./PlayerHandler";
|
import { PlayerHandler } from "./PlayerHandler";
|
||||||
import { PetInfoMsg } from "../../../message/PetInfo";
|
import { PetInfoMsg } from "../../../message/PetInfo";
|
||||||
import { SkillParam } from "../skill/SkillParam";
|
import { SkillParam } from "../skill/SkillParam";
|
||||||
|
import { RemovePetMsg } from "message/RemovePetMsg";
|
||||||
|
|
||||||
export class PetHandler {
|
export class PetHandler {
|
||||||
_pet: Pet;
|
_pet: Pet;
|
||||||
@ -218,4 +219,12 @@ export class PetHandler {
|
|||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public exportRemoveData(): RemovePetMsg{
|
||||||
|
return new RemovePetMsg({
|
||||||
|
id: this._id,
|
||||||
|
player: this._owner.getId(),
|
||||||
|
pos: this._idx
|
||||||
|
})
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import { UnitCfg } from "cfg/parsers/UnitCfg";
|
|||||||
import { Skill } from "../skill/Skill";
|
import { Skill } from "../skill/Skill";
|
||||||
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
||||||
import SkillMan from "../skill/SkillMan";
|
import SkillMan from "../skill/SkillMan";
|
||||||
|
import { Card } from "rooms/schema/Card";
|
||||||
|
|
||||||
export class PlayerHandler {
|
export class PlayerHandler {
|
||||||
public _player: Player;
|
public _player: Player;
|
||||||
@ -60,7 +61,7 @@ export class PlayerHandler {
|
|||||||
let n = 0;
|
let n = 0;
|
||||||
for(let [key, obj] of this._player.pets){
|
for(let [key, obj] of this._player.pets){
|
||||||
if(n != 0){
|
if(n != 0){
|
||||||
if(obj.ap == 0){
|
if(obj.state == 0 || obj.state == 2){
|
||||||
res = obj;
|
res = obj;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -296,4 +297,32 @@ export class PlayerHandler {
|
|||||||
}
|
}
|
||||||
return bok;
|
return bok;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onCardLinkReady(fromplayer: PlayerHandler){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onCardLinkEnd(linkcards: Card[]){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onCardDroped(dropcards: Card[], srcplayer: PlayerHandler){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onCardGetted(getcards: Card[], srcplayer: PlayerHandler){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onUseCardEnd(){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onRoundStart(){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onRoundEnd(){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user