物品ui修改 完善

This commit is contained in:
2025-01-20 10:29:02 +08:00
parent d756516cc6
commit 2b7de7ee92
11 changed files with 2853 additions and 1237 deletions

View File

@@ -38,22 +38,25 @@
},
{
"__id__": 94
},
{
"__id__": 114
}
],
"_active": true,
"_components": [
{
"__id__": 114
"__id__": 121
},
{
"__id__": 116
"__id__": 123
},
{
"__id__": 118
"__id__": 125
}
],
"_prefab": {
"__id__": 120
"__id__": 127
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -209,7 +212,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -384,7 +387,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 86,
"height": 91
"height": 86
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -506,7 +509,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -702,7 +705,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -732,8 +735,8 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 44,
"g": 190,
"r": 17,
"g": 123,
"b": 255,
"a": 255
},
@@ -877,7 +880,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 86,
"height": 91
"height": 86
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -907,9 +910,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 168,
"b": 255,
"r": 17,
"g": 50,
"b": 135,
"a": 255
},
"_spriteFrame": {
@@ -999,7 +1002,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1195,7 +1198,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1225,9 +1228,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 224,
"g": 195,
"b": 0,
"r": 241,
"g": 154,
"b": 2,
"a": 255
},
"_spriteFrame": {
@@ -1370,7 +1373,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 86,
"height": 91
"height": 86
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1400,9 +1403,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 219,
"g": 173,
"b": 0,
"r": 142,
"g": 49,
"b": 16,
"a": 255
},
"_spriteFrame": {
@@ -1492,7 +1495,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 115
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1888,8 +1891,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 34.517,
"y": -42.277,
"x": 40.798,
"y": -37,
"z": 0
},
"_lrot": {
@@ -2047,8 +2050,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -39.118,
"y": -44.831,
"x": -40.837,
"y": -37,
"z": 0
},
"_lrot": {
@@ -2600,6 +2603,167 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 115
},
{
"__id__": 117
}
],
"_prefab": {
"__id__": 120
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 114
},
"_enabled": true,
"__prefab": {
"__id__": 116
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "85+YAl4NtJo6EY9xL02Qja"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 114
},
"_enabled": true,
"__prefab": {
"__id__": 118
},
"clickEvents": [
{
"__id__": 119
}
],
"_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": 1.2,
"_target": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f8t1wMQYpHTZSD4ng7T/IA"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "dc8e3zoHO1Bq7v2cjEJd0Za",
"handler": "show_info",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "bbAnzgbZBPX4ofy4o42sL7",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -2610,7 +2774,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 115
"__id__": 122
},
"_contentSize": {
"__type__": "cc.Size",
@@ -2638,7 +2802,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 117
"__id__": 124
},
"_id": ""
},
@@ -2656,7 +2820,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 119
"__id__": 126
},
"playOnLoad": true,
"_clips": [

View File

@@ -759,8 +759,8 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 44,
"g": 190,
"r": 17,
"g": 123,
"b": 255,
"a": 255
},
@@ -934,9 +934,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 168,
"b": 255,
"r": 17,
"g": 50,
"b": 135,
"a": 255
},
"_spriteFrame": {
@@ -1113,7 +1113,7 @@
"__id__": 55
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 63
@@ -1252,9 +1252,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 224,
"g": 195,
"b": 0,
"r": 241,
"g": 154,
"b": 2,
"a": 255
},
"_spriteFrame": {
@@ -1427,9 +1427,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 219,
"g": 173,
"b": 0,
"r": 142,
"g": 49,
"b": 16,
"a": 255
},
"_spriteFrame": {

View File

@@ -738,8 +738,8 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 44,
"g": 190,
"r": 17,
"g": 123,
"b": 255,
"a": 255
},
@@ -913,9 +913,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 168,
"b": 255,
"r": 17,
"g": 50,
"b": 135,
"a": 255
},
"_spriteFrame": {
@@ -1231,9 +1231,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 224,
"g": 195,
"b": 0,
"r": 241,
"g": 154,
"b": 2,
"a": 255
},
"_spriteFrame": {
@@ -1406,9 +1406,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 219,
"g": 173,
"b": 0,
"r": 142,
"g": 49,
"b": 16,
"a": 255
},
"_spriteFrame": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -54,11 +54,23 @@ export enum GameSet {
HERO_NUM=3,
}
export const ColorSet: { [key: string]: string } = {
RED: "ff364d",
RED: "FF364D",
RED1: "FC1702",
RED2: "7B0B05",
BLUE: "2CBEFF",
BLUE2: "00A8FF",
BLUE3: "117bff",
BLUE4: "113287",
YELLOW: "E0C300" ,
YELLOW2: "DBAD00" ,
GREEN:"83CE00",
GREEN2:"17A047",
YELLOW3: "F19A02",
YELLOW4: "8E3110",
GREEN: "83CE00",
GREEN2: "17A047",
GREEN3: "5ECC3C",
GREEN4: "014523",
PURPLE1: "B640EA",
PURPLE2: "621678",
ORIGIN1: "968369",
ORIGIN2: "483825",
};

