重做 局内经验的利用,加攻 加血,特殊技能,todo:先完成物品设定
This commit is contained in:
@@ -157,13 +157,13 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
if(type == 2){
|
||||
smc.vm_data.item_box.info = smc.sitems[uuid].info
|
||||
smc.vm_data.item_box.name = smc.sitems[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
|
||||
smc.vmdata.item_box.info = smc.sitems[uuid].info
|
||||
smc.vmdata.item_box.name = smc.sitems[uuid].name
|
||||
smc.vmdata.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vmdata.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vmdata.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vmdata.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vmdata.item_box.shield = smc.sitems[uuid].shield
|
||||
node.active=true
|
||||
if(smc.sitems[uuid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
@@ -185,23 +185,23 @@ export class CardControllerComp extends CCComp {
|
||||
node.getChildByName("data").getChildByName("hp").active=false
|
||||
}
|
||||
shuaxin(dt: number) {
|
||||
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
|
||||
if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) {
|
||||
smc.vm_data.shuaxin.min = 0;
|
||||
smc.vmdata.shuaxin.min += smc.vmdata.shuaxin.speed*dt;
|
||||
if (smc.vmdata.shuaxin.min >= smc.vmdata.shuaxin.max) {
|
||||
smc.vmdata.shuaxin.min = 0;
|
||||
this.load_cards()
|
||||
}
|
||||
}
|
||||
// cards_update(){
|
||||
// if(smc.vm_data.gold.min >= smc.vm_data.cards.up_cost){
|
||||
// smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
|
||||
// smc.vm_data.cards.level += 1;
|
||||
// smc.vm_data.gold.max +=2;
|
||||
// smc.vm_data.cards.up_cost += 2
|
||||
// if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
|
||||
// smc.vm_data.cards.level = smc.vm_data.cards.level_max;
|
||||
// smc.vm_data.cards.up_cost = 11
|
||||
// if(smc.vmdata.gold.min >= smc.vmdata.cards.up_cost){
|
||||
// smc.vmdata.gold.min -= smc.vmdata.cards.up_cost;
|
||||
// smc.vmdata.cards.level += 1;
|
||||
// smc.vmdata.gold.max +=2;
|
||||
// smc.vmdata.cards.up_cost += 2
|
||||
// if(smc.vmdata.cards.level >= smc.vmdata.cards.level_max){
|
||||
// smc.vmdata.cards.level = smc.vmdata.cards.level_max;
|
||||
// smc.vmdata.cards.up_cost = 11
|
||||
// }
|
||||
// console.log("card _level:"+this.card_level+"cost:"+smc.vm_data.cards.up_cost)
|
||||
// console.log("card _level:"+this.card_level+"cost:"+smc.vmdata.cards.up_cost)
|
||||
// }else{
|
||||
// oops.gui.toast("金币不够");
|
||||
// }
|
||||
@@ -210,23 +210,23 @@ export class CardControllerComp extends CCComp {
|
||||
if (this.in_load) {
|
||||
return
|
||||
}
|
||||
if((smc.vm_data.shuaxin.max-smc.vm_data.shuaxin.min) < 0.5 ){
|
||||
if((smc.vmdata.shuaxin.max-smc.vmdata.shuaxin.min) < 0.5 ){
|
||||
oops.gui.toast("马上就要刷新了")
|
||||
return
|
||||
}
|
||||
if(smc.vm_data.shuaxin.min < 0.5){
|
||||
if(smc.vmdata.shuaxin.min < 0.5){
|
||||
oops.gui.toast("不要刷新太快哦")
|
||||
return
|
||||
}
|
||||
if (smc.vm_data.gold.min < smc.vm_data.cards.ref_cost) {
|
||||
if (smc.vmdata.gold.min < smc.vmdata.cards.ref_cost) {
|
||||
oops.gui.toast("金币不足")
|
||||
return
|
||||
}
|
||||
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
|
||||
smc.vmdata.gold.min -= smc.vmdata.cards.ref_cost;
|
||||
this.load_cards()
|
||||
smc.vm_data.shuaxin.min = -5
|
||||
if(smc.vm_data.shuaxin.min <=0 ){
|
||||
smc.vm_data.shuaxin.min = 0
|
||||
smc.vmdata.shuaxin.min = -5
|
||||
if(smc.vmdata.shuaxin.min <=0 ){
|
||||
smc.vmdata.shuaxin.min = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("card_index:",index,"card_alive:",this.cards[index].alive)
|
||||
return;
|
||||
};
|
||||
if(smc.vm_data.gold.min >= this.cards[index].cost){
|
||||
if(smc.vmdata.gold.min >= this.cards[index].cost){
|
||||
this.cards[index].alive=false
|
||||
this.do_use_card(index)
|
||||
}else{
|
||||
@@ -333,7 +333,7 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
do_use_card(index:number){
|
||||
this.cards[index].alive=false
|
||||
smc.vm_data.gold.min -= this.cards[index].cost;
|
||||
smc.vmdata.gold.min -= this.cards[index].cost;
|
||||
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
|
||||
// switch (this.cards[index].type) {
|
||||
// case 1:
|
||||
@@ -350,7 +350,7 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
|
||||
do_reward(){
|
||||
smc.vm_data.game_pause = true;
|
||||
smc.vmdata.game_pause = true;
|
||||
this.reward_lv+=1
|
||||
this.rewards_set=RewardSet[this.reward_lv]
|
||||
let i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1)
|
||||
@@ -395,17 +395,17 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
colse_reward(value:number){
|
||||
this.node.getChildByName('rewards').active = false;
|
||||
smc.vm_data.game_pause = false;
|
||||
smc.vmdata.game_pause = false;
|
||||
let reward=this.rewards[value]
|
||||
if(reward.type==1){
|
||||
if(reward.atk > 0){
|
||||
smc.vm_data.mission.hero.atk += reward.atk / 100
|
||||
smc.vmdata.mission.hero.atk += reward.atk / 100
|
||||
}
|
||||
if(reward.atk_cd > 0){
|
||||
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100
|
||||
smc.vmdata.mission.hero.atk_cd -= reward.atk_cd/100
|
||||
}
|
||||
if(reward.hp > 0){
|
||||
smc.vm_data.mission.hero.hp += reward.hp / 100;
|
||||
smc.vmdata.mission.hero.hp += reward.hp / 100;
|
||||
this.add_hero_hp_max(reward.hp / 100)
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(smc.vm_data.game_over||smc.vm_data.game_pause){
|
||||
if(smc.vmdata.game_over||smc.vmdata.game_pause){
|
||||
return
|
||||
}
|
||||
this.shuaxin(dt)
|
||||
@@ -442,10 +442,10 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
smc.vm_data.gold.min += 1;
|
||||
smc.vm_data.gold.time = 0;
|
||||
smc.vmdata.gold.time += dt;
|
||||
if (smc.vmdata.gold.time >= smc.vmdata.gold.cd) {
|
||||
smc.vmdata.gold.min += 1;
|
||||
smc.vmdata.gold.time = 0;
|
||||
}
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -35,13 +35,13 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
if(type == 2){
|
||||
smc.vm_data.item_box.info = smc.sitems[uuid].info
|
||||
smc.vm_data.item_box.name = smc.sitems[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
|
||||
smc.vmdata.item_box.info = smc.sitems[uuid].info
|
||||
smc.vmdata.item_box.name = smc.sitems[uuid].name
|
||||
smc.vmdata.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vmdata.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vmdata.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vmdata.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vmdata.item_box.shield = smc.sitems[uuid].shield
|
||||
node.active=true
|
||||
if(smc.sitems[uuid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
@@ -53,7 +53,7 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(smc.vm_data.game_over||smc.vm_data.game_pause){
|
||||
if(smc.vmdata.game_over||smc.vmdata.game_pause){
|
||||
return
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").active=false;
|
||||
this.node.getChildByName("mission_home").active=false
|
||||
this.node.getChildByName("mission").active=true
|
||||
smc.vm_data.mission.play = true;
|
||||
smc.vmdata.mission.play = true;
|
||||
// oops.message.dispatchEvent("mission_start")
|
||||
}
|
||||
to_home(){
|
||||
|
||||
@@ -7,22 +7,12 @@ import { HCardComp } from "./HCardComp";
|
||||
/** HCard 模块 */
|
||||
@ecs.register(`HCard`)
|
||||
export class HCard extends ecs.Entity {
|
||||
/** ---------- 数据层 ---------- */
|
||||
// HCardModel!: HCardModelComp;
|
||||
|
||||
/** ---------- 业务层 ---------- */
|
||||
// HCardBll!: HCardBllComp;
|
||||
|
||||
/** ---------- 视图层 ---------- */
|
||||
// HCardView!: HCardViewComp;
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
load(uuid:number=1001,index:number=-1,parent:any) {
|
||||
let box_group= 0
|
||||
|
||||
var path = "gui/element/hcard";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
|
||||
30
assets/script/game/map/Item.ts
Normal file
30
assets/script/game/map/Item.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { instantiate, Prefab } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { ItemComp } from "./ItemComp";
|
||||
|
||||
/** Item 模块 */
|
||||
@ecs.register(`Item`)
|
||||
export class Item extends ecs.Entity {
|
||||
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
load(uuid:number=1001,num:number=0,praent:any=null) {
|
||||
var path = "game/gui/item";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent = praent
|
||||
let iv = node.getComponent(ItemComp)!;
|
||||
iv.i_uuid = uuid
|
||||
iv.num=num
|
||||
this.add(iv)
|
||||
}
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/** Item 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
|
||||
9
assets/script/game/map/Item.ts.meta
Normal file
9
assets/script/game/map/Item.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "6d44969e-0c5d-4ef2-8919-e9c18b012dec",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
24
assets/script/game/map/ItemComp.ts
Normal file
24
assets/script/game/map/ItemComp.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { _decorator, Label } 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('ItemComp')
|
||||
@ecs.register('ItemComp', false)
|
||||
export class ItemComp extends CCComp {
|
||||
i_uuid:number = 0;
|
||||
num:number = 0;
|
||||
start() {
|
||||
this.node.getChildByName("num").getComponent(Label).string = this.num.toString();
|
||||
//todo 设定icon 显示
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/ItemComp.ts.meta
Normal file
9
assets/script/game/map/ItemComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b3d7b41f-5185-4a0a-b690-897800e264ef",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(!smc.vm_data.mission.play||smc.vm_data.pause){
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.pause){
|
||||
return
|
||||
}
|
||||
if(this.fight_start){
|
||||
@@ -69,10 +69,9 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
this.count_hero_pos()
|
||||
this.count_mon_pos()
|
||||
this.check_exp()
|
||||
this.check_m_exp()
|
||||
this.check_buff()
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// smc.vmdata.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
}
|
||||
@@ -83,27 +82,27 @@ export class MissionComp extends CCComp {
|
||||
console.log("mission_start:",this.mon_list)
|
||||
//局内数据初始化
|
||||
this.fight_start=false
|
||||
smc.vm_data.mission.is_victory=false
|
||||
smc.vm_data.mission.is_defeat=false
|
||||
smc.vm_data.mission.a_exp=0 //近战经验
|
||||
smc.vm_data.mission.b_exp=0 //远程经验
|
||||
smc.vm_data.mission.c_exp=0 //辅助经验
|
||||
smc.vm_data.mission.ma_exp=0 //敌方近战经验
|
||||
smc.vm_data.mission.mb_exp=0 //敌方远程经验
|
||||
smc.vm_data.mission.mc_exp=0 //敌方辅助经验
|
||||
smc.vmdata.mission.is_victory=false
|
||||
smc.vmdata.mission.is_defeat=false
|
||||
smc.vmdata.mission.a_exp=0 //近战经验
|
||||
smc.vmdata.mission.h_exp=0 //远程经验
|
||||
smc.vmdata.mission.s_exp=0 //辅助经验
|
||||
smc.vmdata.mission.ma_exp=0 //敌方近战经验
|
||||
smc.vmdata.mission.mh_exp=0 //敌方远程经验
|
||||
smc.vmdata.mission.ms_exp=0 //敌方辅助经验
|
||||
this.msk={ on :false, uuid:1001,type:1,lv: 1}
|
||||
this.mmsk={ on :false, uuid:1001,type:1,lv: 1}
|
||||
this.node.getChildByName("exp").getChildByName("a_exp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("b_exp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("c_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("a_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("b_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("c_exp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("ap").active = true
|
||||
this.node.getChildByName("exp").getChildByName("hp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("mskill").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("ap").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("hp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("mskill").active = true
|
||||
this.mon_refresh()
|
||||
this.heros_call()
|
||||
}
|
||||
mission_end(){
|
||||
smc.vm_data.mission.play=false
|
||||
smc.vmdata.mission.play=false
|
||||
let heros:any= this.get_heros();;
|
||||
let monsters:any= this.get_mons();
|
||||
let hcards:any= ecs.query(ecs.allOf(HCardComp));
|
||||
@@ -131,128 +130,56 @@ export class MissionComp extends CCComp {
|
||||
monsters[i].HeroView.ent.destroy()
|
||||
}
|
||||
}
|
||||
check_buff(){
|
||||
if(smc.vmdata.mission.a_exp >= smc.vmdata.mission.a_up_exp){
|
||||
smc.vmdata.mission.ap+=smc.vmdata.mission.a_up
|
||||
smc.vmdata.mission.a_exp-=smc.vmdata.mission.a_up_exp
|
||||
this.node.getChildByName("exp").getChildByName("ap").setScale(1.2,1)
|
||||
this.scheduleOnce(function(){
|
||||
this.node.getChildByName("exp").getChildByName("ap").setScale(1,1)
|
||||
},0.1)
|
||||
}
|
||||
if(smc.vmdata.mission.h_exp >= smc.vmdata.mission.h_up_exp){
|
||||
smc.vmdata.mission.hp+=smc.vmdata.mission.h_up
|
||||
smc.vmdata.mission.h_exp-=smc.vmdata.mission.h_up_exp
|
||||
this.node.getChildByName("exp").getChildByName("hp").setScale(1.2,1)
|
||||
this.scheduleOnce(function(){
|
||||
this.node.getChildByName("exp").getChildByName("hp").setScale(1,1)
|
||||
},0.1)
|
||||
}
|
||||
if(smc.vmdata.mission.ma_exp >= smc.vmdata.mission.ma_up_exp){
|
||||
smc.vmdata.mission.map+=smc.vmdata.mission.ma_up
|
||||
smc.vmdata.mission.ma_exp-=smc.vmdata.mission.ma_up_exp
|
||||
this.node.getChildByName("mexp").getChildByName("ap").setScale(1.2,1)
|
||||
this.scheduleOnce(function(){
|
||||
this.node.getChildByName("mexp").getChildByName("ap").setScale(1,1)
|
||||
},0.1)
|
||||
}
|
||||
if(smc.vmdata.mission.mh_exp >= smc.vmdata.mission.mh_up_exp){
|
||||
smc.vmdata.mission.mhp+=smc.vmdata.mission.mh_up
|
||||
smc.vmdata.mission.mh_exp-=smc.vmdata.mission.mh_up_exp
|
||||
this.node.getChildByName("mexp").getChildByName("hp").setScale(1.2,1)
|
||||
this.scheduleOnce(function(){
|
||||
this.node.getChildByName("mexp").getChildByName("hp").setScale(1,1)
|
||||
},0.1)
|
||||
}
|
||||
}
|
||||
|
||||
exp_move(ap: number,bp: number,cp: number){
|
||||
let a_pos=v3(ap,this.node.getChildByName("exp").getChildByName("a_exp").position.y)
|
||||
let b_pos=v3(bp,this.node.getChildByName("exp").getChildByName("b_exp").position.y)
|
||||
let c_pos=v3(cp,this.node.getChildByName("exp").getChildByName("c_exp").position.y)
|
||||
tween(this.node.getChildByName("exp").getChildByName("a_exp")).to(0.5,{position:a_pos}).start()
|
||||
tween(this.node.getChildByName("exp").getChildByName("b_exp")).to(0.5,{position:b_pos}).start()
|
||||
tween(this.node.getChildByName("exp").getChildByName("c_exp")).to(0.5,{position:c_pos}).start()
|
||||
}
|
||||
mexp_move(ap: number,bp: number,cp: number){
|
||||
let a_pos=v3(ap,this.node.getChildByName("mexp").getChildByName("a_exp").position.y)
|
||||
let b_pos=v3(bp,this.node.getChildByName("mexp").getChildByName("b_exp").position.y)
|
||||
let c_pos=v3(cp,this.node.getChildByName("mexp").getChildByName("c_exp").position.y)
|
||||
tween(this.node.getChildByName("mexp").getChildByName("a_exp")).to(0.5,{position:a_pos}).start()
|
||||
tween(this.node.getChildByName("mexp").getChildByName("b_exp")).to(0.5,{position:b_pos}).start()
|
||||
tween(this.node.getChildByName("mexp").getChildByName("c_exp")).to(0.5,{position:c_pos}).start()
|
||||
}
|
||||
check_exp(){
|
||||
if(!this.msk.on){
|
||||
if(smc.vm_data.mission.a_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 1
|
||||
this.msk.on = true
|
||||
this.select_msk(1)
|
||||
this.exp_move(30,-100,-100)
|
||||
}
|
||||
if(smc.vm_data.mission.b_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 2
|
||||
this.msk.on = true
|
||||
this.select_msk(2)
|
||||
this.exp_move(-100,30,-100)
|
||||
}
|
||||
if(smc.vm_data.mission.c_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 3
|
||||
this.msk.on = true
|
||||
this.select_msk(3)
|
||||
this.exp_move(-100,-100,30)
|
||||
}
|
||||
}else{
|
||||
switch (this.msk.type){
|
||||
case 1:
|
||||
if(smc.vm_data.mission.a_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.a_exp = 0
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(smc.vm_data.mission.b_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.b_exp = 0
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(smc.vm_data.mission.c_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.c_exp = 0
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
check_m_exp(){
|
||||
if(!this.mmsk.on){
|
||||
if(smc.vm_data.mission.ma_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 1
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(1)
|
||||
this.mexp_move(-30,100,100)
|
||||
}
|
||||
if(smc.vm_data.mission.mb_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 2
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(2)
|
||||
this.mexp_move(100,-30,100)
|
||||
}
|
||||
if(smc.vm_data.mission.mc_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 3
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(3)
|
||||
this.mexp_move(100,100,-30)
|
||||
}
|
||||
}else{
|
||||
switch (this.mmsk.type){
|
||||
case 1:
|
||||
if(smc.vm_data.mission.ma_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.ma_exp = 0
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(smc.vm_data.mission.mb_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.mb_exp = 0
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(smc.vm_data.mission.mc_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.mc_exp = 0
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
select_msk(type:number){
|
||||
smc.vm_data.mission.a_exp=0
|
||||
smc.vm_data.mission.b_exp=0
|
||||
smc.vm_data.mission.c_exp=0
|
||||
smc.vmdata.mission.s_exp=0
|
||||
let sk:any=RandomManager.instance.getRandomByObjectList(MSlist[type],1)
|
||||
this.msk.uuid=sk[0]
|
||||
let skill=ecs.getEntity<MSkill>(MSkill)
|
||||
skill.load(BoxSet.HERO,this.msk.uuid)
|
||||
}
|
||||
select_mmsk(type:number){
|
||||
smc.vm_data.mission.ma_exp=0
|
||||
smc.vm_data.mission.mb_exp=0
|
||||
smc.vm_data.mission.mc_exp=0
|
||||
smc.vmdata.mission.ms_exp=0
|
||||
let sk:any=RandomManager.instance.getRandomByObjectList(MSlist[type],1)
|
||||
this.mmsk.uuid=sk[0]
|
||||
let mskill=ecs.getEntity<MSkill>(MSkill)
|
||||
mskill.load(BoxSet.MONSTER,this.mmsk.uuid)
|
||||
}
|
||||
|
||||
do_reward(){
|
||||
console.log("do_reward")
|
||||
|
||||
@@ -272,15 +199,15 @@ export class MissionComp extends CCComp {
|
||||
m_alive=true
|
||||
}
|
||||
}
|
||||
if (!m_alive) smc.vm_data.mission.is_victory = true
|
||||
if (!h_alive) smc.vm_data.mission.is_defeat = true
|
||||
if (!m_alive) smc.vmdata.mission.is_victory = true
|
||||
if (!h_alive) smc.vmdata.mission.is_defeat = true
|
||||
this.to_end_mission()
|
||||
}
|
||||
to_end_mission(){
|
||||
if (smc.vm_data.mission.is_victory){
|
||||
if (smc.vmdata.mission.is_victory){
|
||||
this.VictoryComp.do_victiry()
|
||||
}
|
||||
if (smc.vm_data.mission.is_defeat){
|
||||
if (smc.vmdata.mission.is_defeat){
|
||||
this.VictoryComp.do_defeat()
|
||||
}
|
||||
}
|
||||
@@ -314,7 +241,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
}
|
||||
heros_call(){
|
||||
let heros=smc.vm_data.fight_heros
|
||||
let heros=smc.vmdata.fight_heros
|
||||
for(let i=0;i<heros.length;i++){
|
||||
this.addHero(heros[i],i)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { BossViewComp } from "../Boss/BossViewComp";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { MissionReward } from "../common/config/MissionSet";
|
||||
import { Items } from "../common/config/Items";
|
||||
import { Item } from "./Item";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -20,38 +21,42 @@ export class VictoryComp extends CCComp {
|
||||
reward_lv:number=1
|
||||
reward_num:number=2
|
||||
rerawd_item:any={}
|
||||
if_show:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
}
|
||||
private do_victiry() {
|
||||
if(this.if_show) return
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.getReward(true)
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = false
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = true;
|
||||
}
|
||||
private do_defeat() {
|
||||
if(this.if_show) return
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.getReward(false)
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = false;
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = true
|
||||
}
|
||||
getReward(){
|
||||
let reward1:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let reward2:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let item1 =Items[reward1[0]]
|
||||
let item2 =Items[reward2[1]]
|
||||
let r1_num=0
|
||||
let r2_num=0
|
||||
console.log("getReward:",item1,item2)
|
||||
this.node.getChildByName("Node").getChildByName("item2").getChildByName("num").getComponent(Label).string=item1.r_num.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item2").getChildByName("name").getComponent(Label).string=item1.name.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item3").getChildByName("num").getComponent(Label).string=item2.r_num.toString()
|
||||
this.node.getChildByName("Node").getChildByName("item3").getChildByName("name").getComponent(Label).string=item2.r_num.toString()
|
||||
|
||||
|
||||
getReward(is_victory:boolean){
|
||||
let conut =2
|
||||
if(is_victory) 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 parent = this.node.getChildByName("Node").getChildByName("items")
|
||||
item1.load(1001,gold,parent)
|
||||
for (let i = 0; i < conut; i++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
let reward:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
let im =Items[reward[0]]
|
||||
item.load(im.uuid,im.r_num,parent)
|
||||
}
|
||||
this.if_show=true
|
||||
}
|
||||
end_mission(){
|
||||
this.node.getChildByName("Node").active=false
|
||||
this.if_show=false
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user