From 3c8dda6ebf535fdd459333540fb869f8c3f954ea Mon Sep 17 00:00:00 2001 From: YL Date: Mon, 14 Apr 2025 14:13:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9AR=E6=B8=B8=E6=88=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BD=BF=E7=94=A8sg=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E4=BF=AE=E6=94=B9AR=E5=AE=A0=E7=89=A9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=BD=95=E5=85=A5=E8=84=9A=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomInterface/UIARGameInterface.cs | 3 +- .../UIARGameWidget/UIARGameWidget.cs | 19 +++----- .../YL/UI/UIARGameWindow/UIARGameWindow.cs | 25 +++++------ .../UIARPetInfoRecWindow.cs | 45 +++++++++---------- .../Runtime/Core/GameEvent/GameEvent.cs | 20 --------- 5 files changed, 41 insertions(+), 71 deletions(-) diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/Event/CustomInterface/UIARGameInterface.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/Event/CustomInterface/UIARGameInterface.cs index e84801ee..8e37f773 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/Event/CustomInterface/UIARGameInterface.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/Event/CustomInterface/UIARGameInterface.cs @@ -6,6 +6,7 @@ namespace GameLogic [EventInterface(EEventGroup.GroupUI)] public interface UIARGameInterface { - void GetCurGameName(string gamename); + public void GetCurGameName(string curgamename); + public void WidgetIDSelect(int widgetID); } } \ No newline at end of file diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWidget/UIARGameWidget.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWidget/UIARGameWidget.cs index dc6dedf2..928facfc 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWidget/UIARGameWidget.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWidget/UIARGameWidget.cs @@ -30,10 +30,10 @@ namespace GameLogic private async UniTaskVoid OnClickSelectBtn() { await UniTask.Yield(); - - GameEvent.SendWidgetSelected(_widgetId); - GameEvent.Send("UIARGameInterface", m_textName.text); + GameEvent.Get().WidgetIDSelect(_widgetId); + + GameEvent.Get().GetCurGameName(this.m_textName.text); } #endregion @@ -44,19 +44,12 @@ namespace GameLogic this.m_textName.text = gameName; LockFunc(islock); - - GameEvent.AddWidgetSelectedListener(OnWidgetSelected); + GameEvent.AddEventListener(UIARGameInterface_Event.WidgetIDSelect, WidgetIDSelect); } - protected override void OnDestroy() + public void WidgetIDSelect(int widgetID) { - base.OnDestroy(); - GameEvent.RemoveWidgetSelectedListener(OnWidgetSelected); - } - - private void OnWidgetSelected(int selectedWidgetId) - { - if (_widgetId == selectedWidgetId) + if (_widgetId == widgetID) { OnClickSelect(); } diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWindow.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWindow.cs index 48bcb023..efe134a4 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWindow.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARGameWindow/UIARGameWindow.cs @@ -32,23 +32,10 @@ namespace GameLogic private async UniTaskVoid OnClickSureBtn() { await UniTask.Yield(); - Debug.LogError(curgamename); } #endregion - protected override void RegisterEvent() - { - base.RegisterEvent(); - - GameEvent.AddEventListener( - "UIARGameInterface", - (gamename) => - { - this.curgamename = gamename; - }); - } - protected override void OnCreate() { base.OnCreate(); @@ -58,6 +45,18 @@ namespace GameLogic RegisterEvent(); } + protected override void RegisterEvent() + { + base.RegisterEvent(); + + GameEvent.AddEventListener(UIARGameInterface_Event.GetCurGameName,GetCurGameName); + } + + public void GetCurGameName(string gameName) + { + this.curgamename = gameName; + } + private async void LoadARGameData() { aRGame = GameModule.Resource.LoadAsset(GAME_DATA_PATH); diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARPetInfoRecWindow/UIARPetInfoRecWindow.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARPetInfoRecWindow/UIARPetInfoRecWindow.cs index debf0a1b..dcd50a4c 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARPetInfoRecWindow/UIARPetInfoRecWindow.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/YL/UI/UIARPetInfoRecWindow/UIARPetInfoRecWindow.cs @@ -1,18 +1,15 @@ -using Cysharp.Threading.Tasks; +锘縰sing Cysharp.Threading.Tasks; using UnityEngine; using UnityEngine.UI; using TEngine; using TMPro; -using System.Security.Policy; -using Lightbug.Utilities; -using NodeCanvas.DialogueTrees; namespace GameLogic { [Window(UILayer.UI)] class UIARPetInfoRecWindow : UIWindow { - #region 脚本工具生成的代码 + #region 鑴氭湰宸ュ叿鐢熸垚鐨勪唬鐮 private Button m_btnPetImg; private Image m_imgPet; private TMP_InputField m_tmpinputPetName; @@ -42,8 +39,8 @@ namespace GameLogic } #endregion - #region 事件 - private async UniTaskVoid OnClickPetImgBtn() // 开启摄像头拍照,给宠物拍照 + #region 浜嬩欢 + private async UniTaskVoid OnClickPetImgBtn() // 锟斤拷锟斤拷锟斤拷锟斤拷头锟斤拷锟斤拷,锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 { await UniTask.Yield(); m_imgPet.gameObject.SetActive(true); @@ -52,12 +49,12 @@ namespace GameLogic private async UniTaskVoid OnClickSelectTypeBtn() { await UniTask.Yield(); - SelectTypeFunc("波斯猫"); + SelectTypeFunc("锟斤拷斯猫"); } private async UniTaskVoid OnClickSelectZoneBtn() { await UniTask.Yield(); - SelectZoneFunc("ShangHai->徐汇区"); + SelectZoneFunc("ShangHai->锟斤拷锟斤拷锟"); } private async UniTaskVoid OnClickARPreBtn() { @@ -67,9 +64,9 @@ namespace GameLogic #endregion /// - /// 选择宠物得品种 + /// 閫夋嫨鍝佺 /// - /// 品种 + /// 瀹犵墿鍝佺 private void SelectTypeFunc(string PetType) { this.m_tmptextType.text = PetType; @@ -77,54 +74,54 @@ namespace GameLogic } /// - /// 选择地区 + /// 閫夋嫨鍦板尯 /// - /// 地区 + /// 鍦板尯 private void SelectZoneFunc(string Zone) { this.m_tmptextZone.text = Zone; this.m_tmptextZone.color = Color.black; } - // 打开宠物预览UI + // 鎵撳紑瀹犵墿棰勮UI private void OpenPetPreviewUI() { GameModule.UI.ShowUI(); - // 触发事件 + GameEvent.Send("UIPetInfoRecInterface", m_tmpinputPetName.text, m_tmptextType.text, m_tmpinputOwnName.text, m_tmptextZone.text, m_tmpinputNumber.text); } - // 检查宠物信息填入 + // 妫鏌ュ疇鐗╀俊鎭緭鍏 private void CheckPetInfoInputFunc() { if (string.IsNullOrEmpty(m_tmpinputPetName.text)) { - Debug.LogError("请填入宠物名字"); + Debug.LogError("锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟"); return; } - else if (m_tmptextType.text == "请选择品种") + else if (m_tmptextType.text == "锟斤拷选锟斤拷品锟斤拷") { - Debug.LogError("请选择品种"); + Debug.LogError("锟斤拷选锟斤拷品锟斤拷"); return; } else if (string.IsNullOrEmpty(m_tmpinputOwnName.text)) { - Debug.LogError("请填入宠物主人名字"); + Debug.LogError("锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟"); return; } - else if (m_tmptextZone.text == "请选择地区地址") + else if (m_tmptextZone.text == "锟斤拷选锟斤拷锟斤拷锟斤拷锟街") { - Debug.LogError("请选择地区地址"); + Debug.LogError("锟斤拷选锟斤拷锟斤拷锟斤拷锟街"); return; } else if (string.IsNullOrEmpty(m_tmpinputNumber.text)) { - Debug.LogError("请输入宠物主人号码"); + Debug.LogError("锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷撕锟斤拷锟"); return; } else if (m_tmpinputNumber.text.Length != 11 || m_tmpinputNumber.text[0] != '1') { - Debug.LogError("请输入以 1 开头的 11 位手机号码"); + Debug.LogError("锟斤拷锟斤拷锟斤拷锟斤拷 1 锟斤拷头锟斤拷 11 位锟街伙拷锟斤拷锟斤拷"); return; } else diff --git a/EintooAR/Assets/TEngine/Runtime/Core/GameEvent/GameEvent.cs b/EintooAR/Assets/TEngine/Runtime/Core/GameEvent/GameEvent.cs index d08617bd..541d21d2 100644 --- a/EintooAR/Assets/TEngine/Runtime/Core/GameEvent/GameEvent.cs +++ b/EintooAR/Assets/TEngine/Runtime/Core/GameEvent/GameEvent.cs @@ -593,25 +593,5 @@ namespace TEngine { _eventMgr.Init(); } - - - /// - /// AR娓告垙浜嬩欢 - /// - /// - public static void SendWidgetSelected(int widgetId) - { - _eventMgr.Dispatcher.Send(RuntimeId.ToRuntimeId("WidgetSelected"), widgetId); - } - - public static bool AddWidgetSelectedListener(Action handler) - { - return _eventMgr.Dispatcher.AddEventListener(RuntimeId.ToRuntimeId("WidgetSelected"), handler); - } - - public static void RemoveWidgetSelectedListener(Action handler) - { - _eventMgr.Dispatcher.RemoveEventListener(RuntimeId.ToRuntimeId("WidgetSelected"), handler); - } } } \ No newline at end of file