102 lines
4.5 KiB
TypeScript
102 lines
4.5 KiB
TypeScript
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,UITransform,v3 } from "cc";
|
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
|
import { smc } from "../common/SingletonModuleComp";
|
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
|
import { SkillSet } from "../common/config/SkillSet";
|
|
import { HeroModelComp } from "../hero/HeroModelComp";
|
|
import { RewardSet } from "../common/config/RewardSet";
|
|
import { GameSet } from "../common/config/BoxSet";
|
|
import { GameMap } from "./GameMap";
|
|
import { MapModelComp } from "./model/MapModelComp";
|
|
import { Talent } from "../Role/Talent";
|
|
import { Talents } from "../common/config/TalentSet";
|
|
import { MonViewComp } from "../mon/MonViewComp";
|
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
|
import { RoleViewComp } from "../Role/RoleViewComp";
|
|
import { BossViewComp } from "../Boss/BossViewComp";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/** 视图层对象 */
|
|
@ccclass('CardControllerComp')
|
|
@ecs.register('CardController', false)
|
|
export class CardControllerComp extends CCComp {
|
|
touch_time:number = 0
|
|
in_touch:boolean = false
|
|
protected onLoad(): void {
|
|
|
|
}
|
|
start() {
|
|
|
|
}
|
|
|
|
show_info(uuid:number,type:number){
|
|
// console.log("show_info",uuid)
|
|
let node =this.node.getChildByName("item_box")
|
|
if(type == 2){
|
|
smc.vm_data.item_box.info = smc.sitems[uuid].info
|
|
smc.vm_data.item_box.name = smc.sitems[uuid].name
|
|
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
|
|
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
|
|
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
|
|
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
|
|
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
|
|
node.active=true
|
|
if(smc.sitems[uuid].shield > 0){
|
|
node.getChildByName("data").getChildByName("shield").active=true
|
|
}
|
|
if(smc.sitems[uuid].hp > 0){
|
|
node.getChildByName("data").getChildByName("hp").active=true
|
|
}
|
|
}
|
|
}
|
|
|
|
protected update(dt: number): void {
|
|
if(smc.vm_data.game_over||smc.vm_data.game_pause){
|
|
return
|
|
}
|
|
|
|
}
|
|
|
|
to_mission(){
|
|
this.node.getChildByName("mission_home").active=true
|
|
this.node.getChildByName("mission").active=false
|
|
this.node.getChildByName("bar").active=true;
|
|
this.node.getChildByName("hero_home").active=false
|
|
this.node.getChildByName("shop_home").active=false
|
|
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=true
|
|
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=false
|
|
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=false
|
|
|
|
}
|
|
mission_start(){
|
|
this.node.getChildByName("bar").active=false;
|
|
this.node.getChildByName("mission_home").active=false
|
|
this.node.getChildByName("mission").active=true
|
|
smc.vm_data.mission.play = true;
|
|
// oops.message.dispatchEvent("mission_start")
|
|
}
|
|
to_home(){
|
|
this.node.getChildByName("mission_home").active=false
|
|
this.node.getChildByName("hero_home").active=false
|
|
this.node.getChildByName("shop_home").active=true
|
|
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=false
|
|
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=false
|
|
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=true
|
|
|
|
}
|
|
to_hero(){
|
|
this.node.getChildByName("mission_home").active=false
|
|
this.node.getChildByName("hero_home").active=true
|
|
this.node.getChildByName("shop_home").active=false
|
|
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=false
|
|
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=true
|
|
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=false
|
|
|
|
}
|
|
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
reset() {
|
|
this.node.destroy();
|
|
}
|
|
} |