召唤逻辑改变
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -507,7 +507,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"x": 968.7629999999999,
|
||||
"y": 749.128,
|
||||
"z": 0
|
||||
},
|
||||
@@ -616,7 +616,7 @@
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -262.5,
|
||||
"x": -262.49999999999994,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
}
|
||||
@@ -757,7 +757,7 @@
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -87.5,
|
||||
"x": -87.49999999999994,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
}
|
||||
@@ -882,7 +882,7 @@
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 87.5,
|
||||
"x": 87.50000000000006,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
}
|
||||
@@ -1007,7 +1007,7 @@
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 262.5,
|
||||
"x": 262.50000000000006,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
}
|
||||
@@ -1080,8 +1080,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 15,
|
||||
"y": -142.689,
|
||||
"x": 15.000000000000057,
|
||||
"y": -145,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1440,7 +1440,7 @@
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 1117.8839999999998,
|
||||
"_bottom": -57.68899999999999,
|
||||
"_bottom": -60,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
@@ -1486,7 +1486,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"width": 719.9999999999999,
|
||||
"height": 230
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -1590,8 +1590,8 @@
|
||||
},
|
||||
"_alignFlags": 44,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_left": 968.763,
|
||||
"_right": -968.763,
|
||||
"_top": 15,
|
||||
"_bottom": 634.128,
|
||||
"_horizontalCenter": 0,
|
||||
@@ -1613,7 +1613,7 @@
|
||||
"fileId": "9aCFKx/N9E+6ZXbNILVsdG"
|
||||
},
|
||||
{
|
||||
"__type__": "62b36d9gpxMz5F8hFgkLiVf",
|
||||
"__type__": "3d183Ezxg1EwJM/pim+pDMx",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
@@ -1628,7 +1628,7 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "bedhHO1z1PmoSjxrFpIT2A"
|
||||
"fileId": "50k4XLMJFH1qoYFgIga66D"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
|
||||
@@ -14,6 +14,7 @@ export enum GameEvent {
|
||||
MSSelected = "MSSelected",
|
||||
CastSkill = "CastSkill",
|
||||
CardRefresh = "CardRefresh",
|
||||
CardRefreshEnd = "CardRefreshEnd",
|
||||
UseCard = "UseCard",
|
||||
UseHeroCard = "UseHeroCard",
|
||||
UseSkillCard = "UseSkillCard",
|
||||
@@ -23,6 +24,10 @@ export enum GameEvent {
|
||||
MissionWin = "MissionWin",
|
||||
MissionStart = "MissionStart",
|
||||
FightReady = "FightReady",
|
||||
HeroSkillSelect = "HeroSkillSelect",
|
||||
HeroSkillSelectEnd = "HeroSkillSelectEnd",
|
||||
HeroSelect = "HeroSelect",
|
||||
HeroSelectEnd = "HeroSelectEnd",
|
||||
FightStart = "FightStart",
|
||||
FightPause = "FightPause",
|
||||
FightResume = "FightResume",
|
||||
|
||||
@@ -20,40 +20,26 @@ export class CardComp extends CCComp {
|
||||
is_used:boolean=false;
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.CardRefresh,this.onHandler,this)
|
||||
this.on(GameEvent.MissionStart,this.onHandler,this)
|
||||
this.on(GameEvent.MissionEnd,this.onHandler,this)
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
private onHandler(event: string, args: any) {
|
||||
switch (event) {
|
||||
case GameEvent.CardRefresh:
|
||||
this.onCardRefresh(event,args)
|
||||
break;
|
||||
case GameEvent.MissionStart:
|
||||
this.mission_start(event,args)
|
||||
break;
|
||||
case GameEvent.MissionEnd:
|
||||
this.mission_end(event,args)
|
||||
break;
|
||||
}
|
||||
this.on(GameEvent.HeroSelect,this.onCardRefresh,this)
|
||||
this.on(GameEvent.HeroSkillSelect,this.onCardRefresh,this)
|
||||
this.on(GameEvent.CardRefresh,this.onCardRefresh,this)
|
||||
}
|
||||
|
||||
start() {
|
||||
this.init_card()
|
||||
|
||||
}
|
||||
|
||||
init_card(){
|
||||
this.is_used=true
|
||||
this.node.getChildByName("Button").active=false
|
||||
this.node.getChildByName("show").active=false
|
||||
}
|
||||
mission_start(event: string, args: any){
|
||||
onHeroSelect(event: string, args: any){
|
||||
|
||||
}
|
||||
mission_end(event: string, args: any){
|
||||
onHeroSkillSelect(event: string, args: any){
|
||||
|
||||
}
|
||||
onCardRefresh(event: string, args: any){
|
||||
this.is_used=false
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
this.c_uuid=hero_list[x]
|
||||
@@ -93,11 +79,9 @@ export class CardComp extends CCComp {
|
||||
// return "替换"
|
||||
// }
|
||||
// }
|
||||
return "召唤"
|
||||
return "选择"
|
||||
}
|
||||
use_card(){
|
||||
|
||||
if(this.is_used) return
|
||||
switch(this.c_type){
|
||||
case 0:
|
||||
if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.call_gold){
|
||||
@@ -114,9 +98,6 @@ export class CardComp extends CCComp {
|
||||
oops.message.dispatchEvent(GameEvent.UseCard,{uuid:this.c_uuid})
|
||||
break
|
||||
}
|
||||
this.node.getChildByName("show").active=false
|
||||
this.is_used=true
|
||||
this.node.getChildByName("Button").active=false
|
||||
}
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator } from "cc";
|
||||
import { _decorator, v3 } 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 { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -12,19 +12,25 @@ export class CardsCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
this.on(GameEvent.FightReady, this.onHandler, this);
|
||||
this.on(GameEvent.HeroSkillSelect, this.show, this);
|
||||
this.on(GameEvent.HeroSkillSelectEnd, this.hide, this);
|
||||
this.on(GameEvent.HeroSelect, this.show, this);
|
||||
this.on(GameEvent.HeroSelectEnd, this.hide, this);
|
||||
this.on(GameEvent.CardRefresh, this.show, this);
|
||||
this.on(GameEvent.CardRefreshEnd, this.hide, this);
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
private onHandler(event: string, args: any) {
|
||||
switch (event) {
|
||||
case GameEvent.FightReady:
|
||||
break;
|
||||
show(){
|
||||
this.node.setPosition(v3(0,640,0))
|
||||
}
|
||||
|
||||
hide(){
|
||||
this.node.setPosition(v3(0,-1000,0))
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "62b3677d-829c-4ccf-917c-8458242e255f",
|
||||
"uuid": "3d183133-c60d-44c0-933f-a629bea43331",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { HartModelComp } from "../hero/HartModelComp";
|
||||
import { TimerManager } from "db://oops-framework/core/common/timer/TimerManager";
|
||||
import { HeroList } from "../common/config/heroSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -52,17 +53,33 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
to_end_fight(){
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd)
|
||||
}
|
||||
|
||||
|
||||
mission_start(){
|
||||
/* todo 关卡设定完善*/
|
||||
console.log("战斗开始 关卡怪物:",Missions[smc.mission.lv])
|
||||
this.node.active=true
|
||||
this.data_init()
|
||||
this.hero_init()
|
||||
this.hart_hero_load()
|
||||
this.to_hero_skill_select()
|
||||
}
|
||||
|
||||
to_hero_skill_select(){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSkillSelect)
|
||||
}
|
||||
|
||||
to_hero_select(){
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelect)
|
||||
}
|
||||
|
||||
to_fight(){
|
||||
oops.message.dispatchEvent(GameEvent.FightStart)
|
||||
}
|
||||
|
||||
to_end_fight(){
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd)
|
||||
}
|
||||
|
||||
fight_end(){
|
||||
console.log("任务结束")
|
||||
// 延迟0.5秒后执行任务结束逻辑
|
||||
@@ -86,16 +103,15 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
//角色初始化
|
||||
hero_init(){
|
||||
hart_hero_load(){
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
hero.hart_load()
|
||||
this.scheduleOnce(() => {
|
||||
this.card_init()
|
||||
}, 0.3)
|
||||
}
|
||||
|
||||
card_init(){
|
||||
oops.message.dispatchEvent(GameEvent.CardRefresh)
|
||||
}
|
||||
|
||||
card_refresh(){
|
||||
if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.refresh_gold){
|
||||
oops.gui.toast("金币不足", false);
|
||||
@@ -106,12 +122,12 @@ export class MissionComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -28,7 +28,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
current_hero_uuid:number=0
|
||||
onLoad(){
|
||||
this.on(GameEvent.UseHeroCard,this.show_heros_pos,this)
|
||||
this.on(GameEvent.UseHeroCard,this.call_hero,this)
|
||||
}
|
||||
start() {
|
||||
// this.test_call()
|
||||
@@ -86,26 +86,28 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
}
|
||||
call_hero(event: string, args: any){
|
||||
this.node.getChildByName("location").active=false
|
||||
console.log("call_hero",args)
|
||||
let fight_pos=args
|
||||
this.timer.reset()
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
// let uuid=args.uuid
|
||||
// console.log("call_hero",uuid)
|
||||
this.addHero(this.current_hero_uuid,fight_pos)
|
||||
// this.node.getChildByName("location").active=false
|
||||
// console.log("call_hero",args)
|
||||
// let fight_pos=args
|
||||
// this.timer.reset()
|
||||
// let hero_list =HeroList
|
||||
// let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
// // let uuid=args.uuid
|
||||
// // console.log("call_hero",uuid)
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
|
||||
/** 添加玩家 */
|
||||
/** 添加英雄 */
|
||||
private addHero(uuid:number=1001,fight_pos:number=0) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
let info:any=this.get_info_and_remove(fight_pos,uuid)
|
||||
// let info:any={ap:0,hp:0,lv:0}
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = this.start_pos[fight_pos].pos;
|
||||
console.log("hero load0",pos,this.start_pos)
|
||||
hero.load(pos,scale,uuid,info,fight_pos);
|
||||
oops.message.dispatchEvent(GameEvent.HeroSelectEnd)
|
||||
this.current_hero_uuid=0
|
||||
}
|
||||
|
||||
@@ -125,20 +127,16 @@ export class MissionHeroCompComp extends CCComp {
|
||||
// let s_hp_up = (HeroUpInfo[uuid] || {}).hp_up || 0 //替换 升级的英雄额外替换血量增长值
|
||||
// info.ap=Math.floor(hv.ap*(AP_UP_RATE+o_ap_rate+s_ap_rate)/100+o_ap+s_ap)
|
||||
// info.hp=Math.floor(o_hp_up+s_hp_up)
|
||||
if(hv.hero_uuid === uuid){
|
||||
info.ap=hv.ap
|
||||
info.hp=hv.hp_max
|
||||
info.lv=hv.lv
|
||||
}else{
|
||||
this.do_hero_change()
|
||||
}
|
||||
|
||||
hero.destroy()
|
||||
return info
|
||||
}
|
||||
}
|
||||
return info
|
||||
}
|
||||
|
||||
do_hero_change(){
|
||||
//金币加1
|
||||
smc.vmdata.mission_data.gold+=1
|
||||
|
||||
Reference in New Issue
Block a user