master
humingxing 10 hours ago
parent 69ad42260c
commit d27b447511
  1. 70
      assets/bundles/first/config/Skill.json
  2. 2
      assets/bundles/first/config/Text.json
  3. 16
      assets/bundles/first/config/Weapon.json
  4. 96
      assets/script/ui/BattleGame/BattleGameOtherSkillView.ts
  5. 58
      assets/script/ui/PanelGemstone/UIPanelGemstone.ts

@ -169,7 +169,7 @@
"atk_type": "14",
"fly": "",
"atk_para": "2,0.4,6000",
"atk_buff1": "1,2000,1",
"atk_buff1": "1,1200,1",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -191,7 +191,7 @@
"atk_type": "14",
"fly": "",
"atk_para": "2,0.4,6000",
"atk_buff1": "1,2000,1",
"atk_buff1": "1,1200,1",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -213,9 +213,9 @@
"atk_type": "14",
"fly": "",
"atk_para": "2,0.4,6000",
"atk_buff1": "1,2000,1",
"atk_buff1": "1,1200,1",
"atk_buff2": "",
"skill": "10,30,12,0.075,200,3,10000",
"skill": "10,30,12,0.075,100,6,10000",
"condition": "",
"result": ""
},
@ -256,7 +256,7 @@
"range": 0,
"atk_type": "13",
"fly": "",
"atk_para": "2,0.5,8000",
"atk_para": "2,0.1,8000",
"atk_buff1": "",
"atk_buff2": "",
"skill": "",
@ -278,7 +278,7 @@
"range": 0,
"atk_type": "13",
"fly": "",
"atk_para": "3,0.3,8000",
"atk_para": "3,0.1,8000",
"atk_buff1": "",
"atk_buff2": "",
"skill": "",
@ -300,7 +300,7 @@
"range": 0,
"atk_type": "13",
"fly": "",
"atk_para": "4,0.2,8000",
"atk_para": "4,0.1,8000",
"atk_buff1": "",
"atk_buff2": "",
"skill": "",
@ -322,7 +322,7 @@
"range": 0,
"atk_type": "13",
"fly": "",
"atk_para": "5,0.16,8000",
"atk_para": "5,0.1,8000",
"atk_buff1": "",
"atk_buff2": "",
"skill": "",
@ -470,7 +470,7 @@
"level": 0,
"cd": 1,
"priority": 0,
"animation": "攻击1",
"animation": "攻击2",
"showeffect": "",
"target_stage": 1,
"range": 0,
@ -492,7 +492,7 @@
"level": 0,
"cd": 1,
"priority": 0,
"animation": "攻击1",
"animation": "攻击3",
"showeffect": "",
"target_stage": 1,
"range": 0,
@ -514,14 +514,14 @@
"level": 0,
"cd": 1,
"priority": 0,
"animation": "攻击1",
"animation": "攻击3",
"showeffect": "",
"target_stage": 1,
"range": 0,
"atk_type": "5",
"fly": "",
"atk_para": "40,0.22,3,7500",
"atk_buff1": "1,2000,1",
"atk_buff1": "1,1200,1",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -536,14 +536,14 @@
"level": 0,
"cd": 1,
"priority": 0,
"animation": "攻击1",
"animation": "攻击4+横扫",
"showeffect": "",
"target_stage": 1,
"range": 0,
"atk_type": "5",
"fly": "",
"atk_para": "40,0.2,3,7500",
"atk_buff1": "1,2000,1",
"atk_buff1": "1,1200,1",
"atk_buff2": "",
"skill": "11,0.2,10000,2,10000,50",
"condition": "",
@ -1555,7 +1555,7 @@
"atk_type": "19",
"fly": "",
"atk_para": "1,5000",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -1577,7 +1577,7 @@
"atk_type": "19",
"fly": "",
"atk_para": "2,5000",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -1621,7 +1621,7 @@
"atk_type": "",
"fly": "",
"atk_para": "",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "1,10000",
@ -1643,7 +1643,7 @@
"atk_type": "19",
"fly": "",
"atk_para": "3,5000",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -1687,7 +1687,7 @@
"atk_type": "",
"fly": "",
"atk_para": "",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "1,10000",
@ -1709,7 +1709,7 @@
"atk_type": "19",
"fly": "",
"atk_para": "4,5000",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -1753,7 +1753,7 @@
"atk_type": "",
"fly": "",
"atk_para": "",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "1,10000",
@ -1775,7 +1775,7 @@
"atk_type": "19",
"fly": "",
"atk_para": "5,10000",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "",
@ -1819,7 +1819,7 @@
"atk_type": "",
"fly": "",
"atk_para": "",
"atk_buff1": "13,3300,3",
"atk_buff1": "13,1000,1.5",
"atk_buff2": "",
"skill": "",
"condition": "1,10000",
@ -1876,7 +1876,7 @@
"icon": "",
"type": 2,
"level": 0,
"cd": 0,
"cd": 1.5,
"priority": 100,
"animation": "攻击",
"showeffect": "",
@ -1942,7 +1942,7 @@
"icon": "",
"type": 2,
"level": 0,
"cd": 0,
"cd": 1.5,
"priority": 100,
"animation": "攻击",
"showeffect": "",
@ -2008,7 +2008,7 @@
"icon": "",
"type": 2,
"level": 0,
"cd": 0,
"cd": 1.5,
"priority": 100,
"animation": "攻击",
"showeffect": "",
@ -2074,7 +2074,7 @@
"icon": "",
"type": 2,
"level": 0,
"cd": 0,
"cd": 1.5,
"priority": 100,
"animation": "攻击",
"showeffect": "",
@ -2114,7 +2114,7 @@
{
"id": 610101,
"name": "增幅",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加33%",
"icon": "",
"type": 2,
"level": 0,
@ -2136,7 +2136,7 @@
{
"id": 620101,
"name": "增幅",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加50%",
"icon": "",
"type": 2,
"level": 0,
@ -2180,7 +2180,7 @@
{
"id": 620301,
"name": "土刺",
"desc": "击杀怪物,额外发射2道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "",
"type": 2,
"level": 0,
@ -2202,7 +2202,7 @@
{
"id": 630101,
"name": "增幅",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加100%",
"icon": "",
"type": 2,
"level": 0,
@ -2246,7 +2246,7 @@
{
"id": 630301,
"name": "土刺",
"desc": "击杀怪物,额外发射3道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "",
"type": 2,
"level": 0,
@ -2268,7 +2268,7 @@
{
"id": 640101,
"name": "增幅",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加150%",
"icon": "",
"type": 2,
"level": 0,
@ -2334,7 +2334,7 @@
{
"id": 650101,
"name": "增幅",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加200%",
"icon": "",
"type": 2,
"level": 0,
@ -2378,7 +2378,7 @@
{
"id": 650301,
"name": "土刺",
"desc": "击杀怪物,额外发射8道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "",
"type": 2,
"level": 0,

@ -141,7 +141,7 @@
"id": 3002,
"type": 13,
"level": 0,
"weight": 5
"weight": 0
},
{
"id": 3003,

@ -1270,7 +1270,7 @@
{
"id": 6101,
"name": "增幅1级",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加33%",
"icon": "增幅1",
"skin": "",
"type": 6,
@ -1289,7 +1289,7 @@
{
"id": 6201,
"name": "增幅2级",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加50%",
"icon": "增幅2",
"skin": "",
"type": 6,
@ -1325,7 +1325,7 @@
{
"id": 6203,
"name": "土刺2级",
"desc": "击杀怪物,额外发射2道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "土刺2",
"skin": "",
"type": 6,
@ -1343,7 +1343,7 @@
{
"id": 6301,
"name": "增幅3级",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加100%",
"icon": "增幅3",
"skin": "",
"type": 6,
@ -1379,7 +1379,7 @@
{
"id": 6303,
"name": "土刺3级",
"desc": "击杀怪物,额外发射3道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "土刺3",
"skin": "",
"type": 6,
@ -1397,7 +1397,7 @@
{
"id": 6401,
"name": "增幅4级",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加150%",
"icon": "增幅4",
"skin": "",
"type": 6,
@ -1451,7 +1451,7 @@
{
"id": 6501,
"name": "增幅5级",
"desc": "攻击距离+1,伤害增加",
"desc": "攻击距离+1,伤害增加200%",
"icon": "增幅5",
"skin": "",
"type": 6,
@ -1483,7 +1483,7 @@
{
"id": 6503,
"name": "土刺5级",
"desc": "击杀怪物,额外发射8道土刺",
"desc": "击杀怪物,额外发射4道土刺",
"icon": "土刺5",
"skin": "",
"type": 6,

@ -1,4 +1,4 @@
import { Color, instantiate, Label, Layout, Node, Sprite } from 'cc';
import { Color, instantiate, Label, Layout, Node, Sprite, UITransform } from 'cc';
import { SpriteLoad } from 'db://assets/mx/components/SpriteLoad';
import { GBundle, GPath } from '../../game/ConfigRes';
import { BattleBuffCarryStore } from '../../manager/battleBuff/BattleBuffCarryStore';
@ -19,6 +19,12 @@ const PASSIVE_NAME_OUTLINE_HEX: Record<number, string> = {
3: '#623073',
4: '#734930',
};
/** 敌方被动:左右各最多展示数 */
const PASSIVE_PER_SIDE = 3;
/** 右侧被动列表节点名(运行时创建) */
const PASSIVE_RIGHT_NAME = 'ui_otherskill2ListR';
/** 左右列表贴向屏幕中线的间距(父节点本地像素) */
const PASSIVE_CENTER_GAP = 16;
/** 敌方被动格:仅展示,不触发玩家侧 CD 产字 */
class BattleGameOtherPassiveSlot {
@ -175,12 +181,14 @@ class BattleGameOtherPassiveSlot {
/**
* 战斗界面敌方 buff:ui_otherskill1List(主动)/ ui_otherskill2List(被动)。
* 被动左右最多各 3 个;右侧列表运行时镜像创建。
* 仅展示与同步 AI CD,不可拖拽。
*/
export class BattleGameOtherSkillView {
private readonly _active1: BattleGameDailyShopSkillSlot | null;
private readonly _active2: BattleGameDailyShopSkillSlot | null;
private readonly _passiveRoot: Node | null;
private _passiveRightRoot: Node | null = null;
private readonly _passiveTemplate: Node | null;
private readonly _passiveSlots: BattleGameOtherPassiveSlot[] = [];
private readonly _passiveNodes: Node[] = [];
@ -364,24 +372,95 @@ export class BattleGameOtherSkillView {
}
/**
* 重建被动列表。
* 重建被动列表:前 3 个左、后 3 个右;超出截断并 warn。
* @param passives 携带列表
*/
private _rebuildPassives(passives: DailyShopParsed[]): void {
this._clearPassives();
const root = this._passiveRoot;
const left = this._passiveRoot;
const template = this._passiveTemplate;
if (!root?.isValid || !template?.isValid) return;
for (let i = 0; i < passives.length; i++) {
if (!left?.isValid || !template?.isValid) return;
const maxTotal = PASSIVE_PER_SIDE * 2;
if (passives.length > maxTotal) {
console.warn('[BattleGame] 敌方被动超过左右各3,截断', passives.length, maxTotal);
}
const count = Math.min(passives.length, maxTotal);
const needRight = count > PASSIVE_PER_SIDE;
const right = needRight ? this._ensurePassiveRightRoot() : null;
if (this._passiveRightRoot?.isValid) {
this._passiveRightRoot.active = needRight;
}
for (let i = 0; i < count; i++) {
const parent = i < PASSIVE_PER_SIDE ? left : right;
if (!parent?.isValid) {
console.warn('[BattleGame] 敌方被动父节点无效', i);
continue;
}
const item = instantiate(template);
item.active = true;
item.setParent(root);
item.setParent(parent);
const slot = new BattleGameOtherPassiveSlot(item);
slot.bind(passives[i]);
this._passiveNodes.push(item);
this._passiveSlots.push(slot);
}
root.getComponent(Layout)?.updateLayout();
this._layoutPassiveSide(left, true);
if (right?.isValid) this._layoutPassiveSide(right, false);
left.getComponent(Layout)?.updateLayout();
right?.getComponent(Layout)?.updateLayout();
}
/**
* 左右都从左往右排,并贴向中线:左组右缘、右组左缘靠近中间。
* @param node 列表根
* @param isLeft 是否左侧
*/
private _layoutPassiveSide(node: Node, isLeft: boolean): void {
const ut = node.getComponent(UITransform);
if (ut) ut.setAnchorPoint(isLeft ? 1 : 0, ut.anchorPoint.y);
const layout = node.getComponent(Layout);
if (layout) layout.horizontalDirection = Layout.HorizontalDirection.LEFT_TO_RIGHT;
const p = node.position;
node.setPosition(isLeft ? -PASSIVE_CENTER_GAP : PASSIVE_CENTER_GAP, p.y, p.z);
}
/**
* 右侧被动列表:与左侧同高、同缩放,从左往右排。
*/
private _ensurePassiveRightRoot(): Node | null {
if (this._passiveRightRoot?.isValid) return this._passiveRightRoot;
const left = this._passiveRoot;
const parent = left?.parent;
if (!left?.isValid || !parent?.isValid) {
console.warn('[BattleGame] 无法创建敌方被动右侧列表');
return null;
}
let right = parent.getChildByName(PASSIVE_RIGHT_NAME);
if (!right?.isValid) {
right = new Node(PASSIVE_RIGHT_NAME);
right.parent = parent;
const lut = left.getComponent(UITransform);
const rut = right.addComponent(UITransform);
if (lut) {
rut.setContentSize(lut.contentSize);
rut.setAnchorPoint(0, lut.anchorPoint.y);
} else {
rut.setAnchorPoint(0, 0.5);
}
const ll = left.getComponent(Layout);
const rl = right.addComponent(Layout);
rl.type = Layout.Type.HORIZONTAL;
rl.resizeMode = ll?.resizeMode ?? Layout.ResizeMode.CONTAINER;
rl.spacingX = ll?.spacingX ?? 10;
rl.paddingLeft = ll?.paddingLeft ?? 0;
rl.paddingRight = ll?.paddingRight ?? 0;
rl.horizontalDirection = Layout.HorizontalDirection.LEFT_TO_RIGHT;
const ls = left.scale;
right.setScale(ls.x, ls.y, ls.z);
right.setPosition(PASSIVE_CENTER_GAP, left.position.y, left.position.z);
}
this._passiveRightRoot = right;
return right;
}
/** @param listRoot 被动列表根 */
@ -402,5 +481,8 @@ export class BattleGameOtherSkillView {
}
this._passiveNodes.length = 0;
this._passiveSlots.length = 0;
if (this._passiveRightRoot?.isValid) {
this._passiveRightRoot.active = false;
}
}
}

@ -33,6 +33,7 @@ const SOCKET_EFF_ANIM = '场景变换';
/**
* 宝石页:左右切五行镶嵌 + 页签仓库 + 拖拽镶嵌/卸下 + 一键合成。
* 页签 btn0~btn5 → type 1~6(通用/金/木/水/火/土),默认通用。
* 点金木水火土页签时,顶部镶嵌同步跳到对应五行。
*/
@ccclass('UIPanelGemstone')
export class UIPanelGemstone extends Auto_PanelGemstone {
@ -59,6 +60,8 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
private _bagToken = 0;
/** 已分帧填充下标 */
private _bagFillIndex = 0;
/** 卸下命中区(下方框体整块,非 Layout 的 ui_content) */
private _bagDropArea: Node | null = null;
private _pressing = false;
private _dragging = false;
@ -85,6 +88,11 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
this._bagTpl = this.ui_content?.getChildByName('bagItemTemplate') ?? null;
if (this._bagTpl) this._bagTpl.active = false;
this._skSkin = find('ui_center/top/sk_skin', this.node)?.getComponent(sp.Skeleton) ?? null;
const down = find('ui_center/down', this.node);
this._bagDropArea = down?.getChildByName('下方框体') ?? down ?? null;
if (!this._bagDropArea?.isValid) {
console.warn(LOG, '卸下区域节点缺失(下方框体/down)');
}
this._bindDrag(true);
}
@ -139,12 +147,19 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
void gg.ui.openPanel(UIID.PopGetGem, { data: gains });
}
/** 页签切换 */
/**
* 页签切换;金木水火土(type 2~6)同步顶部镶嵌五行。
* @param filterType Weapon.type 1~6
* @param btn 页签按钮
*/
private _onTag(filterType: number, btn: Node): void {
if (this._filterType === filterType) return;
this._filterType = filterType;
this._selectTag(btn);
this._rebuildBag();
if (filterType >= 2 && filterType <= 6) {
this._setElement(filterType - 1);
}
}
/** 标签底移到当前按钮 */
@ -153,6 +168,37 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
this.ui_tagBtnBg.setWorldPosition(btn.worldPosition);
}
/**
* 顶部五行 → 底部页签(element 1~5 → type 2~6)。
* 当前为「通用」时不跟切,保持仓库筛选。
* @param element 1~5
*/
private _syncFilterToElement(element: number): void {
if (this._filterType === DEFAULT_FILTER) return;
const filterType = Math.floor(Number(element) || 0) + 1;
if (filterType < 2 || filterType > 6) return;
if (this._filterType === filterType) return;
this._filterType = filterType;
this._selectTag(this._btnForFilter(filterType));
this._rebuildBag();
}
/**
* 页签 type → 按钮节点。
* @param filterType 1~6
*/
private _btnForFilter(filterType: number): Node | null {
switch (Math.floor(Number(filterType) || 0)) {
case 1: return this.btn0;
case 2: return this.btn1;
case 3: return this.btn2;
case 4: return this.btn3;
case 5: return this.btn4;
case 6: return this.btn5;
default: return null;
}
}
/** 全量刷新 */
private async _refresh(): Promise<void> {
await gg.gem.ensureTable();
@ -164,7 +210,7 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
}
/**
* 切换当前五行。
* 切换当前五行;左右切时底部页签跟到对应属性。
* @param element 1~5
*/
private _setElement(element: number): void {
@ -177,6 +223,7 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
this._currentElement = e;
this._applyElementVisual();
this._refreshSlots();
this._syncFilterToElement(e);
}
/** 标题图 + 数字皮肤 */
@ -644,9 +691,12 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
return null;
}
/** 是否落在仓库区(卸下) */
/**
* 是否落在仓库卸下区:用「下方框体」整块,避免 ui_content Layout 空列表缩成零高。
* @param loc UI 坐标
*/
private _hitBagArea(loc: Vec2): boolean {
const root = this.ui_content;
const root = this._bagDropArea?.isValid ? this._bagDropArea : this.ui_content;
if (!root?.isValid) return false;
this._hitPos.set(loc.x, loc.y);
const ut = root.getComponent(UITransform);

Loading…
Cancel
Save