From fa8a2d1c6d46449f5b4314be81f36b6d4e40806f Mon Sep 17 00:00:00 2001 From: walkpan Date: Wed, 21 Aug 2024 08:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E7=89=8C=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/heros/c_skill.anim | 348 ++++++++++++++ assets/resources/game/heros/c_skill.anim.meta | 13 + assets/resources/game/heros/skill.prefab | 454 ++++++++++++++++++ assets/resources/game/heros/skill.prefab.meta | 13 + assets/resources/game/map/map_rpg.prefab | 405 +++++++--------- assets/script/game/common/config/BoxSet.ts | 2 + .../script/game/common/config/MissionSet.ts | 2 +- assets/script/game/map/MapMonsterComp.ts | 59 ++- assets/script/game/map/MapSkillComp.ts | 23 +- .../game/map/view/map/layer/EntityLayer.ts | 4 +- .../game/map/view/map/layer/SkillLayer.ts | 10 +- assets/script/game/monster/CSkill.ts | 61 +++ assets/script/game/monster/CSkill.ts.meta | 9 + assets/script/game/monster/CSkillComp.ts | 51 ++ assets/script/game/monster/CSkillComp.ts.meta | 9 + assets/script/game/monster/Hero.ts | 10 +- .../script/game/monster/HeroCardViewComp.ts | 9 + assets/script/game/monster/HeroModelComp.ts | 26 + .../script/game/monster/HeroModelComp.ts.meta | 9 + assets/script/game/monster/MonsterViewComp.ts | 11 +- assets/script/game/role/view/RoleViewComp.ts | 2 +- assets/script/game/skills/Skill.ts | 4 +- assets/script/game/skills/SkillCom.ts | 9 +- 23 files changed, 1279 insertions(+), 264 deletions(-) create mode 100644 assets/resources/game/heros/c_skill.anim create mode 100644 assets/resources/game/heros/c_skill.anim.meta create mode 100644 assets/resources/game/heros/skill.prefab create mode 100644 assets/resources/game/heros/skill.prefab.meta create mode 100644 assets/script/game/monster/CSkill.ts create mode 100644 assets/script/game/monster/CSkill.ts.meta create mode 100644 assets/script/game/monster/CSkillComp.ts create mode 100644 assets/script/game/monster/CSkillComp.ts.meta create mode 100644 assets/script/game/monster/HeroModelComp.ts create mode 100644 assets/script/game/monster/HeroModelComp.ts.meta diff --git a/assets/resources/game/heros/c_skill.anim b/assets/resources/game/heros/c_skill.anim new file mode 100644 index 00000000..81609def --- /dev/null +++ b/assets/resources/game/heros/c_skill.anim @@ -0,0 +1,348 @@ +[ + { + "__type__": "cc.AnimationClip", + "_name": "c_skill", + "_objFlags": 0, + "__editorExtras__": { + "embeddedPlayerGroups": [] + }, + "_native": "", + "sample": 24, + "speed": 1, + "wrapMode": 2, + "enableTrsBlending": false, + "_duration": 0.8333333333333334, + "_hash": 500763545, + "_tracks": [ + { + "__id__": 1 + } + ], + "_exoticAnimation": null, + "_events": [], + "_embeddedPlayers": [], + "_additiveSettings": { + "__id__": 11 + }, + "_auxiliaryCurveEntries": [] + }, + { + "__type__": "cc.animation.VectorTrack", + "_binding": { + "__type__": "cc.animation.TrackBinding", + "path": { + "__id__": 2 + }, + "proxy": null + }, + "_channels": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 7 + }, + { + "__id__": 9 + } + ], + "_nComponents": 3 + }, + { + "__type__": "cc.animation.TrackPath", + "_paths": [ + "scale" + ] + }, + { + "__type__": "cc.animation.Channel", + "_curve": { + "__id__": 4 + } + }, + { + "__type__": "cc.RealCurve", + "_times": [ + 0, + 0.2083333283662796, + 0.4166666567325592, + 0.625, + 0.8333333134651184 + ], + "_values": [ + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 0.800000011920929, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1.100000023841858, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + } + ], + "preExtrapolation": 1, + "postExtrapolation": 1 + }, + { + "__type__": "cc.animation.Channel", + "_curve": { + "__id__": 6 + } + }, + { + "__type__": "cc.RealCurve", + "_times": [ + 0, + 0.2083333283662796, + 0.4166666567325592, + 0.625, + 0.8333333134651184 + ], + "_values": [ + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 0.800000011920929, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1.100000023841858, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + } + ], + "preExtrapolation": 1, + "postExtrapolation": 1 + }, + { + "__type__": "cc.animation.Channel", + "_curve": { + "__id__": 8 + } + }, + { + "__type__": "cc.RealCurve", + "_times": [ + 0, + 0.2083333283662796, + 0.4166666567325592, + 0.625, + 0.8333333134651184 + ], + "_values": [ + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + }, + { + "__type__": "cc.RealKeyframeValue", + "interpolationMode": 0, + "tangentWeightMode": 0, + "value": 1, + "rightTangent": 0, + "rightTangentWeight": 1, + "leftTangent": 0, + "leftTangentWeight": 1, + "easingMethod": 0, + "__editorExtras__": { + "tangentMode": 0 + } + } + ], + "preExtrapolation": 1, + "postExtrapolation": 1 + }, + { + "__type__": "cc.animation.Channel", + "_curve": { + "__id__": 10 + } + }, + { + "__type__": "cc.RealCurve", + "_times": [], + "_values": [], + "preExtrapolation": 1, + "postExtrapolation": 1 + }, + { + "__type__": "cc.AnimationClipAdditiveSettings", + "enabled": false, + "refClip": null + } +] \ No newline at end of file diff --git a/assets/resources/game/heros/c_skill.anim.meta b/assets/resources/game/heros/c_skill.anim.meta new file mode 100644 index 00000000..9d2b8c6c --- /dev/null +++ b/assets/resources/game/heros/c_skill.anim.meta @@ -0,0 +1,13 @@ +{ + "ver": "2.0.3", + "importer": "animation-clip", + "imported": true, + "uuid": "2be0841b-b660-40c6-a0d9-fa346b8d4a83", + "files": [ + ".cconb" + ], + "subMetas": {}, + "userData": { + "name": "c_skill" + } +} diff --git a/assets/resources/game/heros/skill.prefab b/assets/resources/game/heros/skill.prefab new file mode 100644 index 00000000..5800c7b0 --- /dev/null +++ b/assets/resources/game/heros/skill.prefab @@ -0,0 +1,454 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "skill", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "skill", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 10 + } + ], + "_active": true, + "_components": [ + { + "__id__": 16 + }, + { + "__id__": 18 + } + ], + "_prefab": { + "__id__": 20 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -0.041, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 0.7, + "y": 0.7, + "z": 1 + }, + "_mobility": 0, + "_layer": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "skill", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 7 + } + ], + "_prefab": { + "__id__": 9 + }, + "_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": 1, + "_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": 102, + "height": 106 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "eaER4oNWNGv7Dk5yvqhnSs" + }, + { + "__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__": "56fae78e-4db4-4ef1-be24-d030fc909ed1@b3f5a", + "__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": "54bnrJGBVKcJWcSYfj+9Oy" + }, + { + "__type__": "cc.Animation", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "playOnLoad": true, + "_clips": [ + { + "__uuid__": "2be0841b-b660-40c6-a0d9-fa346b8d4a83", + "__expectedType__": "cc.AnimationClip" + } + ], + "_defaultClip": { + "__uuid__": "2be0841b-b660-40c6-a0d9-fa346b8d4a83", + "__expectedType__": "cc.AnimationClip" + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e4WazVB3FEnoT9JTMotxuZ" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "3d7pk/kuRJW5UaOHksQPAv", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "time", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 11 + }, + { + "__id__": 13 + } + ], + "_prefab": { + "__id__": 15 + }, + "_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": 2, + "y": 2, + "z": 1 + }, + "_mobility": 0, + "_layer": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 17.90380859375, + "height": 54.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "464TV9SztO6YISNtFhpsHF" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 14 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "5", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 25, + "_fontSize": 25, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "d0RRL1Gp9M0qu6XX+NQUIS" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "e68MLVqX9HUIHPwQY/ofCT", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": false, + "__prefab": { + "__id__": 17 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "14OhXRCixNOaApgow/hFbp" + }, + { + "__type__": "31174UD2TRL1L1oAaqlU06B", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 19 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b4nIIcjGpGm7x6Bn3w4OXb" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "fdklpBwCBM/qJ4WFlQF3kT", + "instance": null, + "targetOverrides": null + } +] \ No newline at end of file diff --git a/assets/resources/game/heros/skill.prefab.meta b/assets/resources/game/heros/skill.prefab.meta new file mode 100644 index 00000000..d709d494 --- /dev/null +++ b/assets/resources/game/heros/skill.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "cece794f-d3f6-4ff3-8515-76a169e58f70", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "skill" + } +} diff --git a/assets/resources/game/map/map_rpg.prefab b/assets/resources/game/map/map_rpg.prefab index 6d2779df..feaabc03 100644 --- a/assets/resources/game/map/map_rpg.prefab +++ b/assets/resources/game/map/map_rpg.prefab @@ -27,18 +27,18 @@ ], "_active": true, "_components": [ + { + "__id__": 74 + }, + { + "__id__": 76 + }, { "__id__": 78 - }, - { - "__id__": 80 - }, - { - "__id__": 82 } ], "_prefab": { - "__id__": 84 + "__id__": 80 }, "_lpos": { "__type__": "cc.Vec3", @@ -204,16 +204,10 @@ }, { "__id__": 71 - }, - { - "__id__": 73 - }, - { - "__id__": 75 } ], "_prefab": { - "__id__": 77 + "__id__": 73 }, "_lpos": { "__type__": "cc.Vec3", @@ -256,14 +250,14 @@ { "__id__": 8 }, - { - "__id__": 34 - }, { "__id__": 38 }, { - "__id__": 46 + "__id__": 42 + }, + { + "__id__": 48 } ], "_active": true, @@ -324,10 +318,16 @@ }, { "__id__": 31 + }, + { + "__id__": 33 + }, + { + "__id__": 35 } ], "_prefab": { - "__id__": 33 + "__id__": 37 }, "_lpos": { "__type__": "cc.Vec3", @@ -831,6 +831,46 @@ "__type__": "cc.CompPrefabInfo", "fileId": "463tPWLuVLS5+4BU5ZkZyJ" }, + { + "__type__": "b7739lRGUtNE4v/zX96Czu/", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 34 + }, + "light": { + "__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8", + "__expectedType__": "cc.Prefab" + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "abjw1QslRMoJXlFkOcM3tw" + }, + { + "__type__": "c0f2fdqfBtOjKCjsgH1qG9+", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 36 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "32/wDIt+VCGpWZs7dgIh/W" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -854,107 +894,13 @@ }, "_children": [], "_active": true, - "_components": [ - { - "__id__": 35 - } - ], - "_prefab": { - "__id__": 37 - }, - "_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": 1, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 34 - }, - "_enabled": true, - "__prefab": { - "__id__": 36 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 100 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "31oHtMbJVMArMbwqigKTMo" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "dcwiHpOeZB4rB8JR5Z9iTM", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "EntityLayer", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 7 - }, - "_children": [], - "_active": true, "_components": [ { "__id__": 39 - }, - { - "__id__": 41 - }, - { - "__id__": 43 } ], "_prefab": { - "__id__": 45 + "__id__": 41 }, "_lpos": { "__type__": "cc.Vec3", @@ -1009,6 +955,97 @@ }, "_id": "" }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "31oHtMbJVMArMbwqigKTMo" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "dcwiHpOeZB4rB8JR5Z9iTM", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "EntityLayer", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 7 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 43 + }, + { + "__id__": 45 + } + ], + "_prefab": { + "__id__": 47 + }, + "_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": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 42 + }, + "_enabled": true, + "__prefab": { + "__id__": 44 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_id": "" + }, { "__type__": "cc.CompPrefabInfo", "fileId": "f91Y4OCX1NFKfSWOAvmdSa" @@ -1019,11 +1056,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 38 + "__id__": 42 }, "_enabled": true, "__prefab": { - "__id__": 42 + "__id__": 46 }, "_id": "" }, @@ -1031,24 +1068,6 @@ "__type__": "cc.CompPrefabInfo", "fileId": "6fzmfjcbNPK6tOzQOKJfRV" }, - { - "__type__": "c0f2fdqfBtOjKCjsgH1qG9+", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 38 - }, - "_enabled": true, - "__prefab": { - "__id__": 44 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "173LGjeL9OlLaNVYt3Y+qH" - }, { "__type__": "cc.PrefabInfo", "root": { @@ -1072,14 +1091,11 @@ }, "_children": [ { - "__id__": 47 + "__id__": 49 } ], "_active": true, "_components": [ - { - "__id__": 57 - }, { "__id__": 59 }, @@ -1123,17 +1139,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 46 + "__id__": 48 }, "_prefab": { - "__id__": 48 + "__id__": 50 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 47 + "__id__": 49 }, "asset": { "__uuid__": "63c02880-bda6-4370-bb22-46bf4f49bbfe", @@ -1141,7 +1157,7 @@ }, "fileId": "fdklpBwCBM/qJ4WFlQF3kT", "instance": { - "__id__": 49 + "__id__": 51 }, "targetOverrides": null }, @@ -1154,15 +1170,9 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 50 - }, { "__id__": 52 }, - { - "__id__": 53 - }, { "__id__": 54 }, @@ -1171,6 +1181,12 @@ }, { "__id__": 56 + }, + { + "__id__": 57 + }, + { + "__id__": 58 } ], "removedComponents": [] @@ -1178,7 +1194,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_name" @@ -1194,7 +1210,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_lpos" @@ -1209,7 +1225,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_lrot" @@ -1225,7 +1241,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_euler" @@ -1240,7 +1256,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_active" @@ -1250,7 +1266,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 51 + "__id__": 53 }, "propertyPath": [ "_lscale" @@ -1268,11 +1284,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 + "__id__": 48 }, "_enabled": true, "__prefab": { - "__id__": 58 + "__id__": 60 }, "_contentSize": { "__type__": "cc.Size", @@ -1296,29 +1312,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 - }, - "_enabled": true, - "__prefab": { - "__id__": 60 - }, - "light": { - "__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8", - "__expectedType__": "cc.Prefab" - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "90iY8Wt31JQZ1WhSvASP55" - }, - { - "__type__": "b7739lRGUtNE4v/zX96Czu/", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 46 + "__id__": 48 }, "_enabled": true, "__prefab": { @@ -1332,7 +1326,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "7dN39sPBROo6Jp9JrguYbQ" + "fileId": "90iY8Wt31JQZ1WhSvASP55" }, { "__type__": "cc.PrefabInfo", @@ -1438,13 +1432,13 @@ "__id__": 31 }, "floorLayer": { - "__id__": 34 + "__id__": 38 }, "entityLayer": { - "__id__": 41 + "__id__": 45 }, "SkillLayer": { - "__id__": 59 + "__id__": 61 }, "isFollowPlayer": true, "_id": "" @@ -1471,43 +1465,6 @@ "__type__": "cc.CompPrefabInfo", "fileId": "7eqXnRa8JJN6SutHuRICj9" }, - { - "__type__": "c0f2fdqfBtOjKCjsgH1qG9+", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 6 - }, - "_enabled": true, - "__prefab": { - "__id__": 74 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "eanjJqiNdFCbYjTOIs36JC" - }, - { - "__type__": "b7739lRGUtNE4v/zX96Czu/", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 6 - }, - "_enabled": true, - "__prefab": { - "__id__": 76 - }, - "light": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "5fhe2hAPlMUbqe7oghUpNM" - }, { "__type__": "cc.PrefabInfo", "root": { @@ -1531,7 +1488,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 79 + "__id__": 75 }, "_contentSize": { "__type__": "cc.Size", @@ -1559,7 +1516,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 81 + "__id__": 77 }, "_cameraComponent": { "__id__": 3 @@ -1581,7 +1538,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 83 + "__id__": 79 }, "_alignFlags": 45, "_target": null, @@ -1620,7 +1577,7 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": [ { - "__id__": 47 + "__id__": 49 } ] } diff --git a/assets/script/game/common/config/BoxSet.ts b/assets/script/game/common/config/BoxSet.ts index a79f5515..8eb21417 100644 --- a/assets/script/game/common/config/BoxSet.ts +++ b/assets/script/game/common/config/BoxSet.ts @@ -26,4 +26,6 @@ export enum BoxSet { END_POINT = 360, //游戏地平线 GAME_LINE = 0, + CSKILL_X = 200, + CSKILL_Y = 500, } \ No newline at end of file diff --git a/assets/script/game/common/config/MissionSet.ts b/assets/script/game/common/config/MissionSet.ts index 91add9f1..042f3353 100644 --- a/assets/script/game/common/config/MissionSet.ts +++ b/assets/script/game/common/config/MissionSet.ts @@ -1,4 +1,4 @@ -export const MissionNum = 3 +export const MissionNum = [1,2,3] export const MonsetList = { 1:{ 1:[1101,1102,], diff --git a/assets/script/game/map/MapMonsterComp.ts b/assets/script/game/map/MapMonsterComp.ts index ce1048be..5ec8ad56 100644 --- a/assets/script/game/map/MapMonsterComp.ts +++ b/assets/script/game/map/MapMonsterComp.ts @@ -7,38 +7,72 @@ import { BoxSet } from "../common/config/BoxSet"; import { smc } from "../common/SingletonModuleComp"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { MapViewScene } from "./view/MapViewScene"; - +import { MissionSet,MissionNum,MonsetList } from "../common/config/MissionSet"; +import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MapMonsterComp') @ecs.register('MapMonster', false) export class MapMonsterComp extends CCComp { - scene: MapViewScene = null; - current_map: any; - - private monster_refresh_rtimer: Timer = new Timer(1); - async onLoad(){ + // scene: MapViewScene = null; + max_count: number = 99 ; //最大波次 + cur_count: number = 1; //波次 + boss_count: number = 10; //boss波次间隔 + monster_level:number = 1; //怪物池等级 + max_monster_level:number = 4; //最高怪物次等级 + min_monster_num:number = 2; ///最小每次刷新怪物数量 + max_monster_num:number = 2; //最大每次刷新怪物数量 + refresh_timer: Timer = new Timer(5); // 刷新怪物定时器 + refresh_cd: Timer = new Timer(0.5); + mission_up_timer: Timer = new Timer(30); //波次增加 + cur_mission:number = 1; //当前关卡方案 + mission_list:any = [] + setp_timer: Timer = new Timer(0.5); + setp_num:number = 2; + onLoad(){ // 监听全局事件 oops.message.on("do_add_monster", this.on_do_add_monster, this); - + + } + start() { + // this.scene = this.getComponent(MapViewScene); + let num =RandomManager.instance.getRandomByObjectList(MissionNum,1) + this.cur_mission = num[0] + this.mission_list = MonsetList[this.cur_mission] + console.log("当前关卡方案",this.cur_mission,this.mission_list) + this.refresh_timer= new Timer(smc.vm_data.gold.cd); + this.monster_refresh() } protected update(dt: number): void { - if (this.monster_refresh_rtimer.update(dt)) { - // 刷新怪物定时器 + if(this.setp_timer.update(dt)){ this.monster_refresh() } + if (this.refresh_timer.update(dt)) { + this.setp_num = RandomManager.instance.getRandomInt(this.max_monster_num,this.max_monster_level,2) + } + if (this.mission_up_timer.update(dt)) { + // 刷新怪物定时器 + this.cur_count += 1; + } // if (this.game_timer.update(dt)) { // smc.vm_data.game.g_time += 1; // } // this.shuaxin(dt) } monster_refresh(){ - if(smc.monsters.length > 0 ){ - this.addMonster(smc.monsters[0].uuid) + if (this.setp_num <= 0){ + return } + console.log("当前波数",this.cur_count) + console.log("当前怪物池",this.mission_list[this.monster_level]) + let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1) + console.log("刷怪",m) + this.addMonster(m[0]) + this.setp_num -= 1 } private addMonster(uuid:number=1101) { + let monster = ecs.getEntity(Monster); let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE) let camp = -1 @@ -50,10 +84,7 @@ export class MapMonsterComp extends CCComp { // this.addMonster(args.uuid) } /** 视图层逻辑代码分离演示 */ - start() { - this.scene = this.getComponent(MapViewScene); - } /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { diff --git a/assets/script/game/map/MapSkillComp.ts b/assets/script/game/map/MapSkillComp.ts index f5cd4755..4dbe9863 100644 --- a/assets/script/game/map/MapSkillComp.ts +++ b/assets/script/game/map/MapSkillComp.ts @@ -1,15 +1,17 @@ -import { _decorator ,Prefab,instantiate,Node} from "cc"; +import { _decorator ,v3,Prefab,instantiate,Node} 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"; import { BoxSet } from "../common/config/BoxSet"; - +import { MapViewScene } from "./view/MapViewScene"; +import { CSkill } from "../monster/CSkill"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MapSkillComp') @ecs.register('MapSkill', false) export class MapSkillComp extends CCComp { + // scene: MapViewScene = null; @property(Prefab) light: Prefab = null; onLoad(){ @@ -18,19 +20,24 @@ export class MapSkillComp extends CCComp { oops.message.on("do_use_skill", this.doSkill, this); } doSkill(){ - // console.log("doSkill") + this.addSkill(); + } + addSkill(uuid:number=1001){ + let csk =ecs.getEntity(CSkill); + let camp = 1 + let pos = v3(BoxSet.CSKILL_X*-camp,BoxSet.CSKILL_Y) + csk.load(pos,camp,uuid); } doMonsterLoad(){ - // const light = instantiate(this.light); // light.setPosition(300,-30,0); // this.node.addChild(light); } doHeroLoad(){ - // console.log(this.light) - // const light = instantiate(this.light); - // light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0); - // this.node.addChild(light); + console.log(this.light) + const light = instantiate(this.light); + light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0); + this.node.addChild(light); } /** 视图层逻辑代码分离演示 */ start() { diff --git a/assets/script/game/map/view/map/layer/EntityLayer.ts b/assets/script/game/map/view/map/layer/EntityLayer.ts index 44cc3511..6f8f4c50 100644 --- a/assets/script/game/map/view/map/layer/EntityLayer.ts +++ b/assets/script/game/map/view/map/layer/EntityLayer.ts @@ -25,7 +25,9 @@ export default class EntityLayer extends Component { // this.node.children.sort(this.zIndexSort); } - + protected start(): void { + console.log("EntityLayer start") + } public clear() { this.node.children.forEach(n => { diff --git a/assets/script/game/map/view/map/layer/SkillLayer.ts b/assets/script/game/map/view/map/layer/SkillLayer.ts index 008a5b81..541f71e3 100644 --- a/assets/script/game/map/view/map/layer/SkillLayer.ts +++ b/assets/script/game/map/view/map/layer/SkillLayer.ts @@ -36,9 +36,9 @@ export default class SkillLayer extends Component { // this.node.addChild(light); } doHeroLoad(){ - const light = instantiate(this.light); - light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0); - this.node.addChild(light); + // const light = instantiate(this.light); + // light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0); + // this.node.addChild(light); } update(dt: number) { // this.timer.update(dt) @@ -46,7 +46,9 @@ export default class SkillLayer extends Component { // this.node.children.sort(this.zIndexSort); } - + start(){ + console.log("SkillLayer start") + } public clear() { this.node.children.forEach(n => { diff --git a/assets/script/game/monster/CSkill.ts b/assets/script/game/monster/CSkill.ts new file mode 100644 index 00000000..1eefdc02 --- /dev/null +++ b/assets/script/game/monster/CSkill.ts @@ -0,0 +1,61 @@ +import { Prefab,instantiate,Vec3,v3 ,SpriteAtlas,resources,Sprite,Node} from "cc"; +import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; +import { CSkillComp } from "./CSkillComp"; +import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; +import { smc } from "../common/SingletonModuleComp"; +/** CSkill 模块 */ +@ecs.register(`CSkill`) +export class CSkill extends ecs.Entity { + CSkillView!: CSkillComp; + /** 实始添加的数据层组件 */ + protected init() { + + } + + /** 模块资源释放 */ + destroy() { + // 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放 + super.destroy(); + } + start(){ + + } + + /** 加载角色 */ + load(pos: Vec3 = Vec3.ZERO,camp:number = 1,uuid:number=1001) { + // var path = "game/monster/"+prefab_path; + + var path = "game/heros/skill"; + 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("skill").setScale(node.getChildByName("skill").scale.x*camp, node.getChildByName("skill").scale.y, node.getChildByName("skill").scale.z); + node.setPosition(pos) + // console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite)) + const url = 'game/heros/skill'; + resources.load(url, SpriteAtlas, (err: any, atlas) => { + const sprite = node.getChildByName("skill").getComponent(Sprite); + sprite.spriteFrame = atlas.getSpriteFrame('1002'); + }); + this.skill_init(uuid,node,pos) + oops.message.dispatchEvent("cskill_load",this) + + } + + skill_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){ + var mv = node.getComponent(CSkillComp) + mv.camp = 1; + this.add(mv); + } + +} + +/** CSkill 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */ +export class EcsCSkillSystem extends ecs.System { + constructor() { + super(); + + // this.add(new ecs.ComblockSystem()); + } +} diff --git a/assets/script/game/monster/CSkill.ts.meta b/assets/script/game/monster/CSkill.ts.meta new file mode 100644 index 00000000..dfa6ba42 --- /dev/null +++ b/assets/script/game/monster/CSkill.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "430ee378-c69f-409a-b098-d3daec37d90b", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/monster/CSkillComp.ts b/assets/script/game/monster/CSkillComp.ts new file mode 100644 index 00000000..45f66fd1 --- /dev/null +++ b/assets/script/game/monster/CSkillComp.ts @@ -0,0 +1,51 @@ +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 { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer"; + +const { ccclass, property } = _decorator; + +/** 视图层对象 */ +@ccclass('CSkillComp') +@ecs.register('CSkill', false) +export class CSkillComp extends CCComp { + //持续时间 + in_time: Timer = new Timer(5) + is_destroy:boolean = false; + camp:number = 1; + /** 视图层逻辑代码分离演示 */ + start() { + // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 + // this.on(ModuleEvent.Cmd, this.onHandler, this); + } + protected update(dt: number): void { + if (this.in_time.update(dt)) { + if (this.is_destroy) { + return + } + this.to_destroy() + } + } + /** 全局消息逻辑处理 */ + // private onHandler(event: string, args: any) { + // switch (event) { + // case ModuleEvent.Cmd: + // break; + // } + // } + to_destroy() { + this.is_destroy = true + // console.log("CSkillComp toDestroy"); + if (this.node.isValid) { + // console.log("CSkillComp.node.isValid"); + setTimeout(() => { + // console.log("CSkillComp.node.destroy",this); + this.node.destroy() + }, 10); + } + } + /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ + reset() { + this.node.destroy(); + } +} \ No newline at end of file diff --git a/assets/script/game/monster/CSkillComp.ts.meta b/assets/script/game/monster/CSkillComp.ts.meta new file mode 100644 index 00000000..1553d394 --- /dev/null +++ b/assets/script/game/monster/CSkillComp.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "31174503-d934-4bd4-bd68-01aaa5534e81", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/monster/Hero.ts b/assets/script/game/monster/Hero.ts index 0856a7d7..ee9246d2 100644 --- a/assets/script/game/monster/Hero.ts +++ b/assets/script/game/monster/Hero.ts @@ -14,23 +14,23 @@ import { smc } from "../common/SingletonModuleComp"; import { MonsterModelComp } from "./MonsterModelComp"; import { MonsterSpine } from "./MonsterSpine"; import { MonsterViewComp } from "./MonsterViewComp"; +import {HeroModelComp} from "./HeroModelComp"; import { CardSet } from "../common/config/CardSet"; /** 角色实体 */ @ecs.register(`Hero`) export class Hero extends ecs.Entity { // 数据层 - MonsterModel!: MonsterModelComp; + HeroModel!: HeroModelComp; // 视图层 MonsterView!: MonsterViewComp; protected init() { - this.addComponents( - MonsterModelComp); - + this.addComponents(HeroModelComp); } destroy(): void { this.remove(MonsterViewComp); + this.remove(MonsterModelComp); super.destroy(); } @@ -43,7 +43,7 @@ export class Hero extends ecs.Entity { var node = instantiate(prefab); var scene = smc.map.MapView.scene; node.parent = scene.entityLayer!.node!; - var as = node.getComponent(MonsterSpine); + // var as = node.getComponent(MonsterSpine); node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z); node.setPosition(pos) diff --git a/assets/script/game/monster/HeroCardViewComp.ts b/assets/script/game/monster/HeroCardViewComp.ts index 99737a4a..61fe5545 100644 --- a/assets/script/game/monster/HeroCardViewComp.ts +++ b/assets/script/game/monster/HeroCardViewComp.ts @@ -6,6 +6,8 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O import { smc } from "../common/SingletonModuleComp"; import { CardSet } from "../common/config/CardSet"; import { HeroCard } from "./HeroCard"; +import { HeroModelComp } from "./HeroModelComp"; +import { Hero } from "./Hero"; const { ccclass, property } = _decorator; /** 视图层对象 */ @@ -98,6 +100,13 @@ export class HeroCardViewComp extends CCComp { } use_card(){ + Hero + let heros = ecs.query(ecs.allOf(HeroModelComp)) + if(heros.length >= 4){ + oops.gui.toast("英雄数量达到上限"); + this.node.setPosition(this.pos_x,this.pos_y); + return; + } if(smc.vm_data.gold.min >= this.card_level){ this.in_destroy = true; this.do_use_card() diff --git a/assets/script/game/monster/HeroModelComp.ts b/assets/script/game/monster/HeroModelComp.ts new file mode 100644 index 00000000..01969678 --- /dev/null +++ b/assets/script/game/monster/HeroModelComp.ts @@ -0,0 +1,26 @@ +import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; +import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel"; + +/** 数据层对象 */ +@ecs.register('HeroModel') +export class HeroModelComp extends ecs.Comp { + /** 提供 MVVM 组件使用的数据 */ + // private vm: any = {}; + + // /** 显示数据添加到 MVVM 框架中监视 */ + // vmAdd() { + // VM.add(this.vm, "HeroModelComp"); + // } + + // /** 显示数据从 MVVM 框架中移除 */ + // vmRemove() { + // VM.remove("HeroModelComp"); + // } + + /** 数据层组件移除时,重置所有数据为默认值 */ + reset() { + // for (var key in this.vm) { + // delete this.vm[key]; + // } + } +} \ No newline at end of file diff --git a/assets/script/game/monster/HeroModelComp.ts.meta b/assets/script/game/monster/HeroModelComp.ts.meta new file mode 100644 index 00000000..1f02b2a5 --- /dev/null +++ b/assets/script/game/monster/HeroModelComp.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "5e2825cf-c282-4297-be1f-631d2dc3bec5", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/monster/MonsterViewComp.ts b/assets/script/game/monster/MonsterViewComp.ts index d0dcc398..7ea165eb 100644 --- a/assets/script/game/monster/MonsterViewComp.ts +++ b/assets/script/game/monster/MonsterViewComp.ts @@ -52,7 +52,7 @@ export class MonsterViewComp extends CCComp { speed: number = 100; /** 角色移动速度 */ ospeed: number = 100; /** 角色初始速度 */ Tpos: Vec3 = v3(0,-60,0); - stop_cd: number = 0; /*停止倒计时*/ + stop_cd: number = 0.5; /*停止倒计时*/ shield:number = 0; //护盾量 shield_time:number = 0; //护盾持续时间 @@ -139,12 +139,15 @@ export class MonsterViewComp extends CCComp { } move(dt: number){ + if(this.stop_cd > 0){ + return + } /** * 根据角色的阵营检查角色的 x 轴位置是否满足特定条件。 * 如果角色属于正向阵营 (camp == 1) 且 x 轴位置大于等于 0,则直接返回。 * 如果角色属于反向阵营 (camp != 1) 且 x 轴位置小于等于 0,则直接返回。 */ - if ((this.camp === 1 && this.node.position.x >= 180) || (this.camp !== 1 && this.node.position.x <= -180)) { + if ((this.camp === 1 && this.node.position.x >= 0) || (this.camp !== 1 && this.node.position.x <= -180)) { return; } @@ -191,7 +194,7 @@ export class MonsterViewComp extends CCComp { if(this.stop_cd > 0){ this.stop_cd -= dt; if(this.stop_cd <= 0){ - this.speed = this.ospeed; + // this.speed = this.ospeed; this.stop_cd = 0; } } @@ -223,7 +226,7 @@ export class MonsterViewComp extends CCComp { let pos = v3(this.camp*30,30) let speed =400 let scale = this.camp - let range = 360; + let range = 120; skill.load(pos,speed,range,scale,this.node,skill_name,this.atk); } in_atked() { diff --git a/assets/script/game/role/view/RoleViewComp.ts b/assets/script/game/role/view/RoleViewComp.ts index 43b90735..0972fb75 100644 --- a/assets/script/game/role/view/RoleViewComp.ts +++ b/assets/script/game/role/view/RoleViewComp.ts @@ -38,7 +38,7 @@ export class RoleViewComp extends CCComp { skill_name: string = "base"; //技能名称 max_skill_name: string = "base"; //大技能名称 - atk: number = 10; /**攻击力 */ + atk: number = 2; /**攻击力 */ // atk_speed: number = 1; atk_cd: number = 2; /**攻击速度 攻击间隔 */ atk_time: number = 0; /** 冷却时间 */ diff --git a/assets/script/game/skills/Skill.ts b/assets/script/game/skills/Skill.ts index 5db666b3..7ddc0537 100644 --- a/assets/script/game/skills/Skill.ts +++ b/assets/script/game/skills/Skill.ts @@ -1,6 +1,7 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { BoxSet } from "../common/config/BoxSet"; +import { smc } from "../common/SingletonModuleComp"; import { SkillCom } from "./SkillCom"; import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite} from "cc"; @@ -33,8 +34,9 @@ export class Skill extends ecs.Entity { var node = instantiate(prefab); node.parent = parent; node.setScale(scale,1) + //转换pos为世界坐标 node.setPosition(pos) - + var sv = node.getComponent(SkillCom)!; sv.speed = speed; sv.range = range; diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index 8dc793c1..6e362436 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -2,6 +2,7 @@ import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact} 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 { BoxSet } from "../common/config/BoxSet"; +import { smc } from "../common/SingletonModuleComp"; const { ccclass, property } = _decorator; @@ -88,10 +89,16 @@ export class SkillCom extends CCComp { // } // } toDestroy() { + // this.node.active = false; + var scene = smc.map.MapView.scene; + this.node.parent = scene.entityLayer!.node!; + // console.log("toDestroy"); if (this.node.isValid) { + // console.log("this.node.isValid"); setTimeout(() => { + // console.log("SkillCom.node.destroy",this); this.ent.destroy() - }, 15); + }, 10); } }