From 935d3f1185ad60cc793370d95f9b11d7450c075c Mon Sep 17 00:00:00 2001 From: "pan@work" Date: Fri, 29 Nov 2024 16:45:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E6=9B=BF=E6=8D=A2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/heros/k1.prefab | 235 ++++++++++-------- assets/resources/gui/role_controller.prefab | 14 +- .../script/game/common/SingletonModuleComp.ts | 2 +- assets/script/game/common/config/BoxSet.ts | 2 +- assets/script/game/common/config/heroSet.ts | 2 +- assets/script/game/hero/Hero.ts | 2 +- assets/script/game/hero/HeroAnmComp.ts | 115 ++++++--- assets/script/game/hero/HeroSpine.ts | 81 +++--- assets/script/game/hero/HeroViewComp.ts | 2 + assets/script/game/map/CardController.ts | 26 +- 10 files changed, 257 insertions(+), 224 deletions(-) diff --git a/assets/resources/game/heros/k1.prefab b/assets/resources/game/heros/k1.prefab index c002a0d4..66aee607 100644 --- a/assets/resources/game/heros/k1.prefab +++ b/assets/resources/game/heros/k1.prefab @@ -31,26 +31,23 @@ "__id__": 28 }, { - "__id__": 34 + "__id__": 36 }, { - "__id__": 43 + "__id__": 45 }, { - "__id__": 54 + "__id__": 56 }, { - "__id__": 63 + "__id__": 65 }, { - "__id__": 73 + "__id__": 75 } ], "_active": true, "_components": [ - { - "__id__": 82 - }, { "__id__": 84 }, @@ -62,10 +59,13 @@ }, { "__id__": 90 + }, + { + "__id__": 92 } ], "_prefab": { - "__id__": 92 + "__id__": 94 }, "_lpos": { "__type__": "cc.Vec3", @@ -119,8 +119,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 3.123, - "y": 10.835, + "x": 0, + "y": 0, "z": 0 }, "_lrot": { @@ -314,8 +314,8 @@ ], "value": { "__type__": "cc.Vec3", - "x": 4.3770000000000095, - "y": 6.808999999999969, + "x": 0, + "y": 0, "z": 0 } }, @@ -461,8 +461,8 @@ ], "value": { "__type__": "cc.Vec3", - "x": 4.377, - "y": 6.809, + "x": 0, + "y": 0, "z": 0 } }, @@ -523,10 +523,13 @@ }, { "__id__": 31 + }, + { + "__id__": 33 } ], "_prefab": { - "__id__": 33 + "__id__": 35 }, "_lpos": { "__type__": "cc.Vec3", @@ -543,8 +546,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.4, - "y": 0.4, + "x": 0.3, + "y": 0.3, "z": 1 }, "_mobility": 0, @@ -614,7 +617,7 @@ "defaultSkin": "default", "defaultAnimation": "Idle", "_premultipliedAlpha": true, - "_timeScale": 1, + "_timeScale": 0.8, "_preCacheMode": 0, "_cacheMode": 0, "_sockets": [], @@ -630,6 +633,24 @@ "__type__": "cc.CompPrefabInfo", "fileId": "54k9q4iztE15bdAWnFOCpS" }, + { + "__type__": "4ba4awuz8tF34rq4TkZ9W1S", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 28 + }, + "_enabled": true, + "__prefab": { + "__id__": 34 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "569pdLaDNB6qtHi4mnEa2p" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -650,14 +671,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 35 + "__id__": 37 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 34 + "__id__": 36 }, "asset": { "__uuid__": "e1b8a315-ece3-41a2-941e-a66861753f1b", @@ -665,7 +686,7 @@ }, "fileId": "c46/YsCPVOJYA4mWEpNYRx", "instance": { - "__id__": 36 + "__id__": 38 }, "targetOverrides": null }, @@ -678,20 +699,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 37 - }, { "__id__": 39 }, - { - "__id__": 40 - }, { "__id__": 41 }, { "__id__": 42 + }, + { + "__id__": 43 + }, + { + "__id__": 44 } ], "removedComponents": [] @@ -699,7 +720,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 38 + "__id__": 40 }, "propertyPath": [ "_name" @@ -715,7 +736,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 38 + "__id__": 40 }, "propertyPath": [ "_lpos" @@ -730,7 +751,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 38 + "__id__": 40 }, "propertyPath": [ "_lrot" @@ -746,7 +767,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 38 + "__id__": 40 }, "propertyPath": [ "_euler" @@ -761,7 +782,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 38 + "__id__": 40 }, "propertyPath": [ "_active" @@ -775,14 +796,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 44 + "__id__": 46 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 43 + "__id__": 45 }, "asset": { "__uuid__": "50c3d5e4-49f8-4bd7-a15b-cda359a0ae5c", @@ -790,7 +811,7 @@ }, "fileId": "5fqU0L3/FOhKaco5UkHuWT", "instance": { - "__id__": 45 + "__id__": 47 }, "targetOverrides": null }, @@ -803,23 +824,23 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 46 - }, { "__id__": 48 }, - { - "__id__": 49 - }, { "__id__": 50 }, { "__id__": 51 }, + { + "__id__": 52 + }, { "__id__": 53 + }, + { + "__id__": 55 } ], "removedComponents": [] @@ -827,7 +848,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 47 + "__id__": 49 }, "propertyPath": [ "_name" @@ -843,7 +864,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 47 + "__id__": 49 }, "propertyPath": [ "_lpos" @@ -858,7 +879,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 47 + "__id__": 49 }, "propertyPath": [ "_lrot" @@ -874,7 +895,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 47 + "__id__": 49 }, "propertyPath": [ "_euler" @@ -889,7 +910,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 52 + "__id__": 54 }, "propertyPath": [ "_lpos" @@ -910,7 +931,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 47 + "__id__": 49 }, "propertyPath": [ "_lscale" @@ -929,14 +950,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 55 + "__id__": 57 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 54 + "__id__": 56 }, "asset": { "__uuid__": "5b4ca49e-0f12-4478-b56d-bf8198b36b90", @@ -944,7 +965,7 @@ }, "fileId": "0d6ZXmA5dHkZxoGONDL2sE", "instance": { - "__id__": 56 + "__id__": 58 }, "targetOverrides": null }, @@ -957,20 +978,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 57 - }, { "__id__": 59 }, - { - "__id__": 60 - }, { "__id__": 61 }, { "__id__": 62 + }, + { + "__id__": 63 + }, + { + "__id__": 64 } ], "removedComponents": [] @@ -978,7 +999,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 58 + "__id__": 60 }, "propertyPath": [ "_name" @@ -994,7 +1015,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 58 + "__id__": 60 }, "propertyPath": [ "_lpos" @@ -1009,7 +1030,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 58 + "__id__": 60 }, "propertyPath": [ "_lrot" @@ -1025,7 +1046,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 58 + "__id__": 60 }, "propertyPath": [ "_euler" @@ -1040,7 +1061,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 58 + "__id__": 60 }, "propertyPath": [ "_active" @@ -1054,14 +1075,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 64 + "__id__": 66 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 63 + "__id__": 65 }, "asset": { "__uuid__": "ec11e9f5-3347-4d5e-8ed8-f98a6ac7963a", @@ -1069,7 +1090,7 @@ }, "fileId": "c46/YsCPVOJYA4mWEpNYRx", "instance": { - "__id__": 65 + "__id__": 67 }, "targetOverrides": null }, @@ -1082,15 +1103,9 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 66 - }, { "__id__": 68 }, - { - "__id__": 69 - }, { "__id__": 70 }, @@ -1099,6 +1114,12 @@ }, { "__id__": 72 + }, + { + "__id__": 73 + }, + { + "__id__": 74 } ], "removedComponents": [] @@ -1106,7 +1127,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_name" @@ -1122,7 +1143,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_lpos" @@ -1137,7 +1158,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_lrot" @@ -1153,7 +1174,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_euler" @@ -1168,7 +1189,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_lscale" @@ -1183,7 +1204,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 67 + "__id__": 69 }, "propertyPath": [ "_active" @@ -1197,14 +1218,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 74 + "__id__": 76 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 73 + "__id__": 75 }, "asset": { "__uuid__": "ae4493bd-cbcc-4392-921c-3e2b0fcd5338", @@ -1212,7 +1233,7 @@ }, "fileId": "91yoyAQGNDm5ziI7NUChZ+", "instance": { - "__id__": 75 + "__id__": 77 }, "targetOverrides": null }, @@ -1225,20 +1246,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 76 - }, { "__id__": 78 }, - { - "__id__": 79 - }, { "__id__": 80 }, { "__id__": 81 + }, + { + "__id__": 82 + }, + { + "__id__": 83 } ], "removedComponents": [] @@ -1246,7 +1267,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 77 + "__id__": 79 }, "propertyPath": [ "_name" @@ -1262,7 +1283,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 77 + "__id__": 79 }, "propertyPath": [ "_lpos" @@ -1277,7 +1298,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 77 + "__id__": 79 }, "propertyPath": [ "_lrot" @@ -1293,7 +1314,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 77 + "__id__": 79 }, "propertyPath": [ "_euler" @@ -1308,7 +1329,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 77 + "__id__": 79 }, "propertyPath": [ "_active" @@ -1325,7 +1346,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 83 + "__id__": 85 }, "_contentSize": { "__type__": "cc.Size", @@ -1353,7 +1374,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 85 + "__id__": 87 }, "enabledContactListener": true, "bullet": true, @@ -1387,7 +1408,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 87 + "__id__": 89 }, "tag": 0, "_group": 4, @@ -1397,13 +1418,13 @@ "_restitution": 0, "_offset": { "__type__": "cc.Vec2", - "x": 8.4, - "y": 46.3 + "x": -1.8, + "y": 37.7 }, "_size": { "__type__": "cc.Size", - "width": 57.6, - "height": 71 + "width": 50.8, + "height": 78.6 }, "_id": "" }, @@ -1421,9 +1442,11 @@ }, "_enabled": true, "__prefab": { - "__id__": 89 + "__id__": 91 + }, + "anm": { + "__id__": 33 }, - "animator": null, "_id": "" }, { @@ -1440,7 +1463,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 91 + "__id__": 93 }, "_id": "" }, @@ -1461,19 +1484,19 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": [ { - "__id__": 73 + "__id__": 75 }, { - "__id__": 63 + "__id__": 65 }, { - "__id__": 54 + "__id__": 56 }, { - "__id__": 43 + "__id__": 45 }, { - "__id__": 34 + "__id__": 36 }, { "__id__": 19 diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index 45902966..b8718c9a 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -6204,7 +6204,7 @@ "__id__": 333 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 495 @@ -7085,10 +7085,10 @@ "_lineCap": 0, "_fillColor": { "__type__": "cc.Color", - "r": 49, - "g": 6, - "b": 6, - "a": 255 + "r": 255, + "g": 255, + "b": 255, + "a": 0 }, "_miterLimit": 10, "_id": "" @@ -8901,6 +8901,8 @@ "__id__": 0 }, "fileId": "a9tIKArgFMg7ygaq+mp0Zo", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -9031,6 +9033,8 @@ "__id__": 0 }, "fileId": "a5n2QVgsxDQpgqHM3UKEXo", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index e1e8dcac..15f39d86 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -93,7 +93,7 @@ export class SingletonModuleComp extends ecs.Comp { gems:0, energy:0, }, - fight_heros:[9001,9001], + fight_heros:[9001,], items:{ 1001:0, 1002:0, diff --git a/assets/script/game/common/config/BoxSet.ts b/assets/script/game/common/config/BoxSet.ts index 59fdc7bb..ac15597b 100644 --- a/assets/script/game/common/config/BoxSet.ts +++ b/assets/script/game/common/config/BoxSet.ts @@ -28,7 +28,7 @@ export enum BoxSet { MONSTER_START = 360, END_POINT = 360, //游戏地平线 - GAME_LINE = 0, + GAME_LINE = 10, CSKILL_X = 320, CSKILL_Y = 400, //攻击距离 diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 4146ad59..47ed5c02 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,7 +1,7 @@ export const HeroInfo = { 9001: { - uuid:9001,name: "骑士·白",path:"k1",type:1,hp: 20, 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: 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, 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, diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 485e47f8..4fd9ea8e 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -54,7 +54,7 @@ export class Hero extends ecs.Entity { this.addComponents( MonModelComp); } - var path = "game/hero/"+smc.heros[uuid].path; + var path = "game/heros/"+smc.heros[uuid].path; var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); diff --git a/assets/script/game/hero/HeroAnmComp.ts b/assets/script/game/hero/HeroAnmComp.ts index 02b3a0ee..c368b0d2 100644 --- a/assets/script/game/hero/HeroAnmComp.ts +++ b/assets/script/game/hero/HeroAnmComp.ts @@ -1,50 +1,99 @@ -/* - * @Author: dgflash - * @Date: 2022-08-04 15:08:35 - * @LastEditors: dgflash - * @LastEditTime: 2022-08-04 15:26:38 - */ -import { sp, _decorator } from "cc"; -import AnimatorSpine from "../../../../extensions/oops-plugin-framework/assets/libs/animator/AnimatorSpine"; +import { _decorator, CCClass, Component, sp } from "cc"; +const { ccclass, property } = _decorator; -const { ccclass, property, requireComponent, disallowMultiple } = _decorator; +@ccclass('HeroAnmComp') +export default class HeroAnmComp extends Component{ -/** - * Spine状态机组件(主状态机),trackIndex为0 - */ -@ccclass -@disallowMultiple -@requireComponent(sp.Skeleton) -export default class HeroAnmComp extends AnimatorSpine { + mixTime:number= 0.2; - private animName: string = "Idle"; - private loop: boolean = true; + private spine?: sp.Skeleton; + private _hasStop = true; + onLoad () { + var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton; + this._setMix('Walking', 'Idle'); + this._setMix('Walking', 'Attacking'); + this._setMix('Walking', 'Taunt'); + this._setMix('Idle', 'Attacking'); + this._setMix('Idle', 'Taunt'); + this._setMix('Idle', 'Walking'); + this._setMix('Attacking', 'Idle'); + this._setMix('Attacking', 'Walking'); + this._setMix('Taunt', 'Walking'); + this._setMix('Taunt', 'Idle'); - start() { + spine.setCompleteListener((trackEntry) => { + var animationName = trackEntry.animation ? trackEntry.animation.name : ""; + if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') { + this.spine!.clearTrack(1); + } + var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd); + // console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount); + }); + spine.setEventListener(((trackEntry:any, event:any) => { + var animationName = trackEntry.animation ? trackEntry.animation.name : ""; + // console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue); + }) as any); - super.start(); + this._hasStop = false; } - lateUpdate(dt: number) { + // OPTIONS + toggleDebugSlots () { + this.spine!.debugSlots = !this.spine?.debugSlots; } - /** - * 播放动画 - * @override - * @param animName 动画名 - * @param loop 是否循环播放 - */ - protected playAnimation(animName: string, loop: boolean) { - if (animName) { - this.animName = animName; - this.loop = loop; + toggleDebugBones () { + this.spine!.debugBones = !this.spine?.debugBones; + } - this._spine.setAnimation(0, animName, loop); + toggleDebugMesh () { + this.spine!.debugMesh = !this.spine?.debugMesh; + } + + toggleUseTint () { + this.spine!.useTint = !this.spine?.useTint; + } + + toggleTimeScale () { + if (this.spine!.timeScale === 1.0) { + this.spine!.timeScale = 0.3; } else { - this._spine.clearTrack(0); + this.spine!.timeScale = 1.0; } } + // ANIMATIONS + + stop () { + this.spine?.clearTrack(0); + this._hasStop = true; + } + + move () { + if (this._hasStop) { + this.spine?.setToSetupPose(); + } + this.spine?.setAnimation(0, 'Walking', true); + this._hasStop = false; + } + atk () { + this.spine?.setAnimation(1, 'Attacking', false); + } + max () { + this.spine?.setAnimation(1, 'Taunt', false); + } + atked () { + this.spine?.setAnimation(1, 'Hurt', false); + } + idle () { + this.spine?.setToSetupPose(); + this.spine?.setAnimation(0, 'Idle', true); + } + + _setMix (anim1: string, anim2: string) { + this.spine?.setMix(anim1, anim2, this.mixTime); + this.spine?.setMix(anim2, anim1, this.mixTime); + } } \ No newline at end of file diff --git a/assets/script/game/hero/HeroSpine.ts b/assets/script/game/hero/HeroSpine.ts index 4db5223a..1b17e7d4 100644 --- a/assets/script/game/hero/HeroSpine.ts +++ b/assets/script/game/hero/HeroSpine.ts @@ -1,84 +1,63 @@ -/* - * @Author: dgflash - * @Date: 2022-08-04 15:08:35 - * @LastEditors: dgflash - * @LastEditTime: 2022-08-04 15:26:26 - */ -import { Color, Component, EventTouch, sp, Vec3, _decorator ,Animation, AnimationClip, AnimationState,} from "cc"; +import { Color, Component, EventTouch, sp, Vec3, _decorator ,} from "cc"; +import HeroAnmComp from "./HeroAnmComp"; const { ccclass, property } = _decorator; -/** - * RPG SPINE角色模型 - */ @ccclass('HeroSpine') export class HeroSpine extends Component { - @property(Animation) - animator: Animation = null!; - + @property(HeroAnmComp) + anm: HeroAnmComp = null; + status:string="Idle"; + onLoad() { // 角色控制组件 - this.initAnimator(); - this.idle_clip = this.animator.clips[0]; - this.atk_clip = this.animator.clips[1]; - this.move_clip = this.animator.clips[2]; - this.default_clip=this.move_clip.name; - let animation = this.animator.getComponent(Animation); - animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this) + } protected start(): void { this.move(); } /** 初始化动画 */ protected initAnimator() { - this.animator=this.node.getChildByName("anm").getComponent(Animation); - // console.log("mon spine init",this.animator); + } in_playing(){ - if(this.animator.getState(this.atk_clip.name).isPlaying) return true; - if(this.animator.getState(this.idle_clip.name).isPlaying) return true; - if(this.animator.getState(this.move_clip.name).isPlaying) return true; - return false; + } - onAnimationEvent(type: Animation.EventType, state: AnimationState){ - if(type==Animation.EventType.FINISHED){ - // console.log("animator end",state.name); - if(state.name==this.atk_clip.name){ - this.default(); - } - } + change_status(value:string){ + this.status=value } change_default(value:string){ - // console.log("change default",value); - this.default_clip=value; + } default() { - if(!this.in_playing()){ - // console.log("do default"); - this.animator.play(this.default_clip); - } + } idle(){ - if(!this.in_playing()){ - console.log("do idle"); - this.animator.play(this.idle_clip.name); - } + // console.log("do Idle"); + if(this.status=="Idle") return + this.status="Idle" + this.anm.idle() } atk() { // console.log("do atk"); - this.animator.play(this.atk_clip.name); + this.anm.atk() + } + max(){ + // console.log("do max"); + this.anm.max() } - - - move(){ - if(!this.animator.getState(this.move_clip.name).isPlaying) { - console.log("doing move"); - this.animator.play(this.move_clip.name); - } + // console.log("doing move"); + if(this.status=="move") return + this.status="move" + this.anm.move() + } + atked() { + // console.log("do atked"); + this.anm.atked() } onDestroy() { this.node.destroy(); diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 36d7d151..3e0ebe55 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -455,6 +455,7 @@ export class HeroViewComp extends CCComp { //使用max_skill handle_skill(skill:number){ this.as.atk() + this.at = 0; this.tooltip(3,smc.skills[skill].name,skill); switch (smc.skills[skill].tg) { @@ -673,6 +674,7 @@ export class HeroViewComp extends CCComp { let pos =v3(0,30); node.setPosition(pos) node.parent = this.node; + // this.as.atked(); this.atked_count++; this.exp_add(this.uaep) } diff --git a/assets/script/game/map/CardController.ts b/assets/script/game/map/CardController.ts index 9c228687..7c371819 100644 --- a/assets/script/game/map/CardController.ts +++ b/assets/script/game/map/CardController.ts @@ -30,24 +30,7 @@ export class CardControllerComp extends CCComp { } show_info(uuid:number,type:number){ - // console.log("show_info",uuid) - let node =this.node.getChildByName("item_box") - if(type == 2){ - smc.vmdata.item_box.info = smc.sitems[uuid].info - smc.vmdata.item_box.name = smc.sitems[uuid].name - smc.vmdata.item_box.skillcd = smc.sitems[uuid].cd - smc.vmdata.item_box.skillsd = smc.sitems[uuid].sd - smc.vmdata.item_box.atk = smc.sitems[uuid].atk - smc.vmdata.item_box.hp = smc.sitems[uuid].hp - smc.vmdata.item_box.shield = smc.sitems[uuid].shield - node.active=true - if(smc.sitems[uuid].shield > 0){ - node.getChildByName("data").getChildByName("shield").active=true - } - if(smc.sitems[uuid].hp > 0){ - node.getChildByName("data").getChildByName("hp").active=true - } - } + console.log("show_info",uuid) } protected update(dt: number): void { @@ -82,7 +65,6 @@ export class CardControllerComp extends CCComp { this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=false this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=false this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=true - } to_hero(){ this.node.getChildByName("mission_home").active=false @@ -93,12 +75,6 @@ export class CardControllerComp extends CCComp { this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=false } - item_info_show(){ - this.node.getChildByName("item_info").setScale(1,1,1) - } - item_info_hide(){ - this.node.getChildByName("item_info").setScale(0,0,1) - } /** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { this.node.destroy();