diff --git a/assets/resources/game/gui/item.prefab b/assets/resources/game/gui/item.prefab index cafb5686..d7258863 100644 --- a/assets/resources/game/gui/item.prefab +++ b/assets/resources/game/gui/item.prefab @@ -26,28 +26,19 @@ }, { "__id__": 14 - }, - { - "__id__": 20 - }, - { - "__id__": 26 - }, - { - "__id__": 32 } ], "_active": true, "_components": [ { - "__id__": 38 + "__id__": 20 }, { - "__id__": 40 + "__id__": 22 } ], "_prefab": { - "__id__": 42 + "__id__": 24 }, "_lpos": { "__type__": "cc.Vec3", @@ -179,7 +170,7 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b03fe", + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@d8633", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, @@ -216,14 +207,14 @@ }, { "__type__": "cc.Node", - "_name": "bg2", + "_name": "icon", "_objFlags": 0, "__editorExtras__": {}, "_parent": { "__id__": 1 }, "_children": [], - "_active": false, + "_active": true, "_components": [ { "__id__": 9 @@ -278,8 +269,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 128, - "height": 130 + "width": 95, + "height": 95 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -290,7 +281,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "01aW46tltN16RewUmnvZi0" + "fileId": "5365hSAuJCtJeiAFcQboCc" }, { "__type__": "cc.Sprite", @@ -315,12 +306,12 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@62e5d", + "__uuid__": "7b0e7263-3b25-4fec-8935-abdd67c4b86d@094d8", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -335,7 +326,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "3azAelLjlG459ahE8e4Wtg" + "fileId": "43H1R2D8JIjq5O4AFTJpr2" }, { "__type__": "cc.PrefabInfo", @@ -345,14 +336,14 @@ "asset": { "__id__": 0 }, - "fileId": "8bsQeIelFO2LTY6G9lGOUx", + "fileId": "31eGbyP+5HypryNgj/YnuU", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { "__type__": "cc.Node", - "_name": "icon", + "_name": "num", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -373,8 +364,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 0, - "y": 0, + "x": 14.988, + "y": -37.334, "z": 0 }, "_lrot": { @@ -412,414 +403,6 @@ "__prefab": { "__id__": 16 }, - "_contentSize": { - "__type__": "cc.Size", - "width": 114, - "height": 116 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "5365hSAuJCtJeiAFcQboCc" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 14 - }, - "_enabled": true, - "__prefab": { - "__id__": 18 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "7b0e7263-3b25-4fec-8935-abdd67c4b86d@de8ba", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 1, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "43H1R2D8JIjq5O4AFTJpr2" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "31eGbyP+5HypryNgj/YnuU", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "t", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 21 - }, - { - "__id__": 23 - } - ], - "_prefab": { - "__id__": 25 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -37, - "y": 37, - "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__": 20 - }, - "_enabled": true, - "__prefab": { - "__id__": 22 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 30, - "height": 39 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "0dHHWKl/VPo5FrcxtEmGZC" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 20 - }, - "_enabled": true, - "__prefab": { - "__id__": 24 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@12d6e", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 1, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "1cxkutbMJI0YpEi8GUhkNA" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "fdkKc0mYVE7aPxdzzcvciY", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "m", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 27 - }, - { - "__id__": 29 - } - ], - "_prefab": { - "__id__": 31 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -37, - "y": 37, - "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__": 26 - }, - "_enabled": true, - "__prefab": { - "__id__": 28 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 33, - "height": 36 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "99bTzxV0dI/obBHk0TQ3KA" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 26 - }, - "_enabled": true, - "__prefab": { - "__id__": 30 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 132, - "b": 253, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@398ce", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 1, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "a7vTpHYLVB4KAegHtd2ItS" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "ea4Em/87xAJpsUJjD6fnyh", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "num", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 33 - }, - { - "__id__": 35 - } - ], - "_prefab": { - "__id__": 37 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 14.988, - "y": -34.972, - "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__": 32 - }, - "_enabled": true, - "__prefab": { - "__id__": 34 - }, "_contentSize": { "__type__": "cc.Size", "width": 90, @@ -842,11 +425,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 32 + "__id__": 14 }, "_enabled": true, "__prefab": { - "__id__": 36 + "__id__": 18 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -927,7 +510,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 39 + "__id__": 21 }, "_contentSize": { "__type__": "cc.Size", @@ -955,7 +538,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 41 + "__id__": 23 }, "_id": "" }, diff --git a/assets/script/game/common/config/Items.ts b/assets/script/game/common/config/Items.ts index 33378c6e..27959fe1 100644 --- a/assets/script/game/common/config/Items.ts +++ b/assets/script/game/common/config/Items.ts @@ -6,20 +6,20 @@ type: */ export const Items={ - 1001:{uuid: 1001,path: "1001",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", }, - 1002:{uuid: 1002,path: "1001",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练,提升高50级以上英雄等级", }, - 1003:{uuid: 1003,path: "1001",type: 1,r_num:10,name: "英雄原石",info:"一星英雄升星", }, - 1004:{uuid: 1007,path: "1001",type: 1,r_num:1,name: "高级英雄原石",info:"二星英雄升星", }, - 1005:{uuid: 1008,path: "1001",type: 1,r_num:1,name: "稀有英雄原石",info:"三星英雄升星", }, - 1006:{uuid: 1009,path: "1001",type: 1,r_num:1,name: "传说英雄原石",info:"四星英雄升星", }, - 1007:{uuid: 1013,path: "1001",type: 1,r_num:1,name: "招募券",info:"招募英雄", }, - 1021:{uuid: 1021,path: "1021",type: 1,r_num:1,name: "普通攻击石",info:"增加装备攻击力", }, - 1022:{uuid: 1022,path: "1021",type: 1,r_num:1,name: "高级攻击石",info:"增加装备攻击力", }, - 1023:{uuid: 1023,path: "1021",type: 1,r_num:1,name: "稀有攻击石",info:"增加装备攻击力", }, - 1024:{uuid: 1024,path: "1021",type: 1,r_num:1,name: "传说攻击石",info:"增加装备攻击力", }, - 1025:{uuid: 1025,path: "1021",type: 1,r_num:1,name: "普通生命石",info:"增加装备生命值", }, - 1026:{uuid: 1026,path: "1021",type: 1,r_num:1,name: "高级生命石",info:"增加装备生命值", }, - 1027:{uuid: 1027,path: "1021",type: 1,r_num:1,name: "稀有生命石",info:"增加装备生命值", }, - 1028:{uuid: 1028,path: "1021",type: 1,r_num:1,name: "传说生命石",info:"增加装备生命值", }, + 1001:{uuid: 1001,path: "2001",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", }, + 1002:{uuid: 1002,path: "2002",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练,提升高50级以上英雄等级", }, + 1003:{uuid: 1003,path: "1002",type: 1,r_num:10,name: "英雄原石",info:"一星英雄升星", }, + 1004:{uuid: 1004,path: "1005",type: 1,r_num:1,name: "高级英雄原石",info:"二星英雄升星", }, + 1005:{uuid: 1005,path: "1008",type: 1,r_num:1,name: "稀有英雄原石",info:"三星英雄升星", }, + 1006:{uuid: 1006,path: "1011",type: 1,r_num:1,name: "传说英雄原石",info:"四星英雄升星", }, + 1007:{uuid: 1007,path: "5017",type: 1,r_num:1,name: "招募券",info:"招募英雄", }, + 1021:{uuid: 1021,path: "2301",type: 1,r_num:1,name: "普通攻击石",info:"增加装备攻击力", }, + 1022:{uuid: 1022,path: "2302",type: 1,r_num:1,name: "高级攻击石",info:"增加装备攻击力", }, + 1023:{uuid: 1023,path: "2303",type: 1,r_num:1,name: "稀有攻击石",info:"增加装备攻击力", }, + 1024:{uuid: 1024,path: "2304",type: 1,r_num:1,name: "传说攻击石",info:"增加装备攻击力", }, + 1025:{uuid: 1025,path: "2306",type: 1,r_num:1,name: "普通生命石",info:"增加装备生命值", }, + 1026:{uuid: 1026,path: "2307",type: 1,r_num:1,name: "高级生命石",info:"增加装备生命值", }, + 1027:{uuid: 1027,path: "2308",type: 1,r_num:1,name: "稀有生命石",info:"增加装备生命值", }, + 1028:{uuid: 1028,path: "2309",type: 1,r_num:1,name: "传说生命石",info:"增加装备生命值", }, } diff --git a/assets/script/game/common/config/MissionSet.ts b/assets/script/game/common/config/MissionSet.ts index c2b919fc..b00921cd 100644 --- a/assets/script/game/common/config/MissionSet.ts +++ b/assets/script/game/common/config/MissionSet.ts @@ -20,7 +20,7 @@ export const MissionSet = [ export const MissionReward = { - 1:[1001,1002,1003,1013], - 2:[1004,1005,1006,1007,1008,1009,1014], - 3:[1010,1011,1012,1014], + 1:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028], + 2:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028], + 3:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028], } diff --git a/assets/script/game/map/Item.ts b/assets/script/game/map/Item.ts index e3d250ad..b8df9954 100644 --- a/assets/script/game/map/Item.ts +++ b/assets/script/game/map/Item.ts @@ -1,7 +1,8 @@ -import { instantiate, Prefab } from "cc"; +import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { ItemComp } from "./ItemComp"; +import { Items } from "../common/config/Items"; /** Item 模块 */ @ecs.register(`Item`) @@ -14,6 +15,13 @@ export class Item extends ecs.Entity { var path = "game/gui/item"; var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); + node.getChildByName("num").getComponent(Label).string = num.toString(); + let url = "gui/items"; + let pathName= Items[uuid].path; + resources.load(url, SpriteAtlas, (err: any, atlas) => { + const sprite = node.getChildByName("icon").getComponent(Sprite); + sprite.spriteFrame = atlas.getSpriteFrame(pathName); + }); node.parent = praent let iv = node.getComponent(ItemComp)!; iv.i_uuid = uuid diff --git a/assets/script/game/map/ItemComp.ts b/assets/script/game/map/ItemComp.ts index 41b4072b..1e648449 100644 --- a/assets/script/game/map/ItemComp.ts +++ b/assets/script/game/map/ItemComp.ts @@ -1,6 +1,7 @@ -import { _decorator, Label } from "cc"; +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"; const { ccclass, property } = _decorator; @@ -11,7 +12,7 @@ export class ItemComp extends CCComp { i_uuid:number = 0; num:number = 0; start() { - this.node.getChildByName("num").getComponent(Label).string = this.num.toString(); + //todo 设定icon 显示 } diff --git a/assets/script/game/map/MIssionController.ts b/assets/script/game/map/MIssionController.ts index 8525a7ef..6028b576 100644 --- a/assets/script/game/map/MIssionController.ts +++ b/assets/script/game/map/MIssionController.ts @@ -27,6 +27,7 @@ import { HCardComp } from "./HCardComp"; import { MSkill } from "../skills/MSkill"; import { MSkillComp } from "../skills/MSkillComp"; import { VictoryComp } from "./VictoryComp"; +import { ItemComp } from "./ItemComp"; const { ccclass, property } = _decorator; /** 视图层对象 */ @@ -107,6 +108,7 @@ export class MissionComp extends CCComp { let monsters:any= this.get_mons(); let hcards:any= ecs.query(ecs.allOf(HCardComp)); let mska:any= ecs.query(ecs.allOf(MSkillComp)); + let res:any= ecs.query(ecs.allOf(ItemComp)); for(let i=0;i= smc.vmdata.mission.a_up_exp){