fix:1、修复bug。2、删除json表,改为配置加载

This commit is contained in:
barry
2026-06-30 22:15:06 +08:00
parent 1354dfbc34
commit 776d63928d
1086 changed files with 49845 additions and 533285 deletions
+124
View File
@@ -0,0 +1,124 @@
using Gree.UnityWebView;
using UnityEngine;
public class FreeWebViewManager : MonoBehaviour
{
public static FreeWebViewManager Instance;
private GameObject _webObj;
private WebViewObject1 _webView;
private void Awake()
{
if (Instance != null) Destroy(gameObject);
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
}
private void Start()
{
initView();
}
public void initView()
{
if (_webObj != null) return;
// 创建WebView对象
_webObj = new GameObject("WebViewObject1");
_webView = _webObj.AddComponent<WebViewObject1>();
// 关键:开启WKWebView,规避苹果审核拒绝
_webView.Init(
enableWKWebView: true,
cb: OnWebMessage // JS调用Unity回调
);
float top_offset = 0;//fgui中的顶部信息的高度
float buttom_offset = 155;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
}
// 铺满屏幕,适配刘海安全区
_webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// 禁止下拉回弹(可选)
_webView.SetScrollBounceEnabled(false);
_webView.LoadURL("about:blank");
_webView.SetVisibility(false);
}
/// <summary>
/// 打开网页
/// </summary>
public void OpenWeb(string url)
{
// if (_webObj != null) return;
//
// // 创建WebView对象
// _webObj = new GameObject("WebViewObject1");
// _webView = _webObj.AddComponent<WebViewObject1>();
//
// // 关键:开启WKWebView,规避苹果审核拒绝
// _webView.Init(
// enableWKWebView: true,
// cb: OnWebMessage // JS调用Unity回调
// );
//
// float top_offset = 0;//fgui中的顶部信息的高度
// float buttom_offset = 155;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// top_offset += Screen.safeArea.y;
// }
//
// // 铺满屏幕,适配刘海安全区
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// // 禁止下拉回弹(可选)
// _webView.SetScrollBounceEnabled(false);
//
// 加载网页并显示
_webView.LoadURL(url);
_webView.SetVisibility(true);
}
// JS向Unity发消息:window.unity.call("func","参数")
void OnWebMessage(string msg)
{
Debug.Log("收到网页消息:" + msg);
}
// C#调用网页JS
public void CallJs(string jsCode)
{
if (_webView != null)
_webView.EvaluateJS(jsCode);
}
/// <summary>
/// 关闭网页(必调用,释放原生资源)
/// </summary>
public void CloseWeb()
{
if (_webObj != null)
{
_webView.SetVisibility(false);
}
}
private void OnDestroy()
{
if (_webObj != null)
{
_webView.SetVisibility(false);
Destroy(_webObj);
_webObj = null;
_webView = null;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7478ade71b9349e1a05265bf175b11c9
timeCreated: 1782695108
+16 -5
View File
@@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections.Generic;
using ChillConnect;
using IgnoreOPS;
public class LevelManager : MonoBehaviour
{
@@ -48,13 +49,13 @@ public class LevelManager : MonoBehaviour
Debug.LogError("关卡ID必须大于0");
return false;
}
if (levelId > 500)
var gameConfigs = ConfigSystem.GetConfig<ArrowGameConfigModel>().DataList;
if (levelId >= gameConfigs.Count)
{
levelId = 500;
levelId = gameConfigs.Count - 1;
}
TextAsset jsonFile = Resources.Load<TextAsset>($"{LevelResourcePath}{levelId}");
var jsonFile = gameConfigs[levelId];
if (jsonFile == null)
{
@@ -62,7 +63,17 @@ public class LevelManager : MonoBehaviour
return false;
}
CurrentLevel = JsonUtility.FromJson<LevelConfig>(jsonFile.text);
var curlevelConfig = new LevelConfig()
{
levelId = jsonFile.id,
levelName = jsonFile.levelName,
gridRows = jsonFile.gridRows,
gridCols = jsonFile.gridCols,
pointSpacing = jsonFile.pointSpacing,
arrows = SerializeUtil.ToObject<List<ArrowConfig>>(jsonFile.arrows)
};
CurrentLevel = curlevelConfig;
if (CurrentLevel == null || CurrentLevel.arrows == null)
{
+1 -1
View File
@@ -109,7 +109,7 @@ namespace ChillConnect
int offset_y1 = ConfigSystem.GetConfig<CommonModel>().WVOffset[1];
Debug.Log("barry offset_y: " + offset_y + " offset_y1: " + offset_y1);
float top_offset = 0;//fgui中的顶部信息的高度
float buttom_offset = 155;
float buttom_offset = 165;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
@@ -99,7 +99,7 @@ namespace ChillConnect
private Vector2 _lastTouchPos;
private bool _isDraging;
// 拖拽边界留边(防止完全移出屏幕)
private readonly float _dragBorder = 100f;
private readonly float _dragBorder = -300f;
#endregion
@@ -350,10 +350,12 @@ namespace ChillConnect
{
if (Screen.safeArea.y != 0)
{//刘海屏
ui.panel.y += Screen.safeArea.y - 15;
ui.panel.y += Screen.safeArea.y - 25;
ui.com_money.y += Screen.safeArea.y- 15;
ui.com_gem.y += Screen.safeArea.y - 15;
ui.btn_signin.y += Screen.safeArea.y - 15;
ui.btn_signin.y += Screen.safeArea.y - 25;
ui.com_gift.y += Screen.safeArea.y - 15;
ui.btn_wv.y += Screen.safeArea.y - 25;
}
ui.state.selectedIndex = GameHelper.IsGiftSwitch() ? 1 : 0;
@@ -385,6 +387,8 @@ namespace ChillConnect
}
GameHelper.IsShowFirstReward();
GameHelper.IsShowPettyReward();
GameHelper.ShowStatementView();
}
@@ -554,6 +558,12 @@ namespace ChillConnect
_fingerTipObj.visible = false;
_fingerTipObj.touchable = false;
_fingerTipObj.sortingOrder = 9999;
if (GameHelper.IsShowOpenGameUI() && HallManager.Instance.openTipsTimes >= 1)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open);
}
}
@@ -603,6 +613,7 @@ namespace ChillConnect
var vo = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId);
if (vo == null)
{
Debug.LogError("MakeupTaskData 为空");
return;
}
GameHelper.showGameUI = false;
@@ -628,7 +639,15 @@ namespace ChillConnect
{
ui.btn_wv.visible = false;
}
ui.btn_wv.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.H5UI_Open); });
ui.btn_wv.SetClick(() =>
{
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = true,
url = ""
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
});
ui.com_bottom.btn_skin.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.ArrowThemeUI_Open); });
@@ -1204,6 +1223,7 @@ namespace ChillConnect
unit.GetChild("line").asGraph.color = lineColor;
unit.visible = true;
unit.touchable = true;
unit.name = "Arrow_" + arrow.id;
unit.onClick.Add(() => OnPathClick(arrow));
_viewContainer.AddChild(unit);
@@ -1252,6 +1272,7 @@ namespace ChillConnect
else if (type == 1)
{
_isDeleteMode = !_isDeleteMode;
GameHelper.ShowTips("You can delete any one of the arrows!");
}
}
@@ -1709,6 +1730,7 @@ namespace ChillConnect
if (icon != null) icon.color = arrowColor;
arrowIns.visible = true;
arrowIns.name = "Arrow_" + arrow.id;
arrowIns.onClick.Add(() => OnPathClick(arrow));
_viewContainer.AddChild(arrowIns);
@@ -1,5 +1,6 @@
using System;
using FGUI.Arrow_game;
using IgnoreOPS;
using UnityEngine;
namespace ChillConnect
@@ -59,6 +60,11 @@ namespace ChillConnect
HallManager.Instance.UpdateSecondEvent += UpdateCd;
UpdateCd();
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
{
ui.btn_watch.img_saveingpot.visible = true;
}
}
protected override void OnOpen(object args)
@@ -161,6 +161,7 @@ namespace ChillConnect
{
DataMgr.ArrowResultLevel.Value = 0;
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
CtrlCloseUI();
}
else if (DataMgr.ArrowResultLevel.Value == 0)
{
@@ -169,10 +170,10 @@ namespace ChillConnect
if (success)
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
CtrlCloseUI();
}
});
}
CtrlCloseUI();
});
ui.com_arrow_end.btn_restart.SetClick(() =>
+30 -8
View File
@@ -1,9 +1,11 @@
using DG.Tweening;
using FGUI.ZM_H5_15;
using IgnoreOPS;
using SGModule.NetKit;
using UnityEngine;
namespace ChillConnect
{
@@ -43,10 +45,15 @@ namespace ChillConnect
HallManager.Instance.SetCameraVisible(true);
WebviewManager.Instance.setInH5View(false);
WebviewManager.Instance.ShowH5View(false);
if (_config.normal)
{
WebviewManager.Instance.setInH5View(false);
WebviewManager.Instance.ShowH5View(false);
}
else
{
FreeWebViewManager.Instance.CloseWeb();
}
}
@@ -55,16 +62,31 @@ namespace ChillConnect
ui = baseUI as FGUI.ZM_H5_15.com_webview;
}
private SDKOpenConfig _config;
protected override void OnOpenBefore(object args)
{
if (args is not SDKOpenConfig openConfig) return;
_config = openConfig;
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
// Debug.Log($"H5UI OpenBefore url: {_config.url} normal: {_config.normal}");
if (_config.normal)
{
WebviewManager.Instance.setInH5View(true);
WebviewManager.Instance.ShowH5View(true);
}
else
{
DOVirtual.DelayedCall(0.2f, () =>
{
FreeWebViewManager.Instance.OpenWeb(_config.url);
});
}
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
// delayedCall = DOVirtual.DelayedCall(0.3f, () =>
// {
WebviewManager.Instance.setInH5View(true);
WebviewManager.Instance.ShowH5View(true);
ui.btn_close.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Close);
@@ -48,6 +48,9 @@ namespace ChillConnect
protected override void OnClose()
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
HallManager.Instance.UpdateSecondEvent -= updateSpeedCD;
HallManager.Instance.UpdateSecondEvent -= Update;
HallManager.Instance.UpdateSecondEvent -= upTaskWatchAdsBtn;
@@ -79,6 +82,9 @@ namespace ChillConnect
protected override void OnOpenBefore(object args)
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
if (Screen.safeArea.y != 0)
{//刘海屏
ui.group_.y += Screen.safeArea.y;
@@ -89,7 +95,7 @@ namespace ChillConnect
// DataMgr.Ticket.Value = 999999999; //zhushi
// WebviewManager.ShezhiACT(false);
WebviewManager.Instance.SetDarkThough(false);
makeupTaskData = args as MakeupTaskData;
ch_index = makeupTaskData.tableId - 1;
ui.btn_earn.title = GameHelper.getDesByKey("ch_out_1");
@@ -625,15 +631,16 @@ namespace ChillConnect
return;
}
ui.text_condi1.text = GameHelper.getChNumber(vo.item_need);
ui.text_condi1.text = GameHelper.getChString(vo.item_need);
ui.pb_condi1.max = vo.item_need;
ui.text_ch_number.text = GameHelper.getChNumber(DataMgr.Ticket.Value);
Debug.Log($"DataMgr.Ticket.Value==============={DataMgr.Ticket.Value}");
ui.text_ch_number.text = GameHelper.getChString(DataMgr.Ticket.Value);
var curValue = Math.Min(DataMgr.Ticket.Value, vo.item_need);
ui.pb_condi1.value = (double)curValue;
var textTitle = ui.pb_condi1.GetChild("title");
if (textTitle != null)
{
textTitle.text = GameHelper.getChNumber(curValue) + "/" + GameHelper.getChNumber(vo.item_need);
textTitle.text = GameHelper.getChString(curValue) + "/" + GameHelper.getChString(vo.item_need);
}
var taskTime = (int)((float)vo.task_need / 60 * 100) * 0.01F;
@@ -1050,8 +1057,13 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
// GameHelper.OpenEmail();
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb);
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = vo.T_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
CtrlCloseUI();
});
+45 -52
View File
@@ -1,6 +1,9 @@
using System;
using System.Linq;
using DG.Tweening;
using FGUI.Common_01;
using FGUI.Game_04;
using IgnoreOPS;
using Spine.Unity;
namespace ChillConnect
@@ -9,9 +12,8 @@ namespace ChillConnect
{
private OpenGameUICtrl ctrl;
private OpenGameModel model;
private com_open ui;
private com_open_tips ui;
private Action closeCallback;
private bool need_show = true;
public OpenGameUI(OpenGameUICtrl ctrl) : base(ctrl)
{
@@ -21,12 +23,12 @@ namespace ChillConnect
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "Game_04";
uiInfo.assetName = "com_open";
uiInfo.packageName = "Common_01";
uiInfo.assetName = "com_open_tips";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
uiInfo.isNeedUIMask = true;
}
#region
@@ -42,23 +44,43 @@ namespace ChillConnect
protected override void OnBind()
{
ui = baseUI as com_open;
ui = baseUI as com_open_tips;
}
protected override void OnOpenBefore(object args)
{
if (args != null) need_show = (bool)args;
string stage = GameHelper.gameType == 0 ? "Lv." + GameHelper.GetLevel() : "";
ui.text_level.text = stage;
try
{
// 添加空值检查,防止 NullReferenceException
var makeupTaskHistory = DataMgr.MakeupTaskHistory?.Value;
if (makeupTaskHistory != null && makeupTaskHistory.Any())
{
var makeupTaskData = makeupTaskHistory.Last();
var config = ConfigSystem.GetConfig<MakeupModel>();
if (config != null)
{
var vo = config.GetData(makeupTaskData.tableId);
if (vo != null && ui?.text_level_limit != null)
{
var stage= vo.levels_need - GameHelper.GetLevel();
if(stage <= 0)
{
stage = 1;
}
ui.text_level_limit.SetVar("x", stage.ToString()).FlushVars();
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
InitView();
DOVirtual.DelayedCall(0.7f, () => { GameDispatcher.Instance.Dispatch(GameMsg.reset_game, args); });
if (AudioManager.Instance.IsOpenEffect)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.game_open);
}
}
protected override void OnOpen(object args)
@@ -85,48 +107,19 @@ namespace ChillConnect
}
#endregion
//初始化页面逻辑
//初始化页面逻辑`
private void InitView()
{
// var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.anim, Fx_Type.fx_open, ref closeCallback);
// sk.state.SetAnimation(0, "animation", false);
// DOVirtual.DelayedCall(2.8f, () =>
// {
// ui.bg.visible = false;
// });
ui.t0.Play();
DOVirtual.DelayedCall(1.5f, () =>
ui.t0.Play(() =>
{
// ui.anim.visible = false;
if (need_show&&GameHelper.IsGiftSwitch()) {
if (GameHelper.IsShowLevelTips())
{
// ui.tips_node.visible = false;
DOVirtual.DelayedCall(0.2f, ()=>{
// ui.tips_node.visible = true;
var meteor1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.tips_node, Fx_Type.fx_tips, ref closeCallback);
meteor1.state.SetAnimation(0, "animation", false);
meteor1.state.Complete += a =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close);
};
});
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close);
}
} else {
DOVirtual.DelayedCall(0.4f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close);
});
}
DOVirtual.DelayedCall(0.2f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close);
});
});
}
}
}
+1 -1
View File
@@ -105,7 +105,7 @@ namespace ChillConnect
ui.text_list.EnsureBoundsCorrect();
});
ui.btn_close.SetClick(CtrlCloseUI);
ui.btn_back.SetClick(CtrlCloseUI);
}
public string[] getstr(string strs, int len)
@@ -72,9 +72,13 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb);
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = ConfigSystem.GetConfig<CommonModel>().X_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb, openConfig);
CtrlCloseUI();
});
+7 -1
View File
@@ -59,7 +59,13 @@ namespace ChillConnect
InitData();
InitView();
// ui.btn_null.SetClick(() => { });
// ui.btn_null.SetClick(() => { });+
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
{
ui.btn_multi.GetChild("img_saveingpot").visible = true;
}
}
protected override void OnOpen(object args)
@@ -614,8 +614,15 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
// GameHelper.OpenEmail();
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = vo.C_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb);
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
CtrlCloseUI();
});
@@ -877,7 +884,7 @@ namespace ChillConnect
ui.com_pay.btn_change.SetClick(() =>
{
DataMgr.ExchangeName = null;
DataMgr.ExchangeName.Value = null;
DataMgr.ExchangeAccount.Value = null;
OnEnter();
@@ -41,6 +41,11 @@ namespace ChillConnect
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
//open_sign();
if (GameHelper.IsShowOpenGameUI() &&HallManager.Instance.openTipsTimes == 1)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open);
}
}
protected override void OnBind()
@@ -48,8 +53,11 @@ namespace ChillConnect
ui = baseUI as FGUI.Lobby_03.com_statement;
}
private bool need_show = false;
protected override void OnOpenBefore(object args)
{
HallManager.Instance.openTipsTimes++;
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
InitView();
+4 -4
View File
@@ -305,10 +305,10 @@ namespace ChillConnect
}
if (lastId == makeupVOModel.DataList.Last().id)
{
lastId = -1;
}
// if (lastId == makeupVOModel.DataList.Last().id)
// {
// lastId = -1;
// }
foreach (var makeupVo in makeupVOModel.DataList)
{
@@ -70,6 +70,7 @@ namespace ChillConnect
new TurnOffRewardsModel("TurnOffRewards"),
new ExchangeDesModel("ExchangeDescriptors"),
new AppOpenAdModel("SplashAD"),
new ArrowGameConfigModel("ArrowGameConfig"),
},
state =>
{
@@ -124,6 +125,11 @@ namespace ChillConnect
#region
private void ParseArrowGameConfig()
{
}
private void ParseGameConfig()
{
+25 -24
View File
@@ -1,4 +1,5 @@
using System;
using DG.Tweening;
using SGModule.Net;
using SGModule.NetKit;
@@ -61,32 +62,32 @@ namespace ChillConnect
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
//
// void OnFail()
// {
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// }
void OnFail()
{
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
}
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, (Action)OnFail);zhushi
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, (Action)OnFail);
//
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
//
// float times = loginCount == 0 ? 0 : 5f;
//
// DOVirtual.DelayedCall(times,()=>{
// if (loginCount < 5) {
// loginCount++;
// RequestLogin();
//
// } else {
// loginCount = 0;
// Action _OnFail = () =>
// {
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// };
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
// }
// });
float times = loginCount == 0 ? 0 : 5f;
DOVirtual.DelayedCall(times,()=>{
if (loginCount < 5) {
loginCount++;
RequestLogin();
} else {
loginCount = 0;
Action _OnFail = () =>
{
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
};
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
}
});
}
});
}
+78 -2
View File
@@ -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;