dd
This commit is contained in:
@@ -28,7 +28,6 @@ export class CardComp extends CCComp {
|
||||
skill_slot:string="skill1"
|
||||
equip_slot:string="weapon"
|
||||
talent_slot:string="tal1"
|
||||
is_master:boolean=false;
|
||||
enhancement_data:any=null;
|
||||
onLoad(){
|
||||
// this.on(GameEvent.HeroSelect,this.hero_select,this)
|
||||
@@ -54,11 +53,10 @@ export class CardComp extends CCComp {
|
||||
this.node.getChildByName("Button").active=true
|
||||
}, 0.1);
|
||||
}
|
||||
hero_select(args: any,is_master:boolean=false){
|
||||
hero_select(args: any){
|
||||
this.c_type=cardType.HERO
|
||||
this.c_uuid=args.uuid
|
||||
this.is_master=is_master
|
||||
this.show_hero(this.c_uuid,is_master)
|
||||
this.show_hero(this.c_uuid)
|
||||
this.node.getChildByName("show").active=false
|
||||
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
|
||||
this.scheduleOnce(() => {
|
||||
@@ -153,7 +151,7 @@ export class CardComp extends CCComp {
|
||||
show.getChildByName("info").getComponent(Label).string=SkillSet[uuid].info
|
||||
}
|
||||
|
||||
show_hero(uuid:number,is_master:boolean=false){
|
||||
show_hero(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("name").getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
|
||||
this.do_card_bg_show(HeroInfo[uuid].quality)
|
||||
@@ -304,7 +302,7 @@ export class CardComp extends CCComp {
|
||||
use_card(){
|
||||
switch(this.c_type){
|
||||
case cardType.HERO:
|
||||
oops.message.dispatchEvent(GameEvent.UseHeroCard,{uuid:this.c_uuid,is_master:this.is_master})
|
||||
oops.message.dispatchEvent(GameEvent.UseHeroCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case cardType.SKILL:
|
||||
|
||||
@@ -72,8 +72,7 @@ export class CardsCompComp extends CCComp {
|
||||
switch(e){
|
||||
case GameEvent.HeroSelect:
|
||||
console.log("[CardsComp]:显示英雄选择卡牌",data)
|
||||
let title="选择伙伴"
|
||||
if(data.is_master) title="选择英雄"
|
||||
let title="选择英雄"
|
||||
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string=title
|
||||
this.hero_select(data)
|
||||
break
|
||||
@@ -126,16 +125,11 @@ export class CardsCompComp extends CCComp {
|
||||
this.card3c.enhancement_select(list[2])
|
||||
}
|
||||
hero_select(data:any){
|
||||
let list=[]
|
||||
if(data.is_master){ //1是主将,0 是伙伴
|
||||
list=getRandomCardsByType(cardType.HERO,3,1)
|
||||
}else{
|
||||
list=getRandomCardsByType(cardType.HERO,3,0)
|
||||
}
|
||||
let list=getRandomCardsByType(cardType.HERO,3,0)
|
||||
console.log("[CardsComp]:英雄选择卡牌列表",list)
|
||||
this.card1c.hero_select(list[0],data.is_master)
|
||||
this.card2c.hero_select(list[1],data.is_master)
|
||||
this.card3c.hero_select(list[2],data.is_master)
|
||||
this.card1c.hero_select(list[0])
|
||||
this.card2c.hero_select(list[1])
|
||||
this.card3c.hero_select(list[2])
|
||||
// this.card4c.hero_select(list[3])
|
||||
}
|
||||
|
||||
|
||||
39
assets/script/game/map/LifeComp.ts
Normal file
39
assets/script/game/map/LifeComp.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('LifeComp')
|
||||
export class LifeComp extends Component {
|
||||
loss_life:number=0
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.FightReady,this.onFightReady,this)
|
||||
oops.message.on(GameEvent.LifeChange,this.onLifeChange,this)
|
||||
}
|
||||
start() {
|
||||
this.node.setSiblingIndex(100)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
onFightReady(args: any) {
|
||||
console.log("[LifeComp]:onMissionStart",args)
|
||||
let nodes=this.node.children
|
||||
nodes[0].active=true
|
||||
nodes[1].active=true
|
||||
nodes[2].active=true
|
||||
this.loss_life=0
|
||||
}
|
||||
onLifeChange(args: any) {
|
||||
console.log("[LifeComp]:onLifeChange loss_life:",this.loss_life)
|
||||
let nodes=this.node.children
|
||||
nodes[this.loss_life].active=false
|
||||
this.loss_life++
|
||||
if(this.loss_life >= 3){
|
||||
oops.message.dispatchEvent(GameEvent.MissionLoss)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/map/LifeComp.ts.meta
Normal file
9
assets/script/game/map/LifeComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "3bb0f1a5-485d-4c26-a592-9553f8c00f37",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -156,13 +156,13 @@ export class MissionComp extends CCComp {
|
||||
do_mon_dead(){
|
||||
this.do_mon_dead_thing()
|
||||
smc.vmdata.mission_data.mon_num--
|
||||
if(smc.vmdata.mission_data.mon_num<=0 && this.count_tal() < FightSet.TAL_NUM) {
|
||||
if(smc.vmdata.mission_data.current_wave == RogueTalWave[this.count_tal()].wave){
|
||||
console.log("[MissionComp] current_wave:"+smc.vmdata.mission_data.current_wave+" tal wave:"+RogueTalWave[this.count_tal()].wave)
|
||||
oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:TalentSlot[this.count_tal()]})
|
||||
this.tals[this.count_tal()]=true
|
||||
if(smc.vmdata.mission_data.mon_num<=0) {
|
||||
// if(smc.vmdata.mission_data.current_wave == RogueTalWave[this.count_tal()].wave){
|
||||
// console.log("[MissionComp] current_wave:"+smc.vmdata.mission_data.current_wave+" tal wave:"+RogueTalWave[this.count_tal()].wave)
|
||||
// oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:TalentSlot[this.count_tal()]})
|
||||
// this.tals[this.count_tal()]=true
|
||||
|
||||
}
|
||||
// }
|
||||
this.show_time(this.do_next_wave.bind(this))
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,7 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
to_ready(){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect)
|
||||
}
|
||||
ready_to_fight(){
|
||||
this.time_num=5
|
||||
@@ -265,7 +265,7 @@ export class MissionComp extends CCComp {
|
||||
// oops.message.dispatchEvent(GameEvent.EnhancementSelect)
|
||||
// }
|
||||
to_call_friend(){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect)
|
||||
}
|
||||
|
||||
to_fight(){
|
||||
@@ -335,7 +335,7 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
call_friend_card(){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect)
|
||||
}
|
||||
call_tal_card(){
|
||||
oops.message.dispatchEvent(GameEvent.TalentSelect)
|
||||
|
||||
@@ -43,7 +43,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
private zhao_huan(event: string, args: any){
|
||||
console.log("[MissionHeroComp]:zhaohuan",args)
|
||||
this.addHero(args.uuid,false,true)
|
||||
this.addHero(args.uuid,false)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,19 +57,12 @@ export class MissionHeroCompComp extends CCComp {
|
||||
// let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
// // let uuid=args.uuid
|
||||
// // console.log("call_hero",uuid)
|
||||
this.addHero(args.uuid,args.is_master,false)
|
||||
this.addHero(args.uuid,false)
|
||||
}
|
||||
|
||||
/** 添加英雄 */
|
||||
private addHero(uuid:number=1001,is_master:boolean=false,is_zhaohuan:boolean=false) {
|
||||
let hero_pos=1
|
||||
if(is_master){
|
||||
hero_pos=0
|
||||
}
|
||||
if(is_zhaohuan){
|
||||
hero_pos=2
|
||||
}
|
||||
|
||||
private addHero(uuid:number=1001,is_zhaohuan:boolean=false) {
|
||||
let hero_pos=0
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = HeroPos[hero_pos].pos;
|
||||
|
||||
Reference in New Issue
Block a user