再次 清理了一些东西
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "8ff649a8-071c-4be5-ae3d-22d80291867b",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1c56e8f6-c810-4a25-a499-ae1b39579a83",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "307a4494-1b3f-43d7-a489-8ab3c92bdb76",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "e2701b2d-48ad-478f-9f91-2dfdcc897ffb",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "6bd906b8-b499-4ef5-90e5-1c73bd5d2ceb",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "ce8e182a-d776-4361-9de5-cde2246c65a2",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import { instantiate, Prefab, Vec3 ,Node} from "cc";
|
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
||||||
import { TalentComp } from "./TalentComp";
|
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
|
||||||
|
|
||||||
/** Talent 模块 */
|
|
||||||
@ecs.register(`Talent`)
|
|
||||||
export class Talent extends ecs.Entity {
|
|
||||||
/** ---------- 数据层 ---------- */
|
|
||||||
|
|
||||||
TalentView!: TalentComp
|
|
||||||
protected init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
destroy(): void {
|
|
||||||
this.remove(TalentComp);
|
|
||||||
super.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 加载角色 */
|
|
||||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,parent:Node) {
|
|
||||||
// var path = "game/monster/"+prefab_path;
|
|
||||||
var path = "game/talent";
|
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
||||||
var node = instantiate(prefab);
|
|
||||||
node.parent = parent;
|
|
||||||
node.setPosition(pos)
|
|
||||||
console.log("load_talent",node)
|
|
||||||
let tv = node.getComponent(TalentComp)!;
|
|
||||||
tv.t_uuid = uuid;
|
|
||||||
this.add(tv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "da2ee9b0-de45-487a-8c6b-f3ab67f8ff88",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
import { _decorator, Label } 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 { Talents } from "../common/config/TalentSet";
|
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/** 视图层对象 */
|
|
||||||
@ccclass('TalentComp')
|
|
||||||
@ecs.register('TalentView', false)
|
|
||||||
export class TalentComp extends CCComp {
|
|
||||||
t_uuid:number = 0;
|
|
||||||
/** 视图层逻辑代码分离演示 */
|
|
||||||
start() {
|
|
||||||
let name =this.node.getChildByName("name")
|
|
||||||
let info =this.node.getChildByName("info")
|
|
||||||
let icon =this.node.getChildByName("icon")
|
|
||||||
let cost =this.node.getChildByName("cost")
|
|
||||||
let talent= Talents[this.t_uuid]
|
|
||||||
let role_talents = smc.vmdata.talent[talent.uuid]
|
|
||||||
cost.getComponent(Label).string = (talent.cost*(1+role_talents.lv)).toString()
|
|
||||||
name.getComponent(Label).string = talent.name
|
|
||||||
info.getComponent(Label).string = talent.info
|
|
||||||
if (talent.type == 1){
|
|
||||||
this.node.getChildByName("role").active=true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (talent.type == 2){
|
|
||||||
this.node.getChildByName("hero").active=true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (talent.type == 3){
|
|
||||||
this.node.getChildByName("mission").active=true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
to_update_t(){
|
|
||||||
console.log("to_update_t",this.t_uuid)
|
|
||||||
}
|
|
||||||
/** 全局消息逻辑处理 */
|
|
||||||
// private onHandler(event: string, args: any) {
|
|
||||||
// switch (event) {
|
|
||||||
// case ModuleEvent.Cmd:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "91d25bbb-9b90-479f-8e1b-b5624ee56aae",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
/*
|
|
||||||
* 强化系统测试脚本
|
|
||||||
* 用于验证强化系统是否正常工作
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {
|
|
||||||
getRandomEnhancementOptions,
|
|
||||||
getLevelAdjustedEnhancementOptions,
|
|
||||||
getEnhancementOptionByType,
|
|
||||||
EnhancementType,
|
|
||||||
EnhancementOptions,
|
|
||||||
EnhancementQualityWeight
|
|
||||||
} from "./LevelUpEnhancement"
|
|
||||||
import { Quality } from "./CardSet"
|
|
||||||
|
|
||||||
// 测试函数
|
|
||||||
export function testEnhancementSystem(): void {
|
|
||||||
console.log("=== 强化系统测试开始 ===");
|
|
||||||
|
|
||||||
// 测试1: 基础随机生成
|
|
||||||
testBasicRandomGeneration();
|
|
||||||
|
|
||||||
// 测试2: 等级调整功能
|
|
||||||
testLevelAdjustment();
|
|
||||||
|
|
||||||
// 测试3: 特定选项获取
|
|
||||||
testSpecificOptionRetrieval();
|
|
||||||
|
|
||||||
// 测试4: 品质权重验证
|
|
||||||
testQualityWeights();
|
|
||||||
|
|
||||||
// 测试5: 配置完整性
|
|
||||||
testConfigurationIntegrity();
|
|
||||||
|
|
||||||
console.log("=== 强化系统测试完成 ===");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试基础随机生成
|
|
||||||
function testBasicRandomGeneration(): void {
|
|
||||||
console.log("\n--- 测试基础随机生成 ---");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = getRandomEnhancementOptions(3);
|
|
||||||
console.log(`✓ 成功生成 ${options.length} 个强化选项`);
|
|
||||||
|
|
||||||
options.forEach((option, index) => {
|
|
||||||
console.log(` 选项 ${index + 1}: ${option.name} (${option.rarity}) - ${option.description}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 验证选项完整性
|
|
||||||
options.forEach(option => {
|
|
||||||
if (!option.name || !option.description || !option.buffType || !option.value) {
|
|
||||||
throw new Error(`选项数据不完整: ${JSON.stringify(option)}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("✓ 所有选项数据完整");
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("✗ 基础随机生成测试失败:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试等级调整功能
|
|
||||||
function testLevelAdjustment(): void {
|
|
||||||
console.log("\n--- 测试等级调整功能 ---");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const testLevels = [1, 10, 20, 30];
|
|
||||||
|
|
||||||
testLevels.forEach(level => {
|
|
||||||
const options = getLevelAdjustedEnhancementOptions(level, 3);
|
|
||||||
console.log(`✓ 等级 ${level} 生成 ${options.length} 个选项`);
|
|
||||||
|
|
||||||
// 验证高等级是否有更多稀有品质
|
|
||||||
const rareCount = options.filter(option =>
|
|
||||||
option.rarity === "rare" ||
|
|
||||||
option.rarity === "epic" ||
|
|
||||||
option.rarity === "legendary"
|
|
||||||
).length;
|
|
||||||
|
|
||||||
console.log(` 稀有品质数量: ${rareCount}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("✓ 等级调整功能正常");
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("✗ 等级调整功能测试失败:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试特定选项获取
|
|
||||||
function testSpecificOptionRetrieval(): void {
|
|
||||||
console.log("\n--- 测试特定选项获取 ---");
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 测试攻击力强化
|
|
||||||
const attackWhite = getEnhancementOptionByType(EnhancementType.ATTACK, Quality.WHITE);
|
|
||||||
const attackBlue = getEnhancementOptionByType(EnhancementType.ATTACK, Quality.BLUE);
|
|
||||||
|
|
||||||
if (attackWhite && attackBlue) {
|
|
||||||
console.log(`✓ 攻击力强化选项获取成功`);
|
|
||||||
console.log(` 白色: ${attackWhite.name} - ${attackWhite.description}`);
|
|
||||||
console.log(` 蓝色: ${attackBlue.name} - ${attackBlue.description}`);
|
|
||||||
} else {
|
|
||||||
throw new Error("无法获取攻击力强化选项");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试生命值强化
|
|
||||||
const healthPurple = getEnhancementOptionByType(EnhancementType.HEALTH, Quality.PURPLE);
|
|
||||||
if (healthPurple) {
|
|
||||||
console.log(`✓ 生命值强化选项获取成功: ${healthPurple.name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试攻击速度强化
|
|
||||||
const speedOrange = getEnhancementOptionByType(EnhancementType.ATTACK_SPEED, Quality.ORANGE);
|
|
||||||
if (speedOrange) {
|
|
||||||
console.log(`✓ 攻击速度强化选项获取成功: ${speedOrange.name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("✓ 特定选项获取功能正常");
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("✗ 特定选项获取测试失败:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试品质权重验证
|
|
||||||
function testQualityWeights(): void {
|
|
||||||
console.log("\n--- 测试品质权重验证 ---");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const totalWeight = Object.values(EnhancementQualityWeight).reduce((sum, weight) => sum + weight, 0);
|
|
||||||
|
|
||||||
if (Math.abs(totalWeight - 1.0) < 0.001) {
|
|
||||||
console.log(`✓ 品质权重总和为 1.0 (实际: ${totalWeight.toFixed(3)})`);
|
|
||||||
} else {
|
|
||||||
throw new Error(`品质权重总和不为 1.0: ${totalWeight}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证权重分布
|
|
||||||
console.log("品质权重分布:");
|
|
||||||
Object.entries(EnhancementQualityWeight).forEach(([quality, weight]) => {
|
|
||||||
const qualityName = getQualityName(parseInt(quality));
|
|
||||||
console.log(` ${qualityName}: ${(weight * 100).toFixed(1)}%`);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("✓ 品质权重验证通过");
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("✗ 品质权重验证失败:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试配置完整性
|
|
||||||
function testConfigurationIntegrity(): void {
|
|
||||||
console.log("\n--- 测试配置完整性 ---");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const enhancementTypes = Object.values(EnhancementType);
|
|
||||||
const qualities = [Quality.WHITE, Quality.GREEN, Quality.BLUE, Quality.PURPLE, Quality.ORANGE];
|
|
||||||
|
|
||||||
let totalOptions = 0;
|
|
||||||
let missingOptions = 0;
|
|
||||||
|
|
||||||
enhancementTypes.forEach(type => {
|
|
||||||
qualities.forEach(quality => {
|
|
||||||
totalOptions++;
|
|
||||||
const option = EnhancementOptions[type]?.[quality];
|
|
||||||
if (!option) {
|
|
||||||
missingOptions++;
|
|
||||||
console.log(` 缺失: 类型${type} 品质${quality}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`✓ 总选项数: ${totalOptions}`);
|
|
||||||
console.log(`✓ 缺失选项数: ${missingOptions}`);
|
|
||||||
console.log(`✓ 完整度: ${((totalOptions - missingOptions) / totalOptions * 100).toFixed(1)}%`);
|
|
||||||
|
|
||||||
if (missingOptions === 0) {
|
|
||||||
console.log("✓ 配置完整性验证通过");
|
|
||||||
} else {
|
|
||||||
console.log("⚠ 存在缺失配置,但不影响基本功能");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("✗ 配置完整性测试失败:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 辅助函数:获取品质名称
|
|
||||||
function getQualityName(quality: number): string {
|
|
||||||
switch (quality) {
|
|
||||||
case Quality.WHITE: return "白色";
|
|
||||||
case Quality.GREEN: return "绿色";
|
|
||||||
case Quality.BLUE: return "蓝色";
|
|
||||||
case Quality.PURPLE: return "紫色";
|
|
||||||
case Quality.ORANGE: return "橙色";
|
|
||||||
default: return "未知";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 性能测试
|
|
||||||
export function testPerformance(): void {
|
|
||||||
console.log("\n=== 性能测试开始 ===");
|
|
||||||
|
|
||||||
const iterations = 1000;
|
|
||||||
const startTime = Date.now();
|
|
||||||
|
|
||||||
for (let i = 0; i < iterations; i++) {
|
|
||||||
getRandomEnhancementOptions(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
const endTime = Date.now();
|
|
||||||
const duration = endTime - startTime;
|
|
||||||
|
|
||||||
console.log(`生成 ${iterations} 次强化选项耗时: ${duration}ms`);
|
|
||||||
console.log(`平均每次耗时: ${(duration / iterations).toFixed(2)}ms`);
|
|
||||||
|
|
||||||
if (duration < 1000) {
|
|
||||||
console.log("✓ 性能测试通过");
|
|
||||||
} else {
|
|
||||||
console.log("⚠ 性能较慢,建议优化");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出测试函数
|
|
||||||
export function runAllTests(): void {
|
|
||||||
testEnhancementSystem();
|
|
||||||
testPerformance();
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "75f5e9aa-9f71-47b9-b878-545adb08a0c9",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -34,9 +34,7 @@ export class BarCompComp extends CCComp {
|
|||||||
}
|
}
|
||||||
private readay(){
|
private readay(){
|
||||||
this.node.getChildByName("bar").active = true
|
this.node.getChildByName("bar").active = true
|
||||||
this.node.getChildByName("fbar").active = false
|
|
||||||
this.node.getChildByName("bar").getChildByName("more").active=false
|
this.node.getChildByName("bar").getChildByName("more").active=false
|
||||||
this.node.getChildByName("fbar").getChildByName("more").active=false
|
|
||||||
}
|
}
|
||||||
private master_called(e:any,data:any){
|
private master_called(e:any,data:any){
|
||||||
this.node.getChildByName("bar").active = true
|
this.node.getChildByName("bar").active = true
|
||||||
@@ -58,13 +56,6 @@ export class BarCompComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}).start()
|
}).start()
|
||||||
|
|
||||||
}else{
|
|
||||||
let barNode = this.node.getChildByName("fbar").getChildByName("ap").getChildByName("val")
|
|
||||||
tween(barNode).to(0.2, {scale:v3(1.5,1.5,1)},{
|
|
||||||
onComplete:()=>{
|
|
||||||
tween(barNode).to(0.1, {scale:v3(1,1,1)}).start()
|
|
||||||
}
|
|
||||||
}).start()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show_master_more(){
|
show_master_more(){
|
||||||
@@ -86,24 +77,6 @@ export class BarCompComp extends CCComp {
|
|||||||
node.active = false;
|
node.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_friend_more(){
|
|
||||||
let barNode = this.node.getChildByName("fbar");
|
|
||||||
let node = barNode.getChildByName("more");
|
|
||||||
node.active = true;
|
|
||||||
node.setScale(v3(1, 0, 1));
|
|
||||||
console.log("[barcomp]:show_friend_more",node)
|
|
||||||
// 使用缓动动画放大和移动
|
|
||||||
tween(node).to(0.2, {scale:v3(1,1,1)}).start()
|
|
||||||
}
|
|
||||||
|
|
||||||
hide_friend_more(){
|
|
||||||
let barNode = this.node.getChildByName("fbar");
|
|
||||||
let node = barNode.getChildByName("more");
|
|
||||||
console.log("[barcomp]:hide_friend_more",node)
|
|
||||||
// 使用缓动动画放大和移动
|
|
||||||
tween(node).to(0.2, {scale:v3(1,0,1)}).start()
|
|
||||||
node.active = false;
|
|
||||||
}
|
|
||||||
update_bar(){
|
update_bar(){
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,7 @@ import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources
|
|||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
||||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
|
||||||
import { SkillSet } from "../common/config/SkillSet";
|
|
||||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
|
||||||
import { GameSet } from "../common/config/BoxSet";
|
|
||||||
import { GameMap } from "./GameMap";
|
|
||||||
import { MapModelComp } from "./model/MapModelComp";
|
|
||||||
import { Talent } from "../Role/Talent";
|
|
||||||
import { Talents } from "../common/config/TalentSet";
|
|
||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
|
||||||
import { Position } from "../../../../extensions/oops-plugin-framework/assets/libs/gui/badge/Badge";
|
|
||||||
import { MissionHomeComp } from "./MissionHomeComp";
|
import { MissionHomeComp } from "./MissionHomeComp";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
|
||||||
import { MissionComp } from "./MissionComp";
|
import { MissionComp } from "./MissionComp";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user