修改AR宠物识别UI,完善对应脚本

This commit is contained in:
YL 2025-04-02 17:24:34 +08:00
parent a759749bb8
commit 4423c7ccd9
2 changed files with 48 additions and 2 deletions

View File

@ -149,7 +149,7 @@ GameObject:
- component: {fileID: 6600081991818796871}
- component: {fileID: 5692120870677579763}
m_Layer: 5
m_Name: Type
m_Name: m_tmptextType
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1206,7 +1206,7 @@ GameObject:
- component: {fileID: 5001991808430061394}
- component: {fileID: 5056802328997227042}
m_Layer: 5
m_Name: Zone
m_Name: m_tmptextZone
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -2,6 +2,8 @@ using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using TEngine;
using TMPro;
using System.Security.Policy;
namespace GameLogic
{
@ -10,12 +12,16 @@ namespace GameLogic
{
#region
private Button m_btnSelectType;
private TextMeshProUGUI m_tmptextType;
private Button m_btnSelectZone;
private TextMeshProUGUI m_tmptextZone;
private Button m_btnSure;
protected override void ScriptGenerator()
{
m_btnSelectType = FindChildComponent<Button>("MainGroup/SelectUI/SelectTypeBack/Center_01/m_btnSelectType");
m_tmptextType = FindChildComponent<TextMeshProUGUI>("MainGroup/SelectUI/SelectTypeBack/Center_01/m_btnSelectType/m_tmptextType");
m_btnSelectZone = FindChildComponent<Button>("MainGroup/SelectUI/SelectZoneBack /Center_01/m_btnSelectZone");
m_tmptextZone = FindChildComponent<TextMeshProUGUI>("MainGroup/SelectUI/SelectZoneBack /Center_01/m_btnSelectZone/m_tmptextZone");
m_btnSure = FindChildComponent<Button>("MainGroup/Bottom/m_btnSure");
m_btnSelectType.onClick.AddListener(UniTask.UnityAction(OnClickSelectTypeBtn));
m_btnSelectZone.onClick.AddListener(UniTask.UnityAction(OnClickSelectZoneBtn));
@ -27,16 +33,56 @@ namespace GameLogic
private async UniTaskVoid OnClickSelectTypeBtn() // 选择品种
{
await UniTask.Yield();
SelectTypeFunc("波斯猫");
}
private async UniTaskVoid OnClickSelectZoneBtn() // 选择地区
{
await UniTask.Yield();
SelectZoneFunc("上海");
}
private async UniTaskVoid OnClickSureBtn() // 确认
{
await UniTask.Yield();
CheckPetRecognitionSelectFunc();
}
#endregion
/// <summary>
/// 选择宠物得品种
/// </summary>
/// <param name="PetType">品种</param>
private void SelectTypeFunc(string PetType)
{
this.m_tmptextType.text = PetType;
}
/// <summary>
/// 选择地区
/// </summary>
/// <param name="Zone">地区</param>
private void SelectZoneFunc(string Zone)
{
this.m_tmptextZone.text = Zone;
}
// 检查宠物识别信息选择
private void CheckPetRecognitionSelectFunc()
{
if(m_tmptextType.text == "请选择品种")
{
Debug.LogError("请选择品种");
return;
}
else if(m_tmptextZone.text == "请选择地区")
{
Debug.LogError("请选择地区");
return;
}
else
{
//GameModule.UI.CloseUI<UIARPetRecognitionWindow>();
// 打开摄像机进行识别
}
}
}
}