lawless/client/assets/scripts/ui/screens/SectScreen.ts
徐勤民 521603a899
一些检测仍在等待运行
Docs Build / build-and-deploy (push) Waiting to run
refactor(client): 删除游戏核心管理器和场景脚本
- 移除 ConfigManager 配置管理器类
- 移除 GameManager 全局单例管理器类
- 移除 NetworkManager 网络连接管理器类
- 移除 CharacterData 和 ItemData 数据模型类
- 移除 BagScene、BattleScene、LobbyScene 等场景脚本
- 移除 EncounterBubble 和 EventFeedPanel UI组件脚本
- 更新代理邀请文档中的服务器连接方式
- 更新同步状态表格中的代理任务分配信息
- 添加 MiMo 任务完成总结和审查修复记录
2026-07-03 21:34:51 +08:00

169 行
6.2 KiB
TypeScript

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

import { _decorator, Component, Node, Label, Sprite, Color, UITransform, Size, Layout } from 'cc';
import { UITheme } from '../common/UITheme';
import { UIBase } from '../common/UIBase';
const { ccclass, property } = _decorator;
/**
* 门派界面
* 基于江湖截图:门派建筑列表 + 江湖风评
*/
@ccclass('SectScreen')
export class SectScreen extends UIBase {
@property(Node) sectHeader: Node = null!;
@property(Node) buildingList: Node = null!;
@property(Node) reputationArea: Node = null!;
start() {
this.initSectHeader();
this.initBuildingList();
this.initReputationArea();
}
/**
* 门派头部信息
* 门派名称 + 身份 + 贡献
*/
private initSectHeader() {
if (!this.sectHeader) return;
const transform = this.sectHeader.getComponent(UITransform) || this.sectHeader.addComponent(UITransform);
transform.setContentSize(new Size(720, 150));
// 门派名
const nameNode = new Node('SectName');
const nameLabel = nameNode.addComponent(Label);
nameLabel.string = '昆仑派';
nameLabel.fontSize = UITheme.FONT_SIZE.XL;
nameLabel.color = this.hexToColor(UITheme.COLORS.TEXT_GOLD);
nameNode.setParent(this.sectHeader);
// 身份
const identityNode = new Node('Identity');
const identityLabel = identityNode.addComponent(Label);
identityLabel.string = '门派身份:长老';
identityLabel.fontSize = UITheme.FONT_SIZE.SM;
identityLabel.color = this.hexToColor(UITheme.COLORS.TEXT_NORMAL);
identityNode.setParent(this.sectHeader);
// 贡献
const contribNode = new Node('Contribution');
const contribLabel = contribNode.addComponent(Label);
contribLabel.string = '门派贡献7906 🪙';
contribLabel.fontSize = UITheme.FONT_SIZE.SM;
contribLabel.color = this.hexToColor(UITheme.COLORS.GOLD_PRIMARY);
contribNode.setParent(this.sectHeader);
// 按钮
const叛出门派Btn = this.createButton(this.sectHeader, '叛出门派', {
width: 160, height: 50,
bgColor: UITheme.COLORS.HP_BAR,
textColor: UITheme.COLORS.TEXT_WHITE,
});
const Btn = this.createButton(this.sectHeader, '门派精义', {
width: 160, height: 50,
bgColor: UITheme.COLORS.BG_CARD,
textColor: UITheme.COLORS.TEXT_GOLD,
});
}
/**
* 建筑列表
* 两列布局,每项包含建筑图标和名称
*/
private initBuildingList() {
if (!this.buildingList) return;
const transform = this.buildingList.getComponent(UITransform) || this.buildingList.addComponent(UITransform);
transform.setContentSize(new Size(720, 500));
const buildings = [
{ name: '议事殿', icon: '🏛️' },
{ name: '杂务堂', icon: '📋' },
{ name: '藏经阁', icon: '📚' },
{ name: '演武场', icon: '⚔️' },
{ name: '藏宝阁', icon: '💰' },
{ name: '入门殿', icon: '🚪' },
{ name: '比武台', icon: '🥊' },
{ name: '讲义厅', icon: '📖' },
{ name: '门派禁地', icon: '⚠️' },
{ name: '祖师殿', icon: '🏯' },
{ name: '铸剑堂', icon: '🔨' },
];
// 创建网格布局
const gridNode = new Node('BuildingGrid');
const gridLayout = gridNode.addComponent(Layout);
gridLayout.type = Layout.Type.GRID;
gridLayout.startAxis = Layout.AxisDirection.HORIZONTAL;
gridLayout.cellSize = new Size(340, 100);
gridLayout.spacingX = 20;
gridLayout.spacingY = 16;
gridNode.setParent(this.buildingList);
buildings.forEach(building => {
const buildingNode = new Node(`Building_${building.name}`);
const buildingTransform = buildingNode.addComponent(UITransform);
buildingTransform.setContentSize(new Size(340, 100));
buildingNode.setParent(gridNode);
// 建筑图标
const iconNode = new Node('Icon');
const iconLabel = iconNode.addComponent(Label);
iconLabel.string = building.icon;
iconLabel.fontSize = UITheme.FONT_SIZE.XXL;
iconNode.setParent(buildingNode);
// 建筑名称
const nameNode = new Node('Name');
const nameLabel = nameNode.addComponent(Label);
nameLabel.string = building.name;
nameLabel.fontSize = UITheme.FONT_SIZE.MD;
nameLabel.color = this.hexToColor(UITheme.COLORS.TEXT_WHITE);
nameNode.setParent(buildingNode);
});
}
/**
* 江湖风评区域
* 正义值 + 善恶条
*/
private initReputationArea() {
if (!this.reputationArea) return;
const transform = this.reputationArea.getComponent(UITransform) || this.reputationArea.addComponent(UITransform);
transform.setContentSize(new Size(720, 120));
// 正义值
const justiceNode = new Node('Justice');
const justiceLabel = justiceNode.addComponent(Label);
justiceLabel.string = '江湖风评:正义 | 20047';
justiceLabel.fontSize = UITheme.FONT_SIZE.MD;
justiceLabel.color = this.hexToColor(UITheme.COLORS.TEXT_GREEN);
justiceNode.setParent(this.reputationArea);
// 善恶条
const barNode = new Node('AlignmentBar');
const barTransform = barNode.addComponent(UITransform);
barTransform.setContentSize(new Size(600, 30));
barNode.setParent(this.reputationArea);
// 邪 - 正 标签
const evilLabel = new Node('Evil');
const evil = evilLabel.addComponent(Label);
evil.string = '邪';
evil.fontSize = UITheme.FONT_SIZE.SM;
evil.color = this.hexToColor(UITheme.COLORS.TEXT_RED);
evilLabel.setParent(barNode);
const goodLabel = new Node('Good');
const good = goodLabel.addComponent(Label);
good.string = '正';
good.fontSize = UITheme.FONT_SIZE.SM;
good.color = this.hexToColor(UITheme.COLORS.TEXT_BLUE);
goodLabel.setParent(barNode);
}
}