fix:1、修复bug。2、删除json表,改为配置加载
This commit is contained in:
@@ -406,7 +406,7 @@ namespace IgnoreOPS
|
||||
private float select_glist_y;
|
||||
public void TouchClickPoint(string name)
|
||||
{
|
||||
// Debug.Log("TouchClickPoint" + name);
|
||||
Debug.Log("TouchClickPoint" + name);
|
||||
if (name == null) return;
|
||||
if (name == "flyBtn")
|
||||
{
|
||||
@@ -542,8 +542,83 @@ namespace IgnoreOPS
|
||||
}
|
||||
|
||||
}
|
||||
// else if (btn_array[i] is GImage)
|
||||
// {
|
||||
// GImage temp = btn_array[i] as GImage;
|
||||
// if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
|
||||
// fguiScreenPos.x <= temp.position.x + temp.width &&
|
||||
// temp.position.y <= fguiScreenPos.y &&
|
||||
// fguiScreenPos.y <= temp.position.y + temp.height)
|
||||
// {
|
||||
// if (temp.onClick != null)
|
||||
// {
|
||||
// // 触发图片的点击事件
|
||||
// Debug.Log("TouchClickPoint 点击了图片: " + temp.name);
|
||||
// temp.DispatchEvent("click");
|
||||
// goto EndLoop;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
else if (btn_array[i] is GComponent)
|
||||
{
|
||||
GComponent com = btn_array[i] as GComponent;
|
||||
|
||||
// 如果是 view_container_parent,专门处理它的子节点
|
||||
if (com.name == "view_container_parent")
|
||||
{
|
||||
Debug.Log($"TouchClickPoint 点击了组件 com.name: {com.name}");
|
||||
var children = com.GetChildren();
|
||||
Debug.Log($"TouchClickPoint 子组件数量: {children.Length}");
|
||||
for (int k = children.Length - 1; k >= 0; k--)
|
||||
{
|
||||
if (children[k] is GComponent childCom)
|
||||
{
|
||||
// 检测子组件是否为箭头
|
||||
Debug.Log($"TouchClickPoint childCom.name: {childCom.name}");
|
||||
|
||||
var childrens = childCom.GetChildren();
|
||||
Debug.Log($"TouchClickPoint 子子组件数量: {childrens.Length}");
|
||||
for (int l = childrens.Length - 1; l >= 0; l--)
|
||||
{
|
||||
if (childrens[l] is GComponent childComs)
|
||||
{
|
||||
if (childComs.name.StartsWith("Arrow_") &&
|
||||
childComs.onStage && childComs.visible)
|
||||
{
|
||||
// 在检测逻辑中添加调试日志
|
||||
Debug.Log($"箭头名称: {childComs.name}");
|
||||
Debug.Log($"箭头局部坐标: {childComs.position}");
|
||||
Debug.Log($"点击屏幕坐标: {fguiScreenPos}");
|
||||
Debug.Log($"箭头尺寸: {childComs.width} x {childComs.height}");
|
||||
|
||||
Debug.Log($"TouchClickPoint childComs.name: {childComs.name}");
|
||||
|
||||
// 将箭头的局部坐标转换为屏幕坐标(考虑容器拖动和缩放)
|
||||
Vector2 arrowScreenPos = childComs.LocalToGlobal(Vector2.zero);
|
||||
Debug.Log($"箭头屏幕坐标: {arrowScreenPos}");
|
||||
// 考虑缩放后的实际尺寸
|
||||
float actualWidth = childComs.width * childComs.scaleX;
|
||||
float actualHeight = childComs.height * childComs.scaleY;
|
||||
|
||||
// 中心点锚点的位置检测
|
||||
if ((arrowScreenPos.x - actualWidth/2) <= fguiScreenPos.x &&
|
||||
fguiScreenPos.x <= (arrowScreenPos.x + actualWidth/2) &&
|
||||
(arrowScreenPos.y - actualHeight/2) <= fguiScreenPos.y &&
|
||||
fguiScreenPos.y <= (arrowScreenPos.y + actualHeight/2)) {
|
||||
Debug.Log("TouchClickPoint 点击了箭头: " + childComs.name);
|
||||
childComs.DispatchEvent("OnClick");
|
||||
goto EndLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var child_btn_array = btn_array[i].asCom.GetChildren(); //嵌套的com
|
||||
|
||||
for (int j = child_btn_array.Length - 1; j >= 0; j--)
|
||||
@@ -577,9 +652,10 @@ namespace IgnoreOPS
|
||||
}
|
||||
}
|
||||
|
||||
EndLoop: Debug.Log("");
|
||||
EndLoop: Debug.Log("");
|
||||
if (click_card)
|
||||
{
|
||||
Debug.Log("TouchClickPoint === click_card");
|
||||
if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
|
||||
Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height));
|
||||
RaycastHit hit;
|
||||
|
||||
Reference in New Issue
Block a user