feat(map): 新增英雄图鉴相关组件与配置
1. 新增CardLiteComp卡牌组件、HerosListComp英雄列表组件 2. 新增cardlite预制体及其元配置 3. 重构HlistComp移除旧的英雄图标节点与切换按钮逻辑
This commit is contained in:
3810
assets/resources/gui/element/cardlite.prefab
Normal file
3810
assets/resources/gui/element/cardlite.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/resources/gui/element/cardlite.prefab.meta
Normal file
13
assets/resources/gui/element/cardlite.prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "b8313fa7-28e5-4d92-9d64-a1e0ecb040a8",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "cardlite"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
77
assets/script/game/map/CardLiteComp.ts
Normal file
77
assets/script/game/map/CardLiteComp.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
|
||||
*/
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources, Light, UITransform, Widget } 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 { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind, CardPoolList } from "../common/config/CardSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { getLvColor } from "../common/config/GameSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* CardLiteComp —— 单张卡牌简单视图组件
|
||||
*
|
||||
|
||||
*/
|
||||
@ccclass('CardLiteComp')
|
||||
@ecs.register('CardLiteComp', false)
|
||||
export class CardLiteComp extends CCComp {
|
||||
/** 是否开启调试日志 */
|
||||
private debugMode: boolean = true;
|
||||
|
||||
// ======================== 编辑器绑定节点 ========================
|
||||
|
||||
/** 锁定态图标节点(显示时表示本槽位锁定) */
|
||||
|
||||
@property(Node)
|
||||
name_node=null!
|
||||
/** 卡牌图标节点(英雄动画 / 技能图标) */
|
||||
@property(Node)
|
||||
icon_node=null!
|
||||
/** 费用显示节点 */
|
||||
@property(Node)
|
||||
cost_node=null!
|
||||
/** 卡牌种类标识节点(如近战 / 远程 / 辅助等分类子节点的容器) */
|
||||
@property(Node)
|
||||
Ckind_node=null!
|
||||
/** 卡牌背景底框节点(按卡池等级切换子节点显示) */
|
||||
@property(Node)
|
||||
BG_node=null!
|
||||
|
||||
@property(Node)
|
||||
pool_lv_node=null! //英雄对应的卡池等级
|
||||
|
||||
@property(Label)
|
||||
lvl_node: Label = null! //英雄本身的等级
|
||||
|
||||
// ======================== 运行时状态 ========================
|
||||
|
||||
/** 当前卡牌的金币费用 */
|
||||
card_cost:number=0
|
||||
/** 当前卡牌类型(英雄 / 技能 / 特殊升级 / 特殊刷新) */
|
||||
card_type:CardType=CardType.Hero
|
||||
/** 当前卡牌的唯一标识 UUID */
|
||||
card_uuid:number=0
|
||||
|
||||
private cardData: CardConfig | null = null;
|
||||
|
||||
|
||||
/** ECS 组件移除时的释放钩子:销毁节点 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/CardLiteComp.ts.meta
Normal file
9
assets/script/game/map/CardLiteComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "85f84dcf-c7c0-4d19-9ce5-94267b958c0e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
84
assets/script/game/map/HerosListComp.ts
Normal file
84
assets/script/game/map/HerosListComp.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @file HerosListComp.ts
|
||||
* @description 英雄图鉴弹出页面(UI 视图层)
|
||||
*
|
||||
*/
|
||||
import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources, tween, Vec3, Widget, Prefab } 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 { HeroInfo, HeroList } from "../common/config/heroSet";
|
||||
import { IType, SkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
|
||||
const {property, ccclass } = _decorator;
|
||||
|
||||
/**
|
||||
* HerosListComp —— 英雄图鉴轮播视图组件
|
||||
*
|
||||
* 在任务主页展示所有可用英雄,玩家可点击切换当前选中英雄的名称、AP、HP、CD、技能信息
|
||||
*/
|
||||
@ccclass('HerosListComp')
|
||||
@ecs.register('HerosListComp', false)
|
||||
export class HerosListComp extends CCComp {
|
||||
// ======================== 编辑器绑定节点 ========================
|
||||
|
||||
/** 当前英雄 idle 图标节点 */
|
||||
@property(Node)
|
||||
hero_icon=null!
|
||||
|
||||
/** 攻击力标签节点 */
|
||||
@property(Node)
|
||||
ap_node=null!
|
||||
/** 生命值标签节点 */
|
||||
@property(Node)
|
||||
hp_node=null!
|
||||
/** 冷却时间标签节点 */
|
||||
@property(Node)
|
||||
cd_node=null!
|
||||
/** 技能信息容器节点(包含 Line1~Line5 子节点) */
|
||||
@property(Node)
|
||||
info_node=null!
|
||||
/** 英雄名称标签节点 */
|
||||
@property(Node)
|
||||
name_node=null!
|
||||
|
||||
/** 英雄图鉴卡容器节点 */
|
||||
@property(Node)
|
||||
cards_node=null!
|
||||
|
||||
/** 英雄图鉴卡预制体 */
|
||||
@property(Prefab)
|
||||
card_lite_prefab=null!
|
||||
|
||||
|
||||
// ======================== 运行时状态 ========================
|
||||
|
||||
/** 当前选中英雄在 HeroList 中的索引 */
|
||||
huuid:number=null!
|
||||
/** 当前选中英雄在 HeroList 数组中的下标 */
|
||||
/** 调试日志开关 */
|
||||
debugMode: boolean = false;
|
||||
|
||||
onLoad() {
|
||||
|
||||
}
|
||||
/** 预留:弹窗打开时接收参数 */
|
||||
onAdded(args: any) {
|
||||
|
||||
}
|
||||
/** 关闭英雄图鉴弹窗 */
|
||||
closeHeros(){
|
||||
oops.gui.remove(UIID.Heros)
|
||||
}
|
||||
start() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** ECS 组件移除时销毁节点 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/HerosListComp.ts.meta
Normal file
9
assets/script/game/map/HerosListComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8079ebae-a254-472d-a91d-f61c3d0bf031",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -44,18 +44,7 @@ export class HListComp extends CCComp {
|
||||
/** 中间位英雄 idle 图标节点 */
|
||||
@property(Node)
|
||||
hero_icon=null!
|
||||
/** 左侧第 1 位英雄图标 */
|
||||
@property(Node)
|
||||
phero_icon=null!
|
||||
/** 右侧第 1 位英雄图标 */
|
||||
@property(Node)
|
||||
nhero_icon=null!
|
||||
/** 左侧第 2 位英雄图标(最远) */
|
||||
@property(Node)
|
||||
phero1_icon=null!
|
||||
/** 右侧第 2 位英雄图标(最远) */
|
||||
@property(Node)
|
||||
nhero1_icon=null!
|
||||
|
||||
/** 攻击力标签节点 */
|
||||
@property(Node)
|
||||
ap_node=null!
|
||||
@@ -69,11 +58,7 @@ export class HListComp extends CCComp {
|
||||
@property(Node)
|
||||
name_node=null!
|
||||
/** 向左切换按钮 */
|
||||
@property(Node)
|
||||
pre_btn=null!
|
||||
/** 向右切换按钮 */
|
||||
@property(Node)
|
||||
next_btn=null!
|
||||
|
||||
@property(Node)
|
||||
lv_node=null!
|
||||
|
||||
@@ -95,9 +80,7 @@ export class HListComp extends CCComp {
|
||||
debugMode: boolean = false;
|
||||
|
||||
onLoad() {
|
||||
// 绑定左右切换按钮事件
|
||||
this.pre_btn?.on(NodeEventType.TOUCH_END, this.onPreClick, this);
|
||||
this.next_btn?.on(NodeEventType.TOUCH_END, this.onNextClick, this);
|
||||
|
||||
}
|
||||
/** 预留:弹窗打开时接收参数 */
|
||||
onAdded(args: any) {
|
||||
@@ -108,11 +91,7 @@ export class HListComp extends CCComp {
|
||||
oops.gui.remove(UIID.Heros)
|
||||
}
|
||||
start() {
|
||||
// 初始化轮播节点数组和固定位置
|
||||
if (this.phero1_icon && this.phero_icon && this.hero_icon && this.nhero_icon && this.nhero1_icon) {
|
||||
this.carouselNodes = [this.phero1_icon, this.phero_icon, this.hero_icon, this.nhero_icon, this.nhero1_icon];
|
||||
this.fixedPositions = this.carouselNodes.map(n => n.position.clone());
|
||||
}
|
||||
|
||||
|
||||
// 设置初始选中并加载所有位置的英雄动画
|
||||
if (HeroList && HeroList.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user