继续
This commit is contained in:
@@ -77,7 +77,7 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").active=false;
|
||||
this.mh_hide()
|
||||
this.m_show();
|
||||
smc.vmdata.mission.play = true;
|
||||
smc.mission.play = true;
|
||||
// oops.message.dispatchEvent("mission_start")
|
||||
}
|
||||
to_home(){
|
||||
|
||||
@@ -51,7 +51,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause){
|
||||
if(!smc.mission.play||smc.mission.pause){
|
||||
return
|
||||
}
|
||||
if(this.fight_start){
|
||||
@@ -68,15 +68,13 @@ export class MissionComp extends CCComp {
|
||||
mission_start(){
|
||||
/* todo 关卡设定完善*/
|
||||
|
||||
|
||||
|
||||
let mon_set=RandomManager.instance.getRandomByObjectList(MissionSet,1)
|
||||
this.mon_list=mon_set[0]
|
||||
console.log("mission_start:",this.mon_list,smc.vmdata.mission.mbt ,smc.vmdata.mission.mmbt)
|
||||
console.log("mission_start:",this.mon_list)
|
||||
//局内数据初始化
|
||||
this.fight_start=false
|
||||
smc.vmdata.mission.is_victory=false
|
||||
smc.vmdata.mission.is_defeat=false
|
||||
smc.mission.is_victory=false
|
||||
smc.mission.is_defeat=false
|
||||
smc.vmdata.mission.exp=0 //局内经验
|
||||
smc.vmdata.mission.m_exp=0 //敌方局内经验
|
||||
smc.vmdata.mission.ap=0
|
||||
@@ -92,8 +90,8 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission.mdead=0
|
||||
smc.vmdata.mission.mdodge=0
|
||||
|
||||
this.msk=SkillSet[smc.vmdata.mission.msk]
|
||||
this.mmsk=SkillSet[smc.vmdata.mission.mmsk]
|
||||
this.msk=SkillSet[smc.mission.mskill]
|
||||
this.mmsk=SkillSet[smc.mission.mmskill]
|
||||
smc.vmdata.mission.exp_max=this.msk.exp;
|
||||
smc.vmdata.mission.m_exp_max=this.mmsk.exp;
|
||||
|
||||
@@ -102,10 +100,9 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
smc.vmdata.mission.play=false
|
||||
smc.vmdata.mission.pause=false
|
||||
smc.vmdata.mission.mmbt=1
|
||||
smc.vmdata.mission.mbt=1
|
||||
smc.mission.play=false
|
||||
smc.mission.pause=false
|
||||
|
||||
let heros:any= this.get_heros();;
|
||||
let monsters:any= this.get_mons();
|
||||
let hcards:any= ecs.query(ecs.allOf(HCardComp));
|
||||
@@ -134,12 +131,10 @@ export class MissionComp extends CCComp {
|
||||
check_buff(){
|
||||
if(smc.vmdata.mission.exp >= smc.vmdata.mission.exp_max){
|
||||
smc.vmdata.mission.exp-=smc.vmdata.mission.exp_max
|
||||
this.node.getChildByName("msk").getChildByName("flash").getComponent(Animation).play()
|
||||
console.log("tudo 局内技能")
|
||||
}
|
||||
if(smc.vmdata.mission.m_exp >= smc.vmdata.mission.m_exp_max){
|
||||
smc.vmdata.mission.m_exp-=smc.vmdata.mission.m_exp_max
|
||||
this.node.getChildByName("mmsk").getChildByName("flash").getComponent(Animation).play()
|
||||
console.log("tudo 敌方局内技能")
|
||||
}
|
||||
}
|
||||
@@ -159,18 +154,18 @@ export class MissionComp extends CCComp {
|
||||
m_alive=true
|
||||
}
|
||||
}
|
||||
if (!m_alive) smc.vmdata.mission.is_victory = true
|
||||
if (!h_alive) smc.vmdata.mission.is_defeat = true
|
||||
if (!m_alive) smc.mission.is_victory = true
|
||||
if (!h_alive) smc.mission.is_defeat = true
|
||||
this.to_end_mission()
|
||||
}
|
||||
to_end_mission(){
|
||||
if (smc.vmdata.mission.is_victory){
|
||||
if (smc.mission.is_victory){
|
||||
this.VictoryComp.do_victiry(true)
|
||||
smc.vmdata.mission.pause=true
|
||||
smc.mission.pause=true
|
||||
}
|
||||
if (smc.vmdata.mission.is_defeat){
|
||||
if (smc.mission.is_defeat){
|
||||
this.VictoryComp.do_victiry(false)
|
||||
smc.vmdata.mission.pause=true
|
||||
smc.mission.pause=true
|
||||
}
|
||||
}
|
||||
get_mons(){
|
||||
@@ -203,7 +198,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
}
|
||||
heros_call(){
|
||||
let heros=smc.vmdata.fight_heros
|
||||
let heros=smc.fight_heros
|
||||
console.log("heros_call",heros)
|
||||
for(let i=0;i<heros.length;i++){
|
||||
this.addHero(heros[i],i)
|
||||
|
||||
@@ -2,6 +2,9 @@ import { _decorator } 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 { MissionHomeComp } from "./MissionHomeComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -9,12 +12,16 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MSCardComp')
|
||||
@ecs.register('MSCardComp', false)
|
||||
export class MSCardComp extends CCComp {
|
||||
mhc:MissionHomeComp
|
||||
s_uuid: number = 0;
|
||||
is_update: boolean = false;
|
||||
is_select: boolean = false;
|
||||
is_selected: boolean = false;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
oops.message.on(GameEvent.MSSelected, this.update_select, this);
|
||||
|
||||
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
|
||||
console.log("MSCardComp start");
|
||||
if(this.is_update){
|
||||
this.node.getChildByName("update").active=true
|
||||
@@ -30,9 +37,17 @@ export class MSCardComp extends CCComp {
|
||||
|
||||
|
||||
}
|
||||
|
||||
select(){
|
||||
smc.mission.mskill=this.s_uuid
|
||||
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
||||
}
|
||||
update_select(){
|
||||
if(smc.mskill ==this.s_uuid){ this.node.getChildByName("btn").active=false }else{ this.node.getChildByName("btn").active=true }
|
||||
console.log("update_select",smc.mission.mskill,this.s_uuid)
|
||||
if(smc.mission.mskill ==this.s_uuid){
|
||||
this.node.getChildByName("set").getChildByName("btn").active=false
|
||||
}else{
|
||||
this.node.getChildByName("set").getChildByName("btn").active=true
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
24
assets/script/game/map/MSkillComp.ts
Normal file
24
assets/script/game/map/MSkillComp.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { _decorator } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MSkillComp')
|
||||
@ecs.register('MSkillComp', false)
|
||||
export class MSkillComp extends CCComp {
|
||||
|
||||
s_uuid: number = 0;
|
||||
group: number = 0;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
console.log("MSkillComp start s_uuid:",this.s_uuid,this.group);
|
||||
}
|
||||
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/MSkillComp.ts.meta
Normal file
9
assets/script/game/map/MSkillComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "bce99fa9-0a06-4f7b-b378-77a6aa2524b0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { UiHeroComp } from "../hero/UiHeroComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroSelect } from "../hero/HeroSelect";
|
||||
import { MSklist } from "../common/config/SkillSet";
|
||||
import { MSklist, SkillSet } from "../common/config/SkillSet";
|
||||
import { MSCard } from "./MSCard";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -32,8 +32,29 @@ export class MissionHomeComp extends CCComp {
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
this.load_hero_card()
|
||||
this.load_ui_heros()
|
||||
this.load_skill_card()
|
||||
|
||||
}
|
||||
load_hero_card(){
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
let height=Math.ceil(hc / 4)*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
for (let i = 0; i < hc; i++) {
|
||||
let hcc =ecs.getEntity<HeroSelect>(HeroSelect)
|
||||
hcc.load(HeroList[i],parent)
|
||||
}
|
||||
}
|
||||
load_skill_card(){
|
||||
let ms_num:number =MSklist.length
|
||||
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
|
||||
let height=ms_num*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
for (let i = 0; i < ms_num; i++) {
|
||||
let msc =ecs.getEntity<MSCard>(MSCard)
|
||||
msc.load(MSklist[i],parent,2)
|
||||
}
|
||||
}
|
||||
|
||||
start_mission(e:any,args:any) {
|
||||
console.log("mission home start_mission")
|
||||
for(let i=0;i<this.heros.length;i++){
|
||||
@@ -52,8 +73,8 @@ export class MissionHomeComp extends CCComp {
|
||||
}
|
||||
}
|
||||
load_ui_heros(){
|
||||
for(let i=0;i<smc.vmdata.fight_heros.length;i++){
|
||||
this.select_hero(smc.vmdata.fight_heros[i])
|
||||
for(let i=0;i<smc.fight_heros.length;i++){
|
||||
this.select_hero(smc.fight_heros[i])
|
||||
}
|
||||
}
|
||||
select_hero(h_uuid:number){
|
||||
@@ -94,29 +115,9 @@ export class MissionHomeComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
load_hero_card(){
|
||||
let hc:number =HeroList.length
|
||||
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
|
||||
let height=Math.ceil(hc / 4)*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
for (let i = 0; i < hc; i++) {
|
||||
let hcc =ecs.getEntity<HeroSelect>(HeroSelect)
|
||||
hcc.load(HeroList[i],parent)
|
||||
}
|
||||
}
|
||||
load_skill_card(){
|
||||
let ms_num:number =MSklist.length
|
||||
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
|
||||
let height=ms_num*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
for (let i = 0; i < ms_num; i++) {
|
||||
let msc =ecs.getEntity<MSCard>(MSCard)
|
||||
msc.load(HeroList[i],parent,1)
|
||||
}
|
||||
}
|
||||
show_uiheros(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
show_heros(){
|
||||
this.node.getChildByName("heros").setPosition(0,290)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class VictoryComp extends CCComp {
|
||||
let conut =3
|
||||
if(!is_victory) conut=conut-1
|
||||
let item1=ecs.getEntity<Item>(Item)
|
||||
let gold: number = Math.floor(RandomManager.instance.getRandomInt((3000 + smc.vmdata.mission.lv * 100) / 3 * 2, 3000 + smc.vmdata.mission.lv * 100));
|
||||
let gold: number = Math.floor(RandomManager.instance.getRandomInt((3000 + smc.mission.lv * 100) / 3 * 2, 3000 + smc.mission.lv * 100));
|
||||
let parent = this.node.getChildByName("Node").getChildByName("items")
|
||||
item1.load(9001,gold,parent)
|
||||
this.rewards = [];
|
||||
|
||||
Reference in New Issue
Block a user