|
|
@@ -111,6 +111,7 @@ export default class general_head_info extends cc.Component {
|
|
|
}
|
|
|
/** 移动中 */
|
|
|
private onClickHeadMove(comp_btn) {
|
|
|
+ this.touch_world_pos = comp_btn.getLocation();
|
|
|
// 坐标转换
|
|
|
if (this.node_body) {
|
|
|
const vector = comp_btn.getLocation();
|
|
|
@@ -161,6 +162,14 @@ export default class general_head_info extends cc.Component {
|
|
|
}
|
|
|
/** 加载对应武将原画 */
|
|
|
private addGeneralBody() {
|
|
|
+ const world_pos = this.touch_world_pos;
|
|
|
+ let world_head_pos = this.node.parent.convertToWorldSpaceAR(this.node.getPosition());
|
|
|
+ let new_pos = world_pos.sub(world_head_pos)
|
|
|
+ let pos_len = new_pos.len()
|
|
|
+ if (pos_len >= (this.node.width / 2)) {
|
|
|
+ // 距离过长,则是滑动列表,不做处理
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.p_scroll_list.vertical = false;
|
|
|
// let path = "module/general/texture/hero_img/" + this.general_data.resource;
|
|
|
let path = "spine/person/" + this.general_data.resource;
|
|
|
@@ -174,8 +183,7 @@ export default class general_head_info extends cc.Component {
|
|
|
// 名字
|
|
|
let lbl_general_name = this.node_body.getChildByName('lbl_general_name').getComponent(cc.Label);
|
|
|
lbl_general_name.string = this.general_data.name;
|
|
|
- // 坐标转换
|
|
|
- const world_pos = this.touch_world_pos;//this.node.parent.convertToWorldSpaceAR(this.node.getPosition());
|
|
|
+ // 坐标转换//this.node.parent.convertToWorldSpaceAR(this.node.getPosition());
|
|
|
let node_pos = this.node_p_body.convertToNodeSpaceAR(new cc.Vec2(world_pos.x, world_pos.y));
|
|
|
this.node_body.setPosition(new cc.Vec2(node_pos.x, node_pos.y));
|
|
|
this.node_body.parent = this.node_p_body;
|