修改AR游戏接口使用sg自动生成,修改AR宠物信息录入脚本编码
This commit is contained in:
parent
a51e633949
commit
3c8dda6ebf
@ -6,6 +6,7 @@ namespace GameLogic
|
|||||||
[EventInterface(EEventGroup.GroupUI)]
|
[EventInterface(EEventGroup.GroupUI)]
|
||||||
public interface UIARGameInterface
|
public interface UIARGameInterface
|
||||||
{
|
{
|
||||||
void GetCurGameName(string gamename);
|
public void GetCurGameName(string curgamename);
|
||||||
|
public void WidgetIDSelect(int widgetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,10 +30,10 @@ namespace GameLogic
|
|||||||
private async UniTaskVoid OnClickSelectBtn()
|
private async UniTaskVoid OnClickSelectBtn()
|
||||||
{
|
{
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
|
|
||||||
GameEvent.SendWidgetSelected(_widgetId);
|
|
||||||
|
|
||||||
GameEvent.Send<string>("UIARGameInterface", m_textName.text);
|
GameEvent.Get<UIARGameInterface>().WidgetIDSelect(_widgetId);
|
||||||
|
|
||||||
|
GameEvent.Get<UIARGameInterface>().GetCurGameName(this.m_textName.text);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -44,19 +44,12 @@ namespace GameLogic
|
|||||||
this.m_textName.text = gameName;
|
this.m_textName.text = gameName;
|
||||||
|
|
||||||
LockFunc(islock);
|
LockFunc(islock);
|
||||||
|
GameEvent.AddEventListener<int>(UIARGameInterface_Event.WidgetIDSelect, WidgetIDSelect);
|
||||||
GameEvent.AddWidgetSelectedListener(OnWidgetSelected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDestroy()
|
public void WidgetIDSelect(int widgetID)
|
||||||
{
|
{
|
||||||
base.OnDestroy();
|
if (_widgetId == widgetID)
|
||||||
GameEvent.RemoveWidgetSelectedListener(OnWidgetSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnWidgetSelected(int selectedWidgetId)
|
|
||||||
{
|
|
||||||
if (_widgetId == selectedWidgetId)
|
|
||||||
{
|
{
|
||||||
OnClickSelect();
|
OnClickSelect();
|
||||||
}
|
}
|
||||||
|
@ -32,23 +32,10 @@ namespace GameLogic
|
|||||||
private async UniTaskVoid OnClickSureBtn()
|
private async UniTaskVoid OnClickSureBtn()
|
||||||
{
|
{
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
|
|
||||||
Debug.LogError(curgamename);
|
Debug.LogError(curgamename);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected override void RegisterEvent()
|
|
||||||
{
|
|
||||||
base.RegisterEvent();
|
|
||||||
|
|
||||||
GameEvent.AddEventListener<string>(
|
|
||||||
"UIARGameInterface",
|
|
||||||
(gamename) =>
|
|
||||||
{
|
|
||||||
this.curgamename = gamename;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnCreate()
|
protected override void OnCreate()
|
||||||
{
|
{
|
||||||
base.OnCreate();
|
base.OnCreate();
|
||||||
@ -58,6 +45,18 @@ namespace GameLogic
|
|||||||
RegisterEvent();
|
RegisterEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void RegisterEvent()
|
||||||
|
{
|
||||||
|
base.RegisterEvent();
|
||||||
|
|
||||||
|
GameEvent.AddEventListener<string>(UIARGameInterface_Event.GetCurGameName,GetCurGameName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetCurGameName(string gameName)
|
||||||
|
{
|
||||||
|
this.curgamename = gameName;
|
||||||
|
}
|
||||||
|
|
||||||
private async void LoadARGameData()
|
private async void LoadARGameData()
|
||||||
{
|
{
|
||||||
aRGame = GameModule.Resource.LoadAsset<ARGameScriptableObject>(GAME_DATA_PATH);
|
aRGame = GameModule.Resource.LoadAsset<ARGameScriptableObject>(GAME_DATA_PATH);
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TEngine;
|
using TEngine;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using System.Security.Policy;
|
|
||||||
using Lightbug.Utilities;
|
|
||||||
using NodeCanvas.DialogueTrees;
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
[Window(UILayer.UI)]
|
[Window(UILayer.UI)]
|
||||||
class UIARPetInfoRecWindow : UIWindow
|
class UIARPetInfoRecWindow : UIWindow
|
||||||
{
|
{
|
||||||
#region 脚本工具生成的代码
|
#region 脚本工具生成的代码
|
||||||
private Button m_btnPetImg;
|
private Button m_btnPetImg;
|
||||||
private Image m_imgPet;
|
private Image m_imgPet;
|
||||||
private TMP_InputField m_tmpinputPetName;
|
private TMP_InputField m_tmpinputPetName;
|
||||||
@ -42,8 +39,8 @@ namespace GameLogic
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 事件
|
#region 事件
|
||||||
private async UniTaskVoid OnClickPetImgBtn() // 开启摄像头拍照,给宠物拍照
|
private async UniTaskVoid OnClickPetImgBtn() // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
{
|
{
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
m_imgPet.gameObject.SetActive(true);
|
m_imgPet.gameObject.SetActive(true);
|
||||||
@ -52,12 +49,12 @@ namespace GameLogic
|
|||||||
private async UniTaskVoid OnClickSelectTypeBtn()
|
private async UniTaskVoid OnClickSelectTypeBtn()
|
||||||
{
|
{
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
SelectTypeFunc("波斯猫");
|
SelectTypeFunc("<EFBFBD><EFBFBD>˹è");
|
||||||
}
|
}
|
||||||
private async UniTaskVoid OnClickSelectZoneBtn()
|
private async UniTaskVoid OnClickSelectZoneBtn()
|
||||||
{
|
{
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
SelectZoneFunc("ShangHai->徐汇区");
|
SelectZoneFunc("ShangHai-><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
}
|
}
|
||||||
private async UniTaskVoid OnClickARPreBtn()
|
private async UniTaskVoid OnClickARPreBtn()
|
||||||
{
|
{
|
||||||
@ -67,9 +64,9 @@ namespace GameLogic
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选择宠物得品种
|
/// 选择品种
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="PetType">品种</param>
|
/// <param name="PetType">宠物品种</param>
|
||||||
private void SelectTypeFunc(string PetType)
|
private void SelectTypeFunc(string PetType)
|
||||||
{
|
{
|
||||||
this.m_tmptextType.text = PetType;
|
this.m_tmptextType.text = PetType;
|
||||||
@ -77,54 +74,54 @@ namespace GameLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选择地区
|
/// 选择地区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Zone">地区</param>
|
/// <param name="Zone">地区</param>
|
||||||
private void SelectZoneFunc(string Zone)
|
private void SelectZoneFunc(string Zone)
|
||||||
{
|
{
|
||||||
this.m_tmptextZone.text = Zone;
|
this.m_tmptextZone.text = Zone;
|
||||||
this.m_tmptextZone.color = Color.black;
|
this.m_tmptextZone.color = Color.black;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开宠物预览UI
|
// 打开宠物预览UI
|
||||||
private void OpenPetPreviewUI()
|
private void OpenPetPreviewUI()
|
||||||
{
|
{
|
||||||
GameModule.UI.ShowUI<UIARPreviewWindow>();
|
GameModule.UI.ShowUI<UIARPreviewWindow>();
|
||||||
// 触发事件
|
|
||||||
GameEvent.Send<string, string, string, string, string>("UIPetInfoRecInterface", m_tmpinputPetName.text, m_tmptextType.text, m_tmpinputOwnName.text, m_tmptextZone.text, m_tmpinputNumber.text);
|
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()
|
private void CheckPetInfoInputFunc()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(m_tmpinputPetName.text))
|
if (string.IsNullOrEmpty(m_tmpinputPetName.text))
|
||||||
{
|
{
|
||||||
Debug.LogError("请填入宠物名字");
|
Debug.LogError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (m_tmptextType.text == "请选择品种")
|
else if (m_tmptextType.text == "<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>")
|
||||||
{
|
{
|
||||||
Debug.LogError("请选择品种");
|
Debug.LogError("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(m_tmpinputOwnName.text))
|
else if (string.IsNullOrEmpty(m_tmpinputOwnName.text))
|
||||||
{
|
{
|
||||||
Debug.LogError("请填入宠物主人名字");
|
Debug.LogError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (m_tmptextZone.text == "请选择地区地址")
|
else if (m_tmptextZone.text == "<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ")
|
||||||
{
|
{
|
||||||
Debug.LogError("请选择地区地址");
|
Debug.LogError("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(m_tmpinputNumber.text))
|
else if (string.IsNullOrEmpty(m_tmpinputNumber.text))
|
||||||
{
|
{
|
||||||
Debug.LogError("请输入宠物主人号码");
|
Debug.LogError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (m_tmpinputNumber.text.Length != 11 || m_tmpinputNumber.text[0] != '1')
|
else if (m_tmpinputNumber.text.Length != 11 || m_tmpinputNumber.text[0] != '1')
|
||||||
{
|
{
|
||||||
Debug.LogError("请输入以 1 开头的 11 位手机号码");
|
Debug.LogError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><>ͷ<EFBFBD><CDB7> 11 λ<>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -593,25 +593,5 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
_eventMgr.Init();
|
_eventMgr.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AR游戏事件
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="widgetId"></param>
|
|
||||||
public static void SendWidgetSelected(int widgetId)
|
|
||||||
{
|
|
||||||
_eventMgr.Dispatcher.Send(RuntimeId.ToRuntimeId("WidgetSelected"), widgetId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool AddWidgetSelectedListener(Action<int> handler)
|
|
||||||
{
|
|
||||||
return _eventMgr.Dispatcher.AddEventListener(RuntimeId.ToRuntimeId("WidgetSelected"), handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RemoveWidgetSelectedListener(Action<int> handler)
|
|
||||||
{
|
|
||||||
_eventMgr.Dispatcher.RemoveEventListener(RuntimeId.ToRuntimeId("WidgetSelected"), handler);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user