fix(skills): 修正技能预制体锚点并添加调试日志
- 将atk1和atk2技能预制体的锚点y值从0.5改为0 - 在SkillConComp中加载技能时添加uuid为6001时的起始坐标日志输出 - 在Skill加载函数中,uuid为6001时输出加载起始坐标日志 - 在SkillCom组件中,uuid为6001时输出起始位置日志 - 删除HeroPageComp中load_hero函数的实现内容,保留函数体 - 修正Skill加载时节点父级赋值逻辑,确保正确设置父节点
This commit is contained in:
@@ -380,7 +380,7 @@
|
|||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0.5,
|
"x": 0.5,
|
||||||
"y": 0.5
|
"y": 0
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -225,7 +225,7 @@
|
|||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0.5,
|
"x": 0.5,
|
||||||
"y": 0.5
|
"y": 0
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -111,7 +111,9 @@ export class SkillConComp extends CCComp {
|
|||||||
if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) {
|
if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(config.uuid==6001){
|
||||||
|
console.log("[SkillConComp] 技能起始坐标:",this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,this.HeroView.node.position.y + BoxSet.ATK_Y,0)
|
||||||
|
}
|
||||||
skillEntity.load(
|
skillEntity.load(
|
||||||
new Vec3(this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,
|
new Vec3(this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,
|
||||||
this.HeroView.node.position.y + BoxSet.ATK_Y, 0),
|
this.HeroView.node.position.y + BoxSet.ATK_Y, 0),
|
||||||
|
|||||||
@@ -33,18 +33,7 @@ export class HeroPageComp extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
load_hero(uuid:number){
|
load_hero(uuid:number){
|
||||||
// console.log("[HeroPageComp]:load_hero",uuid)
|
|
||||||
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")
|
|
||||||
let path = "game/gui/hcard"
|
|
||||||
const prefab = oops.res.get(path, Prefab);
|
|
||||||
if (!prefab) {
|
|
||||||
console.error("[Skill] 预制体加载失败:", path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const node = instantiate(prefab) as unknown as Node;
|
|
||||||
node.parent = parent;
|
|
||||||
let hcard = node.getComponent(HCardUICom)!;
|
|
||||||
hcard.update_data(uuid,{type:HeroConSet.INFO})
|
|
||||||
}
|
}
|
||||||
clear_heros(){
|
clear_heros(){
|
||||||
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")
|
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")
|
||||||
|
|||||||
@@ -46,15 +46,18 @@ export class Skill extends ecs.Entity {
|
|||||||
|
|
||||||
// 加载预制体
|
// 加载预制体
|
||||||
const path = `game/skills/${config.sp_name}`;
|
const path = `game/skills/${config.sp_name}`;
|
||||||
const prefab = oops.res.get(path, Prefab);
|
const prefab:Prefab = oops.res.get(path, Prefab);
|
||||||
if (!prefab) {
|
if (!prefab) {
|
||||||
console.error("[Skill] 预制体加载失败:", path);
|
console.error("[Skill] 预制体加载失败:", path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(uuid==6001){
|
||||||
|
console.log("load skill startPos",startPos)
|
||||||
|
}
|
||||||
const node = instantiate(prefab);
|
const node = instantiate(prefab);
|
||||||
var scene = smc.map.MapView.scene;
|
var scene = smc.map.MapView.scene;
|
||||||
// 设置节点属性
|
// 设置节点属性
|
||||||
node.parent = scene.entityLayer!.node!;
|
node.parent = parent;
|
||||||
node.setPosition(startPos);
|
node.setPosition(startPos);
|
||||||
if(caster.fac==FacSet.MON){
|
if(caster.fac==FacSet.MON){
|
||||||
node.scale=v3(node.scale.x*-1,1,1)
|
node.scale=v3(node.scale.x*-1,1,1)
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ export class SkillCom extends CCComp {
|
|||||||
this.do_anim()
|
this.do_anim()
|
||||||
break;
|
break;
|
||||||
case AType.fixedStart: //
|
case AType.fixedStart: //
|
||||||
|
if(this.s_uuid==6001){
|
||||||
|
console.log("skillcom startPos",this.startPos)
|
||||||
|
}
|
||||||
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
|
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
|
||||||
this.do_anim()
|
this.do_anim()
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user