dd
This commit is contained in:
@@ -10,6 +10,8 @@ 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";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -42,7 +44,9 @@ export class CardControllerComp extends CCComp {
|
||||
oops.message.on("minssion_defeat", this.do_minssion_defeat, this)
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
show_info(uuid:number,type:number){
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
@@ -188,7 +192,7 @@ export class CardControllerComp extends CCComp {
|
||||
coin_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
let coin =(GameSet.COIN_ADD*smc.vm_data.mission.coin_reward_add*(1+smc.vm_data.talent[6].bonus*smc.vm_data.talent[6].lv)).toFixed(0)
|
||||
let coin =(GameSet.COIN_ADD*smc.vm_data.mission.coin_reward_add*(1+Talents[1006].bonus*smc.vm_data.talent[1006].lv)).toFixed(0)
|
||||
smc.vm_data.mission.coin += parseFloat(coin)
|
||||
smc.vm_data.gold.time = 0;
|
||||
}
|
||||
@@ -204,6 +208,13 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").setScale(1,1)
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").setScale(1,1)
|
||||
}
|
||||
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
|
||||
|
||||
@@ -10,6 +10,8 @@ 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";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -21,12 +23,34 @@ export class HeroHomeComp extends CCComp {
|
||||
|
||||
}
|
||||
start() {
|
||||
let hero_talent_content=this.node.getChildByName("hero_talent").getChildByName("view").getChildByName("content").getComponent(UITransform)
|
||||
hero_talent_content.height=2000
|
||||
|
||||
this.load_talents()
|
||||
console.log("hero_home start")
|
||||
|
||||
}
|
||||
|
||||
load_talents(){
|
||||
let y=-70
|
||||
let pos = v3(0,y)
|
||||
let talents:any= Talents
|
||||
let parent= this.node.getChildByName("talents").getChildByName("view").getChildByName("content")
|
||||
console.log("talents:",talents,)
|
||||
const keys = Object.keys(talents);
|
||||
if (keys.length === 0) {
|
||||
console.log("No talents to process.");
|
||||
} else {
|
||||
for (const key of keys) {
|
||||
const talentData = talents[key];
|
||||
let talent = ecs.getEntity<Talent>(Talent);
|
||||
console.log("talent:", talentData);
|
||||
let uuid = talentData.uuid;
|
||||
talent.load(pos, uuid, parent);
|
||||
pos.y -= 140; // 更新位置
|
||||
}
|
||||
}
|
||||
let hero_talent_content=parent.getComponent(UITransform)
|
||||
hero_talent_content.height=2000
|
||||
console.log("hero_talent_content:",parent)
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
|
||||
@@ -53,7 +53,8 @@ export class MapMonsterComp extends CCComp {
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
oops.message.on("mission_start", this.mission_start, this);
|
||||
oops.message.on("normal_call", this.on_normal_call, this);
|
||||
oops.message.on("better_call", this.on_better_call, this);
|
||||
|
||||
@@ -72,14 +73,10 @@ export class MapMonsterComp extends CCComp {
|
||||
// console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
||||
this.refresh_timer= new Timer(smc.vm_data.shuaxin.max);
|
||||
smc.vm_data.mission.m_less=smc.vm_data.mission.m_alive=JSON.parse(JSON.stringify(this.total));
|
||||
this.monster_refresh()
|
||||
this.load_role()
|
||||
this.load_boss()
|
||||
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(smc.vm_data.game_over||smc.vm_data.game_pause){
|
||||
if(!smc.vm_data.mission.play||smc.vm_data.pause){
|
||||
return
|
||||
}
|
||||
if(this.setp_timer.update(dt)){
|
||||
@@ -102,6 +99,10 @@ export class MapMonsterComp extends CCComp {
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
}
|
||||
mission_start(){
|
||||
this.load_role()
|
||||
this.load_boss()
|
||||
}
|
||||
on_normal_call(){
|
||||
let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1);
|
||||
this.addHero(hero[0].uuid)
|
||||
@@ -150,7 +151,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.addMonster(args.uuid,monster_layer,pos)
|
||||
}
|
||||
set_start_point(){
|
||||
this.start_p.setPosition(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]+30,0)
|
||||
// this.start_p.setPosition(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]+30,0)
|
||||
}
|
||||
check_mon_count(){
|
||||
let count = 0;
|
||||
|
||||
Reference in New Issue
Block a user