Explorar o código

Merge branch 'master' of http://git.gfggame.com:3000/gfg/client

# Conflicts:
#	GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs
zhaoyang %!s(int64=3) %!d(string=hai) anos
pai
achega
78f751cfee

+ 18 - 4
GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs

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