master
humingxing 18 hours ago
parent 863ad28afe
commit 2301a0a9e8
  1. 54
      assets/bundles/first/config/Hero.json
  2. 40
      assets/script/ui/BattleGame/BattleFirstGuidePresenter.ts
  3. 22
      assets/script/ui/BattleGame/UIBattleGame.ts

@ -249,13 +249,8 @@
"res": "金4096",
"number": 4096,
"level": 13,
<<<<<<< HEAD
"atk": 4096,
"atk_range": 140,
=======
"atk": 243,
"atk_range": 130,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -274,13 +269,8 @@
"res": "金8192",
"number": 8192,
"level": 14,
<<<<<<< HEAD
"atk": 9182,
"atk_range": 140,
=======
"atk": 365,
"atk_range": 130,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -539,13 +529,8 @@
"res": "木4096",
"number": 4096,
"level": 13,
<<<<<<< HEAD
"atk": 4096,
"atk_range": 220,
=======
"atk": 243,
"atk_range": 180,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -564,13 +549,8 @@
"res": "木8192",
"number": 8192,
"level": 14,
<<<<<<< HEAD
"atk": 9182,
"atk_range": 220,
=======
"atk": 365,
"atk_range": 180,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -829,13 +809,8 @@
"res": "水4096",
"number": 4096,
"level": 13,
<<<<<<< HEAD
"atk": 4096,
"atk_range": 260,
=======
"atk": 243,
"atk_range": 250,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -854,13 +829,8 @@
"res": "水8192",
"number": 8192,
"level": 14,
<<<<<<< HEAD
"atk": 9182,
"atk_range": 260,
=======
"atk": 365,
"atk_range": 250,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"size": 1,
"critical_chance": 1000,
"critical_dam": 20000,
@ -1113,21 +1083,13 @@
"id": 413,
"name": "火4096",
"type": 2,
<<<<<<< HEAD
"herotype": 1,
=======
"herotype": 4,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"quality": 0,
"icon": "",
"res": "火4096",
"number": 4096,
"level": 13,
<<<<<<< HEAD
"atk": 4096,
=======
"atk": 243,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"atk_range": 300,
"size": 1,
"critical_chance": 1000,
@ -1141,21 +1103,13 @@
"id": 414,
"name": "火9182",
"type": 2,
<<<<<<< HEAD
"herotype": 1,
=======
"herotype": 4,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"quality": 0,
"icon": "",
"res": "火8192",
"number": 8192,
"level": 14,
<<<<<<< HEAD
"atk": 9182,
=======
"atk": 365,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"atk_range": 300,
"size": 1,
"critical_chance": 1000,
@ -1415,11 +1369,7 @@
"res": "土4096",
"number": 4096,
"level": 13,
<<<<<<< HEAD
"atk": 4096,
=======
"atk": 243,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"atk_range": 180,
"size": 1,
"critical_chance": 1000,
@ -1439,11 +1389,7 @@
"res": "土8192",
"number": 8192,
"level": 14,
<<<<<<< HEAD
"atk": 9182,
=======
"atk": 365,
>>>>>>> 90840f9f6b32939b29ddecaa3ba02bd7cdf3e5c5
"atk_range": 180,
"size": 1,
"critical_chance": 1000,

