This commit is contained in:
2024-12-11 16:55:06 +08:00
parent eab71044d0
commit de39c74d4a
17 changed files with 3434 additions and 4543 deletions

View File

@@ -1724,7 +1724,7 @@
"_pressedSprite": null, "_pressedSprite": null,
"_disabledSprite": null, "_disabledSprite": null,
"_duration": 0.1, "_duration": 0.1,
"_zoomScale": 0.8, "_zoomScale": 1.2,
"_target": { "_target": {
"__id__": 53 "__id__": 53
}, },
@@ -1740,8 +1740,8 @@
"__id__": 1 "__id__": 1
}, },
"component": "", "component": "",
"_componentId": "91d25u7m5BHn44btWJO5Wqu", "_componentId": "f7a30g0MchAWp+dcFVZgdYR",
"handler": "to_update_t", "handler": "select",
"customEventData": "" "customEventData": ""
}, },
{ {

View File

@@ -307,9 +307,9 @@
"__expectedType__": "sp.SkeletonData" "__expectedType__": "sp.SkeletonData"
}, },
"defaultSkin": "default", "defaultSkin": "default",
"defaultAnimation": "Idle", "defaultAnimation": "Idle Blink",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 0.9, "_timeScale": 0.7,
"_preCacheMode": 0, "_preCacheMode": 0,
"_cacheMode": 0, "_cacheMode": 0,
"_sockets": [], "_sockets": [],

View File

@@ -310,9 +310,9 @@
"__expectedType__": "sp.SkeletonData" "__expectedType__": "sp.SkeletonData"
}, },
"defaultSkin": "default", "defaultSkin": "default",
"defaultAnimation": "Idle", "defaultAnimation": "Idle Blink",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 0.9, "_timeScale": 0.7,
"_preCacheMode": 0, "_preCacheMode": 0,
"_cacheMode": 0, "_cacheMode": 0,
"_sockets": [], "_sockets": [],

View File

@@ -310,9 +310,9 @@
"__expectedType__": "sp.SkeletonData" "__expectedType__": "sp.SkeletonData"
}, },
"defaultSkin": "default", "defaultSkin": "default",
"defaultAnimation": "Idle", "defaultAnimation": "Idle Blink",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 0.9, "_timeScale": 0.7,
"_preCacheMode": 0, "_preCacheMode": 0,
"_cacheMode": 0, "_cacheMode": 0,
"_sockets": [], "_sockets": [],

File diff suppressed because it is too large Load Diff

View File

