From 9fed7e0b0386e3360335cda437520cfc1c9623cb Mon Sep 17 00:00:00 2001 From: "pan@work" Date: Fri, 9 Aug 2024 10:51:47 +0800 Subject: [PATCH] dd --- assets/resources/game/heros/cards.meta | 9 + .../game/heros/cards/hero_card.prefab | 378 ++++++++++++++++++ .../game/heros/cards/hero_card.prefab.meta | 13 + assets/resources/gui/gui/rund_bg.png.meta | 100 ++++- .../gui/prefab/role_controller.prefab | 4 +- .../script/game/common/SingletonModuleComp.ts | 4 +- .../game/initialize/view/LoadingViewComp.ts | 2 +- assets/script/game/map/CardController.ts | 42 ++ assets/script/game/map/CardController.ts.meta | 9 + assets/script/game/map/Controller.ts | 29 ++ assets/script/game/map/Controller.ts.meta | 9 + assets/script/game/map/view/MapViewComp.ts | 54 ++- assets/script/game/monster/HeroCard.ts | 57 +++ assets/script/game/monster/HeroCard.ts.meta | 1 + .../role/view/RoleViewUIControllerComp.ts | 6 +- 15 files changed, 676 insertions(+), 41 deletions(-) create mode 100644 assets/resources/game/heros/cards.meta create mode 100644 assets/resources/game/heros/cards/hero_card.prefab create mode 100644 assets/resources/game/heros/cards/hero_card.prefab.meta create mode 100644 assets/script/game/map/CardController.ts create mode 100644 assets/script/game/map/CardController.ts.meta create mode 100644 assets/script/game/map/Controller.ts create mode 100644 assets/script/game/map/Controller.ts.meta create mode 100644 assets/script/game/monster/HeroCard.ts create mode 100644 assets/script/game/monster/HeroCard.ts.meta diff --git a/assets/resources/game/heros/cards.meta b/assets/resources/game/heros/cards.meta new file mode 100644 index 00000000..880dab96 --- /dev/null +++ b/assets/resources/game/heros/cards.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "4c135035-7da8-421b-8b3b-9b3a393aa227", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/game/heros/cards/hero_card.prefab b/assets/resources/game/heros/cards/hero_card.prefab new file mode 100644 index 00000000..54aac85e --- /dev/null +++ b/assets/resources/game/heros/cards/hero_card.prefab @@ -0,0 +1,378 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "hero_card", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "hero_card", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 8 + } + ], + "_active": true, + "_components": [ + { + "__id__": 14 + } + ], + "_prefab": { + "__id__": 16 + }, + "_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.Node", + "_name": "bg", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 5 + } + ], + "_prefab": { + "__id__": 7 + }, + "_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__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 4 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 110, + "height": 110 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "98iGc3EdxJG6wem+4QD0kL" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "27c92e56-a5f9-4a91-a837-468ff584d119@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "95KIf1WTFJUJBapgMClaii" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "8at0kvKwNHvrpHcYsSWcp5", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "hero", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + }, + { + "__id__": 11 + } + ], + "_prefab": { + "__id__": 13 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 18.159, + "y": 5.803, + "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__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 10 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 80, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "77G85ThG5I/7Z5nTJTT7Ni" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "061d2a74-f743-4fe0-ac03-c9dca0d14493@f9941", + "__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": "5bq3ch+edF74+blNWlzL1K" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "252bsU10tMA71ujETVNgfV", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 15 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "10FOdA4JlCO7yvtiz10/Pn" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "c46/YsCPVOJYA4mWEpNYRx", + "instance": null, + "targetOverrides": null + } +] \ No newline at end of file diff --git a/assets/resources/game/heros/cards/hero_card.prefab.meta b/assets/resources/game/heros/cards/hero_card.prefab.meta new file mode 100644 index 00000000..971ff77a --- /dev/null +++ b/assets/resources/game/heros/cards/hero_card.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "3212dcd0-cfa0-4564-98c3-77c2fe68c9d8", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "hero_card" + } +} diff --git a/assets/resources/gui/gui/rund_bg.png.meta b/assets/resources/gui/gui/rund_bg.png.meta index a37b6510..5be287ca 100644 --- a/assets/resources/gui/gui/rund_bg.png.meta +++ b/assets/resources/gui/gui/rund_bg.png.meta @@ -15,8 +15,8 @@ "id": "6c48a", "name": "texture", "userData": { - "wrapModeS": "repeat", - "wrapModeT": "repeat", + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", "minfilter": "linear", "magfilter": "linear", "mipfilter": "none", @@ -31,12 +31,104 @@ ".json" ], "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "9c55e80e-b560-43fc-b152-5057150fcd3c@f9941", + "displayName": "rund_bg", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 152, + "height": 152, + "rawWidth": 152, + "rawHeight": 152, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -76, + -76, + 0, + 76, + -76, + 0, + -76, + 76, + 0, + 76, + 76, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 152, + 152, + 152, + 0, + 0, + 152, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -76, + -76, + 0 + ], + "maxPos": [ + 76, + 76, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "9c55e80e-b560-43fc-b152-5057150fcd3c@6c48a", + "atlasUuid": "" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} } }, "userData": { "hasAlpha": true, - "type": "texture", + "type": "sprite-frame", "fixAlphaTransparencyArtifacts": false, - "redirect": "9c55e80e-b560-43fc-b152-5057150fcd3c@6c48a" + "redirect": "9c55e80e-b560-43fc-b152-5057150fcd3c@f9941" } } diff --git a/assets/resources/gui/prefab/role_controller.prefab b/assets/resources/gui/prefab/role_controller.prefab index d673d47d..f334152f 100644 --- a/assets/resources/gui/prefab/role_controller.prefab +++ b/assets/resources/gui/prefab/role_controller.prefab @@ -6151,7 +6151,7 @@ "fileId": "8bAuNLBPJCO6dVxsBakc2W" }, { - "__type__": "adad6XDtGJOpY1lBgpfLeJd", + "__type__": "ee99bEQ89lEtavAHQsY2sba", "_name": "", "_objFlags": 0, "__editorExtras__": {}, @@ -6166,7 +6166,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "5b9X2C1CdMrKN11OyUYu8g" + "fileId": "e4xMGk4GFKMItlvPLEwF7G" }, { "__type__": "cc.PrefabInfo", diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index acf87068..18da1f06 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -8,7 +8,7 @@ import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/mod import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { Initialize } from "../initialize/Initialize"; import { GameMap } from "../map/GameMap"; -import { Role } from "../role/Role"; +// import { Role } from "../role/Role"; // import { data } from "../data/data"; /** 游戏模块 */ @ecs.register('SingletonModule') @@ -18,7 +18,7 @@ export class SingletonModuleComp extends ecs.Comp { /** 游戏地图 */ map: GameMap = null!; /** 游戏主角 */ - own: Role = null; + // own: Role = null; /** 游戏数据 */ // data:data = null!; /**怪物数据 数组 */ diff --git a/assets/script/game/initialize/view/LoadingViewComp.ts b/assets/script/game/initialize/view/LoadingViewComp.ts index 2ce880bc..f1c5a2f6 100644 --- a/assets/script/game/initialize/view/LoadingViewComp.ts +++ b/assets/script/game/initialize/view/LoadingViewComp.ts @@ -11,7 +11,7 @@ import { CCVMParentComp } from "../../../../../extensions/oops-plugin-framework/ import { UIID } from "../../common/config/GameUIConfig"; import { smc } from "../../common/SingletonModuleComp"; import { GameMap } from "../../map/GameMap"; -import { Role } from "../../role/Role"; +// import { Role } from "../../role/Role"; const { ccclass, property } = _decorator; /** 游戏资源加载 */ diff --git a/assets/script/game/map/CardController.ts b/assets/script/game/map/CardController.ts new file mode 100644 index 00000000..c1a7b1a5 --- /dev/null +++ b/assets/script/game/map/CardController.ts @@ -0,0 +1,42 @@ +import { _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 { smc } from "../common/SingletonModuleComp"; +import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; + +const { ccclass, property } = _decorator; + +/** 视图层对象 */ +@ccclass('ControllerComp') +@ecs.register('Controller', false) +export class ControllerComp extends CCComp { + /** 视图层逻辑代码分离演示 */ + start() { + // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 + // this.on(ModuleEvent.Cmd, this.onHandler, this); + } + + /** 全局消息逻辑处理 */ + // private onHandler(event: string, args: any) { + // switch (event) { + // case ModuleEvent.Cmd: + // break; + // } + // } + shuaxin(dt: number) { + smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt; + if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) { + smc.vm_data.shuaxin.min = 0; + oops.message.dispatchEvent("do_add_hero",this) + } + } + /** 转场 */ + protected update(dt: number): void { + this.shuaxin(dt) + } + + /** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */ + reset() { + this.node.destroy(); + } +} \ No newline at end of file diff --git a/assets/script/game/map/CardController.ts.meta b/assets/script/game/map/CardController.ts.meta new file mode 100644 index 00000000..5c97cec4 --- /dev/null +++ b/assets/script/game/map/CardController.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "ee99b110-f3d9-44b5-abc0-1d0b18dac6da", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/map/Controller.ts b/assets/script/game/map/Controller.ts new file mode 100644 index 00000000..5413a34c --- /dev/null +++ b/assets/script/game/map/Controller.ts @@ -0,0 +1,29 @@ +import { _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"; + +const { ccclass, property } = _decorator; + +/** 视图层对象 */ +@ccclass('CardControllerComp') +@ecs.register('CardController', false) +export class CardControllerComp extends CCComp { + /** 视图层逻辑代码分离演示 */ + start() { + // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 + // this.on(ModuleEvent.Cmd, this.onHandler, this); + } + + /** 全局消息逻辑处理 */ + // private onHandler(event: string, args: any) { + // switch (event) { + // case ModuleEvent.Cmd: + // break; + // } + // } + + /** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */ + reset() { + this.node.destroy(); + } +} \ No newline at end of file diff --git a/assets/script/game/map/Controller.ts.meta b/assets/script/game/map/Controller.ts.meta new file mode 100644 index 00000000..e09902c9 --- /dev/null +++ b/assets/script/game/map/Controller.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "7c495718-13bc-4f64-8ecc-27c210626d0a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/map/view/MapViewComp.ts b/assets/script/game/map/view/MapViewComp.ts index a2b7b975..068a5f66 100644 --- a/assets/script/game/map/view/MapViewComp.ts +++ b/assets/script/game/map/view/MapViewComp.ts @@ -27,10 +27,16 @@ export class MapViewComp extends CCComp { private timer: Timer = new Timer(3); onLoad(){ // 监听全局事件 - oops.message.on("monster_load", this.onMonsterLoaded, this); + oops.message.on("do_add_monster", this.on_do_add_monster, this); + oops.message.on("do_add_hero", this.on_do_add_hero, this); } - private onMonsterLoaded(event: string, args: any) { - // console.log('on_monster_load'); + private on_do_add_monster(event: string, args: any) { + this.addMonster() + } + private on_do_add_hero(event: string, args: any) { + this.addHero() + this.addMonster() + } reset(): void { @@ -44,7 +50,7 @@ export class MapViewComp extends CCComp { /** 转场 */ protected update(dt: number): void { - this.shuaxin(dt) + // this.shuaxin(dt) this.gold_add(dt) } @@ -65,23 +71,11 @@ export class MapViewComp extends CCComp { smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt; if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) { smc.vm_data.shuaxin.min = 0; - this.addHero(); } } /** 添加玩家 */ private addHero() { this.scene.node.active = true - if (smc.monsters.length>0){ - let monster = ecs.getEntity(Monster); - let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE) - let speed =smc.monsters[0].speed - let camp = -1 - let prefab_path = smc.monsters[0].prefab_path - let name = smc.monsters[0].name - monster.load(pos,speed,camp,prefab_path,name); - smc.monsters.splice(0,1) - } - if(smc.heros.length>0) { console.log("heros load") let hero = ecs.getEntity(Hero); @@ -92,21 +86,23 @@ export class MapViewComp extends CCComp { let name = smc.heros[0].name hero.load(pos,speed,camp,prefab_path,name); smc.heros.splice(0,1) - } - smc.vm_data.hp.min = 100 - + } + } + private addMonster() { + this.scene.node.active = true + if (smc.monsters.length>0){ + let monster = ecs.getEntity(Monster); + let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE) + let speed =smc.monsters[0].speed + let camp = -1 + let prefab_path = smc.monsters[0].prefab_path + let name = smc.monsters[0].name + monster.load(pos,speed,camp,prefab_path,name); + smc.monsters.splice(0,1) + } } - private addMonster(name:string = "niu",speed:number = 100) { - - - } + - - private getRandomInt(min: number, max: number): number { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min + 1)) + min; - } } diff --git a/assets/script/game/monster/HeroCard.ts b/assets/script/game/monster/HeroCard.ts new file mode 100644 index 00000000..73903f23 --- /dev/null +++ b/assets/script/game/monster/HeroCard.ts @@ -0,0 +1,57 @@ + +/* + * @Author: dgflash + * @Date: 2021-11-18 17:47:56 + * @LastEditors: dgflash + * @LastEditTime: 2022-08-04 15:43:04 + */ +import { instantiate, Node, Prefab, Vec3 ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact, animation,Label,resources,SpriteFrame,Sprite} from "cc"; +import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines"; +import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; +import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; +import { UIID } from "../common/config/GameUIConfig"; +import { smc } from "../common/SingletonModuleComp"; + +/** 角色实体 */ +@ecs.register(`HeroCard`) +export class HeroCard extends ecs.Entity { + // 数据层 + + // 视图层 + + + protected init() { + // this.addComponents( + // MonsterModelComp); + + } + + destroy(): void { + // this.remove(MonsterViewComp); + super.destroy(); + } + + /** 加载角色 */ + load(pos: Vec3 = Vec3.ZERO,speed:number = 100,camp:number = 1,prefab_path:string = "monster",name:string="hero") { + // var path = "game/monster/"+prefab_path; + var path = "game/monster/hero"; + + var prefab: Prefab = oops.res.get(path, Prefab)!; + var node = instantiate(prefab); + var scene = smc.map.MapView.scene; + node.parent = scene.entityLayer!.node!; + node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z); + node.setPosition(pos) + // console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite)) + const url = 'game/heros/hero/'+prefab_path+'/spriteFrame'; + resources.load(url, SpriteFrame, (err: any, spriteFrame) => { + const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite); + + sprite.spriteFrame = spriteFrame; + }); + } + + + + +} \ No newline at end of file diff --git a/assets/script/game/monster/HeroCard.ts.meta b/assets/script/game/monster/HeroCard.ts.meta new file mode 100644 index 00000000..c4389046 --- /dev/null +++ b/assets/script/game/monster/HeroCard.ts.meta @@ -0,0 +1 @@ +{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"9ec1b4da-2a40-4f23-8f9d-96f10cafb1b0","files":[],"subMetas":{},"userData":{}} diff --git a/assets/script/game/role/view/RoleViewUIControllerComp.ts b/assets/script/game/role/view/RoleViewUIControllerComp.ts index 17a273c5..d57b3615 100644 --- a/assets/script/game/role/view/RoleViewUIControllerComp.ts +++ b/assets/script/game/role/view/RoleViewUIControllerComp.ts @@ -9,7 +9,7 @@ import { EventTouch, Vec3, _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 { smc } from '../../common/SingletonModuleComp'; -import { Role } from '../Role'; +// import { Role } from '../Role'; const { ccclass, property } = _decorator; @@ -17,10 +17,10 @@ const { ccclass, property } = _decorator; @ecs.register('RoleViewUIController', false) export class RoleViewUIControllerComp extends CCComp { - private target: Role = null!; + // private target: Role = null!; start() { - this.target = smc.own; + // this.target = smc.own; } onDestroy() {