123456789101112131415161718192021222324252627282930313233343536373839404142 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
- import AniList from "./aniList";
- import MonsterFactory from "./monsterFactory";
- const {ccclass, property, executeInEditMode, playOnFocus} = cc._decorator;
- @ccclass
- @executeInEditMode
- @playOnFocus
- export default class MonsterPlay extends cc.Component {
- protected onFocusInEditor(): void {
- let arr = this.getComponentsInChildren(MonsterFactory);
- arr.forEach(v=>{
- v.end();
- v.play();
- });
- this.getComponentsInChildren(AniList).forEach(v=>{
- v.end();
- v.play();
- });
- }
- protected onLostFocusInEditor(): void {
- let arr = this.getComponentsInChildren(MonsterFactory);
- arr.forEach(v=>{
- v.end();
- });
- this.getComponentsInChildren(AniList).forEach(v=>{
- v.end();
- });
- }
- }
|