|
@@ -1,6 +1,8 @@
|
|
using FairyGUI;
|
|
using FairyGUI;
|
|
using UI.CreateRole;
|
|
using UI.CreateRole;
|
|
using System;
|
|
using System;
|
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
+
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
public class CreateRoleView : BaseWindow
|
|
public class CreateRoleView : BaseWindow
|
|
@@ -42,11 +44,25 @@ namespace GFGGame
|
|
|
|
|
|
private void OnClickBtnSure()
|
|
private void OnClickBtnSure()
|
|
{
|
|
{
|
|
- if (_ui.m_inputName.text.Length > 0)
|
|
|
|
|
|
+ string roleName = _ui.m_inputName.text;
|
|
|
|
+ if (string.IsNullOrEmpty(roleName))
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("角色名不能为空");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (roleName.Length > GFGGame.GlobalConst.MaxNameLen)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("角色名最多七个字");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Regex.IsMatch(roleName, @"^[\u4e00-\u9fa5_0-9]+$"))//角色起名仅允许汉字、数字、底划线
|
|
{
|
|
{
|
|
- string roleName = _ui.m_inputName.text;
|
|
|
|
- LoginController.ReqCreateRole(roleName).Coroutine();
|
|
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("角色名仅允许汉字、数字、下划线");
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ LoginController.ReqCreateRole(roleName).Coroutine();
|
|
}
|
|
}
|
|
|
|
|
|
private void RandomRoleName()
|
|
private void RandomRoleName()
|