奖励页面ui 修改完成
This commit is contained in:
@@ -11,6 +11,8 @@ 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";
|
||||
import { HChipComp } from "../hero/HChipComp";
|
||||
import { MissionComp } from "./MissionComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -27,80 +29,84 @@ export class VictoryComp extends CCComp {
|
||||
}
|
||||
onAdded(args: any) {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
open(){
|
||||
console.log("Victory open",smc.items,smc.heros)
|
||||
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 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)
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
item.load(smc.items[i].uuid,smc.items[i].x1,parent)
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
if(smc.heros[i].x1 > 0){
|
||||
smc.heros[i].x10 =smc.heros[i].x1*9
|
||||
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)
|
||||
let path = "game/gui/hchip";
|
||||
let prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
let node = instantiate(prefab);
|
||||
node.parent=parent
|
||||
let hc= node.getComponent(HChipComp)
|
||||
hc.update_data(smc.heros[i].uuid,smc.heros[i].x1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
do_x10(){
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].num+=smc.items[i].x10
|
||||
if(smc.items[i].uuid == 9001){
|
||||
smc.vmdata.gold.num+=smc.items[i].x1*10
|
||||
}
|
||||
if(smc.items[i].uuid == 9003){
|
||||
smc.vmdata.exp.num+=smc.items[i].x1*10
|
||||
}
|
||||
if(smc.items[i].uuid < 9000){
|
||||
smc.items[i].num+=smc.items[i].x1*10
|
||||
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].num+=smc.heros[i].x10
|
||||
smc.heros[i].num+=smc.heros[i].x1*10
|
||||
}
|
||||
this.clear_x1()
|
||||
this.reset();
|
||||
|
||||
}
|
||||
do_x1(){
|
||||
this.clear_x1()
|
||||
this.reset();
|
||||
}
|
||||
|
||||
clear_x1(){
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].x1=smc.items[i].x10=0
|
||||
}
|
||||
for (let i in smc.skills) {
|
||||
smc.skills[i].x1=smc.skills[i].x10=0
|
||||
if(smc.items[i].uuid == 9001){
|
||||
smc.vmdata.gold.num+=smc.items[i].x1
|
||||
}
|
||||
|
||||
if(smc.items[i].uuid == 9003){
|
||||
smc.vmdata.exp.num+=smc.items[i].x1
|
||||
}
|
||||
if(smc.items[i].uuid < 9000){
|
||||
smc.items[i].num+=smc.items[i].x1
|
||||
|
||||
}
|
||||
}
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].x1=smc.heros[i].x10=0
|
||||
smc.heros[i].num+=smc.heros[i].x1
|
||||
}
|
||||
console.log("clear_x1",smc.items,smc.skills,smc.heros)
|
||||
this.clear_x1()
|
||||
}
|
||||
end_mission(){
|
||||
|
||||
clear_x1(){
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].x1=0
|
||||
}
|
||||
// for (let i in smc.skills) {
|
||||
// smc.skills[i].x1=0
|
||||
// }
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].x1=0
|
||||
console.log("clear_x1",smc.heros[i].num)
|
||||
}
|
||||
let children = this.node.getChildByName("items").children
|
||||
for (let i in children) {
|
||||
children[i].destroy()
|
||||
}
|
||||
console.log("clear_x1",smc.items,smc.heros)
|
||||
this.node.parent.getComponent(MissionComp).to_mission_home()
|
||||
}
|
||||
|
||||
|
||||
item_show(e:any,val:any){
|
||||
console.log("item_show",val)
|
||||
}
|
||||
@@ -109,6 +115,6 @@ export class VictoryComp extends CCComp {
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
oops.gui.remove(UIID.Victory, false);
|
||||
this.node.destroy()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user