清理之前文件 + 再次取消碰撞检测

This commit is contained in:
2025-03-27 12:15:02 +08:00
parent 63e182e214
commit 3a15541170
33 changed files with 220 additions and 1130 deletions

View File

@@ -14,11 +14,7 @@ const { ccclass, property } = _decorator;
@ccclass('Main')
export class Main extends Root {
start() {
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
EPhysics2DDrawFlags.Pair |
EPhysics2DDrawFlags.CenterOfMass |
EPhysics2DDrawFlags.Joint |
EPhysics2DDrawFlags.Shape;
}
protected async run() {
smc.initialize = ecs.getEntity<Initialize>(Initialize);

View File

@@ -51,6 +51,8 @@ export enum endType {
animationEnd = 0,
timeEnd = 1,
distanceEnd = 2,
collision = 3,
countEnd = 4,
}
/*
path: 图片地址
@@ -76,16 +78,16 @@ info:技能描述
*/
export const SkillSet = {
6001:{uuid:6001,name:"凛冬之触",sp_name:"ball_blue",path:"6001",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"},
6002:{uuid:6002,name:"烈焰之怒",sp_name:"ball_blue",path:"6002",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放火焰弹,造成100%攻击的伤害"},
6003:{uuid:6003,name:"奥术冲击",sp_name:"ball_blue",path:"6003",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放魔法弹,造成100%攻击的伤害"},
6004:{uuid:6004,name:"神圣裁决",sp_name:"ball_blue",path:"6004",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放圣光弹,造成100%攻击的伤害"},
6005:{uuid:6005,name:"破空斩击",sp_name:"ball_blue",path:"6005",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:50,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"攻击前方直线100码内的敌人造成50%伤害"},
6006:{uuid:6006,name:"穿心箭矢",sp_name:"ball_blue",path:"6006",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放箭矢,造成100%攻击的伤害"},
6007:{uuid:6007,name:"铁斧打击",sp_name:"ball_blue",path:"6007",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出铁斧,造成100%攻击的伤害"},
6008:{uuid:6008,name:"木棍打击",sp_name:"ball_blue",path:"6008",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出木棍,造成100%攻击的伤害"},
6009:{uuid:6009,name:"飞刀打击",sp_name:"ball_blue",path:"6009",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出飞刀,造成100%攻击的伤害"},
6010:{uuid:6010,name:"石斧打击",sp_name:"ball_blue",path:"6010",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:2,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出石斧,造成100%攻击的伤害"},
6001:{uuid:6001,name:"凛冬之触",sp_name:"ball_blue",path:"6001",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"},
6002:{uuid:6002,name:"烈焰之怒",sp_name:"ball_red",path:"6002",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放火焰弹,造成100%攻击的伤害"},
6003:{uuid:6003,name:"奥术冲击",sp_name:"ball_green",path:"6003",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放魔法弹,造成100%攻击的伤害"},
6004:{uuid:6004,name:"神圣裁决",sp_name:"ball_yellow",path:"6004",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放圣光弹,造成100%攻击的伤害"},
6005:{uuid:6005,name:"破空斩击",sp_name:"patk",path:"6005",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:50,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"攻击前方直线100码内的敌人造成50%伤害"},
6006:{uuid:6006,name:"穿心箭矢",sp_name:"arrow",path:"6006",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人释放箭矢,造成100%攻击的伤害"},
6007:{uuid:6007,name:"铁斧打击",sp_name:"mon_ft",path:"6007",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出铁斧,造成100%攻击的伤害"},
6008:{uuid:6008,name:"木棍打击",sp_name:"mon_ly",path:"6008",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出木棍,造成100%攻击的伤害"},
6009:{uuid:6009,name:"飞刀打击",sp_name:"mon_xd",path:"6009",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出飞刀,造成100%攻击的伤害"},
6010:{uuid:6010,name:"石斧打击",sp_name:"mon_sf",path:"6010",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"向最前方敌人扔出石斧,造成100%攻击的伤害"},
6011:{uuid:6011,name:"烈火呼吸",sp_name:"firequan",path:"6011",TargetType:1,TargetGroup:3,act:"max",CdType:2,AnimType:0,endType:1,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:3,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:0.5,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"召唤烈焰攻击前方敌人,造成200%攻击的伤害,烈焰维持3秒"},
6012:{uuid:6012,name:"大火球" ,sp_name:"fire",path:"6012",TargetType:1,TargetGroup:3,act:"max",CdType:2,AnimType:0,endType:1,fname:"max",flash:false,with:50,debuff:2,depb:20,debtime:2,derate:100,in:1,count:1,def:0,apup:0,ap:300,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧"},
6013:{uuid:6013,name:"火墙", sp_name:"firewall",path:"6013",TargetType:1,TargetGroup:3,act:"max",CdType:2,AnimType:4,endType:1,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:10,count:1,def:0,apup:0,ap:50,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:300,sonsk:0,hero:0,info:"在最前方敌人位置,召唤一堵火墙,持续10秒,每秒造成50%攻击伤害"},

View File

@@ -19,9 +19,9 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
if (!move.moving) return;
// 检测攻击范围内是否有敌人
// 检测友方碰撞和敌方攻击范围
const alliesStop = this.checkAlliesInProximity(e);
// const alliesStop = this.checkAlliesInProximity(e);
const enemiesStop = this.checkEnemiesInRange(e, view.dis);
const shouldStop = alliesStop || enemiesStop;
const shouldStop = enemiesStop;
view.is_atking = shouldStop;
// 同步状态
@@ -96,15 +96,15 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
}
// 获取前一个单位uuid比当前小的最近单位
const prevUnit = sortedAllies[currentIndex - 1];
const prevView = prevUnit.get(HeroViewComp);
const distToPrev = Math.abs(currentPos.x - prevView.node.position.x);
// const prevUnit = sortedAllies[currentIndex - 1];
// const prevView = prevUnit.get(HeroViewComp);
// const distToPrev = Math.abs(currentPos.x - prevView.node.position.x);
// 如果与前一个单位距离小于安全距离,则停止
if (distToPrev < SAFE_DISTANCE) {
current.is_stop_temp = true;
return true;
}
// if (distToPrev < SAFE_DISTANCE) {
// current.is_stop_temp = true;
// return true;
// }
// 如果与前一个单位距离大于安全距离,则移动
current.is_stop_temp = false;

View File

@@ -91,29 +91,29 @@ export class HeroViewComp extends CCComp {
this.as = this.getComponent(HeroSpine);
// 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
// console.log("hero collider ",this.scale,collider);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
this.rigid = this.getComponent(RigidBody2D);
if(this.rigid.sleep){
console.log("hero rigid sleep ",this.scale,this.rigid);
this.rigid.wakeUp();
}
// let collider = this.getComponent(Collider2D);
// collider.group = this.box_group;
// // console.log("hero collider ",this.scale,collider);
// if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
// collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
// // collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
// }
// this.rigid = this.getComponent(RigidBody2D);
// if(this.rigid.sleep){
// console.log("hero rigid sleep ",this.scale,this.rigid);
// this.rigid.wakeUp();
// }
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
console.log("碰撞开始 ",this.scale,seCol,oCol);
// onBeginContact (seCol: Collider2D, oCol: Collider2D) {
// console.log("碰撞开始 ",this.scale,seCol,oCol);
}
onEndContact (seCol: Collider2D, oCol: Collider2D) { console.log("碰撞结束 ",this.scale,seCol,oCol);}
onPreSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞预处理 ",this.scale,seCol,oCol);}
onPostSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞后处理 ",this.scale,seCol,oCol); }
// }
// onEndContact (seCol: Collider2D, oCol: Collider2D) { console.log("碰撞结束 ",this.scale,seCol,oCol);}
// onPreSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞预处理 ",this.scale,seCol,oCol);}
// onPostSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞后处理 ",this.scale,seCol,oCol); }
/** 视图层逻辑代码分离演示 */
start () {

View File

@@ -1,42 +0,0 @@
import { _decorator,NodeEventType,EventTouch } 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('CsuoComp')
@ecs.register('Csuo', false)
export class CsuoComp extends CCComp {
protected onLoad() {
// this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
}
onTouch() {
}
onOk(){
this.node.active=false;
}
oncancel(){
}
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bcd8a069-5208-4be1-8c8e-2cedddb3860a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,155 +0,0 @@
import { _decorator,Button,color,EventHandler,EventTouch,instantiate,Label,NodeEventType,Prefab,ProgressBar,resources,Sprite,SpriteAtlas,tween,UITransform,v3 } 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 { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { SkillSet } from "../common/config/SkillSet";
import { getUpChipByLv, getUpGoldByRange, LvUp, SlvUp, UpGold } from "../common/config/RoleSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('HeroHomeComp')
@ecs.register('HeroHome', false)
export class HeroHomeComp extends CCComp {
h_uuid:number=0
role:any=null
hero:any=null
gold_need:number=9999
chip_need:number=9999
slv:number=0
protected onLoad(): void {
}
start() {
// this.load_talents()
console.log("hero_home start")
// this.h_uuid=5001
// this.hero_show(this.h_uuid)
this.loads()
this.node.getChildByName("show").active=false
}
loads(){
let hc:number =HeroList.length
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
parent.getComponent(UITransform).setContentSize(hc*185,230)
// console.log("hc",hc,parent.getComponent(UITransform))
console.log("parent",parent)
}
hero_show(uuid:number) {
this.node.getChildByName("show").active=true
this.h_uuid=uuid
this.hero=HeroInfo[uuid]
console.log("hero_show",uuid)
// let skill1 = SkillSet[this.hero.skill[0]]
// let skill2 = SkillSet[this.hero.skill[1]]
// var sk_path = "game/skills/skill_icon"
// var icon_path = "game/heros/herois"
let content=this.node.getChildByName("show").getChildByName("content")
content.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
content.getChildByName("name").getChildByName("g1").active=HeroInfo[uuid].quality==1
content.getChildByName("name").getChildByName("g2").active=HeroInfo[uuid].quality==2
content.getChildByName("name").getChildByName("g3").active=HeroInfo[uuid].quality==3
this.clear_hero()
this.call_hero(uuid)
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = content.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(this.hero.path);
// });
// resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = content.getChildByName("bottom").getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(skill1.path);
// });
// content.getChildByName("bottom").getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
// content.getChildByName("bottom").getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
// resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = content.getChildByName("bottom").getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(skill2.path);
// });
// content.getChildByName("bottom").getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
// content.getChildByName("bottom").getChildByName("sk2").getChildByName("info").getComponent(Label).string = skill2.info;
// tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0]
// tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1]
// tal.getChildByName("slv3").getChildByName("val").getComponent(Label).string = this.hero.tals[2]
// tal.getChildByName("slv4").getChildByName("val").getComponent(Label).string = this.hero.tals[3]
// tal.getChildByName("slv5").getChildByName("val").getComponent(Label).string = this.hero.tals[4]
this.update_data()
}
update_data(){
let content=this.node.getChildByName("show").getChildByName("content")
// let slv_node=content.getChildByName("name").getChildByName("slv");
// let slvup=content.getChildByName("slvup");
let attr = content.getChildByName("attr");
// slv_node.getChildByName("slv").getComponent(Label).string = smc.heros[uuid].slv.toString();
// content.getChildByName("name").getChildByName("quality").getChildByName("q1").active = this.hero.quality == 1;
// content.getChildByName("name").getChildByName("quality").getChildByName("q2").active = this.hero.quality == 2;
// content.getChildByName("name").getChildByName("quality").getChildByName("q3").active = this.hero.quality == 3;
// content.getChildByName("name").getChildByName("quality").getChildByName("k1").active = this.hero.kind == 1;
// content.getChildByName("name").getChildByName("quality").getChildByName("k2").active = this.hero.kind == 2;
// content.getChildByName("name").getChildByName("quality").getChildByName("k3").active = this.hero.kind == 3;
// lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*smc.heros[uuid].lv).toString()
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = this.hero.ap.toFixed(0).toString()
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = this.hero.hp.toFixed(0).toString()
attr.getChildByName("acd").getChildByName("val").getComponent(Label).string = this.hero.a_cd
attr.getChildByName("speed").getChildByName("val").getComponent(Label).string = this.hero.speed
attr.getChildByName("dis").getChildByName("val").getComponent(Label).string = this.hero.dis
oops.message.dispatchEvent("hero_card_update_info",{uuid:this.h_uuid})
}
lv_selcet(e:any,val:any){
}
call_hero(uuid:number){
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = this.node.getChildByName("show").getChildByName("content").getChildByName("hero").getChildByName("node")
}
clear_hero(){
this.node.getChildByName("show").getChildByName("content").getChildByName("hero").getChildByName("node").destroyAllChildren()
}
pre_hero(){
let hi= HeroList.indexOf(this.h_uuid)
if(hi==0){
oops.gui.toast("已经是第一个英雄");
return
}
this.h_uuid=HeroList[hi-1]
this.hero_show(this.h_uuid)
}
next_hero(){
let hi= HeroList.indexOf(this.h_uuid)
if(hi==HeroList.length-1){
oops.gui.toast("已经是最后一个英雄");
return
}
this.h_uuid=HeroList[hi+1]
this.hero_show(this.h_uuid)
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
}
close_show(){
this.node.getChildByName("show").active=false
}
close(){
this.node.active=false
}
reset() {
this.node.destroy();
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"f830455e-1cb8-4379-b382-6de74c383166","files":[],"subMetas":{},"userData":{}}

View File

@@ -1,142 +0,0 @@
import { _decorator, instantiate, Prefab ,Node, Label, Sprite, resources, SpriteAtlas, v3} 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { Item } from "./Item";
import { Items } from "../common/config/Items";
import { HChipComp } from "../hero/HChipComp";
import { BoxDrop } from "../common/config/RewardSet";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { SChipComp } from "../hero/SChipComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('LuckHomeCompComp')
@ecs.register('LuckHomeComp', false)
export class LuckHomeCompComp extends CCComp {
@property({ type: Node })
sbn: Node = null;
@property({ type: Node })
mbn: Node | null = null;
@property({ type: Node })
lbn: Node | null = null;
@property({ type: Node })
btnno: Node | null = null;
@property({ type: Node })
itmes: Node | null = null;
selected: string = "";
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
// this.frist();
}
frist(){
this.colse_reward()
}
open_sb() {
smc.vmdata.box.num--;
this.open_reward()
this.get_reward(1)
}
open_mb() {
if (smc.vmdata.box.num < 5) {oops.gui.toast("宝箱数量不足");return;}
smc.vmdata.box.num=smc.vmdata.box.num-5;
this.open_reward()
for (let x = 0; x < 5; x++) {
this.get_reward(2)
}
}
open_lb() {
if (smc.vmdata.box.num < 15) {oops.gui.toast("宝箱数量不足");return;}
smc.vmdata.box.num=smc.vmdata.box.num-15;
this.open_reward()
for (let x = 0; x < 15; x++) {
this.get_reward(2)
}
}
colse_reward() {
this.node.getChildByName("reward").setScale(0,0,0);
this.node.getChildByName("reward").getChildByName("items").removeAllChildren();
}
open_reward() {
this.node.getChildByName("reward").setScale(1,1,1);
}
get_reward(reward:number){
console.log("get_reward",reward)
let list =BoxDrop[reward];
let uuid= 0
let num =1
let i=0
while (uuid==0) {
for (let x = 0; x < list.length; x++) {
let rate = Math.random()*100
if(rate < list[x].dropRate){
uuid=list[x].uuid;
num =RandomManager.instance.getRandomInt(list[x].num_max/2,list[x].num_max);
break;
}
}
i++;
}
switch(reward){
}
}
show_hero_chip(uuid:number,num:number){
console.log("show_hero_chip",uuid,num)
let path = "game/gui/hchip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
let hc= node.getComponent(HChipComp)
hc.update_data(uuid,num)
node.parent = this.node.getChildByName("reward").getChildByName("items");
}
show_item(uuid:number,num:number){
var path = "game/gui/item";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let ic= node.getComponent(ItemComp)
ic.update_data(uuid,num)
node.parent = this.node.getChildByName("reward").getChildByName("items");
}
show_skill_chip(uuid:number,num:number){
let path = "game/gui/schip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
let sc= node.getComponent(SChipComp)
sc.update_data(uuid,num)
node.parent = this.node.getChildByName("reward").getChildByName("items");
}
show_bbox() {
var parent = this.node.getChildByName("bbox")
var path = "game/gui/bbox";
var prefab: Prefab = oops.res.get(path, Prefab)!;
let box = instantiate(prefab);
box.parent = parent;
parent.getChildByName("light").active = true;
this.scheduleOnce(()=>{
parent.getChildByName("light").active = false;
}, 0.5)
this.scheduleOnce(()=>{
box.destroy();
}, 0.7)
}
to_open(){
if(this.selected==""){return;}
switch(this.selected){
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "461697d5-ffa2-4577-8e33-2c329f3410b5",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,46 +0,0 @@
import { _decorator ,Vec3,v3, Prefab, instantiate,Node} 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 { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { BoxSet, GameSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { MapViewScene } from "./view/MapViewScene";
import { MissionSet,MissionNum,MonsetList, BossList } from "../common/config/MissionSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { Hero } from "../hero/Hero";
import { HeroModelComp } from "../hero/HeroModelComp";
import { Boss} from "../Boss/Boss";
import { UIID } from "../common/config/GameUIConfig";
import { Talents } from "../common/config/TalentSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroSet } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MapMonsterComp')
@ecs.register('MapMonster', false)
export class MapMonsterComp extends CCComp {
onLoad(){
// 监听全局事件
}
start() {
}
protected update(dt: number): void {
}
/** 视图层逻辑代码分离演示 */
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "c0f2f76a-7c1b-4e8c-a0a3-b201f5a86f7e",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,64 +0,0 @@
import { _decorator ,v3,Prefab,instantiate,Node} 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { BoxSet } from "../common/config/BoxSet";
import { MapViewScene } from "./view/MapViewScene";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MapSkillComp')
@ecs.register('MapSkill', false)
export class MapSkillComp extends CCComp {
// scene: MapViewScene = null;
@property(Prefab)
light: Prefab = null;
onLoad(){
oops.message.on("monster_load", this.doMonsterLoad, this);
oops.message.on("hero_load", this.doHeroLoad, this);
oops.message.on("do_use_skill", this.doSkill, this);
oops.message.on("do_use_item", this.useItem, this);
}
doSkill(event: string, args: any){
this.addCSkill(args.uuid);
}
addSkill(){
}
addCSkill(uuid:number=1001,args:any=null){
}
doMonsterLoad(){
// const light = instantiate(this.light);
// light.setPosition(BoxSet.MONSTER_START,BoxSet.GAME_LINE);
// this.node.addChild(light);
}
doHeroLoad(){
// const light = instantiate(this.light);
// light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
// this.node.addChild(light);
}
useItem(event: string, args: any){
console.log("useItem");
}
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b7739951-194b-4d13-8bff-cd7f7a0b3bbf",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -17,10 +17,10 @@ const { ccclass, property } = _decorator;
export class MissionHeroCompComp extends CCComp {
timer:Timer=new Timer(2)
onLoad(){
// this.on(GameEvent.UserHeroCard,this.call_hero,this)
this.on(GameEvent.UserHeroCard,this.call_hero,this)
}
start() {
this.test_call()
// this.test_call()
}
protected update(dt: number): void {
if(smc.mission.status != 1) return

View File

@@ -7,6 +7,7 @@ import { HeroSet } from "../common/config/heroSet";
import { Missions } from "../common/config/MissionSet";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
@@ -19,12 +20,14 @@ export class MissionMonCompComp extends CCComp {
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.test_call()
// this.test_call()
}
protected update(dt: number): void {
// if(this.timer.update(dt)){
// this.mon_refresh()
// }
if(!smc.mission.play||smc.mission.pause) return
if(this.timer.update(dt)){
this.mon_refresh()
}
}
test_call(){
this.addMonster(5202,0,true)

View File

@@ -1,38 +0,0 @@
import { _decorator } 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('RewardsComp')
@ecs.register('Rewards', false)
export class RewardsComp extends CCComp {
reward_lv = 1;
onLoad(){
// 监听全局事件
oops.message.on("do_reward", this.do_reward, this);
}
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
do_reward(){
this.node.active = true;
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "df8725c7-a5e8-4dfd-b357-59fb88b68283",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,32 +0,0 @@
import { _decorator, instantiate, Prefab, UITransform } 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
import { Item } from "./Item";
import { smc } from "../common/SingletonModuleComp";
import { RewardComp } from "./RewardComp";
import { SChipComp } from "../hero/SChipComp";
import { HChipComp } from "../hero/HChipComp";
import { Goods } from "./Goods";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ShopHomeComp')
@ecs.register('ShopHomeComp', false)
export class ShopHomeComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
this.get_items();
}
get_items(){
let goodsnode = this.node.getChildByName("goods").getChildByName("view").getChildByName("content")
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "08123a0b-18dd-4dcb-8f8b-17664ff1ec67",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,35 +0,0 @@
import { _decorator, UITransform } 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 { MSklist } from "../common/config/SkillSet";
import { MSCard } from "./MSCard";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('SkillHomeComp')
@ecs.register('SkillHome', false)
export class SkillHomeComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.load_skill_card()
}
load_skill_card(){
let ms_num:number =MSklist.length
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
let height=ms_num*135
parent.getComponent(UITransform).height=height
for (let i = 0; i < ms_num; i++) {
let msc =ecs.getEntity<MSCard>(MSCard)
msc.load(MSklist[i],parent,1)
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "cf5847e5-a4d7-4a84-8064-024371ea2125",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,24 +0,0 @@
import { _decorator, Component, Node ,director,game} from 'cc';
import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops';
const { ccclass, property } = _decorator;
@ccclass('unlock')
export class unlockComp extends Component {
start() {
}
doCancel() {
this.node.active = false
}
doActive() {
this.node.active = true
}
update(deltaTime: number) {
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "3a67f9d9-8df3-4cfc-955d-1a8b1c30b2e8",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,4 +1,4 @@
import { Node, Vec3 } from "cc";
import { Node, UI, UITransform, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { HeroViewComp } from "../hero/HeroViewComp";
import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
@@ -47,11 +47,11 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
const targets = this.selectEnemyTargets(caster, config);
if (targets.length === 0) return;
skillEntity.load(
view.node.position, // 起始位置
new Vec3(view.node.position.x, view.node.position.y+view.node.getComponent(UITransform).contentSize.height/2, 0), // 起始位置
view.box_group, // 阵营
view.node.parent, // 父节点
config.uuid, // 技能ID
targets[0]?.get(HeroViewComp).node.position, // 目标位置
new Vec3(targets[0]?.get(HeroViewComp).node.position.x, targets[0]?.get(HeroViewComp).node.position.y, 0), // 目标位置
targets[0]?.get(HeroViewComp),
view
);

View File

@@ -2,7 +2,7 @@ import { Node, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroSkillsComp } from "./heroSkillsComp";
import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
import { endType, SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
import { CdType } from "../common/config/SkillSet";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
@@ -32,7 +32,7 @@ export class SkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
if(skill.atk_count < 1){
skill.atk_count++;
// console.log("技能命中目标",skill.caster,skill.target,SkillSet[skill.s_uuid]);
this.applySkillEffect(skill.caster,skill.target,SkillSet[skill.s_uuid]);
this.applySkillEffect(skill.caster,skill.target,SkillSet[skill.s_uuid],e);
}
}
this.processDamageQueue();
@@ -56,14 +56,14 @@ export class SkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
// 根据技能配置获取判定范围
const config = SkillSet[skill.s_uuid];
const rangeX = config?.rangeX || 20; // 默认值为10
const rangeY = config?.rangeY || 20;
const rangeY = config?.rangeY || 30;
const distanceX = Math.abs(targetPos.x - skillPos.x);
const distanceY = Math.abs(targetPos.y - skillPos.y);
const distanceY = Math.abs(targetPos.y+40 - skillPos.y);
const isInRange = distanceX < rangeX && distanceY < rangeY;
return isInRange;
}
/** 应用技能效果 */
private applySkillEffect(casterView:HeroViewComp, targetView: HeroViewComp, config: typeof SkillSet[keyof typeof SkillSet]) {
private applySkillEffect(casterView:HeroViewComp, targetView: HeroViewComp, config: typeof SkillSet[keyof typeof SkillSet],e:ecs.Entity) {
// 直接计算伤害(包含防御减免)
const damageResult = this.calculateDamage(casterView, targetView, config);
// 将施法者传入applyDamage方法
@@ -71,6 +71,9 @@ export class SkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
// 播放技能特效
casterView.playSkillEffect(config.uuid);
console.log(`${casterView.hero_name}${targetView.hero_name} 造成 ${damageResult.value}伤害`);
if(config.endType === endType.collision){
e.destroy();
}
}
private calculateDamage(caster: HeroViewComp, target: HeroViewComp, config: typeof SkillSet[keyof typeof SkillSet]) {

View File

@@ -56,6 +56,11 @@ export class Skill extends ecs.Entity {
skillComp.caster = caster;
skillComp.prefabName = config.sp_name;
skillComp.group = group;
if(group==BoxSet.HERO){
skillComp.fac=0;
}else{
skillComp.fac=1;
}
console.log(config.sp_name+"技能配置",skillComp);
// 初始化动画名称
skillComp.animName = config.animName; // 从配置获取动画名称

View File

@@ -33,7 +33,8 @@ export class SkillCom extends CCComp {
duration: number = 0; // 技能持续时间
prefabName: string = ""; // 预制体名称
animName: string = "";
group:number = 0; //阵营
group:number = 0; //阵营
fac:number=0; //阵营
rigid:RigidBody2D=null!; // 动画名称
target:any=null;
caster:any=null;
@@ -46,24 +47,24 @@ export class SkillCom extends CCComp {
start() {
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active = true;
let collider = this.getComponent(Collider2D);
console.log(this.group +"技能 collider ",collider);
collider.group = this.group;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// let collider = this.getComponent(Collider2D);
// console.log(this.group +"技能 collider ",collider);
// collider.group = this.group;
// if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
this.rigid = this.getComponent(RigidBody2D);
if(this.rigid.sleep){
console.log(this.scale+"技能 rigid sleep ",this.rigid);
this.rigid.wakeUp();
}
// }
// this.rigid = this.getComponent(RigidBody2D);
// if(this.rigid.sleep){
// console.log(this.scale+"技能 rigid sleep ",this.rigid);
// this.rigid.wakeUp();
// }
// 根据动画类型开始相应的运动
this.startMovement();
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
console.log(this.scale+"碰撞开始 ",seCol,oCol);
}
// onBeginContact (seCol: Collider2D, oCol: Collider2D) {
// console.log(this.scale+"碰撞开始 ",seCol,oCol);
// }