refactor: 移除调试日志并统一使用日志工具
- 删除多个文件中的 console.log/console.warn/console.error 调试输出 - 将日志输出统一替换为 mLogger 工具,支持调试模式控制 - 清理注释掉的调试代码和空方法体
This commit is contained in:
@@ -7,8 +7,6 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet, FacSet, IndexSet } from "../common/config/GameSet";
|
||||
import { HeroInfo, HeroPos, HType } from "../common/config/heroSet";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { time } from "console";
|
||||
import { getNeAttrs, getAttrs ,Attrs} from "../common/config/HeroAttrs";
|
||||
import { HeroSkillsComp } from "./HeroSkills";
|
||||
import { HeroMoveComp } from "./HeroMove";
|
||||
@@ -24,6 +22,7 @@ export class Hero extends ecs.Entity {
|
||||
View!: HeroViewComp;
|
||||
HeroMove!: HeroMoveComp;
|
||||
TalComp!: TalComp;
|
||||
debugMode: boolean = false; // 是否启用调试模式
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>(
|
||||
HeroMoveComp,
|
||||
@@ -50,7 +49,6 @@ export class Hero extends ecs.Entity {
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,fight_pos:number=1,is_master:boolean=false,is_friend:boolean=false) {
|
||||
// console.log("英雄加载:",uuid,pos,scale,info)
|
||||
scale = 1
|
||||
// 查找空闲英雄槽位
|
||||
let size=1
|
||||
@@ -66,9 +64,8 @@ export class Hero extends ecs.Entity {
|
||||
|
||||
// 🔥 设置初始 SiblingIndex - 英雄基础层级 + 位置偏移
|
||||
|
||||
console.log("hero",node.getSiblingIndex());
|
||||
mLogger.log(this.debugMode,"hero",node.getSiblingIndex());
|
||||
|
||||
// console.log("hero load",pos)
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
const model = this.get(HeroAttrsComp);
|
||||
const skillsComp = this.get(HeroSkillsComp);
|
||||
@@ -89,7 +86,7 @@ export class Hero extends ecs.Entity {
|
||||
model.rangeType = hero.rangeType;
|
||||
// 只有主角才挂载天赋组件
|
||||
if (is_master) {
|
||||
console.log(`[Hero] 主角创建, uuid=${uuid}`);
|
||||
mLogger.log(this.debugMode,`[Hero] 主角创建, uuid=${uuid}`);
|
||||
this.add(TalComp);
|
||||
this.add(HeroMasterComp)
|
||||
const talComp = this.get(TalComp);
|
||||
|
||||
@@ -28,7 +28,6 @@ export default class HeroAnmComp extends Component{
|
||||
this._hasStop = true;
|
||||
}
|
||||
onAnimationFinished(type:Animation.EventType, state:AnimationState){
|
||||
// console.log("[HeroAnmComp]: 动画播放完毕",state.name)
|
||||
if(state.name!="idle"&&state.name!="move"&&state.name!="dead"&&state.name!="stun"){
|
||||
this.anmcon.play(this.default_anim)
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
CView.scheduleRevive(1.0);
|
||||
}
|
||||
|
||||
console.log(`[HeroAtkSystem] Hero waiting to revive from Thorns! Lives left: ${CAttrs.Attrs[Attrs.REVIVE_COUNT]}`);
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] Hero waiting to revive from Thorns! Lives left: ${CAttrs.Attrs[Attrs.REVIVE_COUNT]}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
if (CAttrs.is_master&&CAttrs.Attrs[Attrs.REVIVE_COUNT] <= 0) {
|
||||
smc.mission.stop_mon_action = true;
|
||||
oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: CAttrs.hero_uuid});
|
||||
console.log("[HeroAtkSystem] Hero died from thorns, stopping monster action (spawn/move)");
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] Hero died from thorns, stopping monster action (spawn/move)");
|
||||
}
|
||||
|
||||
this.doDead(caster);
|
||||
@@ -409,7 +409,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
this.onDeath(entity);
|
||||
|
||||
if (this.debugMode) {
|
||||
console.log(`[HeroAtkSystem] ${TAttrsComp.hero_name} 死亡`);
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] ${TAttrsComp.hero_name} 死亡`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
}
|
||||
this.shield += addValue;
|
||||
this.dirty_shield = true; // 标记护盾需要更新
|
||||
console.log(`[HeroAttrs] 护盾变更: ${this.hero_name}, 变化=${addValue.toFixed(1)}, ${oldShield.toFixed(1)} -> ${this.shield.toFixed(1)}`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', `[HeroAttrs] 护盾变更: ${this.hero_name}, 变化=${addValue.toFixed(1)}, ${oldShield.toFixed(1)} -> ${this.shield.toFixed(1)}`);
|
||||
}
|
||||
// ==================== BUFF 管理 ====================
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ export class HeroSkillsComp extends ecs.Comp {
|
||||
const s_uuid = sUuids[i];
|
||||
const config = SkillSet[s_uuid];
|
||||
if (!config) {
|
||||
console.warn(`[HeroSkills] 技能配置不存在: ${s_uuid}`);
|
||||
mLogger.warn(this.debugMode, 'HeroSkills', `[HeroSkills] 技能配置不存在: ${s_uuid}`);
|
||||
continue;
|
||||
}
|
||||
// 第0个技能的 cd_max 取 herosinfo[uuid].as
|
||||
|
||||
@@ -36,18 +36,15 @@ export class HeroSpine extends Component {
|
||||
|
||||
}
|
||||
idle(){
|
||||
// console.log("change to idle",this.status);
|
||||
// console.log("do Idle");
|
||||
|
||||
if(this.status=="idle") return
|
||||
this.status="idle"
|
||||
this.anm.idle()
|
||||
}
|
||||
atk() {
|
||||
// console.log("do atk");
|
||||
this.anm.atk()
|
||||
}
|
||||
max(){
|
||||
// console.log("do max");
|
||||
this.anm.max()
|
||||
}
|
||||
play(name:string){
|
||||
@@ -70,7 +67,6 @@ export class HeroSpine extends Component {
|
||||
this.anm.atked()
|
||||
}
|
||||
dead(){
|
||||
// console.log("do dead");
|
||||
this.anm.dead()
|
||||
}
|
||||
do_buff(){
|
||||
@@ -80,7 +76,6 @@ export class HeroSpine extends Component {
|
||||
this.anm.buff()
|
||||
}
|
||||
move(){
|
||||
// console.log("change to move",this.status);
|
||||
if(this.status=="move") return
|
||||
this.status="move"
|
||||
this.anm.move()
|
||||
|
||||
@@ -63,7 +63,6 @@ export class HeroViewComp extends CCComp {
|
||||
private damageInterval: number = 0.01; // 伤害数字显示间隔
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||
const collider = this.node.getComponent(BoxCollider2D);
|
||||
this.scheduleOnce(()=>{
|
||||
if (collider) {
|
||||
@@ -377,7 +376,7 @@ export class HeroViewComp extends CCComp {
|
||||
// 恢复怪物行动
|
||||
if (this.model.is_master) {
|
||||
smc.mission.stop_mon_action = false;
|
||||
console.log("[HeroViewComp] Hero revived, resuming monster action");
|
||||
mLogger.log(this.debugMode, 'HeroViewComp', "[HeroViewComp] Hero revived, resuming monster action");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { TalEffet, TriType } from "../common/config/TalSet";
|
||||
import { BoxSet, FacSet } from "../common/config/GameSet";
|
||||
import { GameConst } from "../common/config/GameConst";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/**
|
||||
* ==================== 自动施法系统 ====================
|
||||
@@ -29,6 +30,7 @@ import { Attrs } from "../common/config/HeroAttrs";
|
||||
*/
|
||||
@ecs.register('SACastSystem')
|
||||
export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
debugMode: boolean = false; // 是否启用调试模式
|
||||
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(HeroSkillsComp, HeroAttrsComp, HeroViewComp);
|
||||
@@ -155,7 +157,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
const heroAttrs=casterEntity.get(HeroAttrsComp)
|
||||
const config = SkillSet[s_uuid];
|
||||
if (!config) {
|
||||
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
|
||||
mLogger.error(this.debugMode, 'SACastSystem', "[SACastSystem] 技能配置不存在:", s_uuid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -182,7 +184,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
// 获取目标位置(伤害技能)
|
||||
let targets = this.sTargets(heroView, s_uuid);
|
||||
if (targets.length === 0) {
|
||||
console.warn("[SACastSystem] 没有找到有效目标");
|
||||
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 没有找到有效目标");
|
||||
return false;
|
||||
}
|
||||
// 2.1 普通攻击逻辑
|
||||
@@ -243,14 +245,14 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0) {
|
||||
// 检查节点有效性
|
||||
if (!caster.node || !caster.node.isValid) {
|
||||
console.warn("[SACastSystem] 施法者节点无效");
|
||||
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 施法者节点无效");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取场景节点
|
||||
const parent = caster.node.parent;
|
||||
if (!parent) {
|
||||
console.warn("[SACastSystem] 场景节点无效");
|
||||
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 场景节点无效");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +265,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
const startPos = caster.node.position.clone();
|
||||
|
||||
const targetPos = targets[0]; // 使用第一个目标位置
|
||||
// console.log(`[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
|
||||
// mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
|
||||
// 加载技能实体(包括预制体、组件初始化等)
|
||||
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg);
|
||||
|
||||
@@ -440,7 +442,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
// 检查概率
|
||||
if (buffConf.chance >= 1 || Math.random() < buffConf.chance) {
|
||||
targetAttrs.addBuff(buffConf);
|
||||
console.log(`[SACastSystem] Buff生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, Buff类型=${buffConf.buff}, 值=${buffConf.value}`);
|
||||
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] Buff生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, Buff类型=${buffConf.buff}, 值=${buffConf.value}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,7 +510,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
|
||||
targetAttrs.add_hp(healAmount, true);
|
||||
targetView.health(healAmount);
|
||||
console.log(`[SACastSystem] 治疗生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 治疗量=${healAmount}`);
|
||||
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] 治疗生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 治疗量=${healAmount}`);
|
||||
}
|
||||
}, delay);
|
||||
|
||||
@@ -537,7 +539,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
|
||||
targetAttrs.add_shield(shieldAmount, true);
|
||||
targetView.add_shield(shieldAmount);
|
||||
console.log(`[SACastSystem] 护盾生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 护盾量=${shieldAmount}`);
|
||||
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] 护盾生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 护盾量=${shieldAmount}`);
|
||||
}
|
||||
}, delay);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { UIID } from "../common/config/GameUIConfig";
|
||||
import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/**
|
||||
* 游戏进入初始化模块
|
||||
@@ -22,7 +23,7 @@ import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
@ecs.register(`Initialize`)
|
||||
export class Initialize extends ecs.Entity {
|
||||
LoadingView!: LoadingViewComp;
|
||||
|
||||
debugMode: boolean = false; // 是否启用调试模式
|
||||
protected init() {
|
||||
var queue: AsyncQueue = new AsyncQueue();
|
||||
// 加载自定义资
|
||||
@@ -52,7 +53,7 @@ export class Initialize extends ecs.Entity {
|
||||
//加载精灵配置表
|
||||
// oops.res.load("config/game/heros", next);
|
||||
} catch (error) {
|
||||
console.error("[Initialize]: 自定义内容加载失败:", error);
|
||||
mLogger.error(this.debugMode, 'Initialize', "[Initialize]: 自定义内容加载失败:", error);
|
||||
next(); // 即使失败也要继续,不阻塞游戏启动
|
||||
}
|
||||
});
|
||||
@@ -99,20 +100,20 @@ export class Initialize extends ecs.Entity {
|
||||
*/
|
||||
private async loadGameDataUnified() {
|
||||
try {
|
||||
console.log("[Initialize]: 开始统一数据加载流程...");
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 开始统一数据加载流程...");
|
||||
|
||||
if (this.isWxClient()) {
|
||||
// 微信客户端:加载云端数据
|
||||
console.log("[Initialize]: 检测到微信客户端,使用云端数据");
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 检测到微信客户端,使用云端数据");
|
||||
await this.loadFromCloud();
|
||||
} else {
|
||||
// 非微信客户端:使用本地调试数据
|
||||
console.log("[Initialize]: 非微信客户端,使用本地调试数据");
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 非微信客户端,使用本地调试数据");
|
||||
await this.loadFromLocalDebug();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("[Initialize]: 统一数据加载失败:", error);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 统一数据加载失败:", error);
|
||||
// 失败时使用默认数据 游戏需要退出
|
||||
}
|
||||
}
|
||||
@@ -130,7 +131,7 @@ export class Initialize extends ecs.Entity {
|
||||
const response = loginResult.result;
|
||||
|
||||
if (loginResult.result.code === 200) {
|
||||
console.log("[Initialize]: 云端登录成功");
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 云端登录成功");
|
||||
smc.updateCloudData()
|
||||
const cloudData = loginResult.result.data;
|
||||
try {
|
||||
@@ -147,17 +148,17 @@ export class Initialize extends ecs.Entity {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error(`[SMC]: 数据覆盖失败:`, error);
|
||||
mLogger.log(this.debugMode, 'Initialize', `[SMC]: 数据覆盖失败:`, error);
|
||||
}
|
||||
|
||||
} else {
|
||||
console.warn("[Initialize]: 云端登录失败:", response.msg);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 云端登录失败:", response.msg);
|
||||
// 登录失败时使用本地数据 游戏需要退出
|
||||
console.log("[Initialize]: 云端登录失败:", response.msg);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 云端登录失败:", response.msg);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("[Initialize]: 云端数据加载异常:", error);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 云端数据加载异常:", error);
|
||||
// 异常时使用本地数据 游戏需要退出
|
||||
}
|
||||
}
|
||||
@@ -172,7 +173,7 @@ export class Initialize extends ecs.Entity {
|
||||
// 用本地调试数据覆盖客户端数据
|
||||
|
||||
} catch (error) {
|
||||
console.error("[Initialize]: 本地调试数据加载异常:", error);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 本地调试数据加载异常:", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,9 +185,9 @@ export class Initialize extends ecs.Entity {
|
||||
// 请替换为您的实际云环境ID
|
||||
const cloudEnvId = "cloud1-6gknw0qk911036d8"; // TODO: 配置您的云环境ID
|
||||
WxCloudApi.init(cloudEnvId);
|
||||
console.log("[Initialize]: 微信云环境初始化完成");
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 微信云环境初始化完成");
|
||||
} catch (error) {
|
||||
console.error("[Initialize]: 微信云环境初始化失败:", error);
|
||||
mLogger.log(this.debugMode, 'Initialize', "[Initialize]: 微信云环境初始化失败:", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -540,7 +540,7 @@ export class MissionCardComp extends CCComp {
|
||||
oops.gui.toast(attrCard.desc);
|
||||
}
|
||||
} else {
|
||||
console.warn(`[MissionCard] 未找到属性卡配置: UUID=${selectedData.uuid}`);
|
||||
mLogger.warn(this.debugMode, 'MissionCard', `[MissionCard] 未找到属性卡配置: UUID=${selectedData.uuid}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export class MissionComp extends CCComp {
|
||||
SpecialMonsterSchedule.forEach((item, index) => {
|
||||
if (!this.spawnedSpecialIndices.has(index) && fightTime >= item.time) {
|
||||
this.spawnedSpecialIndices.add(index);
|
||||
console.log(`[MissionComp] 触发特殊刷怪: ${item.desc}`);
|
||||
mLogger.log(this.debugMode, 'MissionComp', `[MissionComp] 触发特殊刷怪: ${item.desc}`);
|
||||
oops.message.dispatchEvent("SpawnSpecialMonster", {
|
||||
uuid: item.uuid,
|
||||
type: item.type,
|
||||
@@ -170,7 +170,6 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
do_hero_dead(event:any,data:any){
|
||||
// console.log("[MissionComp] do_hero_dead",event,data)
|
||||
// 收到 HeroDead 说明已经没有复活次数了,打开失败界面,等待玩家选择(复活或结束)
|
||||
// oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false}) // 暂时不分发结束事件
|
||||
this.open_Victory(null,true)
|
||||
@@ -197,7 +196,6 @@ do_ad(){
|
||||
// 确保清理上一局的残留实体
|
||||
this.cleanComponents();
|
||||
|
||||
// console.log("[MissionComp] ** 1 ** mission_start")
|
||||
oops.message.dispatchEvent(GameEvent.FightReady)
|
||||
this.node.active=true
|
||||
this.data_init()
|
||||
@@ -277,7 +275,6 @@ do_ad(){
|
||||
this.spawnedSpecialIndices.clear(); // 重置特殊刷怪记录
|
||||
|
||||
// 重置全局属性加成和主角引用 (确保新一局数据干净)
|
||||
// console.log(`[MissionComp] data_init 重置 smc.role 为 null`);
|
||||
// smc.role = null;
|
||||
|
||||
// 重置英雄数据,确保新一局是初始状态
|
||||
|
||||
@@ -5,6 +5,7 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { CardKind } from "../common/config/GameSet";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -12,6 +13,7 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MissionGetsCompComp')
|
||||
@ecs.register('MissionGetsComp', false)
|
||||
export class MissionGetsCompComp extends CCComp {
|
||||
debugMode = false;
|
||||
get_datas: { [key: number]: { num: number, node: Node, kind?: number } } = {};
|
||||
get_nodes: Node[] = [];
|
||||
// 图标图集缓存
|
||||
@@ -49,7 +51,7 @@ export class MissionGetsCompComp extends CCComp {
|
||||
}
|
||||
|
||||
addGet(uuid: number, iconName?: string, kind?: number) {
|
||||
console.log("[MissionGetsComp]添加获取到的物品:", uuid, iconName, kind);
|
||||
mLogger.log(this.debugMode, 'MissionGetsComp', "[MissionGetsComp]添加获取到的物品:", uuid, iconName, kind);
|
||||
if (this.get_datas[uuid]) {
|
||||
this.get_datas[uuid].num++;
|
||||
this.updateNodeNum(this.get_datas[uuid].node, this.get_datas[uuid].num);
|
||||
@@ -62,7 +64,7 @@ export class MissionGetsCompComp extends CCComp {
|
||||
var path = "game/gui/get";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
if (!prefab) {
|
||||
console.warn("Prefab not found:", path);
|
||||
mLogger.log(this.debugMode, 'MissionGetsComp', "Prefab not found:", path);
|
||||
return;
|
||||
}
|
||||
var node = instantiate(prefab);
|
||||
@@ -129,7 +131,7 @@ export class MissionGetsCompComp extends CCComp {
|
||||
// 加载图集
|
||||
resources.load("gui/uicons", SpriteAtlas, (err, atlas) => {
|
||||
if (err) {
|
||||
console.error("[MissionGetsComp] Failed to load uicons atlas", err);
|
||||
mLogger.error(this.debugMode, 'MissionGetsComp', "[MissionGetsComp] Failed to load uicons atlas", err);
|
||||
return;
|
||||
}
|
||||
this.uiconsAtlas = atlas;
|
||||
|
||||
@@ -34,7 +34,6 @@ export class MissionHeroCompComp extends CCComp {
|
||||
// this.test_call()
|
||||
}
|
||||
clear_heros(){
|
||||
// console.log("[MissionHeroComp]: FightEnd clear heros")
|
||||
|
||||
}
|
||||
fight_ready(){
|
||||
@@ -49,11 +48,9 @@ export class MissionHeroCompComp extends CCComp {
|
||||
// this.current_hero_num=-1
|
||||
// this.current_hero_uuid=0
|
||||
smc.vmdata.mission_data.hero_num=0
|
||||
// console.log("[MissionHeroComp]:fight_ready",smc.fight_heros,Object.keys(smc.fight_heros).length)
|
||||
this.addHero(smc.fight_hero,true)
|
||||
// for(let i=0;i<Object.keys(heros).length;i++){
|
||||
// if(heros[i]!=0){
|
||||
// // console.log("[MissionHeroComp]:fight_ready",heros[i])
|
||||
// this.addHero(heros[i],false)
|
||||
// }
|
||||
// }
|
||||
@@ -65,16 +62,13 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
|
||||
private zhao_huan(event: string, args: any){
|
||||
// console.log("[MissionHeroComp]:zhaohuan",args)
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
private call_friend(event: string, args: any){
|
||||
// console.log("[MissionHeroComp]:call_friend",args)
|
||||
this.addHero(args.uuid,false,true)
|
||||
}
|
||||
/** 添加英雄 */
|
||||
private addHero(uuid:number=1001,is_master:boolean=false,is_friend:boolean=false) {
|
||||
// console.log("[MissionHeroComp]:addHero",uuid,is_zhaohuan)
|
||||
let hero_pos=0
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
|
||||
@@ -58,7 +58,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
*/
|
||||
private onSpawnSpecialMonster(event: string, args: any) {
|
||||
if (!args) return;
|
||||
console.log(`[MissionMonComp] 收到特殊刷怪指令:`, args);
|
||||
mLogger.log(this.debugMode, 'MissionMonComp', `[MissionMonComp] 收到特殊刷怪指令:`, args);
|
||||
|
||||
// 插入队列
|
||||
this.MonQueue.push({
|
||||
|
||||
@@ -10,6 +10,7 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { FacSet } from "../common/config/GameSet";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { ScoreWeights } from "../common/config/ScoreSet";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -17,7 +18,7 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('VictoryComp')
|
||||
@ecs.register('Victory', false)
|
||||
export class VictoryComp extends CCComp {
|
||||
|
||||
debugMode: boolean = false;
|
||||
reward_lv:number=1
|
||||
reward_num:number=2
|
||||
rewards:any[]=[]
|
||||
@@ -40,7 +41,7 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
onAdded(args: any) {
|
||||
this.node.getChildByName("loading").active=false
|
||||
console.log("[VictoryComp] onAdded",args)
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] onAdded",args)
|
||||
if(args.game_data){
|
||||
this.game_data=args.game_data
|
||||
}
|
||||
@@ -98,7 +99,7 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
// 更新总分(向下取整)
|
||||
s.score = Math.floor(totalScore);
|
||||
console.log(`[VictoryComp] 结算总分: ${s.score}`);
|
||||
mLogger.log(this.debugMode, 'VictoryComp', `[VictoryComp] 结算总分: ${s.score}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,13 +116,13 @@ export class VictoryComp extends CCComp {
|
||||
return true
|
||||
}
|
||||
double_reward(){
|
||||
// console.log("[VictoryComp]double_reward",smc.items,this.rewards)
|
||||
|
||||
}
|
||||
|
||||
/** 看广告复活 */
|
||||
watch_ad_revive() {
|
||||
if (!this.canRevive) {
|
||||
console.log("已经复活过,无法再次复活");
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "已经复活过,无法再次复活");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,8 +132,9 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
/** 广告复活成功回调 */
|
||||
private onAdReviveSuccess() {
|
||||
console.log("[VictoryComp] 广告复活成功");
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] 广告复活成功");
|
||||
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] 广告复活成功")
|
||||
// 1. 标记已复活
|
||||
// this.reviveCount++;
|
||||
this.canRevive = false;
|
||||
@@ -174,7 +176,7 @@ export class VictoryComp extends CCComp {
|
||||
}
|
||||
|
||||
hasRevived = true;
|
||||
console.log(`[VictoryComp] 复活英雄: ${attrs.hero_name}`);
|
||||
mLogger.log(this.debugMode, 'VictoryComp', `[VictoryComp] 复活英雄: ${attrs.hero_name}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -182,7 +184,7 @@ export class VictoryComp extends CCComp {
|
||||
// 发送复活事件(如果有需要)
|
||||
// oops.message.dispatchEvent(GameEvent.HeroRevived);
|
||||
} else {
|
||||
console.warn("[VictoryComp] 未找到可复活的英雄实体");
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] 未找到可复活的英雄实体");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,11 +200,11 @@ export class VictoryComp extends CCComp {
|
||||
},0.5)
|
||||
}
|
||||
item_show(e:any,val:any){
|
||||
// console.log("item_show",val)
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "item_show",val)
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
// console.log("释放胜利界面");
|
||||
mLogger.log(this.debugMode, 'VictoryComp', "释放胜利界面");
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
@@ -32,7 +32,6 @@ export class MapViewComp extends CCComp {
|
||||
|
||||
load_data(){
|
||||
// let heros = oops.res.get("config/game/heros")
|
||||
// console.log("heros",heros)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ export default class EntityLayer extends Component {
|
||||
}
|
||||
|
||||
protected start(): void {
|
||||
// console.log("EntityLayer start",this)
|
||||
}
|
||||
|
||||
public clear() {
|
||||
|
||||
@@ -26,7 +26,6 @@ export default class SkillLayer extends Component {
|
||||
|
||||
}
|
||||
doSkill(){
|
||||
// console.log("doSkill")
|
||||
}
|
||||
|
||||
update(dt: number) {
|
||||
@@ -36,7 +35,6 @@ export default class SkillLayer extends Component {
|
||||
}
|
||||
|
||||
start(){
|
||||
// console.log("SkillLayer start")
|
||||
}
|
||||
|
||||
public clear() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { EType, RType, SkillSet } from "../common/config/SkillSet";
|
||||
import { SMoveDataComp } from "./SMoveComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillView } from "./SkillView";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/**
|
||||
* ==================== 技能移动系统 ====================
|
||||
@@ -21,7 +22,7 @@ import { SkillView } from "./SkillView";
|
||||
*/
|
||||
@ecs.register('SMoveSystem')
|
||||
export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
|
||||
debugMode: boolean = false;
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(SMoveDataComp, SkillView);
|
||||
}
|
||||
@@ -35,7 +36,7 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
// 获取技能配置
|
||||
const skillConfig = SkillSet[moveComp.s_uuid];
|
||||
if (!skillConfig) {
|
||||
console.warn(`[SMoveSystem] 技能配置不存在: ${moveComp.s_uuid}`);
|
||||
mLogger.warn(this.debugMode, 'SMoveSystem', `[SMoveSystem] 技能配置不存在: ${moveComp.s_uuid}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
moveComp.startMove();
|
||||
}
|
||||
|
||||
// console.log(`[SMoveSystem] 技能 ${skillConfig.name} 开始移动,类型: ${moveComp.runType}`);
|
||||
mLogger.log(this.debugMode, 'SMoveSystem', `[SMoveSystem] 技能 ${skillConfig.name} 开始移动,类型: ${moveComp.runType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,10 +9,12 @@ import { SDataCom } from "./SDataCom";
|
||||
import { SMoveDataComp } from "../skill/SMoveComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/** Skill 模块 */
|
||||
@ecs.register(`Skill`)
|
||||
export class Skill extends ecs.Entity {
|
||||
private debugMode: boolean = false;
|
||||
/** 多键对象池:Map<prefabPath, NodePool> */
|
||||
static pools: Map<string, NodePool> = new Map();
|
||||
|
||||
@@ -57,7 +59,7 @@ export class Skill extends ecs.Entity {
|
||||
const config = SkillSet[s_uuid];
|
||||
|
||||
if (!config) {
|
||||
console.error("[Skill] 技能配置不存在:", s_uuid);
|
||||
mLogger.error(this.debugMode, 'Skill', "[Skill] 技能配置不存在:", s_uuid);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,12 +67,10 @@ export class Skill extends ecs.Entity {
|
||||
const path = `game/skill/atk/${config.sp_name}`;
|
||||
const prefab:Prefab = oops.res.get(path, Prefab);
|
||||
if (!prefab) {
|
||||
console.error("[Skill] 预制体加载失败:", path);
|
||||
mLogger.error(this.debugMode, 'Skill', "[Skill] 预制体加载失败:", path);
|
||||
return;
|
||||
}
|
||||
// console.log("load skill startPos",startPos)
|
||||
const node: Node = instantiate(prefab);
|
||||
// console.log("load skill node",node)
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!.getChildByName("SKILL")!;
|
||||
// 设置节点属性
|
||||
|
||||
@@ -50,7 +50,7 @@ export class SkillView extends CCComp {
|
||||
}
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
mLogger.log(this.debugMode, 'SkillView', "[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
|
||||
// 对象池复用时,需要手动播放默认动画(因为 Play On Load 只在首次生效)
|
||||
@@ -82,7 +82,7 @@ export class SkillView extends CCComp {
|
||||
return;
|
||||
}
|
||||
let model = targetView.ent.get(HeroAttrsComp);
|
||||
// console.log(`[skillView] 碰撞3`, oCol.group, seCol.group, model);
|
||||
mLogger.log(this.debugMode, 'SkillView', `[skillView] 碰撞3`, oCol.group, seCol.group, model);
|
||||
if (!model) return;
|
||||
if (model.is_dead) return;
|
||||
if (this.sData.fac == model.fac) return;
|
||||
|
||||
Reference in New Issue
Block a user