环境技能基本完成 todo 技能cd动画 技能执行
This commit is contained in:
@@ -24,6 +24,7 @@ import { HCard } from "./HCard";
|
||||
import { HCardComp } from "./HCardComp";
|
||||
import { VictoryComp } from "./VictoryComp";
|
||||
import { ItemComp } from "./ItemComp";
|
||||
import { MSkillComp } from "./MSkillComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -41,13 +42,20 @@ export class MissionComp extends CCComp {
|
||||
mission_buff_type:number = 1 // 1 攻击 2 防御 3 HP
|
||||
m_mission_buff_type:number = 1 // 1 攻击 2 防御 3 HP
|
||||
mission_buff_up_exp:number = 99999999
|
||||
msk:any=null
|
||||
mmsk:any=null
|
||||
MSComp:MSkillComp=null
|
||||
MMSComp:MSkillComp=null
|
||||
|
||||
onLoad(){
|
||||
|
||||
this.MSComp=this.node.getChildByName("msk").getComponent(MSkillComp)
|
||||
this.MMSComp=this.node.getChildByName("mmsk").getComponent(MSkillComp)
|
||||
this.MSComp.group=BoxSet.HERO
|
||||
this.MSComp.s_uuid=smc.mission.mskill
|
||||
this.MMSComp.group=BoxSet.MONSTER
|
||||
this.MMSComp.s_uuid=smc.mission.mmskill
|
||||
}
|
||||
start() {
|
||||
this.VictoryComp=this.node.getChildByName("victory").getComponent(VictoryComp)
|
||||
console.log("mission_start:",this.MSComp)
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
@@ -67,34 +75,12 @@ 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)
|
||||
//局内数据初始化
|
||||
this.fight_start=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
|
||||
smc.vmdata.mission.hp=0
|
||||
smc.vmdata.mission.def=0
|
||||
smc.vmdata.mission.crit=0
|
||||
smc.vmdata.mission.dodge=0
|
||||
smc.vmdata.mission.dead=0
|
||||
smc.vmdata.mission.map=0
|
||||
smc.vmdata.mission.mhp=0
|
||||
smc.vmdata.mission.mdef=0
|
||||
smc.vmdata.mission.mcrit=0
|
||||
smc.vmdata.mission.mdead=0
|
||||
smc.vmdata.mission.mdodge=0
|
||||
|
||||
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;
|
||||
console.log("mission_start:",this.mon_list,this.MSComp,this.MMSComp)
|
||||
|
||||
this.mission_init()
|
||||
this.mskill_init()
|
||||
this.mon_refresh()
|
||||
this.heros_call()
|
||||
}
|
||||
@@ -128,15 +114,36 @@ export class MissionComp extends CCComp {
|
||||
rewards[i].ItemComp.ent.destroy()
|
||||
}
|
||||
}
|
||||
mission_init(){
|
||||
//局内数据初始化
|
||||
this.fight_start=false
|
||||
smc.mission.is_victory=false
|
||||
smc.mission.is_defeat=false
|
||||
smc.vmdata.mission.exp=0 //局内经验
|
||||
smc.vmdata.mission.mexp=0 //敌方局内经验
|
||||
smc.vmdata.mission.exp_max=99999 //局内经验
|
||||
smc.vmdata.mission.mexp_max=99999 //敌方局内经验
|
||||
smc.vmdata.mission.ap=0
|
||||
smc.vmdata.mission.hp=0
|
||||
smc.vmdata.mission.def=0
|
||||
smc.vmdata.mission.crit=0
|
||||
smc.vmdata.mission.dodge=0
|
||||
smc.vmdata.mission.dead=0
|
||||
smc.vmdata.mission.map=0
|
||||
smc.vmdata.mission.mhp=0
|
||||
smc.vmdata.mission.mdef=0
|
||||
smc.vmdata.mission.mcrit=0
|
||||
smc.vmdata.mission.mdead=0
|
||||
smc.vmdata.mission.mdodge=0
|
||||
}
|
||||
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
|
||||
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
|
||||
console.log("tudo 敌方局内技能")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
check_mon_num(){
|
||||
|
||||
@@ -39,6 +39,7 @@ export class MSCardComp extends CCComp {
|
||||
}
|
||||
select(){
|
||||
smc.mission.mskill=this.s_uuid
|
||||
this.mhc.select_skill()
|
||||
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
||||
}
|
||||
update_select(){
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { _decorator } from "cc";
|
||||
import { _decorator, resources, Sprite, SpriteAtlas } 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 { SkillSet } from "../common/config/SkillSet";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -8,15 +11,58 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MSkillComp')
|
||||
@ecs.register('MSkillComp', false)
|
||||
export class MSkillComp extends CCComp {
|
||||
|
||||
s_uuid: number = 0;
|
||||
group: number = 0;
|
||||
lv:number = 0;
|
||||
skill_on:boolean = false;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
console.log("MSkillComp start s_uuid:",this.s_uuid,this.group);
|
||||
}
|
||||
init(){
|
||||
console.log("MSkillComp init s_uuid:",this.s_uuid,this.group);
|
||||
if(SkillSet[this.s_uuid]==undefined){this.skill_on=false; return}
|
||||
|
||||
this.s_uuid=smc.mission.mskill
|
||||
smc.vmdata.mission.exp_max=SkillSet[this.s_uuid].exp
|
||||
|
||||
if(this.group == BoxSet.MONSTER){
|
||||
this.s_uuid=smc.mission.mmskill
|
||||
smc.vmdata.mission.mexp_max=SkillSet[this.s_uuid].exp
|
||||
}
|
||||
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[this.s_uuid].path);
|
||||
});
|
||||
this.skill_on=true
|
||||
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(!this.skill_on) return
|
||||
this.check_exp()
|
||||
}
|
||||
check_exp(){
|
||||
switch(this.group){
|
||||
case BoxSet.HERO:
|
||||
if(smc.vmdata.mission.exp >= SkillSet[this.s_uuid].exp){
|
||||
console.log("hero MSkillComp check_exp s_uuid:",this.s_uuid,this.group);
|
||||
smc.vmdata.mission.exp-=SkillSet[this.s_uuid].exp
|
||||
this.lvup()
|
||||
}
|
||||
break;
|
||||
case BoxSet.MONSTER:
|
||||
if(smc.vmdata.mission.mexp >= SkillSet[this.s_uuid].exp){
|
||||
console.log("monster MSkillComp check_exp s_uuid:",this.s_uuid,this.group);
|
||||
smc.vmdata.mission.mexp-=SkillSet[this.s_uuid].exp
|
||||
this.lvup()
|
||||
}
|
||||
}
|
||||
}
|
||||
lvup(){
|
||||
console.log("MSkillComp lvup s_uuid:",this.s_uuid,this.group);
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, instantiate, Prefab, UITransform } from "cc";
|
||||
import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform } 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 { HeroInfo, HeroList } from "../common/config/heroSet";
|
||||
@@ -33,7 +33,24 @@ export class MissionHomeComp extends CCComp {
|
||||
this.load_hero_card()
|
||||
this.load_ui_heros()
|
||||
this.load_skill_card()
|
||||
|
||||
this.select_skill()
|
||||
}
|
||||
start_mission(e:any,args:any) {
|
||||
console.log("mission home start_mission")
|
||||
for(let i=0;i<this.heros.length;i++){
|
||||
this.heros[i].to_destroy()
|
||||
}
|
||||
this.heros=[]
|
||||
this.heros_pos=[
|
||||
{uuid:0,px:-300},
|
||||
{uuid:0,px:-200},
|
||||
{uuid:0,px:-100},
|
||||
{uuid:0,px:0},
|
||||
{uuid:0,px:100},
|
||||
]
|
||||
if(args!=0){
|
||||
this.load_ui_heros()
|
||||
}
|
||||
}
|
||||
load_hero_card(){
|
||||
let hc:number =HeroList.length
|
||||
@@ -55,28 +72,19 @@ export class MissionHomeComp extends CCComp {
|
||||
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++){
|
||||
this.heros[i].to_destroy()
|
||||
}
|
||||
this.heros=[]
|
||||
this.heros_pos=[
|
||||
{uuid:0,px:-300},
|
||||
{uuid:0,px:-200},
|
||||
{uuid:0,px:-100},
|
||||
{uuid:0,px:0},
|
||||
{uuid:0,px:100},
|
||||
]
|
||||
if(args!=0){
|
||||
this.load_ui_heros()
|
||||
}
|
||||
}
|
||||
load_ui_heros(){
|
||||
for(let i=0;i<smc.fight_heros.length;i++){
|
||||
this.select_hero(smc.fight_heros[i])
|
||||
}
|
||||
}
|
||||
select_skill(){
|
||||
if(SkillSet[smc.mission.mskill]==undefined) return
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("msk").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[smc.mission.mskill].path);
|
||||
});
|
||||
}
|
||||
select_hero(h_uuid:number){
|
||||
for(let i=0;i<4;i++){
|
||||
if(this.heros_pos[i].uuid==0){
|
||||
@@ -115,7 +123,7 @@ export class MissionHomeComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
show_heros(){
|
||||
|
||||
Reference in New Issue
Block a user