diff --git a/assets/bundles/tetriCards/350.meta b/assets/bundles/tetriCards/350.meta deleted file mode 100644 index fd95cb9..0000000 --- a/assets/bundles/tetriCards/350.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "89ba5527-a4bc-4f98-ae19-3481f1826cde", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247.meta b/assets/bundles/tetriCards/350/247.meta deleted file mode 100644 index 42d9a50..0000000 --- a/assets/bundles/tetriCards/350/247.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "c59b5b7e-8124-41d7-99c5-0969b1add3f5", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222.meta b/assets/bundles/tetriCards/350/247/222.meta deleted file mode 100644 index 6788f03..0000000 --- a/assets/bundles/tetriCards/350/247/222.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "73b68213-4cf6-475e-8af6-968f2ba09ee6", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350.meta b/assets/bundles/tetriCards/350/247/222/350.meta deleted file mode 100644 index f530a3f..0000000 --- a/assets/bundles/tetriCards/350/247/222/350.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "37070032-98df-45ee-9d01-ba2ae312ceeb", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211.meta b/assets/bundles/tetriCards/350/247/222/350/211.meta deleted file mode 100644 index eee1809..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "32fdb07e-4eb0-4554-96d4-97f4d091d20d", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262.meta b/assets/bundles/tetriCards/350/247/222/350/211/262.meta deleted file mode 100644 index 1ed6ea5..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "36e9edf0-83e5-4fe2-9ceb-f560b5f29872", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262/350.meta b/assets/bundles/tetriCards/350/247/222/350/211/262/350.meta deleted file mode 100644 index ee35ee4..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262/350.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "6648ada5-6888-413e-8a1f-fbe9e656b61c", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247.meta b/assets/bundles/tetriCards/350/247/222/350/211/262/350/247.meta deleted file mode 100644 index f9ef21f..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "779b37b5-3343-4832-b159-ce92093e9c57", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222.meta b/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222.meta deleted file mode 100644 index 671d61c..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "8d5cc47d-eed7-45bb-9068-654989fe43b5", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350.meta b/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350.meta deleted file mode 100644 index 6b3f96d..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "9f9e53df-8358-4def-b1a6-9c5aee425e6b", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350/211.meta b/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350/211.meta deleted file mode 100644 index 6bc9391..0000000 --- a/assets/bundles/tetriCards/350/247/222/350/211/262/350/247/222/350/211.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "68aba59a-bced-47c3-8469-9af98a71aff5", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/prefab/Tetris_att_.meta b/assets/bundles/tetriCards/prefab/Tetris_att_.meta deleted file mode 100644 index 73c0960..0000000 --- a/assets/bundles/tetriCards/prefab/Tetris_att_.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "e37a83f0-fae9-4ddc-8aa9-bb2d501431eb", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/prefab/Tetris_att_/345.meta b/assets/bundles/tetriCards/prefab/Tetris_att_/345.meta deleted file mode 100644 index 950a46d..0000000 --- a/assets/bundles/tetriCards/prefab/Tetris_att_/345.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "8aeca904-16b7-49bd-b956-89452d06bbd3", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/prefab/Tetris_att_/345/207.meta b/assets/bundles/tetriCards/prefab/Tetris_att_/345/207.meta deleted file mode 100644 index 98704a6..0000000 --- a/assets/bundles/tetriCards/prefab/Tetris_att_/345/207.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "f6e568b9-a1e6-48af-9543-c53fbbc035c1", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/bundles/tetriCards/prefab/Tetris_att_凸_2.prefab b/assets/bundles/tetriCards/prefab/Tetris_att_凸_2.prefab index c333b95..f6227d9 100644 --- a/assets/bundles/tetriCards/prefab/Tetris_att_凸_2.prefab +++ b/assets/bundles/tetriCards/prefab/Tetris_att_凸_2.prefab @@ -198,7 +198,7 @@ "__expectedType__": "sp.SkeletonData" }, "defaultSkin": "default", - "defaultAnimation": "", + "defaultAnimation": "", "_premultipliedAlpha": true, "_timeScale": 1, "_preCacheMode": 0, diff --git a/assets/script/interface/AutoTable.ts b/assets/script/interface/AutoTable.ts index 8425db6..f39ee26 100644 --- a/assets/script/interface/AutoTable.ts +++ b/assets/script/interface/AutoTable.ts @@ -107,6 +107,7 @@ declare global { /** 奖励 */ readonly reward: string; } + /** * Box 配置数据 */ @@ -130,6 +131,7 @@ declare global { 道具id,数量 */ readonly fragment: string; } + /** * Shop 配置数据 */ @@ -153,6 +155,7 @@ declare global { /** 权重 */ readonly weight: number; } + /** * Const 配置数据 */ @@ -168,6 +171,7 @@ declare global { /** 组 */ readonly constString: string; } + /** * Monster 配置数据 */ @@ -269,6 +273,7 @@ declare global { /** 难度28 */ readonly attr28: number; } + /** * Skill 配置数据 */ @@ -470,6 +475,7 @@ declare global { */ readonly fall_effect: string; } + /** * NewYearSign 配置数据 */ @@ -483,6 +489,7 @@ declare global { /** 道具id,数量 */ readonly reward: string; } + /** * Weapon2 配置数据 */ @@ -628,6 +635,7 @@ declare global { /** 升级道具数 */ readonly item_num4: number; } + /** * Task 配置数据 */ @@ -661,6 +669,7 @@ declare global { 4、武器 */ readonly location: string; } + /** * TaskReward 配置数据 */ @@ -681,6 +690,7 @@ declare global { /** 数量 */ readonly quantity: number; } + /** * Chapter 配置数据 */ @@ -903,6 +913,7 @@ declare global { /** 出现权重 */ readonly weight: number; } + /** * Sign 配置数据 */ @@ -912,6 +923,7 @@ declare global { /** 类型,道具id,数量 */ readonly reward: string; } + /** * Role 配置数据 */ @@ -955,6 +967,7 @@ declare global { /** 金币消耗系数3 */ readonly coefficient_coin3: number; } + /** * Character 配置数据 */ @@ -976,6 +989,7 @@ declare global { /** 数量 */ readonly num: number; } + /** * lang_cn 配置数据 */ @@ -998,6 +1012,7 @@ declare global { /** 英文 */ readonly en: string; } + /** * Lottery 配置数据 */ @@ -1033,6 +1048,7 @@ declare global { /** 首次权重 */ readonly weight: string; } + /** * Item 配置数据 */ @@ -1093,6 +1109,7 @@ declare global { /** 字段说明 */ readonly reward: string; } + /** * LimitActivity 配置数据 */ @@ -1118,6 +1135,7 @@ declare global { /** 活动未开始的提示文字 */ readonly tips: string; } + /** * Obstacle 配置数据 */ @@ -1844,6 +1862,9 @@ declare global { + + + @@ -2050,7 +2071,6 @@ declare global { /** 解锁弹出描述 */ readonly popDesc: string; } - /** * Replica 配置数据 */ @@ -2105,6 +2125,7 @@ declare global { /** 排序 */ readonly sort: number; } + /** * Playmode 配置数据 */ @@ -2140,6 +2161,7 @@ declare global { /** 参数2 */ readonly par2: string; } + /** * TarTask 配置数据 */ @@ -2162,6 +2184,7 @@ declare global { /** 跳转 */ readonly jumpto: number; } + /** * Skin 配置数据 */ @@ -2207,7 +2230,6 @@ declare global { /** 升级属性 */ readonly upattr: string; } - /** * Pet 配置数据 */ @@ -2307,7 +2329,6 @@ declare global { /** 权重 */ readonly hight: number; } - /** * StoryComic 配置数据 */ @@ -2331,6 +2352,7 @@ declare global { /** 引导 */ readonly guide: number; } + /** * Guide 配置数据 */ @@ -2352,7 +2374,6 @@ declare global { /** 描述(部分引导需要展示的文字提示内容) */ readonly desc: string; } - /** * Skill_pool 配置数据 */ @@ -2426,7 +2447,6 @@ declare global { /** 181-240 */ readonly refresh_game_time4: string; } - /** * Const_weight 配置数据 */ @@ -2440,6 +2460,7 @@ declare global { /** 组 */ readonly constString: string; } + /** * chapter_reward 配置数据 */ @@ -2450,7 +2471,6 @@ declare global { 道具id,数量 */ readonly reward: string; } - /** * zombie 配置数据 */ @@ -2482,6 +2502,7 @@ declare global { /** 升级奖励 */ readonly levelRewardNum: string; } + /** * Gift 配置数据 */ @@ -2491,7 +2512,6 @@ declare global { /** 类型,道具id,数量 */ readonly reward: string; } - /** * BattleCube 配置数据 */ @@ -2540,7 +2560,6 @@ declare global { /** 权重 */ readonly typeweight4: string; } - /** * ReplicaLevel 配置数据 */ @@ -2593,6 +2612,9 @@ declare global { + + + diff --git a/assets/script/tetriCard/roleHand.ts b/assets/script/tetriCard/roleHand.ts index 6a8a927..80bb1e2 100644 --- a/assets/script/tetriCard/roleHand.ts +++ b/assets/script/tetriCard/roleHand.ts @@ -65,7 +65,6 @@ export function applyRoleHand(hostNode: Node | null, handName?: string): void { hideRoleAnim(hostNode); const handNode = hostNode.getChildByName('hand'); if (!handNode?.isValid) { - console.warn('[roleHand] 方块缺少 hand 子节点'); return; } diff --git a/assets/script/tetriCard/tetriWeaponCarrier.ts b/assets/script/tetriCard/tetriWeaponCarrier.ts index 3ac6f13..6bc8dab 100644 --- a/assets/script/tetriCard/tetriWeaponCarrier.ts +++ b/assets/script/tetriCard/tetriWeaponCarrier.ts @@ -1,5 +1,4 @@ import { _decorator, Component, find, isValid, Layers, Node, sp, UITransform, v3, Vec3 } from 'cc'; -import { SpriteLoad } from '../../mx/components/SpriteLoad'; import { GBundle, GPath } from '../game/ConfigRes'; import { shootPoint } from './shootPoint'; import { GEvent } from '../../mx/module/event/GEvent'; @@ -8,7 +7,8 @@ import { IWeaponProperty, SpecialSkillType } from '../ui/BattleGame/BattleDataMa import { Skill } from '../ui/BattleGame/WeaponSkill/Skill'; import { LaserLine } from '../ui/BattleGame/WeaponSkill/LaserLine'; import { tetriNode } from './tetriNode'; -import { role } from './role'; +import { applyRoleHand } from './roleHand'; +import MTools from '../../mx/tools/MTools'; import { WeaponType } from '../manager/WeaponDataManager'; import { BattleType } from '../manager/ChapterDataManager'; import { UILayer } from '../../mx/module/ui/UIManager'; @@ -28,30 +28,26 @@ export class tetriWeaponCarrier extends Component { private static readonly ATK_ANIM_LEAD_SEC = 0.4; private static readonly ATK_ANIM_LEAD_SEC2 = 0.1; + /** 方块 prefab 名 → 武器/hand 缩放与 hand 贴图(与原「角色」节点 scale 一致) */ roleConfig = [ - { id: 1, name: "Tetris_att_I", mainPosi: { x: -0.308, y: -10.809 }, animSkin: '小紫', scalex: -0.25, scaley: 0.25 }, - { id: 2, name: "Tetris_att_1_1", mainPosi: { x: -1.484, y: -12.331 }, animSkin: '小紫', scalex: -0.25, scaley: 0.25 }, - { id: 3, name: "Tetris_att_J1", mainPosi: { x: -28.877, y: -25.077 }, animSkin: '小蓝', scalex: -0.25, scaley: 0.25 }, - { id: 4, name: "Tetris_att_J2", mainPosi: { x: -13.884, y: 23.864 }, animSkin: '小蓝', scalex: -0.25, scaley: 0.25 }, - { id: 5, name: "Tetris_att_J3", mainPosi: { x: 33.67, y: 5.42 }, animSkin: '小蓝', scalex: -0.25, scaley: 0.25 }, - { id: 6, name: "Tetris_att_J", mainPosi: { x: 16.683, y: -43.542 }, animSkin: '小蓝', scalex: -0.25, scaley: 0.25 }, - - { id: 7, name: "Tetris_att_L1", mainPosi: { x: -29.799, y: 4.73 }, animSkin: '小橙', scalex: -0.25, scaley: 0.25 }, - { id: 8, name: "Tetris_att_L2", mainPosi: { x: 15.513, y: 21.501 }, animSkin: '小橙', scalex: -0.25, scaley: 0.25 }, - { id: 9, name: "Tetris_att_L3", mainPosi: { x: 33.276, y: -29.162 }, animSkin: '小橙', scalex: -0.25, scaley: 0.25 }, - { id: 10, name: "Tetris_att_L", mainPosi: { x: -14.952, y: -44.351 }, animSkin: '小橙', scalex: -0.25, scaley: 0.25 }, - - { id: 11, name: "Tetris_att_Z1_1", mainPosi: { x: 2.397, y: -12.412 }, animSkin: '小憨', scalex: -0.25, scaley: 0.25 }, - { id: 12, name: "Tetris_att_Z1", mainPosi: { x: -0.035, y: -9.153 }, animSkin: '小憨', scalex: -0.2, scaley: 0.2 }, - - { id: 13, name: "Tetris_att_Z2_1", mainPosi: { x: 16.189, y: -10.274 }, animSkin: '小红', scalex: -0.25, scaley: 0.25 }, - { id: 14, name: "Tetris_att_Z2", mainPosi: { x: -0.057, y: -12.142 }, animSkin: '小红', scalex: -0.25, scaley: 0.25 }, - - { id: 15, name: "Tetris_att_凸_1", mainPosi: { x: -14.41, y: -10.235 }, animSkin: '小贱', scalex: -0.25, scaley: 0.25 }, - { id: 16, name: "Tetris_att_凸_2", mainPosi: { x: 0.131, y: 1.91 }, animSkin: '小贱', scalex: -0.25, scaley: 0.25 }, - { id: 17, name: "Tetris_att_凸_3", mainPosi: { x: 15.166, y: -13.766 }, animSkin: '小贱', scalex: -0.25, scaley: 0.25 }, - { id: 18, name: "Tetris_att_凸", mainPosi: { x: -0.001, y: -25.291 }, animSkin: '小贱', scalex: -0.25, scaley: 0.25 }, - + { id: 1, name: "Tetris_att_I", mainPosi: { x: 0, y: 0 }, handName: '3格横手', scalex: -0.25, scaley: 0.25 }, + { id: 2, name: "Tetris_att_1_1", mainPosi: { x: 0, y: 0 }, handName: '3格横手', scalex: -0.25, scaley: 0.25 }, + { id: 3, name: "Tetris_att_J1", mainPosi: { x: -12.214, y: -17.434 }, handName: '左L手', scalex: -0.25, scaley: 0.25 }, + { id: 4, name: "Tetris_att_J2", mainPosi: { x: -18.862, y: 10.235 }, handName: '左L手', scalex: -0.25, scaley: 0.25 }, + { id: 5, name: "Tetris_att_J3", mainPosi: { x: 11.196, y: 18.98 }, handName: '左L手', scalex: -0.25, scaley: 0.25 }, + { id: 6, name: "Tetris_att_J", mainPosi: { x: 18.079, y: -8.477 }, handName: '左L手', scalex: -0.25, scaley: 0.25 }, + { id: 7, name: "Tetris_att_L1", mainPosi: { x: -19, y: 15 }, handName: '右L手', scalex: -0.25, scaley: 0.25 }, + { id: 8, name: "Tetris_att_L2", mainPosi: { x: 17, y: 18 }, handName: '右L手', scalex: -0.25, scaley: 0.25 }, + { id: 9, name: "Tetris_att_L3", mainPosi: { x: 19, y: -15 }, handName: '右L手', scalex: -0.25, scaley: 0.25 }, + { id: 10, name: "Tetris_att_L", mainPosi: { x: -25, y: -22 }, handName: '右L手', scalex: -0.25, scaley: 0.25 }, + { id: 11, name: "Tetris_att_Z1_1", mainPosi: { x: 4.018, y: -2.712 }, handName: '右z手', scalex: -0.25, scaley: 0.25 }, + { id: 12, name: "Tetris_att_Z1", mainPosi: { x: -6.197, y: -4.563 }, handName: '右z手', scalex: -0.2, scaley: 0.2 }, + { id: 13, name: "Tetris_att_Z2_1", mainPosi: { x: 2.81, y: 1.751 }, handName: '左z手', scalex: -0.25, scaley: 0.25 }, + { id: 14, name: "Tetris_att_Z2", mainPosi: { x: 4.65, y: -1.475 }, handName: '左z手', scalex: -0.25, scaley: 0.25 }, + { id: 15, name: "Tetris_att_凸_1", mainPosi: { x: 20.727, y: 0 }, handName: 'T手', scalex: -0.25, scaley: 0.25 }, + { id: 16, name: "Tetris_att_凸_2", mainPosi: { x: 0, y: -19.624 }, handName: 'T手', scalex: -0.25, scaley: 0.25 }, + { id: 17, name: "Tetris_att_凸_3", mainPosi: { x: -16.394, y: 0 }, handName: 'T手', scalex: -0.25, scaley: 0.25 }, + { id: 18, name: "Tetris_att_凸", mainPosi: { x: 0, y: 17.555 }, handName: 'T手', scalex: -0.25, scaley: 0.25 }, ] @@ -61,10 +57,9 @@ export class tetriWeaponCarrier extends Component { timeoutIndex: number = 0 animState: string; - /**初始角色朝向*/ + /** 武器挂点初始朝向(scale.x 符号) */ initRoleFacing: number = 0; initRoleFacingFix: number = 0; - private roleNode: Node | null = null; private roleBaseAbsScaleX: number = 1; _isBattleScene = false //是否是战斗场景相机 _isCanShoot = true //是否可以射击 @@ -106,10 +101,7 @@ export class tetriWeaponCarrier extends Component { const block = this.findCarrierTetriNode()?.node ?? this.node; gg.game?.CurentBattle?.pruneDetachedBattleLayers?.(block); const weapon = this.weaponNode; - const role = this.roleNode; this.weaponNode = null; - this.roleNode = null; - // 武器挂在「角色/武器」下,先回收武器再回收角色,避免子随父一起进半销毁态 if (this.timeoutIndex) clearTimeout(this.timeoutIndex as unknown as number); GEvent.Ins.off(GEvent.ChangeCubeWeaponConfig, this.ChangeCubeWeapon, this) GEvent.Ins.off(GEvent.StraightWeaponShoot, this.StraightWeaponShoot, this) @@ -123,7 +115,6 @@ export class tetriWeaponCarrier extends Component { GEvent.Ins.off(GEvent.StraightTargetDamage, this.StraightTargetDamage, this) GEvent.Ins.off(GEvent.LightningElectricity, this.LightningElectricity, this) this.safePutPoolNode(weapon); - this.safePutPoolNode(role); } @@ -142,140 +133,104 @@ export class tetriWeaponCarrier extends Component { GEvent.Ins.on(GEvent.StraightTargetDamage, this.StraightTargetDamage, this)//直线目标持续伤害 GEvent.Ins.on(GEvent.LightningElectricity, this.LightningElectricity, this)//雷电电击攻击单体 - if(gg.game.CurentBattle.BattleType == BattleType.OrangeWeaponMode_Ya){ - //已经有角色了直接修改皮肤 - this.scheduleOnce(() => { - //this.addWeapon() - this.createRoleNode2() - }, 0.02) - }else{ - this.scheduleOnce(() => { - this.createRoleNode() - }, 0.02) - } - - + this.scheduleOnce(() => this.initCarrier(), 0.02); + } + /** 方块 prefab 上的武器挂点 */ + private getWeaponMountNode(): Node | null { + return find('武器', this.node); } - createRoleNode2(){ - if (!this._config) { - console.error('[tetriWeaponCarrier] createRoleNode: _config 为空,请保证 setConfig 在 start 之前已调用'); - return; + /** 武器预制体 Spine(动画在子节点 spine 上) */ + private getWeaponSkeleton(weaponNode: Node | null): sp.Skeleton | null { + if (!weaponNode?.isValid) return null; + const spineNode = weaponNode.getChildByName('spine'); + if (spineNode?.isValid) { + return spineNode.getComponent(sp.Skeleton); } + return weaponNode.getComponent(sp.Skeleton); + } - this.roleNode = this.node - const conf = this.roleConfig.find(item => item.name == this._config.cubename); - // console.log('conf',conf); - if (conf) { - // this.roleNode.setPosition(conf.mainPosi.x, conf.mainPosi.y); - this.roleNode.setScale(conf.scalex, conf.scaley); - const anim = this.roleNode.getChildByName('anim')?.getComponent(sp.Skeleton); - if (anim) { - anim.setAnimation(0, '待机', true); - anim.setSkin(conf.animSkin); - } else { - console.warn('[tetriWeaponCarrier] createRoleNode: 角色 prefab 缺少 anim 子节点', this._config.cubename); - } - } - - this.scheduleOnce(() => { - if (!isValid(this.node)) return; - this.setView(); - }, 0.1); - - this.initRoleFacing = this.roleNode.scale.x; - this.initRoleFacingFix = this.roleNode.scale.x; - const abs = Math.abs(this.initRoleFacingFix); - this.roleBaseAbsScaleX = abs > 1e-6 ? abs : 1; + private playWeaponAnim(weaponNode: Node | null, animName: string, loop: boolean): void { + this.getWeaponSkeleton(weaponNode)?.setAnimation(0, animName, loop); } - createRoleNode() { - // 先挂角色节点,再 setView -> addWeapon(依赖子路径 角色/anim、角色/武器) - if (!this._config) { - console.error('[tetriWeaponCarrier] createRoleNode: _config 为空,请保证 setConfig 在 start 之前已调用'); - return; - } - // instantiate(整块) / 参考方块拷贝会带上已有「角色」;若再从池里取会叠两个 + + /** 清理旧版动态挂上的「角色」子节点 */ + private removeLegacyRoleNodes(): void { const dupDestroy: Node[] = []; - let existingRole: Node | null = null; for (let i = 0; i < this.node.children.length; i++) { const c = this.node.children[i]; - if (c.name === '角色') { - if (!existingRole) existingRole = c; - else dupDestroy.push(c); - } + if (c?.name === '角色') dupDestroy.push(c); } for (const d of dupDestroy) { if (d?.isValid) d.destroy(); } + } - let roleNode: Node | null = existingRole?.isValid ? existingRole : null; - if (!roleNode) { - void gg.res.getNodeAsync('角色/', '角色', GBundle.tetriCards).then((loaded) => { - if (!loaded?.isValid || !this.node?.isValid) return; - this._setupRoleNode(loaded); - }); - return; + /** 按 roleConfig 设置武器挂点 / hand 的缩放与朝向基准(等同原角色节点 setScale) */ + private applyBlockWeaponVisual(conf: { scalex: number; scaley: number }): void { + const mount = this.getWeaponMountNode(); + if (mount?.isValid) { + mount.setScale(conf.scalex, conf.scaley); } - this._setupRoleNode(roleNode); + const hand = this.node.getChildByName('hand'); + if (hand?.isValid) { + hand.setScale(conf.scalex, conf.scaley); + } + this.initRoleFacing = conf.scalex; + this.initRoleFacingFix = conf.scalex; + const abs = Math.abs(conf.scalex); + this.roleBaseAbsScaleX = abs > 1e-6 ? abs : 1; } - private _setupRoleNode(roleNode: Node) { - roleNode.setParent(this.node); - this.roleNode = roleNode; - roleNode.active = true; - - const roleComp = roleNode.getComponent(role); - roleComp?.setFollowTarget(this.findCarrierTetriNode()?.node ?? this.node); + /** 初始化方块载体:hand 贴图 + 武器(挂方块「武器」节点,local 0,0) */ + private initCarrier(): void { + if (!this._config) { + console.error('[tetriWeaponCarrier] initCarrier: _config 为空,请保证 setConfig 在 start 之前已调用'); + return; + } + this.removeLegacyRoleNodes(); - const conf = this.roleConfig.find(item => item.name == this._config.cubename); - // console.log('conf',conf); + const conf = this.roleConfig.find(item => item.name === this._config.cubename); if (conf) { - roleNode.setPosition(conf.mainPosi.x, conf.mainPosi.y); - roleNode.setScale(conf.scalex, conf.scaley); - const anim = roleNode.getChildByName('anim')?.getComponent(sp.Skeleton); - if (anim) { - anim.setAnimation(0, '待机', true); - anim.setSkin(conf.animSkin); - } else { - console.warn('[tetriWeaponCarrier] createRoleNode: 角色 prefab 缺少 anim 子节点', this._config.cubename); + if (conf.handName) { + applyRoleHand(this.node, conf.handName); } + this.applyBlockWeaponVisual(conf); } - - if (this._isBattleScene) { - console.log('我是在战斗场景相机下创建角色', this.node.layer) - this.setLayerMask(roleNode, this.node.layer) - } this.scheduleOnce(() => { if (!isValid(this.node)) return; + const conf2 = this.roleConfig.find(item => item.name === this._config?.cubename); + if (conf2) { + if (conf2.handName) applyRoleHand(this.node, conf2.handName); + this.applyBlockWeaponVisual(conf2); + } this.setView(); }, 0.1); - - this.initRoleFacing = this.roleNode.scale.x; - this.initRoleFacingFix = this.roleNode.scale.x; - const abs = Math.abs(this.initRoleFacingFix); - this.roleBaseAbsScaleX = abs > 1e-6 ? abs : 1; } - - /**将“角色”翻转到面向目标 x(只改 scale.x,不改大小) */ + /** 翻转武器挂点 / hand 面向目标 x(只改 scale.x) */ private faceRoleToWorldX(targetWorldX: number) { - if (!this.roleNode || !isValid(this.roleNode)) return; - // 用载体方块作为参考坐标,更稳定(避免“角色”子节点有额外偏移) + const mount = this.getWeaponMountNode(); + if (!mount?.isValid) return; const selfX = this.node.worldPosition.x; const dx = targetWorldX - selfX; if (Math.abs(dx) < 0.01) return; - // 你给的基准:初始一定是“脸朝右”,但 scale.x 可能正/负 - // 所以把初始符号视为“朝右符号”,朝左时取反即可 const rightSign = this.initRoleFacingFix >= 0 ? 1 : -1; const dir = dx >= 0 ? rightSign : -rightSign; - const s = this.roleNode.scale; const newX = this.roleBaseAbsScaleX * dir; - if (Math.abs(s.x - newX) > 1e-6) { - this.roleNode.setScale(newX, s.y, s.z); - } + + const applyFlip = (n: Node) => { + const s = n.scale; + if (Math.abs(s.x - newX) > 1e-6) { + n.setScale(newX, s.y, s.z); + } + }; + applyFlip(mount); + const hand = this.node.getChildByName('hand'); + if (hand?.isValid) applyFlip(hand); } private faceRoleToMonster(monsterNode: Node | null) { @@ -334,13 +289,13 @@ export class tetriWeaponCarrier extends Component { * @param isUpLevel true 技能升级,false 武器替换 */ showSkillSelectCompleteEffect(isUpLevel = true, delay = 0) { - const host = this.roleNode?.isValid ? this.roleNode : this.node; + const host = this.node; if (!host?.isValid) return; this.scheduleOnce(() => { if (!host?.isValid) return; void gg.res.getNodeAsync(GPath.Prefab, '三选一完成格子效果', GBundle.tetriGame).then((eff) => { - if (!eff?.isValid) return; + if (!eff?.isValid) return; const battle = gg.game?.CurentBattle; const ya = battle?.BattleType === BattleType.OrangeWeaponMode_Ya; @@ -393,25 +348,31 @@ export class tetriWeaponCarrier extends Component { this.addWeapon(weaponani) } - //增加武器和修改icon图片 + // 武器挂到方块 prefab 的「武器」节点(local 0,0,偏移在 prefab 挂点配置) addWeapon(weaponani) { - const anim = find('anim', this.roleNode); - const wuqiNode = find('武器', this.roleNode); - if (!anim || !wuqiNode) { - console.error('[tetriWeaponCarrier] addWeapon: 未找到 角色/anim 或 角色/武器', this._config?.cubename); + const wuqiNode = this.getWeaponMountNode(); + if (!wuqiNode) { + console.error('[tetriWeaponCarrier] addWeapon: 未找到方块/武器', this._config?.cubename); return; } void gg.res.getNodeAsync('prefab/', weaponani, GBundle.tetriWeapon).then((weaponNode) => { - if (!weaponNode?.isValid || !wuqiNode?.isValid) return; + if (!weaponNode?.isValid || !wuqiNode?.isValid) { + if (!weaponNode) { + console.error('[tetriWeaponCarrier] addWeapon: 武器预制未取到', weaponani, this._config?.cubename); + } + return; + } this.setLayerMask(weaponNode, wuqiNode.layer); this.weaponNode = weaponNode; weaponNode.setParent(wuqiNode); - anim.getComponent(sp.Skeleton)?.setAnimation(0, '待机', true); - weaponNode.getComponent(sp.Skeleton)?.setAnimation(0, '待机', true); + weaponNode.setPosition(0, 0, 0); + + this.playWeaponAnim(weaponNode, '待机', true); }); } setLayerMask(n: Node, layerMask: number) { + if (n.name === 'hand') return; n.layer = layerMask; for (let i = 0; i < n.children.length; i++) { if (n.children[i].isValid) { @@ -428,23 +389,13 @@ export class tetriWeaponCarrier extends Component { //播放攻击动画 playAtkAnim() { clearTimeout(this.timeoutIndex as unknown as number); - if (!this.roleNode?.isValid) { + const weaponSk = this.getWeaponSkeleton(this.weaponNode); + if (!weaponSk) { return; } - const animNode = find('anim', this.roleNode); - const animSk = animNode?.getComponent(sp.Skeleton); - const weaponSk = this.weaponNode?.getComponent(sp.Skeleton); - if (animSk) { - animSk.setAnimation(0, '攻击', false); - } - if (weaponSk) { - weaponSk.setAnimation(0, '攻击', false); - } + weaponSk.setAnimation(0, '攻击', false); this.timeoutIndex = setTimeout(() => { - if (animSk?.isValid) { - animSk.setAnimation(0, '待机', true); - } if (weaponSk?.isValid) { weaponSk.setAnimation(0, '待机', true); } @@ -456,14 +407,13 @@ export class tetriWeaponCarrier extends Component { //获取武器的发射节点和原点 getWeaponLaunchNode(): Node { - if (!this.roleNode?.isValid) { - return this.node; - } - const wuqiNode = find('武器', this.roleNode); + const wuqiNode = this.getWeaponMountNode(); if (!wuqiNode?.isValid) { - return this.roleNode; + return this.node; } - const shoot = wuqiNode.getComponentInChildren(shootPoint)?.node; + const shoot = + this.weaponNode?.getComponentInChildren(shootPoint)?.node + ?? wuqiNode.getComponentInChildren(shootPoint)?.node; if (shoot?.isValid) { return shoot; } @@ -557,8 +507,9 @@ export class tetriWeaponCarrier extends Component { this.scheduleWeaponFire(t1, () => { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - // 音效节流交给 SoundManager.shouldPlayWeaponSfx(按音效名);勿共用 audio_timeStamp - this.playEffectStraight(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp")) { + this.playEffectStraight(weaponId); + } for (let j = 0; j < launchCount; j++) { let addPos = v3(j * posX - (launchCount - 1) * posX / 2, 0, 0) void battle.SkillController.instantiateSingleWeapon(weaponId, volume, addPos, 0, launchNodeSnap).then((weaponNode) => { @@ -615,7 +566,9 @@ export class tetriWeaponCarrier extends Component { this.scheduleWeaponFire(t1, () => { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - this.playEffectStraightLaunch(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp2")) { + this.playEffectStraightLaunch(weaponId); + } for (let j = 0; j < launchCount; j++) { let addPos = v3(j * posX - (launchCount - 1) * posX / 2, 0, 0) void battle.SkillController.instantiateSingleWeapon(weaponId, volume, addPos, 0, launchNodeSnap).then((weaponNode) => { @@ -670,7 +623,9 @@ export class tetriWeaponCarrier extends Component { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - this.playEffectStraightNum(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp3")) { + this.playEffectStraightNum(weaponId); + } for (let j = 0; j < launchCount; j++) { //多个子弹并排开 @@ -727,7 +682,9 @@ export class tetriWeaponCarrier extends Component { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - this.playEffectStraight(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp3")) { + this.playEffectStraight(weaponId); + } for (let j = 0; j < launchCount; j++) { //多个子弹并排开 @@ -784,7 +741,9 @@ export class tetriWeaponCarrier extends Component { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - this.playEffectStraight(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp3")) { + this.playEffectStraight(weaponId); + } for (let j = 0; j < launchCount; j++) { //多个子弹并排开 @@ -854,7 +813,9 @@ export class tetriWeaponCarrier extends Component { let singleLaunchCall = () => { //单次发射数量 - this.playEffectParabolaCollide(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp4")) { + this.playEffectParabolaCollide(weaponId); + } let selectMonster = []; selectMonster = gg.game.CurentBattle.MonsterSpawner.getMonsterNearestCountPar(this.node, throwCount); if (selectMonster.length == 0) { @@ -890,8 +851,8 @@ export class tetriWeaponCarrier extends Component { if (isBurst) { for (let j = 0; j < burstCount; j++) { this.scheduleWeaponFire(lead + xTime * j, () => { - singleLaunchCall(); - }); + singleLaunchCall() + }) } //单发 } else { @@ -972,7 +933,9 @@ export class tetriWeaponCarrier extends Component { let singleLaunchCall = () => { //单次发射数量 - this.playEffectParabolaNoCollide(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp5")) { + this.playEffectParabolaNoCollide(weaponId); + } let selectMonster = []; selectMonster = gg.game.CurentBattle.MonsterSpawner.getMonsterParabolaPos(throwCount, this.node); if (selectMonster.length == 0) { @@ -1011,8 +974,8 @@ export class tetriWeaponCarrier extends Component { if (isBurst) { for (let j = 0; j < burstCount; j++) { this.scheduleWeaponFire(lead + xTime * j, () => { - singleLaunchCall(); - }); + singleLaunchCall() + }) } //单发 } else { @@ -1074,6 +1037,10 @@ export class tetriWeaponCarrier extends Component { carrier.playAtkAnim(); const lead = tetriWeaponCarrier.ATK_ANIM_LEAD_SEC2 / battle.TimeScale; this.scheduleWeaponFire(lead, () => { + const b = gg.game.CurentBattle; + if (b?.IsWarnTimeActive && b?.IsGamePause) { + return; + } for (let i = 0; i < burstCount; i++) { for (let j = 0; j < launchCount; j++) { const laserIndex = i * launchCount + j; @@ -1131,8 +1098,9 @@ export class tetriWeaponCarrier extends Component { this.scheduleWeaponFire(t1, () => { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - // 音效节流交给 SoundManager.shouldPlayWeaponSfx(按音效名);勿共用 audio_timeStamp - this.playEffectStraight(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp")) { + this.playEffectStraight(weaponId); + } for (let j = 0; j < launchCount; j++) { let addPos = v3(j * posX - (launchCount - 1) * posX / 2, 0, 0) void battle.SkillController.instantiateSingleWeapon(weaponId, volume, addPos, 0, launchNodeSnap).then((weaponNode) => { @@ -1192,7 +1160,9 @@ export class tetriWeaponCarrier extends Component { // 面向最近怪物(角色不移动也需要左右转向) this.faceRoleToMonster(battle.MonsterSpawner?.getAllPathDisMinMonster?.(carrierNode)); - this.playEffectStraightNum(weaponId); + if (!MTools.beforeTimes(100, "audio_timeStamp3")) { + this.playEffectStraightNum(weaponId); + } for (let j = 0; j < launchCount; j++) { //多个子弹并排开 diff --git a/settings/v2/packages/builder.json b/settings/v2/packages/builder.json index 04de9ba..891cecb 100644 --- a/settings/v2/packages/builder.json +++ b/settings/v2/packages/builder.json @@ -252,7 +252,7 @@ }, "splash-setting": { "logo": { - "image": "project://settings/ICON.png", + "image": "project://settings/icon.jpg", "type": "custom" }, "background": {