dd
This commit is contained in:
@@ -54,7 +54,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
level:1,
|
||||
level_max:4,
|
||||
eid:0,
|
||||
ref_cost:2,
|
||||
ref_cost:1,
|
||||
up_cost:4,
|
||||
},
|
||||
hp: {
|
||||
@@ -66,8 +66,8 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
max: 30
|
||||
},
|
||||
gold: {
|
||||
min: 3,
|
||||
max: 3,
|
||||
min: 20,
|
||||
max: 20,
|
||||
max_limit:10,
|
||||
time:0,
|
||||
cd:10,
|
||||
|
||||
@@ -9,11 +9,11 @@ export const CardType = {
|
||||
2: "后排",
|
||||
}
|
||||
export const CardList={
|
||||
1:[1101,1102,1201,1202,1301,1302,],
|
||||
2:[2101,2102,2201,2202,2301,2302,],
|
||||
3:[3101,3102,3201,3202,3301,3302,],
|
||||
4:[4101,4102,4201,4202,4301,4302,],
|
||||
5:[5001,5002,5003,5004],
|
||||
1:[{uuid:1101,type:1},{uuid:1102,type:1},{uuid:1201,type:1},{uuid:1202,type:1},{uuid:1301,type:1},{uuid:1302,type:1},{uuid:1001,type:2}],
|
||||
2:[{uuid:2101,type:1},{uuid:2102,type:1},{uuid:2201,type:1},{uuid:2202,type:1},{uuid:2301,type:1},{uuid:2302,type:1},],
|
||||
3:[{uuid:3101,type:1},{uuid:3102,type:1},{uuid:3201,type:1},{uuid:3202,type:1},{uuid:3301,type:1},{uuid:3302,type:1},],
|
||||
4:[{uuid:4101,type:1},{uuid:4102,type:1},{uuid:4201,type:1},{uuid:4202,type:1},{uuid:4301,type:1},{uuid:4302,type:1},],
|
||||
5:[{uuid:5001,type:1},{uuid:5002,type:1},{uuid:5003,type:1},{uuid:5004,type:1}],
|
||||
// 1:[1101,1102,1103,1104,1105,1106,1201,1202,1203,1204,1205,1301,1302,1303,1304,],
|
||||
// 2:[2101,2102,2103,2104,2105,2201,2202,2203,2204,2301,2302,2303,2304,2305,],
|
||||
// 3:[3101,3102,3103,3104,3201,3202,3203,3204,3205,3301,3302,3303,3304,],
|
||||
@@ -29,6 +29,11 @@ export const HeroSet ={
|
||||
},
|
||||
|
||||
}
|
||||
export const SkillSet={
|
||||
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const CardSet = {
|
||||
1101:{uuid: 1101,path: "1101",type: 1,level: 1,name: "守护犬",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,skill: "base",max_skill: "base",int1: null,int2: null,dps: 2,word: "守护", info: "自身护盾",atktype: "攻击型", mon: "狗"},
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
export const MissionNum = 3
|
||||
export const Mission= {
|
||||
// 1:[1101,1102,1201,1202,1301,1302,],
|
||||
// 2:[2101,2102,2201,2202,2301,2302,],
|
||||
// 3:[3101,3102,3201,3202,3301,3302,],
|
||||
// 4:[4101,4102,4201,4202,4301,4302,],
|
||||
// 5:[5001,5002,5003,5004],
|
||||
// 1:[1101,1102,1103,1104,1105,1106,1201,1202,1203,1204,1205,1301,1302,1303,1304,],
|
||||
// 2:[2101,2102,2103,2104,2105,2201,2202,2203,2204,2301,2302,2303,2304,2305,],
|
||||
// 3:[3101,3102,3103,3104,3201,3202,3203,3204,3205,3301,3302,3303,3304,],
|
||||
// 4:[4101,4102,4103,4104,4201,4202,4203,4204,4301,4302,4303,4304,],
|
||||
// 5:[5001,5002,5003,5004],
|
||||
export const MonsetList = {
|
||||
1:{
|
||||
1:[1101,1102,],
|
||||
2:[1101,1102,2101,2102,],
|
||||
@@ -33,3 +23,42 @@ export const Mission= {
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export const MissionSet = {
|
||||
1:{
|
||||
lv1_num:10,
|
||||
lv2_num:10,
|
||||
lv3_num:10,
|
||||
lv4_num:10,
|
||||
lv5_num:10,
|
||||
lv1_skill_num:10,
|
||||
lv2_skill_num:10,
|
||||
lv3_skill_num:10,
|
||||
lv4_skill_num:10,
|
||||
lv5_skill_num:10,
|
||||
},
|
||||
2:{
|
||||
lv1_num:10,
|
||||
lv2_num:10,
|
||||
lv3_num:10,
|
||||
lv4_num:10,
|
||||
lv5_num:10,
|
||||
lv1_skill_num:10,
|
||||
lv2_skill_num:10,
|
||||
lv3_skill_num:10,
|
||||
lv4_skill_num:10,
|
||||
lv5_skill_num:10,
|
||||
},
|
||||
3:{
|
||||
lv1_num:10,
|
||||
lv2_num:10,
|
||||
lv3_num:10,
|
||||
lv4_num:10,
|
||||
lv5_num:10,
|
||||
lv1_skill_num:10,
|
||||
lv2_skill_num:10,
|
||||
lv3_skill_num:10,
|
||||
lv4_skill_num:10,
|
||||
lv5_skill_num:10,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class CardControllerComp extends CCComp {
|
||||
lists.forEach(element => {
|
||||
let card = ecs.getEntity<HeroCard>(HeroCard);
|
||||
let pos = v3(x,y)
|
||||
card.load(pos,element[0],cards_node,1);
|
||||
card.load(pos,element[0].uuid,cards_node,element[0].type);
|
||||
x=x+142
|
||||
});
|
||||
this.in_load = false;
|
||||
|
||||
62
assets/script/game/map/MapMonsterComp.ts
Normal file
62
assets/script/game/map/MapMonsterComp.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { _decorator ,Vec3,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 { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { Monster } from "../monster/Monster";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { MapViewScene } from "./view/MapViewScene";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MapMonsterComp')
|
||||
@ecs.register('MapMonster', false)
|
||||
export class MapMonsterComp extends CCComp {
|
||||
scene: MapViewScene = null;
|
||||
current_map: any;
|
||||
|
||||
private monster_refresh_rtimer: Timer = new Timer(1);
|
||||
async onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if (this.monster_refresh_rtimer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
this.monster_refresh()
|
||||
}
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
}
|
||||
monster_refresh(){
|
||||
if(smc.monsters.length > 0 ){
|
||||
this.addMonster(smc.monsters[0].uuid)
|
||||
}
|
||||
}
|
||||
private addMonster(uuid:number=1101) {
|
||||
let monster = ecs.getEntity<Monster>(Monster);
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let camp = -1
|
||||
monster.load(pos,camp,uuid);
|
||||
smc.monsters.splice(0,1)
|
||||
|
||||
}
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
// this.addMonster(args.uuid)
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
this.scene = this.getComponent(MapViewScene);
|
||||
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/MapMonsterComp.ts.meta
Normal file
9
assets/script/game/map/MapMonsterComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c0f2f76a-7c1b-4e8c-a0a3-b201f5a86f7e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
53
assets/script/game/map/MapSkillComp.ts
Normal file
53
assets/script/game/map/MapSkillComp.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { _decorator ,Prefab,instantiate,Node} 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MapSkillComp')
|
||||
@ecs.register('MapSkill', false)
|
||||
export class MapSkillComp extends CCComp {
|
||||
@property(Prefab)
|
||||
light: Prefab = null;
|
||||
onLoad(){
|
||||
oops.message.on("monster_load", this.doMonsterLoad, this);
|
||||
oops.message.on("hero_load", this.doHeroLoad, this);
|
||||
oops.message.on("do_use_skill", this.doSkill, this);
|
||||
}
|
||||
doSkill(){
|
||||
// console.log("doSkill")
|
||||
}
|
||||
doMonsterLoad(){
|
||||
|
||||
// const light = instantiate(this.light);
|
||||
// light.setPosition(300,-30,0);
|
||||
// this.node.addChild(light);
|
||||
}
|
||||
doHeroLoad(){
|
||||
// console.log(this.light)
|
||||
// const light = instantiate(this.light);
|
||||
// light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
// this.node.addChild(light);
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/MapSkillComp.ts.meta
Normal file
9
assets/script/game/map/MapSkillComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7739951-194b-4d13-8bff-cd7f7a0b3bbf",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -21,24 +21,18 @@ export class MapViewComp extends CCComp {
|
||||
scene: MapViewScene = null!;
|
||||
current_map: any;
|
||||
private game_timer: Timer = new Timer(1);
|
||||
private monster_refresh_rtimer: Timer = new Timer(3);
|
||||
|
||||
|
||||
private mapLoaded() {
|
||||
|
||||
}
|
||||
async onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
|
||||
}
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
this.addMonster()
|
||||
}
|
||||
|
||||
/**监听do_add_hero 添加hero,通过uuid */
|
||||
private on_do_add_hero(event: string, args: any) {
|
||||
console.log("do_add_hero",args.uuid)
|
||||
// console.log("do_add_hero",args.uuid)
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
reset(): void {
|
||||
@@ -54,22 +48,15 @@ export class MapViewComp extends CCComp {
|
||||
// console.log("heros",heros)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if (this.monster_refresh_rtimer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
this.monster_refresh()
|
||||
}
|
||||
if (this.game_timer.update(dt)) {
|
||||
smc.vm_data.game.g_time += 1;
|
||||
}
|
||||
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
this.gold_add(dt)
|
||||
}
|
||||
// 刷新怪物
|
||||
monster_refresh(){
|
||||
if(smc.monsters.length > 0 ){
|
||||
this.addMonster(smc.monsters[0].uuid)
|
||||
}
|
||||
}
|
||||
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
@@ -94,13 +81,6 @@ export class MapViewComp extends CCComp {
|
||||
let camp = 1
|
||||
hero.load(pos,camp,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001) {
|
||||
this.scene.node.active = true
|
||||
let monster = ecs.getEntity<Monster>(Monster);
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let camp = -1
|
||||
monster.load(pos,camp,uuid);
|
||||
smc.monsters.splice(0,1)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,16 +22,20 @@ export default class SkillLayer extends Component {
|
||||
@property(Prefab)
|
||||
light: Prefab = null;
|
||||
onLoad(){
|
||||
oops.message.on("monster_load", this.onMonsterLoaded, this);
|
||||
oops.message.on("hero_load", this.onHeroLoaded, this);
|
||||
oops.message.on("monster_load", this.doMonsterLoad, this);
|
||||
oops.message.on("hero_load", this.doHeroLoad, this);
|
||||
oops.message.on("do_use_skill", this.doSkill, this);
|
||||
|
||||
}
|
||||
onMonsterLoaded(){
|
||||
doSkill(){
|
||||
// console.log("doSkill")
|
||||
}
|
||||
doMonsterLoad(){
|
||||
// const light = instantiate(this.light);
|
||||
// light.setPosition(300,-30,0);
|
||||
// this.node.addChild(light);
|
||||
}
|
||||
onHeroLoaded(){
|
||||
doHeroLoad(){
|
||||
const light = instantiate(this.light);
|
||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
this.node.addChild(light);
|
||||
|
||||
@@ -52,7 +52,7 @@ export class Hero extends ecs.Entity {
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(CardSet[uuid].path);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
|
||||
});
|
||||
this.hero_init(uuid,node)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
@@ -61,22 +61,22 @@ export class Hero extends ecs.Entity {
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(MonsterViewComp)!;
|
||||
mv.hero_uuid=uuid;
|
||||
mv.speed =mv.ospeed = CardSet[uuid].speed;
|
||||
mv.hero_name= CardSet[uuid].name;
|
||||
mv.hp= mv.hp_max = CardSet[uuid].hp;
|
||||
mv.level = CardSet[uuid].level;
|
||||
mv.atk = CardSet[uuid].atk;
|
||||
mv.atk_cd = CardSet[uuid].atk_cd;
|
||||
mv.power = CardSet[uuid].power;
|
||||
mv.type = CardSet[uuid].type;
|
||||
mv.speed =mv.ospeed = smc.heros[uuid].speed;
|
||||
mv.hero_name= smc.heros[uuid].name;
|
||||
mv.hp= mv.hp_max = smc.heros[uuid].hp;
|
||||
mv.level = smc.heros[uuid].level;
|
||||
mv.atk = smc.heros[uuid].atk;
|
||||
mv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
mv.camp = 1;
|
||||
mv.change_name(CardSet[uuid].name,1)
|
||||
mv.change_name(smc.heros[uuid].name,1)
|
||||
this.add(mv);
|
||||
this.push_monsters_in(uuid,mv.ent.eid)
|
||||
}
|
||||
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||
smc.monsters_in.push({name:CardSet[uuid].name,eid:eid})
|
||||
smc.monsters_in.push({name:smc.heros[uuid].name,eid:eid})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import{HeroCardViewComp} from "./HeroCardViewComp";
|
||||
import { CardSet } from "../common/config/CardSet";
|
||||
import { CardSet ,SkillSet} from "../common/config/CardSet";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`HeroCard`)
|
||||
export class HeroCard extends ecs.Entity {
|
||||
@@ -32,20 +32,28 @@ export class HeroCard extends ecs.Entity {
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=1001,parent:Node,type:number=1) {
|
||||
// console.log("load hero",uuid);
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
switch(type){
|
||||
let path: string;
|
||||
let url: string;
|
||||
let pathName: string;
|
||||
let name: string;
|
||||
let level: number;
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
var path = "game/heros/hero_card";
|
||||
path = "game/heros/hero_card";
|
||||
url = "game/heros/heros";
|
||||
({ path: pathName, name, level } = smc.heros[uuid]);
|
||||
break;
|
||||
case 2:
|
||||
var path = "game/heros/skill_card";
|
||||
path = "game/heros/skill_card";
|
||||
url = "game/heros/skill";
|
||||
({ path: pathName, name, level } = SkillSet[uuid]);
|
||||
break;
|
||||
case 3:
|
||||
var path = "game/heros/item_card";
|
||||
break;
|
||||
default:
|
||||
var path = "game/heros/hero_card";
|
||||
path = "game/heros/hero_card";
|
||||
url = "game/heros/heros";
|
||||
({ path: pathName, name, level } = smc.heros[uuid]);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,20 +63,19 @@ export class HeroCard extends ecs.Entity {
|
||||
// node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||
node.setPosition(pos)
|
||||
|
||||
const url = 'game/heros/heros';
|
||||
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("hero").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(CardSet[uuid].path);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
|
||||
var hcv = node.getComponent(HeroCardViewComp)!;
|
||||
hcv.card_name=CardSet[uuid].name
|
||||
hcv.card_name=name
|
||||
hcv.card_uid=uuid
|
||||
hcv.card_type=type
|
||||
hcv.card_level=level
|
||||
this.add(hcv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('HeroCardView', false)
|
||||
export class HeroCardViewComp extends CCComp {
|
||||
card_name:string = "hero_card";
|
||||
card_type:string = "hero";
|
||||
card_uid:number = 1000;
|
||||
in_destroy:boolean = false;
|
||||
pos_x:number = 0;
|
||||
pos_y:number = 0;
|
||||
card_type:number = 1;
|
||||
card_level:number = 1;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.node.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
|
||||
@@ -31,7 +32,7 @@ export class HeroCardViewComp extends CCComp {
|
||||
start() {
|
||||
this.pos_x=this.node.position.x;
|
||||
this.pos_y=this.node.position.y;
|
||||
this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = CardSet[this.card_uid].level.toString();
|
||||
this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.card_level.toString();
|
||||
this.node.getChildByName("name").getComponent(Label).string = this.card_name
|
||||
|
||||
}
|
||||
@@ -97,14 +98,30 @@ export class HeroCardViewComp extends CCComp {
|
||||
}
|
||||
|
||||
use_card(){
|
||||
if(smc.vm_data.gold.min >= smc.vm_data.cards.ref_cost){
|
||||
if(smc.vm_data.gold.min >= this.card_level){
|
||||
this.in_destroy = true;
|
||||
oops.message.dispatchEvent("do_add_hero",{uuid:this.card_uid})
|
||||
this.do_use_card()
|
||||
this.ent.destroy();
|
||||
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
|
||||
smc.vm_data.gold.min -= this.card_level;
|
||||
}else{
|
||||
oops.gui.toast("金币不够");
|
||||
this.node.setPosition(this.pos_x,this.pos_y);
|
||||
}
|
||||
}
|
||||
do_use_card(){
|
||||
switch (this.card_type) { // 添加括号并修正语法
|
||||
case 1:
|
||||
oops.message.dispatchEvent("do_add_hero", { uuid: this.card_uid }); // 添加分号
|
||||
break;
|
||||
case 2:
|
||||
oops.message.dispatchEvent("do_use_skill", { uuid: this.card_uid }); // 添加分号
|
||||
// console.log("do_use_skill",this.card_uid)
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,29 +52,29 @@ export class Monster extends ecs.Entity {
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(CardSet[uuid].path);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path);
|
||||
});
|
||||
this.hero_init(uuid,node)
|
||||
oops.message.dispatchEvent("monster_load",this)
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(MonsterViewComp)!;
|
||||
mv.speed =mv.ospeed = CardSet[uuid].speed;
|
||||
mv.hero_name= CardSet[uuid].name;
|
||||
mv.hp= mv.hp_max = CardSet[uuid].hp;
|
||||
mv.level = CardSet[uuid].level;
|
||||
mv.atk = CardSet[uuid].atk;
|
||||
mv.atk_cd = CardSet[uuid].atk_cd;
|
||||
mv.power = CardSet[uuid].power;
|
||||
mv.type = CardSet[uuid].type;
|
||||
mv.speed =mv.ospeed = smc.heros[uuid].speed;
|
||||
mv.hero_name= smc.heros[uuid].name;
|
||||
mv.hp= mv.hp_max = smc.heros[uuid].hp;
|
||||
mv.level = smc.heros[uuid].level;
|
||||
mv.atk = smc.heros[uuid].atk;
|
||||
mv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.camp = -1;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
mv.change_name(CardSet[uuid].name,-1)
|
||||
mv.change_name(smc.heros[uuid].name,-1)
|
||||
this.add(mv);
|
||||
this.push_monsters_in(uuid,mv.ent.eid)
|
||||
}
|
||||
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||
smc.monsters_in.push({name:CardSet[uuid].name,eid:eid})
|
||||
smc.monsters_in.push({name:smc.heros[uuid].name,eid:eid})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user