@@ -41,14 +41,25 @@ export class SingletonModuleComp extends ecs.Comp {
{uuid:1008,type:3,lv:0}, {uuid:1008,type:3,lv:0},
{uuid:1009,type:3,lv:0}, {uuid:1009,type:3,lv:0},
] ]
mskill=0; mission:any={
play:false,
pause:false,
is_victory:false,
is_defeat:false,
is_battle:false,
lv:1,
victory:0,
mskill:1001,
mmskill:1001,
}
/** 游戏主角 */ /** 游戏主角 */
heros:any={ heros:any={
9001:{uuid:9001,lv:1,exp:0,slv:0,stone:0}, 9001:{uuid:9001,lv:1,exp:0,slv:0,stone:0},
9002:{uuid:9002,lv:2,exp:0,slv:1,stone:0}, 9002:{uuid:9002,lv:2,exp:0,slv:1,stone:0},
9003:{uuid:9003,lv:3,exp:0,slv:2,stone:0}, 9003:{uuid:9003,lv:3,exp:0,slv:2,stone:0},
}; };
fight_heros=[9001,9002]
mheros:any = []; mheros:any = [];
monsters:any = []; monsters:any = [];
sk_info:any = [] sk_info:any = []
@@ -62,22 +73,12 @@ export class SingletonModuleComp extends ecs.Comp {
game_over:false, game_over:false,
game_pause:false, game_pause:false,
mission:{ mission:{
play:false,
pause:false,
is_victory:false,
is_defeat:false,
lv:1,
victory:0,
once:6, //每波刷新怪物数量 once:6, //每波刷新怪物数量
total:1, //总怪物数 total:1, //总怪物数
mbt:1, //局内buff类型
mmbt:1,//敌方局内buff类型
exp:0, exp:0,
exp_max:100, exp_max:100,
m_exp:0, m_exp:0,
m_exp_max:100, m_exp_max:100,
msk:1001,
mmsk:1001,
hp:0, hp:0,
ap:0, ap:0,
def:0, def:0,
@@ -91,15 +92,6 @@ export class SingletonModuleComp extends ecs.Comp {
mdodge:0, mdodge:0,
mdead:0, mdead:0,
hp_up:0,
ap_up:0,
def_up:0,
mhp_up:0,
map_up:0,
mdef_up:0,
reward_num:0, //怪物死亡数 reward_num:0, //怪物死亡数
reward_gold:0, reward_gold:0,
reward_exp:0, reward_exp:0,
@@ -109,7 +101,7 @@ export class SingletonModuleComp extends ecs.Comp {
gems:0, gems:0,
energy:0, energy:0,
}, },
fight_heros:[9001,9002],
items:{ items:{
1001:1000, 1001:1000,
1002:0, 1002:0,

View File

@@ -10,5 +10,6 @@ export enum GameEvent {
/** 游戏服务器连接成功 */ /** 游戏服务器连接成功 */
GameServerConnected = "GameServerConnected", GameServerConnected = "GameServerConnected",
/** 登陆成功 */ /** 登陆成功 */
LoginSuccess = "LoginSuccess" LoginSuccess = "LoginSuccess",
MSSelected = "MSSelected",
} }

View File

@@ -28,45 +28,45 @@ run:number = 0; // 0有目标 带方向1贝塞尔曲线 2 不动 ,3 直线
*/ */
export const SkillSet={ export const SkillSet={
1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人", 1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1002:{uuid: 1002,path: "1002",type: 1,tg:3,angle:true,exp:30,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人", 1002:{uuid: 1002,path: "1002",type: 1,tg:3,angle:true,exp:100,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1003:{uuid: 1003,path: "1003",type: 1,tg:3,angle:true,exp:30,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人", 1003:{uuid: 1003,path: "1003",type: 1,tg:3,angle:true,exp:100,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人",
dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1004:{uuid: 1004,path: "1004",type: 1,tg:3,angle:true,exp:30,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人", 1004:{uuid: 1004,path: "1004",type: 1,tg:3,angle:true,exp:100,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,exp:30,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人", 2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,exp:100,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,exp:30,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人", 2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,exp:100,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,exp:30,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人", 2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,exp:100,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人", 3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人",
dis:1,count:3,in:0.3,run:2,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, dis:1,count:3,in:0.3,run:2,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
4011:{uuid: 4011,path: "1011",type: 11,tg:3,angle:true,exp:30,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人", 4011:{uuid: 4011,path: "1011",type: 11,tg:3,angle:true,exp:100,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人",
dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
4012:{uuid: 4012,path: "1012",type: 11,tg:3,angle:true,exp:30,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人", 4012:{uuid: 4012,path: "1012",type: 11,tg:3,angle:true,exp:100,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人",
dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人", 9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:1000,}, dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:1000,},
9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人", 9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人", 9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:1,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, dis:1,count:1,in:0,run:1,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人", 8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,exp:100,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,}, dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,},
} }
export const MSklist = [1101,1002] export const MSklist = [1001,1002]
export const MSkillset={ export const MSkillset={
confirm_exp:10, confirm_exp:10,
} }

View File

@@ -21,24 +21,24 @@ export class HeroSelectComp extends CCComp {
start() { start() {
this.mhc_home=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp); this.mhc_home=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp);
if(smc.vmdata.fight_heros.indexOf(this.h_uuid)>=0){ if(smc.fight_heros.indexOf(this.h_uuid)>=0){
this.show_bg(true) this.show_bg(true)
}else{ }else{
this.show_bg(false) this.show_bg(false)
} }
} }
select(){ select(){
if(smc.vmdata.fight_heros.indexOf(this.h_uuid)>=0){ if(smc.fight_heros.indexOf(this.h_uuid)>=0){
smc.vmdata.fight_heros.splice(smc.vmdata.fight_heros.indexOf(this.h_uuid),1) smc.fight_heros.splice(smc.fight_heros.indexOf(this.h_uuid),1)
this.show_bg(false) this.show_bg(false)
this.mhc_home.cancel_hero(this.h_uuid) this.mhc_home.cancel_hero(this.h_uuid)
return return
} }
if(smc.vmdata.fight_heros.length>= 5){ if(smc.fight_heros.length>= 5){
oops.gui.toast("英雄数量不能超过5个") oops.gui.toast("英雄数量不能超过5个")
return return
} }
smc.vmdata.fight_heros.push(this.h_uuid) smc.fight_heros.push(this.h_uuid)
this.mhc_home.select_hero(this.h_uuid) this.mhc_home.select_hero(this.h_uuid)
this.show_bg(true) this.show_bg(true)
} }

View File

@@ -195,7 +195,7 @@ export class HeroViewComp extends CCComp {
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) { onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
} }
update(dt: number){ update(dt: number){
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause) return if(!smc.mission.play||smc.mission.pause) return
if(this.is_dead) { if(this.is_dead) {
if(!this.in_grave()) this.to_grave() if(!this.in_grave()) this.to_grave()
return return
@@ -277,7 +277,7 @@ export class HeroViewComp extends CCComp {
} }
//移动 //移动
move(dt: number){ move(dt: number){
if(this.stop_cd > 0||smc.vmdata.mission.is_victory||smc.vmdata.mission.is_defeat){ if(this.stop_cd > 0||smc.mission.is_victory||smc.mission.is_defeat){
this.status_change("idle") this.status_change("idle")
return return
} }

View File

@@ -77,7 +77,7 @@ export class CardControllerComp extends CCComp {
this.node.getChildByName("bar").active=false; this.node.getChildByName("bar").active=false;
this.mh_hide() this.mh_hide()
this.m_show(); this.m_show();
smc.vmdata.mission.play = true; smc.mission.play = true;
// oops.message.dispatchEvent("mission_start") // oops.message.dispatchEvent("mission_start")
} }
to_home(){ to_home(){

View File

@@ -51,7 +51,7 @@ export class MissionComp extends CCComp {
} }
protected update(dt: number): void { protected update(dt: number): void {
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause){ if(!smc.mission.play||smc.mission.pause){
return return
} }
if(this.fight_start){ if(this.fight_start){
@@ -68,15 +68,13 @@ export class MissionComp extends CCComp {
mission_start(){ mission_start(){
/* todo 关卡设定完善*/ /* todo 关卡设定完善*/
let mon_set=RandomManager.instance.getRandomByObjectList(MissionSet,1) let mon_set=RandomManager.instance.getRandomByObjectList(MissionSet,1)
this.mon_list=mon_set[0] 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 this.fight_start=false
smc.vmdata.mission.is_victory=false smc.mission.is_victory=false
smc.vmdata.mission.is_defeat=false smc.mission.is_defeat=false
smc.vmdata.mission.exp=0 //局内经验 smc.vmdata.mission.exp=0 //局内经验
smc.vmdata.mission.m_exp=0 //敌方局内经验 smc.vmdata.mission.m_exp=0 //敌方局内经验
smc.vmdata.mission.ap=0 smc.vmdata.mission.ap=0
@@ -92,8 +90,8 @@ export class MissionComp extends CCComp {
smc.vmdata.mission.mdead=0 smc.vmdata.mission.mdead=0
smc.vmdata.mission.mdodge=0 smc.vmdata.mission.mdodge=0
this.msk=SkillSet[smc.vmdata.mission.msk] this.msk=SkillSet[smc.mission.mskill]
this.mmsk=SkillSet[smc.vmdata.mission.mmsk] this.mmsk=SkillSet[smc.mission.mmskill]
smc.vmdata.mission.exp_max=this.msk.exp; smc.vmdata.mission.exp_max=this.msk.exp;
smc.vmdata.mission.m_exp_max=this.mmsk.exp; smc.vmdata.mission.m_exp_max=this.mmsk.exp;
@@ -102,10 +100,9 @@ export class MissionComp extends CCComp {
} }
mission_end(){ mission_end(){
smc.vmdata.mission.play=false smc.mission.play=false
smc.vmdata.mission.pause=false smc.mission.pause=false
smc.vmdata.mission.mmbt=1
smc.vmdata.mission.mbt=1
let heros:any= this.get_heros();; let heros:any= this.get_heros();;
let monsters:any= this.get_mons(); let monsters:any= this.get_mons();
let hcards:any= ecs.query(ecs.allOf(HCardComp)); let hcards:any= ecs.query(ecs.allOf(HCardComp));
@@ -134,12 +131,10 @@ export class MissionComp extends CCComp {
check_buff(){ check_buff(){
if(smc.vmdata.mission.exp >= smc.vmdata.mission.exp_max){ if(smc.vmdata.mission.exp >= smc.vmdata.mission.exp_max){
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 局内技能") console.log("tudo 局内技能")
} }
if(smc.vmdata.mission.m_exp >= smc.vmdata.mission.m_exp_max){ if(smc.vmdata.mission.m_exp >= smc.vmdata.mission.m_exp_max){
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 敌方局内技能") console.log("tudo 敌方局内技能")
} }
} }
@@ -159,18 +154,18 @@ export class MissionComp extends CCComp {
m_alive=true m_alive=true
} }
} }
if (!m_alive) smc.vmdata.mission.is_victory = true if (!m_alive) smc.mission.is_victory = true
if (!h_alive) smc.vmdata.mission.is_defeat = true if (!h_alive) smc.mission.is_defeat = true
this.to_end_mission() this.to_end_mission()
} }
to_end_mission(){ to_end_mission(){
if (smc.vmdata.mission.is_victory){ if (smc.mission.is_victory){
this.VictoryComp.do_victiry(true) 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) this.VictoryComp.do_victiry(false)
smc.vmdata.mission.pause=true smc.mission.pause=true
} }
} }
get_mons(){ get_mons(){
@@ -203,7 +198,7 @@ export class MissionComp extends CCComp {
} }
} }
heros_call(){ heros_call(){
let heros=smc.vmdata.fight_heros let heros=smc.fight_heros
console.log("heros_call",heros) console.log("heros_call",heros)
for(let i=0;i<heros.length;i++){ for(let i=0;i<heros.length;i++){
this.addHero(heros[i],i) this.addHero(heros[i],i)

View File

@@ -2,6 +2,9 @@ import { _decorator } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp"; 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; const { ccclass, property } = _decorator;
@@ -9,12 +12,16 @@ const { ccclass, property } = _decorator;
@ccclass('MSCardComp') @ccclass('MSCardComp')
@ecs.register('MSCardComp', false) @ecs.register('MSCardComp', false)
export class MSCardComp extends CCComp { export class MSCardComp extends CCComp {
mhc:MissionHomeComp
s_uuid: number = 0; s_uuid: number = 0;
is_update: boolean = false; is_update: boolean = false;
is_select: boolean = false; is_select: boolean = false;
is_selected: boolean = false; is_selected: boolean = false;
/** 视图层逻辑代码分离演示 */ /** 视图层逻辑代码分离演示 */
start() { start() {
oops.message.on(GameEvent.MSSelected, this.update_select, this);
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
console.log("MSCardComp start"); console.log("MSCardComp start");
if(this.is_update){ if(this.is_update){
this.node.getChildByName("update").active=true 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(){ 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) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */

View 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();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bce99fa9-0a06-4f7b-b378-77a6aa2524b0",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -7,7 +7,7 @@ import { UiHeroComp } from "../hero/UiHeroComp";
import { BoxSet } from "../common/config/BoxSet"; import { BoxSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
import { HeroSelect } from "../hero/HeroSelect"; import { HeroSelect } from "../hero/HeroSelect";
import { MSklist } from "../common/config/SkillSet"; import { MSklist, SkillSet } from "../common/config/SkillSet";
import { MSCard } from "./MSCard"; import { MSCard } from "./MSCard";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -32,8 +32,29 @@ export class MissionHomeComp extends CCComp {
// this.on(ModuleEvent.Cmd, this.onHandler, this); // this.on(ModuleEvent.Cmd, this.onHandler, this);
this.load_hero_card() this.load_hero_card()
this.load_ui_heros() 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) { start_mission(e:any,args:any) {
console.log("mission home start_mission") console.log("mission home start_mission")
for(let i=0;i<this.heros.length;i++){ for(let i=0;i<this.heros.length;i++){
@@ -52,8 +73,8 @@ export class MissionHomeComp extends CCComp {
} }
} }
load_ui_heros(){ load_ui_heros(){
for(let i=0;i<smc.vmdata.fight_heros.length;i++){ for(let i=0;i<smc.fight_heros.length;i++){
this.select_hero(smc.vmdata.fight_heros[i]) this.select_hero(smc.fight_heros[i])
} }
} }
select_hero(h_uuid:number){ 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(){ show_heros(){
this.node.getChildByName("heros").setPosition(0,290) this.node.getChildByName("heros").setPosition(0,290)
} }

View File

@@ -38,7 +38,7 @@ export class VictoryComp extends CCComp {
let conut =3 let conut =3
if(!is_victory) conut=conut-1 if(!is_victory) conut=conut-1
let item1=ecs.getEntity<Item>(Item) 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") let parent = this.node.getChildByName("Node").getChildByName("items")
item1.load(9001,gold,parent) item1.load(9001,gold,parent)
this.rewards = []; this.rewards = [];