假期修改

This commit is contained in:
2024-09-18 12:45:05 +08:00
parent 2095393757
commit cd0dc9fe7c
79 changed files with 7383 additions and 1449 deletions

View File

@@ -20,12 +20,12 @@ export class CardControllerComp extends CCComp {
touch_time:number = 0
in_touch:boolean = false
cards:any = {
1:{uuid:1101,type:1,lv:0,alive:false},
2:{uuid:1102,type:1,lv:0,alive:false},
3:{uuid:1103,type:1,lv:0,alive:false},
4:{uuid:1104,type:1,lv:0,alive:false},
5:{uuid:1105,type:1,lv:0,alive:false},
6:{uuid:1106,type:1,lv:0,alive:false},
1:{uuid:1101,type:1,lv:0,cost:0,alive:false},
2:{uuid:1102,type:1,lv:0,cost:0,alive:false},
3:{uuid:1103,type:1,lv:0,cost:0,alive:false},
4:{uuid:1104,type:1,lv:0,cost:0,alive:false},
5:{uuid:1105,type:1,lv:0,cost:0,alive:false},
6:{uuid:1106,type:1,lv:0,cost:0,alive:false},
}
protected onLoad(): void {
let card1 = this.node.getChildByName("cards").getChildByName("card1");
@@ -146,27 +146,18 @@ 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 = SkillSet[uuid].info
smc.vm_data.item_box.name = SkillSet[uuid].name
smc.vm_data.item_box.skillcd = SkillSet[uuid].cd
smc.vm_data.item_box.skillsd = SkillSet[uuid].sd
smc.vm_data.item_box.atk = SkillSet[uuid].atk
smc.vm_data.item_box.hp = SkillSet[uuid].hp
smc.vm_data.item_box.info = smc.items[uuid].info
smc.vm_data.item_box.name = smc.items[uuid].name
smc.vm_data.item_box.skillcd = smc.items[uuid].cd
smc.vm_data.item_box.skillsd = smc.items[uuid].sd
smc.vm_data.item_box.atk = smc.items[uuid].atk
smc.vm_data.item_box.hp = smc.items[uuid].hp
smc.vm_data.item_box.shield = smc.items[uuid].shield
node.active=true
}
if(type == 3){
smc.vm_data.item_box.info = SkillSet[uuid].info
smc.vm_data.item_box.name = SkillSet[uuid].name
smc.vm_data.item_box.skillcd = SkillSet[uuid].cd
smc.vm_data.item_box.skillsd = SkillSet[uuid].sd
smc.vm_data.item_box.atk = SkillSet[uuid].atk
smc.vm_data.item_box.hp = SkillSet[uuid].hp
smc.vm_data.item_box.shield = SkillSet[uuid].shield
node.active=true
if(SkillSet[uuid].shield > 0){
if(smc.items[uuid].shield > 0){
node.getChildByName("data").getChildByName("shield").active=true
}
if(SkillSet[uuid].hp > 0){
if(smc.items[uuid].hp > 0){
node.getChildByName("data").getChildByName("hp").active=true
}
}
@@ -231,8 +222,9 @@ export class CardControllerComp extends CCComp {
load_cards() {
this.in_load = true
let card:any=null
for (let index = 1; index <= 4; index++) {
for (let index = 1; index <= 6; index++) {
card=RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.cards[index].uuid=card[0].uuid
this.cards[index].type=card[0].type
@@ -241,35 +233,15 @@ export class CardControllerComp extends CCComp {
let pathName: string = "";
let name: string = "";
let level: number = 0;
let cost: number = 0;
let { uuid, type } = card[0];
url = "game/hero/hero_icon";
({ uuid: pathName, name, level } = smc.heros[uuid]);
({ uuid: pathName, name, level ,cost} = smc.heros[uuid]);
this.cards[index].lv=level
this.cards[index].cost = cost
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=level.toString()
node.getChildByName('name').getComponent(Label).string=name
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("item").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
this.cards[index].alive=true
}
for (let index = 5; index <= 6; index++) {
card=RandomManager.instance.getRandomByObjectList(smc.items, 1);
this.cards[index].uuid=card[0].uuid
this.cards[index].type=card[0].type
let url: string = "";
let pathName: string = "";
let name: string = "";
let level: number = 0;
let { uuid, type } = card[0];
url = "game/heros/skill";
({ path: pathName, name, level } = smc.skills[uuid]);
this.cards[index].lv=level
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=level.toString()
node.getChildByName('cost').getComponent(Label).string=cost.toString()
node.getChildByName('lv').getChildByName('lv').getComponent(Label).string=level.toString()
node.getChildByName('name').getComponent(Label).string=name
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
@@ -279,6 +251,29 @@ export class CardControllerComp extends CCComp {
});
this.cards[index].alive=true
}
// for (let index = 5; index <= 6; index++) {
// card=RandomManager.instance.getRandomByObjectList(smc.item_list, 1);
// this.cards[index].uuid=card[0].uuid
// this.cards[index].type=card[0].type
// let url: string = "";
// let pathName: string = "";
// let name: string = "";
// let level: number = 0;
// let { uuid, type } = card[0];
// url = "game/heros/skill";
// ({ path: pathName, name, level } = smc.items[uuid]);
// this.cards[index].lv=level
// let node=this.node.getChildByName('cards').getChildByName('card'+index)
// node.getChildByName('cost').getComponent(Label).string=level.toString()
// node.getChildByName('name').getComponent(Label).string=name
// // const sprite = node.getChildByName("item").getComponent(Sprite);
// // console.log(this['card'+index],url,pathName,sprite)
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("item").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(pathName);
// });
// this.cards[index].alive=true
// }
// console.log("cards:",this.cards)
this.in_load = false
}
@@ -317,7 +312,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].lv){
if(smc.vm_data.gold.min >= this.cards[index].cost){
this.cards[index].alive=false
this.do_use_card(index)
}else{
@@ -327,18 +322,19 @@ export class CardControllerComp extends CCComp {
}
do_use_card(index:number){
this.cards[index].alive=false
smc.vm_data.gold.min -= this.cards[index].lv;
switch (this.cards[index].type) {
case 1:
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
break;
case 2:
oops.message.dispatchEvent("do_use_skill", { uuid: this.cards[index].uuid });
break;
case 3:
oops.message.dispatchEvent("do_use_skill", { uuid: this.cards[index].uuid });
break;
}
smc.vm_data.gold.min -= this.cards[index].cost;
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// switch (this.cards[index].type) {
// case 1:
// oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// break;
// case 2:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// case 3:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// }
this.remove_card(index)
}
protected update(dt: number): void {