技能碎片完成
This commit is contained in:
@@ -35,15 +35,15 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
|
||||
};
|
||||
skills: any = {
|
||||
1001:{lv:0,num:4,x1:0,x10:0},
|
||||
1002:{lv:0,num:3,x1:0,x10:0},
|
||||
1003:{lv:0,num:0,x1:0,x10:0},
|
||||
1004:{lv:0,num:0,x1:0,x10:0},
|
||||
1005:{lv:0,num:0,x1:0,x10:0},
|
||||
1006:{lv:0,num:0,x1:0,x10:0},
|
||||
1007:{lv:0,num:0,x1:0,x10:0},
|
||||
1008:{lv:0,num:0,x1:0,x10:0},
|
||||
1009:{lv:0,num:0,x1:0,x10:0},
|
||||
1001:{uuid:1001,lv:0,num:4,x1:1,x10:0},
|
||||
1002:{uuid:1002,lv:0,num:3,x1:2,x10:0},
|
||||
1003:{uuid:1003,lv:0,num:0,x1:0,x10:0},
|
||||
1004:{uuid:1004,lv:0,num:0,x1:0,x10:0},
|
||||
1005:{uuid:1005,lv:0,num:0,x1:0,x10:0},
|
||||
1006:{uuid:1006,lv:0,num:0,x1:0,x10:0},
|
||||
1007:{uuid:1007,lv:0,num:0,x1:0,x10:0},
|
||||
1008:{uuid:1008,lv:0,num:0,x1:0,x10:0},
|
||||
1009:{uuid:1009,lv:0,num:0,x1:0,x10:0},
|
||||
};
|
||||
/** 游戏主角 */
|
||||
heros:any={
|
||||
|
||||
35
assets/script/game/hero/SChipComp.ts
Normal file
35
assets/script/game/hero/SChipComp.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
|
||||
import { HeroInfo } from '../common/config/heroSet';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('SChipComp')
|
||||
export class SChipComp extends Component {
|
||||
h_uuid:number=0
|
||||
num:number=0
|
||||
lv:number=0
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
update_data(uuid:number,num:number=0){
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
// console.log("update_data",SkillSet[uuid].path)
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("skill").getChildByName("icon").getComponent(Sprite);
|
||||
// console.log("update_data",atlas,sprite)
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
|
||||
});
|
||||
if(num > 0){
|
||||
this.node.getChildByName("num").getComponent(Label).string = num.toString();
|
||||
}else{
|
||||
this.node.getChildByName("num").getComponent(Label).string = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
assets/script/game/hero/SChipComp.ts.meta
Normal file
1
assets/script/game/hero/SChipComp.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"f653e13a-d17c-4f62-808a-1e95a4df5327","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -4,6 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { Items } from "../common/config/Items";
|
||||
import { HChipComp } from "../hero/HChipComp";
|
||||
import { SChipComp } from "../hero/SChipComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -33,11 +34,17 @@ export class RewardComp extends CCComp {
|
||||
if(type==1){
|
||||
this.node.getChildByName("icon").active=false
|
||||
this.node.getChildByName("hchip").active=true
|
||||
let hchipcomp= this.node.getChildByName("hchip").getComponent(HChipComp)
|
||||
hchipcomp.update_data(uuid,0)
|
||||
let hc= this.node.getChildByName("hchip").getComponent(HChipComp)
|
||||
hc.update_data(uuid,0)
|
||||
}
|
||||
|
||||
if(type==2){
|
||||
this.node.getChildByName("icon").active=false
|
||||
this.node.getChildByName("schip").active=true
|
||||
let sc= this.node.getChildByName("schip").getComponent(SChipComp)
|
||||
sc.update_data(uuid,0)
|
||||
}
|
||||
|
||||
|
||||
this.node.getChildByName("x1").getComponent(Label).string = x1.toString()
|
||||
this.node.getChildByName("x10").getComponent(Label).string = x10.toString()
|
||||
this.node.parent = parent
|
||||
|
||||
@@ -41,26 +41,27 @@ export class VictoryComp extends CCComp {
|
||||
smc.vmdata.exp.x10=smc.vmdata.exp.x1*9
|
||||
}
|
||||
var parent = this.node.getChildByName("items")
|
||||
var path = "game/gui/reward";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
for (let i in smc.items) {
|
||||
if(smc.items[i].x1 > 0){
|
||||
smc.items[i].x10 =smc.items[i].x1*9
|
||||
var path = "game/gui/reward";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
console.log("VictoryComp",prefab,smc.items[i])
|
||||
var node = instantiate(prefab);
|
||||
let rc:any= node.getComponent(RewardComp)!;
|
||||
rc.init(smc.items[i].uuid,smc.items[i].x1,smc.items[i].x10,parent,0)
|
||||
}
|
||||
}
|
||||
for (let i in smc.skills) {
|
||||
|
||||
if(smc.skills[i].x1 > 0){
|
||||
smc.skills[i].x10 =smc.skills[i].x1*9
|
||||
var node = instantiate(prefab);
|
||||
let rc:any= node.getComponent(RewardComp)!;
|
||||
rc.init(smc.skills[i].uuid,smc.skills[i].x1,smc.skills[i].x10,parent,2)
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
if(smc.heros[i].x1 > 0){
|
||||
smc.heros[i].x10 =smc.heros[i].x1*9
|
||||
var path = "game/gui/reward";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
console.log("VictoryComp",prefab,smc.heros[i])
|
||||
var node = instantiate(prefab);
|
||||
let rc:any= node.getComponent(RewardComp)!;
|
||||
rc.init(smc.heros[i].uuid,smc.heros[i].x1,smc.heros[i].x10,parent,1)
|
||||
|
||||
Reference in New Issue
Block a user