完成奖品和物品显示,使用oops.gui.open打开物品信息栏 可能还存在问题

This commit is contained in:
2024-11-28 10:37:27 +08:00
parent ce0a88988b
commit f32a7e5c47
9 changed files with 754 additions and 382 deletions

View File

@@ -26,5 +26,5 @@ export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Netinstable]: { layer: LayerType.PopUp, prefab: "common/prefab/netinstable" },
[UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
[UIID.ItemInfo]: { layer: LayerType.UI, prefab: "gui/element/item_info" },
[UIID.ItemInfo]: { layer: LayerType.Dialog, prefab: "gui/element/item_info" },
}

View File

@@ -1,7 +1,7 @@
export const HeroInfo = {
9001: {
uuid:9001,name: "骑士·白",path:"k1",type:1,hp: 200, hp_up:10,def:10,def_up:1,ap:20,ap_up:2,atp:1,vun:0,crit:20,crit_add:0,dodge:0,dis:100,a_cd:1,
uuid:9001,name: "骑士·白",path:"k1",type:1,hp: 50, hp_up:10,def:10,def_up:1,ap:20,ap_up:2,atp:1,vun:0,crit:20,crit_add:0,dodge:0,dis:100,a_cd:1,
lvexp:2,slvexp:2, speed: 100,aep:1,uaep:1,dep:10,sk1:[9001,9001,9001,9001,9001],sk2: [2002,2002,2002,2002,2002],pw:0,pwm:15,pws:1,
akr:[10,20,30,40,50],akc:[1,1,1,1,1],uar:[10,20,30,40,50],uac:[1,1,1,1,1],dgr:[10,20,30,40,50],dgc:[1,1,1,1,1],crr:[10,20,30,40,50],crc:[1,1,1,1,1],
abh:0,abc:0,uabh:0,uabc:0,cbh:0,cbc:0,aua:0,auc:0,uaua:0,uauc:0,cua:0,cuc:0,wp:1001,arm:2001,ring:3001,shoes:4001,

View File

@@ -2,6 +2,8 @@ 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";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
const { ccclass, property } = _decorator;
@@ -16,7 +18,9 @@ export class ItemComp extends CCComp {
//todo 设定icon 显示
}
show_info(){
oops.gui.open(UIID.ItemInfo, { name:Items[this.i_uuid].name, info:Items[this.i_uuid].info});
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {

View File

@@ -1,4 +1,4 @@
import { EventTouch, Node,_decorator } from "cc";
import { EventTouch, Label, Node,_decorator } 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";
@@ -10,20 +10,15 @@ const { ccclass, property } = _decorator;
@ecs.register('ItemInfo', false)
export class ItemInfoComp extends CCComp {
onAdded(args: any) {
console.log("args");
}
onLoad() {
this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
console.log("args",args);
this.node.getChildByName("name").getComponent(Label).string=args.name
this.node.getChildByName("info").getComponent(Label).string=args.info
}
private onTouchEnd(event: EventTouch) {
switch (event.target.name) {
case "btn_levelup":
this.ent.remove(ItemInfoComp);
break;
case "btn_close":
this.ent.remove(ItemInfoComp);
case "btn":
this.reset();
break;
}
@@ -33,10 +28,10 @@ export class ItemInfoComp extends CCComp {
reset() {
oops.gui.remove(UIID.ItemInfo, false);
// 注:模拟二次删除清理缓存
setTimeout(() => {
oops.gui.remove(UIID.ItemInfo);
}, 1000);
// // 注:模拟二次删除清理缓存
// setTimeout(() => {
// oops.gui.remove(UIID.ItemInfo);
// }, 100);
}
protected onDestroy(): void {

View File

@@ -99,9 +99,6 @@ export class MissionComp extends CCComp {
this.node.getChildByName("mexp").getChildByName("hp").active = true
this.mon_refresh()
this.heros_call()
}
do_x10(){
}
mission_end(){
smc.vmdata.mission.play=false

View File

@@ -28,21 +28,21 @@ export class VictoryComp extends CCComp {
}
private do_victiry() {
if(this.if_show) return
this.node.getChildByName("Node").setScale(1,1,1)
this.node.setPosition(0,this.node.position.y,0)
this.getReward(true)
this.node.getChildByName("Node").getChildByName("defeat").active = false
this.node.getChildByName("Node").getChildByName("victory").active = true;
}
private do_defeat() {
if(this.if_show) return
this.node.getChildByName("Node").setScale(1,1,1)
this.node.setPosition(0,this.node.position.y,0)
this.getReward(false)
this.node.getChildByName("Node").getChildByName("victory").active = false;
this.node.getChildByName("Node").getChildByName("defeat").active = true
}
getReward(is_victory:boolean){
let conut =2
if(is_victory) conut=1
if(!is_victory) conut=1
let item1=ecs.getEntity<Item>(Item)
let gold: number = Math.floor(RandomManager.instance.getRandomInt((3000 + smc.vmdata.mission.lv * 100) / 3 * 2, 3000 + smc.vmdata.mission.lv * 100));
let parent = this.node.getChildByName("Node").getChildByName("items")
@@ -55,17 +55,17 @@ export class VictoryComp extends CCComp {
}
this.if_show=true
}
do_x10(){
console.log("x10")
this.end_mission()
}
do_x1(){
console.log("x1")
this.end_mission()
}
end_mission(){
this.node.getChildByName("Node").setScale(0,0,0)
this.node.setPosition(2000,this.node.position.y,0)
this.if_show=false
let args:any ={
uuid:1001,
name:"普通攻击石",
info:"一星英雄升星",
num:1
}
}