完成奖品和物品显示,使用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

@@ -35,10 +35,13 @@
},
{
"__id__": 22
},
{
"__id__": 24
}
],
"_prefab": {
"__id__": 24
"__id__": 27
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -305,10 +308,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "7b0e7263-3b25-4fec-8935-abdd67c4b86d@094d8",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
@@ -441,7 +441,7 @@
"b": 255,
"a": 255
},
"_string": "99999",
"_string": "0",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 31,
@@ -546,6 +546,76 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "a3fT984fVMY6kPqXqb9G8d"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"clickEvents": [
{
"__id__": 26
}
],
"_interactable": true,
"_transition": 3,
"_normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 0.95,
"_target": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2fDZn0y0hGe74K7nzW6Hsq"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "b3d7bQfUYVKCraQiXgA4mTv",
"handler": "show_info",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -52,7 +52,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 748.999,
"y": 0,
"z": 0
},
"_lrot": {
@@ -142,7 +142,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 600,
"width": 700,
"height": 500
},
"_anchorPoint": {
@@ -241,7 +241,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -227.342,
"x": -270,
"y": 163.185,
"z": 0
},
@@ -514,7 +514,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -13.947,
"y": -4.997,
"z": 0
},
"_lrot": {
@@ -554,8 +554,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 550,
"height": 250
"width": 630,
"height": 240
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -977,10 +977,12 @@
},
{
"__type__": "cc.ClickEvent",
"target": null,
"target": {
"__id__": 1
},
"component": "",
"_componentId": "",
"handler": "",
"_componentId": "8a98fQ67vxAqoq1t/JfAe7z",
"handler": "onTouchEnd",
"customEventData": ""
},
{
@@ -1019,7 +1021,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -169.242,
"x": -200,
"y": 161.461,
"z": 0
},
@@ -1099,8 +1101,8 @@
"_string": "这是物品名称",
"_horizontalAlign": 0,
"_verticalAlign": 1,
"_actualFontSize": 31,
"_fontSize": 30,
"_actualFontSize": 41,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 2,
@@ -1113,7 +1115,7 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": false,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
@@ -1122,7 +1124,7 @@
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_enableShadow": true,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
@@ -1132,8 +1134,8 @@
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
"x": 1,
"y": -2
},
"_shadowBlur": 2,
"_id": ""
@@ -1219,8 +1221,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 530,
"height": 230
"width": 600,
"height": 220
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1369,6 +1371,7 @@
"__id__": 0
},
"fileId": "93EVPcNsBBXpMaJjrmWbVn",
"instance": null,
"targetOverrides": null
}
]

File diff suppressed because it is too large Load Diff

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
}
}