奖励物品基本完成

This commit is contained in:
pan@work
2024-11-26 16:26:38 +08:00
parent 3b8052761c
commit 6f58500ea9
6 changed files with 56 additions and 458 deletions

View File

@@ -6,20 +6,20 @@ type:
*/
export const Items={
1001:{uuid: 1001,path: "1001",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", },
1002:{uuid: 1002,path: "1001",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练提升高50级以上英雄等级", },
1003:{uuid: 1003,path: "1001",type: 1,r_num:10,name: "英雄原石",info:"一星英雄升星", },
1004:{uuid: 1007,path: "1001",type: 1,r_num:1,name: "高级英雄原石",info:"二星英雄升星", },
1005:{uuid: 1008,path: "1001",type: 1,r_num:1,name: "稀有英雄原石",info:"三星英雄升星", },
1006:{uuid: 1009,path: "1001",type: 1,r_num:1,name: "传说英雄原石",info:"四星英雄升星", },
1007:{uuid: 1013,path: "1001",type: 1,r_num:1,name: "招募券",info:"招募英雄", },
1021:{uuid: 1021,path: "1021",type: 1,r_num:1,name: "普通攻击石",info:"增加装备攻击力", },
1022:{uuid: 1022,path: "1021",type: 1,r_num:1,name: "高级攻击石",info:"增加装备攻击力", },
1023:{uuid: 1023,path: "1021",type: 1,r_num:1,name: "稀有攻击石",info:"增加装备攻击力", },
1024:{uuid: 1024,path: "1021",type: 1,r_num:1,name: "传说攻击石",info:"增加装备攻击力", },
1025:{uuid: 1025,path: "1021",type: 1,r_num:1,name: "普通生命石",info:"增加装备生命值", },
1026:{uuid: 1026,path: "1021",type: 1,r_num:1,name: "高级生命石",info:"增加装备生命值", },
1027:{uuid: 1027,path: "1021",type: 1,r_num:1,name: "稀有生命石",info:"增加装备生命值", },
1028:{uuid: 1028,path: "1021",type: 1,r_num:1,name: "传说生命石",info:"增加装备生命值", },
1001:{uuid: 1001,path: "2001",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", },
1002:{uuid: 1002,path: "2002",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练提升高50级以上英雄等级", },
1003:{uuid: 1003,path: "1002",type: 1,r_num:10,name: "英雄原石",info:"一星英雄升星", },
1004:{uuid: 1004,path: "1005",type: 1,r_num:1,name: "高级英雄原石",info:"二星英雄升星", },
1005:{uuid: 1005,path: "1008",type: 1,r_num:1,name: "稀有英雄原石",info:"三星英雄升星", },
1006:{uuid: 1006,path: "1011",type: 1,r_num:1,name: "传说英雄原石",info:"四星英雄升星", },
1007:{uuid: 1007,path: "5017",type: 1,r_num:1,name: "招募券",info:"招募英雄", },
1021:{uuid: 1021,path: "2301",type: 1,r_num:1,name: "普通攻击石",info:"增加装备攻击力", },
1022:{uuid: 1022,path: "2302",type: 1,r_num:1,name: "高级攻击石",info:"增加装备攻击力", },
1023:{uuid: 1023,path: "2303",type: 1,r_num:1,name: "稀有攻击石",info:"增加装备攻击力", },
1024:{uuid: 1024,path: "2304",type: 1,r_num:1,name: "传说攻击石",info:"增加装备攻击力", },
1025:{uuid: 1025,path: "2306",type: 1,r_num:1,name: "普通生命石",info:"增加装备生命值", },
1026:{uuid: 1026,path: "2307",type: 1,r_num:1,name: "高级生命石",info:"增加装备生命值", },
1027:{uuid: 1027,path: "2308",type: 1,r_num:1,name: "稀有生命石",info:"增加装备生命值", },
1028:{uuid: 1028,path: "2309",type: 1,r_num:1,name: "传说生命石",info:"增加装备生命值", },
}

View File

@@ -20,7 +20,7 @@ export const MissionSet = [
export const MissionReward = {
1:[1001,1002,1003,1013],
2:[1004,1005,1006,1007,1008,1009,1014],
3:[1010,1011,1012,1014],
1:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
2:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
3:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
}

View File

@@ -1,7 +1,8 @@
import { instantiate, Prefab } from "cc";
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } 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";
import { Items } from "../common/config/Items";
/** Item 模块 */
@ecs.register(`Item`)
@@ -14,6 +15,13 @@ export class Item extends ecs.Entity {
var path = "game/gui/item";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.getChildByName("num").getComponent(Label).string = num.toString();
let url = "gui/items";
let pathName= Items[uuid].path;
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
node.parent = praent
let iv = node.getComponent(ItemComp)!;
iv.i_uuid = uuid

View File

@@ -1,6 +1,7 @@
import { _decorator, Label } from "cc";
import { _decorator, Label, resources, Sprite, SpriteAtlas } 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 { Items } from "../common/config/Items";
const { ccclass, property } = _decorator;
@@ -11,7 +12,7 @@ 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 显示
}

View File

@@ -27,6 +27,7 @@ import { HCardComp } from "./HCardComp";
import { MSkill } from "../skills/MSkill";
import { MSkillComp } from "../skills/MSkillComp";
import { VictoryComp } from "./VictoryComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -107,6 +108,7 @@ export class MissionComp extends CCComp {
let monsters:any= this.get_mons();
let hcards:any= ecs.query(ecs.allOf(HCardComp));
let mska:any= ecs.query(ecs.allOf(MSkillComp));
let res:any= ecs.query(ecs.allOf(ItemComp));
for(let i=0;i<mska.length;i++){
mska[i].MSkillComp.reset()
mska[i].MSkillComp.ent.destroy()
@@ -129,6 +131,10 @@ export class MissionComp extends CCComp {
monsters[i].HeroView.reset()
monsters[i].HeroView.ent.destroy()
}
for(let i=0;i<res.length;i++){
res[i].ItemComp.reset()
res[i].ItemComp.ent.destroy()
}
}
check_buff(){
if(smc.vmdata.mission.a_exp >= smc.vmdata.mission.a_up_exp){