import { _decorator, Component, Node } from 'cc'; import { DataSystem } from '../core/data/DataSystem'; import { Http } from '../core/net/Http'; import { WindowOpenMode } from '../core/ui/window/WindowOpenMode'; import { WindowSystem } from '../core/ui/window/WindowSystem'; import { FightData } from './FightData'; const { ccclass, property } = _decorator; /** * @author 郑聂华 * @description 切磋判断 */ @ccclass('FightCheck') export class FightCheck extends Component { update() { DataSystem.watch(FightData, "beAttack") && this.checkBeAttack(); } /**检测是否有玩家攻击*/ private async checkBeAttack() { let fightData = DataSystem.getData(FightData); console.log("BeAttack: " , fightData.beAttack); if (fightData.beAttack) { await fightData.pull(this.getComponent(Http)); console.log("BeAttack Data: " , fightData.beAttackNoticeList); fightData.beAttackNoticeList && fightData.beAttackNoticeList.length > 0 && WindowSystem.open("prefabs/ui/fight/revengeNoticeUI", WindowOpenMode.NotCloseAndAdd); } } }