View File

@@ -19,7 +19,7 @@ export class HChipComp extends Component {
}
show_info(){
if(this.node.parent.name=="reward"||this.node.parent.name=="item_info") return
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2});
}

View File

@@ -30,11 +30,11 @@ const { ccclass, property } = _decorator;
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
@ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp {
BUFFCOMP:any=null!;
enemy_pos:Vec3=null!;
enemy:any=null!;
BUFFCOMP:BuffComp=null!
enemy_pos:Vec3=null!
// enemy:any=null!;
as: HeroSpine = null!;
as: HeroSpine = null!
anm_timer:Timer = new Timer(0.3);
anm_name="idle"
status:String = "idle"

View File

@@ -17,7 +17,7 @@ export class ItemComp extends CCComp {
//todo 设定icon 显示
}
update_data(uuid:number,num:number){
update_data(uuid:number,num:number=0){
this.i_uuid=uuid;
this.num=num;
this.node.getChildByName("num").getComponent(Label).string = num.toString();
@@ -26,26 +26,18 @@ export class ItemComp extends CCComp {
}
let url = "gui/items";
let pathName= Items[uuid].path;
switch(Items[uuid].lv){
case 1:
this.node.getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("lv4").active = true;
break;
}
this.node.getChildByName("lv1").active = Items[uuid].lv==1;
this.node.getChildByName("lv2").active = Items[uuid].lv==2;
this.node.getChildByName("lv3").active = Items[uuid].lv==3;
this.node.getChildByName("lv4").active = Items[uuid].lv==4;
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
}

View File

@@ -8,6 +8,7 @@ import { SkillSet } from "../common/config/SkillSet";
import { HeroInfo, HeroSet } from "../common/config/heroSet";
import { Hero } from "../hero/Hero";
import { HChipComp } from "../hero/HChipComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -23,31 +24,9 @@ export class ItemInfoComp extends CCComp {
this.node.getChildByName("item").active = true;
this.node.getChildByName("name").getComponent(Label).string=Items[args.uuid].name
this.node.getChildByName("info").getComponent(Label).string=Items[args.uuid].info
let url = "gui/items";
let pathName= Items[args.uuid].path;
this.node.getChildByName("item").getChildByName("lv1").active = false;
this.node.getChildByName("item").getChildByName("lv2").active = false;
this.node.getChildByName("item").getChildByName("lv3").active = false;
this.node.getChildByName("item").getChildByName("lv4").active = false;
switch(Items[args.uuid].lv){
case 1:
this.node.getChildByName("item").getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("item").getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("item").getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("item").getChildByName("lv4").active = true;
break;
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("item").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
let itemcom = this.node.getChildByName("item").getComponent(ItemComp);
itemcom.update_data(args.uuid,args.num);
}
if(args.type==1){ //技能碎片
this.node.getChildByName("skill").active = true;
@@ -59,13 +38,12 @@ export class ItemInfoComp extends CCComp {
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[args.uuid].path);
});
}
if(args.type==2){ //英雄碎片
this.node.getChildByName("hero").active = true;
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于英雄升阶,开宝箱获得"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于强化英雄,怪物掉落和开宝箱抽卡获得"
let HChip=this.node.getChildByName("hero").getComponent(HChipComp);
HChip.update_data(args.uuid)
}

View File

@@ -1,4 +1,4 @@
import { _decorator, Animation, Component, Node } from 'cc';
import { _decorator, Animation, Component, Node, sp } from 'cc';
import { SkillCom } from './SkillCom';
import { SkillSet } from '../common/config/SkillSet';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';