@ -1,4 +1,4 @@
import { Node, sp } from 'cc';
import { Node, UITransform, Vec3, sp } from 'cc';
import { MergeEventType, type MergeEvent } from 'db://assets/mx/module/merge';
import type { BattleBagSession } from '../../battle/bag/BattleBagSession';
import { BattleSpinePlayback } from '../../battle/presentation/BattleSpinePlayback';
@ -17,6 +17,7 @@ const FINGER_NODE = '引导手指';
/**
* 新玩家首次进战弱引导:点召唤 → 拖字上阵。
* 手指对齐召唤按钮世界坐标,避免预制体旧坐标偏移。
*/
export class BattleFirstGuidePresenter {
/** 引导根 */
@ -29,17 +30,22 @@ export class BattleFirstGuidePresenter {
private _finger: Node | null = null;
/** 手指 Spine */
private _fingerSk: sp.Skeleton | null = null;
/** 召唤按钮(对齐目标) */
private _summonBtn: Node | null = null;
/** 本机背包 */
private _bag: BattleBagSession | null = null;
/** 当前步:0 未开 / 2 点召唤 / 3 拖字 */
private _step = 0;
/** 复用世界坐标,避免每帧 new */
private readonly _alignWorld = new Vec3();
/**
* 绑定并按存档决定是否展示第一步。
* @param root ui_guide
* @param bag 本机背包会话
* @param summonBtn 召唤按钮(btnRefresh)
*/
bind(root: Node | null, bag: BattleBagSession | null): void {
bind(root: Node | null, bag: BattleBagSession | null, summonBtn?: Node | null): void {
this.unbind();
if (!root?.isValid) {
console.error('[BattleFirstGuide] ui_guide 缺失');
@ -60,13 +66,23 @@ export class BattleFirstGuidePresenter {
console.error('[BattleFirstGuide] bagSession 未就绪');
return;
}
if (!summonBtn?.isValid) {
console.warn('[BattleFirstGuide] 召唤按钮缺失,手指可能错位');
}
this._root = root;
this._bag = bag;
this._summonBtn = summonBtn?.isValid ? summonBtn : null;
this._bag.on(MergeEventType.TilePlaced, this._onPlayerDrag);
this._bag.on(MergeEventType.TileMoved, this._onPlayerDrag);
this._showSummon();
}
/** Widget 布局后再对齐一次(由界面 scheduleOnce 调用) */
realignFinger(): void {
if (this._step !== 2) return;
this._alignFingerToSummon();
}
/** 召唤刷新成功:藏手指,切到拖字提示 */
onSummonOk(): void {
if (this._step !== 2) return;
@ -89,6 +105,7 @@ export class BattleFirstGuidePresenter {
this._stepDrag = null;
this._finger = null;
this._fingerSk = null;
this._summonBtn = null;
this._bag = null;
this._step = 0;
}
@ -102,9 +119,28 @@ export class BattleFirstGuidePresenter {
if (this._stepSummon) this._stepSummon.active = true;
if (this._stepDrag) this._stepDrag.active = false;
if (this._finger) this._finger.active = true;
this._alignFingerToSummon();
this._playFinger();
}
/** 将手指对齐到召唤按钮中心(不拦截点击,否则会挡住召唤) */
private _alignFingerToSummon(): void {
const finger = this._finger;
const btn = this._summonBtn;
if (!finger?.isValid || !btn?.isValid) return;
btn.getWorldPosition(this._alignWorld);
const put = finger.parent?.getComponent(UITransform);
if (!put) {
finger.setWorldPosition(this._alignWorld);
} else {
const local = put.convertToNodeSpaceAR(this._alignWorld);
finger.setPosition(local.x, local.y, 0);
}
// Spine 仍绘制;命中盒清零,触摸落到下方 btnRefresh
const fut = finger.getComponent(UITransform);
if (fut) fut.setContentSize(0, 0);
}
/** 第二步:只留拖字文案 */
private _showDrag(): void {
this._step = 3;

@ -73,10 +73,8 @@ const FIRST_PLACE_COMBAT_TIMEOUT_SEC = 10;
/** 看视频加金币期间暂停 token */
const COIN_AD_PAUSE_TOKEN = 'ad:battleCoin';
/** 砚台 Spine:资源里名字取反,出字过程播「待机」 */
/** 砚台 Spine:出字过程/待机均播「待机」(资源内「出字」为空动画) */
const INKSTONE_SPINE_SPAWN = '待机';
/** 砚台 Spine:资源里名字取反,出完播「出字」待机 */
const INKSTONE_SPINE_IDLE = '出字';
@ccclass('UIBattleGame')
export class UIBattleGame extends Auto_BattleGame {
@ -176,9 +174,9 @@ export class UIBattleGame extends Auto_BattleGame {
this._playInkstoneSpine(INKSTONE_SPINE_SPAWN, true);
};
/** 出字结束:播资源名「出字」,再结算倍增卡 */
/** 出字结束:回待机(资源「出字」为空动画,勿强播),再结算倍增卡 */
private readonly _onInkstoneEntranceEnd = (): void => {
this._playInkstoneSpine(INKSTONE_SPINE_IDLE, true);
this._playInkstoneSpine(INKSTONE_SPINE_SPAWN, true);
this._flushPendingDigitDouble();
};
@ -426,12 +424,19 @@ export class UIBattleGame extends Auto_BattleGame {
this._bindBattleBuffSelect(battle);
this._campHpBar.bind(battle, map);
getBattleGameMonsterCrisisHintPresenter().bind(battle, map);
this._firstGuide.bind(this.ui_guide, battle.bagSession);
this._firstGuide.bind(this.ui_guide, battle.bagSession, this.btnRefresh);
// Widget 布局完成后再对齐一次,避免手指仍停在预制体旧坐标
this.scheduleOnce(this._realignFirstGuideFinger, 0);
PerfSampler.beginBattle();
this._listenFirstPlaceCombat();
this._refreshWaveUi();
}
/** 引导手指对齐召唤按钮 */
private readonly _realignFirstGuideFinger = (): void => {
this._firstGuide.realignFinger();
};
/**
* 开局不立刻出怪:本机首次放数字开怪,或超时后强制开怪。
*/
@ -739,7 +744,7 @@ export class UIBattleGame extends Auto_BattleGame {
return;
}
this._inkstoneSkel = skel;
this._playInkstoneSpine(INKSTONE_SPINE_IDLE, true);
this._playInkstoneSpine(INKSTONE_SPINE_SPAWN, true);
}
/** 释放砚台 Spine 播放回调 */
@ -758,7 +763,7 @@ export class UIBattleGame extends Auto_BattleGame {
private _playInkstoneSpine(animName: string, loop: boolean): void {
const skel = this._inkstoneSkel;
if (!skel?.isValid) return;
BattleSpinePlayback.play(skel, animName, { loop });
BattleSpinePlayback.play(skel, animName, { loop, optional: true });
}
/** 绑定 AI 主动施放飞图标表现 */
@ -1322,6 +1327,7 @@ export class UIBattleGame extends Auto_BattleGame {
this._otherSkillView = null;
this._otherOwnedDesc = null;
this._unbindFirstPlaceCombat();
this.unschedule(this._realignFirstGuideFinger);
this._firstGuide.unbind();
this._bagView?.unbind();
this._bagView = null;

Loading…
Cancel
Save