修复boss副本bug

main
chenanghui 1 week ago
parent f227e8ec38
commit 3939284a0f
  1. 10
      assets/script/game/BattleResLoader.ts
  2. 24
      assets/script/game/GM.ts
  3. 16
      assets/script/sdk/config/DefaultConfig.ts
  4. 2
      assets/script/sdk/sdkConfig.ts
  5. 2
      assets/script/ui/BattleGame/BattleCore.ts
  6. 40
      assets/script/ui/BattleGame/Boss.ts
  7. 39
      assets/script/ui/BattleGame/BossSkill.ts
  8. 35
      assets/script/ui/BattleGame/MapGrid.ts
  9. 17
      assets/script/ui/BattleGame/MapManager.ts
  10. 17
      assets/script/ui/BattleGame/PlayerController.ts
  11. 55
      assets/script/ui/pageShop/UIpageShop.ts
  12. 17
      assets/script/ui/pageUserLevelup/UIpageUserLevelup.ts
  13. 1
      bin/tt_bknsb1.0.1.bin

@ -190,6 +190,16 @@ export class BattleResLoader {
}
}
/** Boss 副本投掷物 / 爆炸特效(同步 getNode 前需已 ensure) */
static async preloadBossSkillAssets(): Promise<void> {
if (!gg?.res) return;
await this.loadBundle(GBundle.BattleGameWeapon);
await Promise.all([
gg.res.ensurePrefab('bossWeapon1', 'prefab/武器/', GBundle.BattleGameWeapon),
gg.res.ensurePrefab('砖块爆炸', 'prefab/爆炸/', GBundle.BattleGameWeapon),
]);
}
/** hitEffect: `spine名|爆炸预制体名` → 取预制体名 */
private static _parseHitEffectPrefabName(hitEffect: string | null | undefined): string {
if (!hitEffect || typeof hitEffect !== 'string') return '';

@ -31,12 +31,30 @@ export class GM extends Component {
return;
}
if (this.ShowGM) {
let res = gg.res.getNode(GPath.UIPrefab, "gm", GBundle.First);
gg.ui.showNode(res, UILayer.DeBug);
GM.Instance = res.getComponent(GM);
void this._showAsync();
}
}
private static async _showAsync(): Promise<void> {
if (GM.Instance && isValid(GM.Instance.node)) {
GM.Instance.node.active = this.ShowGM;
return;
}
const res = await gg.res.getNodeAsync(GPath.UIPrefab, 'gm', GBundle.First);
if (!res?.isValid) {
console.warn('[GM] gm prefab 加载失败');
return;
}
if (GM.Instance && isValid(GM.Instance.node)) {
gg.res.putNode(res);
GM.Instance.node.active = this.ShowGM;
return;
}
gg.ui.showNode(res, UILayer.DeBug);
GM.Instance = res.getComponent(GM);
if (GM.Instance) GM.Instance.node.active = this.ShowGM;
}
@property(EditBox)
eb_prama: EditBox;

