清理 老的 没用的组件

This commit is contained in:
2025-08-14 16:39:06 +08:00
parent f539cf9b7b
commit 6adff46fd1
59 changed files with 2145 additions and 52918 deletions

View File

@@ -1,12 +0,0 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/**
* 角色属性数据
*/
@ecs.register('BossModel')
export class BossModelComp extends ecs.Comp {
reset() {
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"fa6157bf-a254-44af-a0c0-5d16f12cd761","files":[],"subMetas":{},"userData":{}}

View File

@@ -1,26 +0,0 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
/** 数据层对象 */
@ecs.register('FriendModel')
export class FriendModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "FriendModel");
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("FriendModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bffcbaf3-0abd-46c9-b297-da0667e9b7f3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,44 +0,0 @@
import { _decorator, Color, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { HeroInfo } from '../common/config/heroSet';
import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { Items } from '../common/config/Items';
import { ColorSet } from '../common/config/BoxSet';
const { ccclass, property } = _decorator;
@ccclass('HChipComp')
export class HChipComp extends Component {
h_uuid:number=0
num:number=0
lv:number=0
start() {
}
update(deltaTime: number) {
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2});
}
update_data(uuid:number,num:number=0){
this.h_uuid = uuid;
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
if(num > 1){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
}
this.node.getChildByName("g1").active=HeroInfo[uuid].quality==1
this.node.getChildByName("g2").active=HeroInfo[uuid].quality==2
this.node.getChildByName("g3").active=HeroInfo[uuid].quality==3
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "dc8e3ce8-1ced-41ab-bbf6-72310977465a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -7,8 +7,6 @@ import { HeroViewComp } from "./HeroViewComp";
import { BoxSet, FacSet } from "../common/config/BoxSet";
import { HeroInfo, HeroPos, HType } from "../common/config/heroSet";
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
import { FriendModelComp } from "./FriendModel";
import { MasterModelComp } from "./MasterModel";
import { GameEvent } from "../common/config/GameEvent";
import { BuffAttr, getBuffNum, SkillSet } from "../common/config/SkillSet";
import { FightSet } from "../common/config/Mission";
@@ -30,12 +28,8 @@ export class Hero extends ecs.Entity {
destroy(): void {
this.remove(HeroViewComp);
this.remove(HeroModelComp);
if(this.get(FriendModelComp)){
this.remove(FriendModelComp);
}
if(this.get(MasterModelComp)){
this.remove(MasterModelComp);
}
super.destroy();
}
@@ -56,7 +50,6 @@ export class Hero extends ecs.Entity {
// console.log("hero load",pos)
var hv = this.hero_init(uuid,node,info)
this.add(hv);
this.addComponents<ecs.Comp>(MasterModelComp)
oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid})
const move = this.get(BattleMoveComp);
move.direction = 1; // 向右移动

View File

@@ -1,26 +0,0 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
/** 数据层对象 */
@ecs.register('MasterModel')
export class MasterModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "MasterModel");
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("MasterModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8b5cf0cb-bab1-4084-bfe5-21fc74914b2f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,45 +0,0 @@
import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { SkillSet } from '../common/config/SkillSet';
import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { Items } from '../common/config/Items';
const { ccclass, property } = _decorator;
@ccclass('SChipComp')
export class SChipComp extends Component {
h_uuid:number=0
num:number=0
lv:number=0
start() {
}
update(deltaTime: number) {
}
show_info(){
if(this.node.parent.name=="reward") return
oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:1});
}
update_data(uuid:number,num:number=0){
this.h_uuid = uuid;
if(num > 0){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
}
if(uuid == 0){ return;}
var icon_path = "game/heros/cards"
// console.log("update_data",SkillSet[uuid].path)
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("skill").getChildByName("icon").getComponent(Sprite);
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"f653e13a-d17c-4f62-808a-1e95a4df5327","files":[],"subMetas":{},"userData":{}}

View File

@@ -11,7 +11,6 @@ import { CCComp } from 'db://oops-framework/module/common/CCComp';
import { MonModelComp } from './MonModelComp';
import { HeroModelComp } from './HeroModelComp';
import { FightSet } from '../common/config/Mission';
import { MasterModelComp } from './MasterModel';
const { ccclass, property } = _decorator;
@ccclass('SkillCon')
@@ -21,23 +20,12 @@ export class SkillConComp extends CCComp {
HeroEntity:any=null;
skill_cd=0
private _timers: { [key: string]: number } = {};
private _damageQueue: Array<{ timer: number; callback: () => void }> = [];
aoe_queues:any[]=[] // 范围伤害技能执行队列
private aoe_timers: Map<number, number> = new Map(); // 每个技能的独立计时器
private readonly AOE_INTERVAL: number = 0.4; // 执行间隔,单位秒
private skill_id_counter: number = 0; // 技能ID计数器
aoe_target_pos:Vec3=new Vec3(180,40,0)
init(): void {
this.on(GameEvent.FightEnd, this.clear_timer, this);
}
onLoad(){
this.HeroView=this.node.getComponent(HeroViewComp)
// //console.log(this.HeroView.uid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
}
start() {
@@ -60,34 +48,6 @@ export class SkillConComp extends CCComp {
}
}
if (this.aoe_queues.length > 0) {
//console.log("[FightConComp]:aoe_queues:",this.aoe_queues)
// 遍历所有必杀技技能,更新它们的计时器
for (let i = this.aoe_queues.length - 1; i >= 0; i--) {
let skill = this.aoe_queues[i];
let timer = this.aoe_timers.get(skill.id) || 0;
timer += dt;
this.aoe_timers.set(skill.id, timer);
// 检查是否到达执行间隔
if (timer >= this.AOE_INTERVAL) {
// 重置计时器
this.aoe_timers.set(skill.id, 0);
// 执行技能
this.aoe_skill_execute(skill);
skill.count--;
// 如果技能执行完毕,从队列中移除
if (skill.count <= 0) {
this.aoe_queues.splice(i, 1);
this.aoe_timers.delete(skill.id);
}
}
}
}
}
@@ -211,42 +171,7 @@ export class SkillConComp extends CCComp {
return pos
}
private aoe_skill_execute(data:any){
let skill=ecs.getEntity<Skill>(Skill)
let master = ecs.query(ecs.allOf(MasterModelComp))
// 检查必要参数
if (!master || master.length === 0) {
console.error("[FightConComp] 未找到主角实体");
return;
}
let masterView = master[0].get(HeroViewComp);
if (!masterView) {
console.error("[FightConComp] 主角视图组件获取失败");
return;
}
let angle=0
let targets = this.pickRandomTarget(data.count)
let target_pos= new Vec3(0,0,0)
if(targets.length==0){
target_pos=this.aoe_target_pos
}else{
target_pos= new Vec3(targets[0].get(HeroViewComp).node.position.x,0,0)
}
let start_pos=new Vec3(-280,50,0)
// //console.log("[Skill]:node=>",start_pos)
skill.load(
start_pos,
this.node.parent,
data.s_uuid,
target_pos,
masterView,
angle,
data.damage
);
}
/** 随机选择目标 */
private pickRandomTarget(count: number): ecs.Entity[] {
@@ -276,9 +201,6 @@ export class SkillConComp extends CCComp {
reset() {
this.clear_timer();
this.aoe_queues = [] // 清空技能队列
this.aoe_timers = new Map(); // 重置计时器
this.skill_id_counter = 0; // 重置技能ID计数器
}
onDestroy() {

View File

@@ -1,19 +0,0 @@
import { _decorator, Component, Node, sp } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('UiHeroComp')
export class UiHeroComp extends Component {
h_uuid:number=0
start() {
var spine = this.node.getChildByName("anm").getComponent('sp.Skeleton') as sp.Skeleton;
spine.setAnimation(0, 'Idle', true);
}
to_destroy(){
this.node.destroy()
}
update(deltaTime: number) {
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "44ef2827-b6e4-45fd-b3c2-9f8562884b81",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,16 +0,0 @@
import { _decorator, Component, Node, sp } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('idleComp')
export class idleComp extends Component {
start() {
var spine = this.node.getChildByName("anm").getComponent('sp.Skeleton') as sp.Skeleton;
spine.setAnimation(0, 'Idle', true);
}
update(deltaTime: number) {
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "3fc03a0b-a210-4f3e-8f82-e98a4c1d9b34",
"files": [],
"subMetas": {},
"userData": {}
}