更新AR宠物信息录入UI以及完成预览UI对接

This commit is contained in:
YL 2025-04-09 14:41:31 +08:00
parent 0679235d10
commit 4bb91f4082
10 changed files with 193 additions and 30 deletions

File diff suppressed because one or more lines are too long

View File

@ -1148,10 +1148,10 @@ RectTransform:
- {fileID: 3381555495858973484}
m_Father: {fileID: 7921817359556784596}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 83, y: 0}
m_SizeDelta: {x: 166, y: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166, y: 180}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8816592105157379121
CanvasRenderer:
@ -1926,6 +1926,81 @@ MonoBehaviour:
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &3500450064803666970
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1546999699364987996}
- component: {fileID: 3209748548080919947}
- component: {fileID: 4610917385868709097}
m_Layer: 5
m_Name: m_imgPet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1546999699364987996
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3500450064803666970}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7921817359556784596}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 140, y: 140}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3209748548080919947
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3500450064803666970}
m_CullTransparentMesh: 1
--- !u!114 &4610917385868709097
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3500450064803666970}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3530522402178716171
GameObject:
m_ObjectHideFlags: 0
@ -4807,6 +4882,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7241500957200191114}
- {fileID: 1546999699364987996}
m_Father: {fileID: 7170900614466599203}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}

View File

@ -40,8 +40,7 @@ public partial class GameApp : Singleton<GameApp>
/// </summary>
private void StartGameLogic()
{
//LoadGame().Forget();
GameModule.UI.ShowUI<UIPetInfoWindow>();
LoadGame().Forget();
}
public async UniTask LoadGame()

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 069bc10f62d033e4682f0f3bcb6296ec
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 99a4e914ebd269c4185add5b2f239cd3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
using TEngine;
namespace GameLogic
{
[EventInterface(EEventGroup.GroupUI)]
public interface UIPetInfoRecInterface
{
void OnOpenPetPreviewUI(string petName, string petType, string ownName, string zone, string number);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7c329055b202bd14fa895d9e28d32fa8

View File

@ -5,6 +5,7 @@ using TEngine;
using TMPro;
using System.Security.Policy;
using Lightbug.Utilities;
using NodeCanvas.DialogueTrees;
namespace GameLogic
{
@ -13,6 +14,7 @@ namespace GameLogic
{
#region
private Button m_btnPetImg;
private Image m_imgPet;
private TMP_InputField m_tmpinputPetName;
private Button m_btnSelectType;
private TextMeshProUGUI m_tmptextType;
@ -24,6 +26,7 @@ namespace GameLogic
protected override void ScriptGenerator()
{
m_btnPetImg = FindChildComponent<Button>("BackGround/Group/Pet/Background/CenterPhoto/Background/ImageGroup/m_btnPetImg");
m_imgPet = FindChildComponent<Image>("BackGround/Group/Pet/Background/CenterPhoto/Background/ImageGroup/m_imgPet");
m_tmpinputPetName = FindChildComponent<TMP_InputField>("BackGround/Group/Pet/Background/PetInput/m_tmpinputPetName");
m_btnSelectType = FindChildComponent<Button>("BackGround/Group/Pet/Background/PetInput/m_btnSelectType");
m_tmptextType = FindChildComponent<TextMeshProUGUI>("BackGround/Group/Pet/Background/PetInput/m_btnSelectType/m_tmptextType");
@ -43,6 +46,8 @@ namespace GameLogic
private async UniTaskVoid OnClickPetImgBtn() // 开启摄像头拍照,给宠物拍照
{
await UniTask.Yield();
m_imgPet.gameObject.SetActive(true);
m_btnPetImg.gameObject.SetActive(false);
}
private async UniTaskVoid OnClickSelectTypeBtn()
{
@ -85,36 +90,43 @@ namespace GameLogic
private void OpenPetPreviewUI()
{
GameModule.UI.ShowUI<UIARPreviewWindow>();
GameModule.UI.CloseUI<UIARPetInfoRecWindow>();
// 触发事件
GameEvent.Send<string, string, string, string, string>("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))
if (string.IsNullOrEmpty(m_tmpinputPetName.text))
{
Debug.LogError("请填入宠物名字");
return;
}
else if(m_tmptextType.text == "ワ恁寁ⅲ笱")
else if (m_tmptextType.text == "请选择品种")
{
Debug.LogError("请选择品种");
return;
}
else if(string.IsNullOrEmpty(m_tmpinputOwnName.text))
else if (string.IsNullOrEmpty(m_tmpinputOwnName.text))
{
Debug.LogError("请填入宠物主人名字");
return;
}
else if(m_tmptextZone.text == "ワ恁寁華Е華硊")
else if (m_tmptextZone.text == "请选择地区地址")
{
Debug.LogError("请选择地区地址");
return;
}else if(string.IsNullOrEmpty(m_tmpinputNumber.text))
}
else if (string.IsNullOrEmpty(m_tmpinputNumber.text))
{
Debug.LogError("请输入宠物主人号码");
return;
}
else if (m_tmpinputNumber.text.Length != 11 || m_tmpinputNumber.text[0] != '1')
{
Debug.LogError("请输入以 1 开头的 11 位手机号码");
return;
}
else
{
OpenPetPreviewUI();

View File

@ -3,6 +3,7 @@ using UnityEngine;
using UnityEngine.UI;
using TEngine;
using TMPro;
using UnityEditor;
namespace GameLogic
{
@ -37,6 +38,25 @@ namespace GameLogic
}
#endregion
protected override async void OnCreate()
{
base.OnCreate();
RegisterEvent();
}
protected override void RegisterEvent()
{
base.RegisterEvent();
// 注册事件监听
GameEvent.AddEventListener<string, string, string, string, string>(
"UIPetInfoRecInterface",
(petName, petType, ownName, zone, number) =>
{
PetInfoPreviewSetFunc(petName, petType, ownName, zone, number);
});
}
/// <summary>
/// 预览信息
@ -46,13 +66,15 @@ namespace GameLogic
/// <param name="PetOwnName">宠物主人名字</param>
/// <param name="PetOwnOri">宠物主人地址</param>
/// <param name="PetOwnNumber">宠物主人号码</param>
public void PetInfoPreviewSetFunc(string PetName, string PetType, string PetOwnName, string PetOwnOri, string PetOwnNumber)
private void PetInfoPreviewSetFunc(string PetName, string PetType, string PetOwnName, string PetOwnOri, string PetOwnNumber)
{
this.m_tmptextPetName.text = PetName;
this.m_tmptextPetType.text = PetType;
this.m_tmptextOwnName.text = PetOwnName;
this.m_tmptextPetOwnOri.text = PetOwnOri;
this.m_tmptextPetOwnNum.text = PetOwnNumber;
GameModule.UI.CloseUI<UIARPetInfoRecWindow>();
}
}
}

View File

@ -37,6 +37,9 @@ namespace GameLogic
private async UniTaskVoid OnClickAddtionPetBtn() // 新增宠物
{
await UniTask.Yield();
GameModule.UI.ShowUI<UIARPetInfoRecWindow>();
GameModule.UI.CloseUI<UIPetInfoWindow>();
}
private async UniTaskVoid OnClickCancleBtn() // 取消删除
{