@ -6,8 +6,8 @@ import { IConfigData } from "./IConfigData";
*/
export const DefaultConfig: IConfigData = {
id: "",
name: "tt_zdtnl",
vsion: "2.1.22",
name: "tt_bknsb",
vsion: "1.0.1",
chanId: "tt",
themeId: "1",
useDoc: true,
@ -17,15 +17,15 @@ export const DefaultConfig: IConfigData = {
showAddToDesk: true,
showSidebar: true,
platformConf: {
gameName: "真的太难了",
appid: "tt371c41a1a829bf5e02",
gameName: "不可能失败",
appid: "tt760800b5e93e72d802",
shareData: [
//示例
{ id: 1, type: 1, wx: "", tt: "", res: "", desc: "真的太难了" },
{ id: 1, type: 1, wx: "", tt: "", res: "", desc: "不可能失败" },
// { id: 2, type: 1, wx: "", tt: "j5gfj8d1gc04g6tj3n", res: "share/share_1.jpg", desc: "他拿塔皮勾引我,我没去,因为我知道塔皮不能叠Q!" },
],
video: ["nnpo9j06l6e2didojr", 'l6n00l295n7c5aa30b', '47fi6ghc27474hiq4g'],
interstitialAd: ["2feid96ncq3j031rp9"],
video: ["2qhoewej2abhf2h82b", '24g326clnf7ikgdd12', 'g54696jc6b882d6rf4'],
interstitialAd: ["4grmk6vnub81tc37ej"],
banner: [``],
contentIDs: ["CONTENT13670864130"],
notice: "<color=#90592D>版本更新内容到语言表进行修改。 修改的key是----版本更新内容<br/></color>",
@ -48,6 +48,6 @@ export const DefaultConfig: IConfigData = {
pointData: {
gameName: "",
accessToken: "gw0MRpBbernhPztqHlulUYjLnwyAdvOm",
gid: "tt_zdtnl",
gid: "tt_bknsb",
}
}

@ -12,7 +12,7 @@ export class sdkConfig {
/**配置是否开发调试模式 */
static readonly isDev = false;
/**当前配置文件,不同项目分支设置好对应项目配置文件 */
static readonly config: IConfigData = XiaoXiaoFangkuaiZhen;
static readonly config: IConfigData = DefaultConfig;
//-------------------------------------------------------------------------
/**s是否开启小游戏*/

@ -32,6 +32,7 @@ import { jiujiuwoMap } from '../../jiujiuwoMap/jiujiuwoMap';
import { JIUJIUWOYA_INIT_WEAPON_ID, tetriWeaponCarrier } from '../../tetriCard/tetriWeaponCarrier';
import { role } from '../../tetriCard/role';
import { LuosiDing } from '../jiujiuwoyaGame/LuosiDing';
import { BattleResLoader } from '../../game/BattleResLoader';
const { ccclass, property } = _decorator;
@ -756,6 +757,7 @@ export class BattleCore {
if (this.BattleType == BattleType.BossMode) {
this.waveGetCoin = gg.data.table.getSkillCostData(SkillCostType.skillCostType_1213)?.constValue;
void BattleResLoader.preloadBossSkillAssets();
}
//如果是副本模式,并且需要随机章节地图的话,随机一个章节地图id

@ -26,17 +26,21 @@ export class Boss extends Component {
setMonster(monster: Monster) {
this.monster = monster;
this.playWaitAnim();
// 预热 Boss 投掷物,避免 useskillwave 触发时 getNode 同步未命中返回 null
void gg.res.ensurePrefab('bossWeapon1', 'prefab/武器/', GBundle.BattleGameWeapon);
void gg.res.ensurePrefab('砖块爆炸', 'prefab/爆炸/', GBundle.BattleGameWeapon);
}
/**战斗警告时间开始 */
onBattleWarnTimeStart() {
this.scheduleOnce(() => {
if (!this.monster?.Data?.useskillwave) return;
let wNum = gg.game.CurentBattle.CurentWaveNum;
if (this.monster.Data.useskillwave.includes(wNum)) {
this.playAttackAnim(() => {
this.playWaitAnim();
});
this.atk();
void this.atk();
}
}, 4.8);
}
@ -48,19 +52,44 @@ export class Boss extends Component {
});
}
atk() {
async atk() {
const battle = gg.game?.CurentBattle;
if (!battle) return;
const parent =
battle.SkillController?.node?.isValid
? battle.SkillController.node
: battle.TetraMap?._gameRoot?.isValid
? battle.TetraMap._gameRoot
: null;
if (!parent) {
console.warn('[Boss.atk] SkillController / GameRoot 均不可用,跳过投掷');
return;
}
let startPos = this.startPosNode ? this.startPosNode.worldPosition : this.node.worldPosition;
let targetPos = this.getHighestBlockWorldPos();
let n = gg.res.getNode("prefab/武器/", "bossWeapon1", GBundle.BattleGameWeapon);
n.setParent(gg.game.CurentBattle.SkillController.node, true);
let n = await gg.res.getNodeAsync('prefab/武器/', 'bossWeapon1', GBundle.BattleGameWeapon);
if (!n?.isValid) {
console.warn('[Boss.atk] bossWeapon1 加载失败');
return;
}
n.setParent(parent, true);
n.worldPosition = startPos;
let comp = n.getComponent(BossSkill);
if (!comp) {
console.warn('[Boss.atk] bossWeapon1 缺少 BossSkill');
gg.res.putNode(n);
return;
}
comp.setData(this.monster, targetPos);
}
/**获取当前堆叠的方块中最高的那个方块的世界坐标 */
getHighestBlockWorldPos() {
let nodes = gg.game.CurentBattle.TetraMap._tetrisTable.children;
let nodes = gg.game.CurentBattle?.TetraMap?._tetrisTable?.children;
if (!nodes?.length) {
return this.startPosNode ? this.startPosNode.worldPosition.clone() : this.node.worldPosition.clone();
}
let highestBlock = nodes.reduce((max, node) => {
return node.worldPosition.y > max.worldPosition.y ? node : max;
}, nodes[0]);
@ -106,4 +135,3 @@ export class Boss extends Component {
}
}

@ -519,21 +519,42 @@ export class BossSkill extends Component {
}
if (!BattlePerformance.rollShowCombatVfx(0.55)) {
this.scheduleOnce(() => {
gg.res.putNode(this.node);
if (this.node?.isValid) gg.res.putNode(this.node);
}, 0.1);
return;
}
let n = gg.res.getNode("prefab/爆炸/", "砖块爆炸", GBundle.BattleGameWeapon);
n.setParent(this.node.parent, true);
n.worldPosition = this.node.worldPosition;
const vfxMul = BattlePerformance.vfxScaleMul();
n.setScale(vfxMul, vfxMul, vfxMul);
void this._spawnExplosionVfx();
}
private async _spawnExplosionVfx(): Promise<void> {
if (!this.node?.isValid) return;
const parent = this.node.parent?.isValid
? this.node.parent
: (gg.game?.CurentBattle?.TetraMap?._gameRoot ?? null);
const wp = this.node.worldPosition.clone();
this.scheduleOnce(() => {
gg.res.putNode(this.node);
if (this.node?.isValid) gg.res.putNode(this.node);
}, 0.1);
n.getComponent(sp.Skeleton).setAnimation(0, "爆炸", false);
n.getComponent(sp.Skeleton).setCompleteListener(() => {
let n = await gg.res.getNodeAsync('prefab/爆炸/', '砖块爆炸', GBundle.BattleGameWeapon);
if (!n?.isValid) return;
if (parent?.isValid) {
n.setParent(parent, true);
} else {
gg.res.putNode(n);
return;
}
n.worldPosition = wp;
const vfxMul = BattlePerformance.vfxScaleMul();
n.setScale(vfxMul, vfxMul, vfxMul);
const sk = n.getComponent(sp.Skeleton);
if (!sk) {
gg.res.putNode(n);
return;
}
sk.setAnimation(0, '爆炸', false);
sk.setCompleteListener(() => {
if (n?.isValid) gg.res.putNode(n);
});
}

@ -58,12 +58,37 @@ export class MapGrid extends Component {
/**显示铲子 */
showRemoveIcon(isShow: boolean) {
if (this.removeIcon == null) {
this.removeIcon = gg.res.getNode(GPath.ObstaclePrefab(""), "removeIcon", GBundle.BattleMap);
this.node.addChild(this.removeIcon);
if (this.removeIcon?.isValid) {
this.removeIcon.active = isShow;
this.removeIcon.setSiblingIndex(-1);
return;
}
this.removeIcon.active = isShow;
this.removeIcon.setSiblingIndex(-1);
if (!isShow) return;
void this._loadRemoveIcon(true);
}
private async _loadRemoveIcon(isShow: boolean): Promise<void> {
if (!this.node?.isValid) return;
if (this.removeIcon?.isValid) {
this.removeIcon.active = isShow;
this.removeIcon.setSiblingIndex(-1);
return;
}
const n = await gg.res.getNodeAsync(GPath.ObstaclePrefab(''), 'removeIcon', GBundle.BattleMap);
if (!n?.isValid || !this.node?.isValid) {
console.warn('[MapGrid] removeIcon 加载失败');
return;
}
if (this.removeIcon?.isValid) {
gg.res.putNode(n);
this.removeIcon.active = isShow;
this.removeIcon.setSiblingIndex(-1);
return;
}
this.removeIcon = n;
this.node.addChild(n);
n.active = isShow;
n.setSiblingIndex(-1);
}
}

@ -293,11 +293,24 @@ export class MapManager extends Component {
/**创建推荐点 */
createRecommendPoints(grid: MapGrid) {
let point = gg.res.getNode(GPath.ObstaclePrefab(""), "guidePos", GBundle.BattleMap);
void this._createRecommendPointsAsync(grid);
}
private async _createRecommendPointsAsync(grid: MapGrid): Promise<void> {
if (!grid?.node?.isValid || !this.guidePosParent?.isValid) return;
const point = await gg.res.getNodeAsync(GPath.ObstaclePrefab(''), 'guidePos', GBundle.BattleMap);
if (!point?.isValid || !this.guidePosParent?.isValid || !grid?.node?.isValid) {
console.warn('[MapManager] guidePos 加载失败');
return;
}
this.guidePosParent.addChild(point);
point.worldPosition = grid.node.worldPosition;
point.active = true;
let posGuide = point.getComponent(MapPosGuide);
const posGuide = point.getComponent(MapPosGuide);
if (!posGuide) {
gg.res.putNode(point);
return;
}
posGuide.grid = grid;
posGuide.updateShow();
}

@ -64,10 +64,7 @@ export class PlayerController extends Component {
GEvent.Ins.off(GEvent.ShowLevelSpine, this.showLevelSpine, this);
}
onLoad() {
let n = gg.res.getNode(`skin/${gg.skin.CurrentSkin}/`, `主角`, GBundle.Items);
this.playerNode.find("skin").addChild(n);
this.playerSpine = n.getComponent(sp.Skeleton);
void this._loadPlayerSkin();
// 缓存“角色”节点及初始朝向(只做左右翻转,不改大小)
this.roleVisual = this.playerNode.getChildByName('角色') || this.node.getChildByName('角色') || null;
@ -79,7 +76,19 @@ export class PlayerController extends Component {
// 初始化玩家位置到屏幕左侧
this.setInitialPosition();
}
private async _loadPlayerSkin(): Promise<void> {
const skin = this.playerNode?.find('skin');
if (!skin?.isValid) return;
const n = await gg.res.getNodeAsync(`skin/${gg.skin.CurrentSkin}/`, '主角', GBundle.Items);
if (!n?.isValid || !skin?.isValid) {
console.warn('[PlayerController] 主角皮肤加载失败');
return;
}
skin.addChild(n);
this.playerSpine = n.getComponent(sp.Skeleton);
this.playWait();
}
protected start(): void {

@ -237,22 +237,55 @@ export class UIpageShop extends Auto_pageShop {
/**显示章节礼包 */
showChapterBox() {
let chapterGiftNode = find("chapterGift", this.ui_content);
if (!chapterGiftNode) {
chapterGiftNode = gg.res.getNode(GPath.UIPrefab, "chapterGift", GBundle.ChapterGiftBg)
this.ui_content.addChild(chapterGiftNode);
chapterGiftNode.setSiblingIndex(1);
void this._showChapterBoxAsync();
}
private async _showChapterBoxAsync(): Promise<void> {
if (!this.ui_content?.isValid) return;
let chapterGiftNode = find('chapterGift', this.ui_content);
if (!chapterGiftNode?.isValid) {
chapterGiftNode = await gg.res.getNodeAsync(GPath.UIPrefab, 'chapterGift', GBundle.ChapterGiftBg);
if (!chapterGiftNode?.isValid || !this.ui_content?.isValid) {
console.warn('[UIpageShop] chapterGift 加载失败');
return;
}
// 异步期间可能已挂上同名节点,避免重复
const existed = find('chapterGift', this.ui_content);
if (existed?.isValid) {
gg.res.putNode(chapterGiftNode);
chapterGiftNode = existed;
} else {
this.ui_content.addChild(chapterGiftNode);
chapterGiftNode.setSiblingIndex(1);
}
}
chapterGiftNode.active = true;
}
showDiamondShop() {
let diamondShopNode = find("diamondShop", this.ui_content);
if (!diamondShopNode) {
diamondShopNode = gg.res.getNode(GPath.UIPrefab, "diamondShop", GBundle.DiamondShop)
this.ui_content.addChild(diamondShopNode);
let index = find("BoxNodes", this.ui_content).getSiblingIndex();
diamondShopNode.setSiblingIndex(index + 1);
void this._showDiamondShopAsync();
}
private async _showDiamondShopAsync(): Promise<void> {
if (!this.ui_content?.isValid) return;
let diamondShopNode = find('diamondShop', this.ui_content);
if (!diamondShopNode?.isValid) {
diamondShopNode = await gg.res.getNodeAsync(GPath.UIPrefab, 'diamondShop', GBundle.DiamondShop);
if (!diamondShopNode?.isValid || !this.ui_content?.isValid) {
console.warn('[UIpageShop] diamondShop 加载失败');
return;
}
const existed = find('diamondShop', this.ui_content);
if (existed?.isValid) {
gg.res.putNode(diamondShopNode);
diamondShopNode = existed;
} else {
this.ui_content.addChild(diamondShopNode);
const boxNodes = find('BoxNodes', this.ui_content);
if (boxNodes) {
diamondShopNode.setSiblingIndex(boxNodes.getSiblingIndex() + 1);
}
}
}
diamondShopNode.active = true;
}

@ -620,15 +620,24 @@ export class UIpageUserLevelup extends Auto_pageUserLevelup {
}
updateSkin() {
void this._updateSkinAsync();
}
private async _updateSkinAsync(): Promise<void> {
if (!this.ui_skin?.isValid) return;
this.ui_skin.destroyAllChildren();
let n = gg.res.getNode(`skin/${gg.skin.CurrentSkin}/`, "角色页待机", GBundle.Items);
const n = await gg.res.getNodeAsync(`skin/${gg.skin.CurrentSkin}/`, '角色页待机', GBundle.Items);
if (!n?.isValid || !this.ui_skin?.isValid) {
console.warn('[UIpageUserLevelup] 角色页待机加载失败');
return;
}
this.ui_skin.addChild(n);
n.y = 500;
n.getComponent(Sorting2D).enabled = false
const sorting = n.getComponent(Sorting2D);
if (sorting) sorting.enabled = false;
tween(n)
.to(0.2, { y: 0 }, { easing: easing.backOut })
.start()
.start();
this.refreshBtnNode(this.shengjikuangBtnAtt, addType.Att);
GEvent.Ins.emit(GEvent.UpdateCombatPower);

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save