dd
This commit is contained in:
@@ -28,7 +28,6 @@ export class CardControllerComp extends CCComp {
|
||||
bbg_y:number=40
|
||||
bbg_x:any=[-300,-150,0,150,300]
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.MissionStart,this.mission_home_to_mission,this)
|
||||
// oops.message.on(GameEvent.MissionEnd,this.mission_home_to_mission,this)
|
||||
}
|
||||
start() {
|
||||
|
||||
@@ -44,6 +44,7 @@ export class MissionComp extends CCComp {
|
||||
MSComp:MSkillComp=null
|
||||
MMSComp:MSkillComp=null
|
||||
|
||||
|
||||
onLoad(){
|
||||
// this.MSComp=this.node.getChildByName("msk").getComponent(MSkillComp)
|
||||
// this.MMSComp=this.node.getChildByName("mmsk").getComponent(MSkillComp)
|
||||
@@ -65,7 +66,6 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
this.count_hero_pos()
|
||||
this.count_mon_pos()
|
||||
this.check_buff()
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vmdata.game.g_time += 1;
|
||||
// }
|
||||
@@ -77,20 +77,15 @@ export class MissionComp extends CCComp {
|
||||
this.colose_victory()
|
||||
this.mission_init()
|
||||
// this.mskill_init()
|
||||
this.mon_refresh()
|
||||
this.heros_call()
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
||||
smc.mission.play=false
|
||||
smc.mission.pause=false
|
||||
|
||||
this.cleanComponents()
|
||||
// this.to_mission_home()
|
||||
this.open_victory()
|
||||
|
||||
|
||||
}
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => {entity.remove(HeroSkillsComp);entity.destroy()});
|
||||
@@ -119,31 +114,13 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission.mexp=0 //敌方局内经验
|
||||
smc.vmdata.mission.exp_max= smc.vmdata.mission.mexp_max=MBSet.exp
|
||||
}
|
||||
clear_x1(){
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].x1=0
|
||||
}
|
||||
// for (let i in smc.skills) {
|
||||
// smc.skills[i].x1=0
|
||||
// }
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].x1=0
|
||||
}
|
||||
// console.log("clear_x1",smc.items,smc.heros)
|
||||
}
|
||||
|
||||
mskill_init(){
|
||||
this.MSComp.group=BoxSet.HERO
|
||||
this.MMSComp.group=BoxSet.MONSTER
|
||||
this.MSComp.init()
|
||||
this.MMSComp.init()
|
||||
}
|
||||
check_buff(){
|
||||
if(smc.vmdata.mission.exp >= smc.vmdata.mission.exp_max){
|
||||
smc.vmdata.mission.exp-=smc.vmdata.mission.exp_max
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
check_mon_num(){
|
||||
let mons:any = this.get_mons()
|
||||
let heros:any= this.get_heros()
|
||||
@@ -209,73 +186,10 @@ export class MissionComp extends CCComp {
|
||||
smc.hero_back_x=right_x
|
||||
// console.log("count_hero_pos",smc.hero_pos,smc.hero_front_x,smc.mon_front_x)
|
||||
}
|
||||
|
||||
mon_refresh(){
|
||||
let num =3
|
||||
let t_num= Missions[0].length
|
||||
let y_num= Missions[1].length
|
||||
let b_num= Missions[2].length
|
||||
let tc=1
|
||||
let yc=2
|
||||
let bc=1
|
||||
for(let i=0;i<tc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,t_num,1)
|
||||
this.addMonster(Missions[0][x],i)
|
||||
console.log("Missions t:"+x,Missions[0][x])
|
||||
}
|
||||
for(let i=0;i<yc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[1][x],i)
|
||||
console.log("Missions y:"+x,Missions[1][x])
|
||||
}
|
||||
for(let i=0;i<bc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
this.addMonster(Missions[2][x],i,true)
|
||||
}
|
||||
}
|
||||
heros_call(){
|
||||
let heros=smc.fight_heros
|
||||
console.log("heros_call",heros)
|
||||
for(let i=0;i<heros.length;i++){
|
||||
this.addHero(heros[i],i)
|
||||
}
|
||||
this.hcard_call()
|
||||
}
|
||||
hcard_call(){
|
||||
let node =this.node.getChildByName("hcards")
|
||||
let heros:any= this.get_heros();
|
||||
|
||||
for(let i=0;i<heros.length;i++){
|
||||
let hcard = ecs.getEntity<HCard>(HCard)
|
||||
// console.log("hcard:",hcard)
|
||||
hcard.load(heros[i].HeroView.hero_uuid,i,node)
|
||||
}
|
||||
this.fight_start= true
|
||||
}
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,i:number=0) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[1]-i*10,BoxSet.GAME_LINE);
|
||||
hero.load(pos,scale,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false) {
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[1]+i*10,BoxSet.GAME_LINE);
|
||||
mon.load(pos,scale,uuid,is_boss);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
|
||||
33
assets/script/game/map/MissionHeroComp.ts
Normal file
33
assets/script/game/map/MissionHeroComp.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { _decorator, v3, Vec3 } 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 { HCard } from "./HCard";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
import { Hero } from "../hero/Hero";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MissionHeroCompComp')
|
||||
@ecs.register('MissionHeroComp', false)
|
||||
export class MissionHeroCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
}
|
||||
|
||||
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,i:number=0) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[1]-i*10,BoxSet.GAME_LINE);
|
||||
hero.load(pos,scale,uuid);
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/MissionHeroComp.ts.meta
Normal file
9
assets/script/game/map/MissionHeroComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0e186bfb-2282-449d-9f50-757559af2d96",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { HeroSelect } from "../hero/HeroSelect";
|
||||
import { HeroSelectComp } from "../hero/HeroSelectComp";
|
||||
import { MBSet } from "../common/config/MissionSet";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { MissionComp } from "./MissionComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -47,7 +48,12 @@ export class MissionHomeComp extends CCComp {
|
||||
{uuid:0,px:-300},
|
||||
]
|
||||
oops.message.dispatchEvent(GameEvent.MissionStart, {})
|
||||
let mission=this.node.parent.getChildByName("mission").getComponent(MissionComp)
|
||||
mission.node.active = true;
|
||||
mission.mission_start()
|
||||
smc.mission.play = true;
|
||||
this.node.active=false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
74
assets/script/game/map/MissionMonComp.ts
Normal file
74
assets/script/game/map/MissionMonComp.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import { _decorator, v3, Vec3 } 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 { Monster } from "../hero/Mon";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
import { Missions } from "../common/config/MissionSet";
|
||||
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MissionMonCompComp')
|
||||
@ecs.register('MissionMonComp', false)
|
||||
export class MissionMonCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
mon_refresh(){
|
||||
let num =3
|
||||
let t_num= Missions[0].length
|
||||
let y_num= Missions[1].length
|
||||
let b_num= Missions[2].length
|
||||
let tc=1
|
||||
let yc=2
|
||||
let bc=1
|
||||
for(let i=0;i<tc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,t_num,1)
|
||||
this.addMonster(Missions[0][x],i)
|
||||
console.log("Missions t:"+x,Missions[0][x])
|
||||
}
|
||||
for(let i=0;i<yc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[1][x],i)
|
||||
console.log("Missions y:"+x,Missions[1][x])
|
||||
}
|
||||
for(let i=0;i<bc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
this.addMonster(Missions[2][x],i,true)
|
||||
}
|
||||
}
|
||||
|
||||
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false) {
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[1]+i*10,BoxSet.GAME_LINE);
|
||||
mon.load(pos,scale,uuid,is_boss);
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/MissionMonComp.ts.meta
Normal file
9
assets/script/game/map/MissionMonComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "032d623d-38de-4117-9dcb-68ec75f124f5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user