完成奖励 物品和英雄碎片奖励界面,todo 技能修改为碎片升级+技能升级+ui奖励碎片ui制作
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator, Label ,v3} from "cc";
|
||||
import { _decorator, instantiate, Label ,Prefab,resources,Sprite,SpriteAtlas,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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
@@ -11,6 +11,7 @@ import { Items } from "../common/config/Items";
|
||||
import { Item } from "./Item";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { PopViewParams, UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
||||
import { RewardComp} from "./RewardComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -26,30 +27,62 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
}
|
||||
onAdded(args: any) {
|
||||
console.log("VictoryComp onAdded",args)
|
||||
let items=smc.items
|
||||
if(smc.vmdata.gold.x1 > 0) this.node.getChildByName("items").getChildByName("gold").active=true
|
||||
if(smc.vmdata.skp.x1 > 0) this.node.getChildByName("items").getChildByName("skp").active=true
|
||||
if(smc.vmdata.exp.x1 > 0) this.node.getChildByName("items").getChildByName("exp").active=true
|
||||
|
||||
|
||||
if(smc.vmdata.gold.x1 > 0) {
|
||||
this.node.getChildByName("items").getChildByName("gold").active=true
|
||||
smc.vmdata.gold.x10=smc.vmdata.gold.x1*9
|
||||
}
|
||||
if(smc.vmdata.skp.x1 > 0) {
|
||||
this.node.getChildByName("items").getChildByName("skp").active=true
|
||||
smc.vmdata.skp.x10=smc.vmdata.skp.x1*9
|
||||
}
|
||||
if(smc.vmdata.exp.x1 > 0) {
|
||||
this.node.getChildByName("items").getChildByName("exp").active=true
|
||||
smc.vmdata.exp.x10=smc.vmdata.exp.x1*9
|
||||
}
|
||||
var parent = this.node.getChildByName("items")
|
||||
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) {
|
||||
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
do_x10(){
|
||||
console.log("do_x10",smc.vmdata)
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].num+=smc.items[i].x10
|
||||
}
|
||||
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].num+=smc.heros[i].x10
|
||||
}
|
||||
this.clear_x1()
|
||||
this.reset();
|
||||
}
|
||||
do_x1(){
|
||||
console.log("x1",smc.vmdata)
|
||||
this.clear_x1()
|
||||
this.reset();
|
||||
|
||||
}
|
||||
|
||||
clear_x1(){
|
||||
@@ -72,7 +105,9 @@ export class VictoryComp extends CCComp {
|
||||
console.log("item_show",val)
|
||||
oops.gui.open(UIID.ItemInfo, Items[val]);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
console.log("释放胜利界面");
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
oops.gui.remove(UIID.Victory, false);
|
||||
|
||||
Reference in New Issue
Block a user