zhaoyang 2 년 전
부모
커밋
5d3271479c

+ 11 - 0
FGUIProject/assets/Main/ChangeNameUI.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="936,476" bgColor="#000000">
+  <displayList>
+    <image id="n4_xt5s" name="bg" src="lwri5u" fileName="imagesExport/hc_kuang_6.png" pkg="mk0fwx0x" xy="0,0" size="936,476"/>
+    <image id="n11_hpgr" name="n11" src="njmng0" fileName="images/mc_jlkuang_1.png" xy="108,112"/>
+    <component id="n5_xt5s" name="btnSure" src="ih7594" fileName="components/Button10.xml" pkg="mk0fwx0x" xy="278,304">
+      <Button title="确认" titleColor="#ffffff" titleFontSize="42"/>
+    </component>
+    <text id="n10_xt5s" name="inputName" xy="162,125" size="560,56" fontSize="42" color="#9e8056" autoSize="none" text="" input="true" prompt="[color=#B6A688]请输入新角色名称[/color]" maxLength="7"/>
+  </displayList>
+</component>

BIN
FGUIProject/assets/Main/images/mc_jlkuang_1.png


+ 2 - 0
FGUIProject/assets/Main/package.xml

@@ -394,6 +394,8 @@
     <image id="v482fw" name="zjm_2.jpg" path="/"/>
     <image id="v482fx" name="zjm_1.jpg" path="/"/>
     <image id="qqatfy" name="zjm_hdhd_2.png" path="/images/"/>
+    <component id="njmnfz" name="ChangeNameUI.xml" path="/" exported="true"/>
+    <image id="njmng0" name="mc_jlkuang_1.png" path="/images/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\Main" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 77 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ChangeNameUI.cs

@@ -0,0 +1,77 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.Main
+{
+    public partial class UI_ChangeNameUI
+    {
+        public GComponent target;
+        public GImage m_bg;
+        public GButton m_btnSure;
+        public GTextInput m_inputName;
+        public const string URL = "ui://mfvz4q8knjmnfz";
+        public const string PACKAGE_NAME = "Main";
+        public const string RES_NAME = "ChangeNameUI";
+        private static UI_ChangeNameUI _proxy;
+
+        public static UI_ChangeNameUI Create(GObject gObject = null)
+        {
+            var ui = new UI_ChangeNameUI();
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_ChangeNameUI Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_ChangeNameUI();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static void ProxyEnd()
+        {
+            if (_proxy != null)
+            {
+                _proxy.Dispose();
+            }
+        }
+
+        public static void ClearProxy()
+        {
+            ProxyEnd();
+            _proxy = null;
+        }
+
+        private void Init(GComponent comp)
+        {
+            m_bg = (GImage)comp.GetChild("bg");
+            m_btnSure = (GButton)comp.GetChild("btnSure");
+            m_inputName = (GTextInput)comp.GetChild("inputName");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_bg = null;
+            m_btnSure = null;
+            m_inputName = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_ChangeNameUI.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2428fe27673010547b64b9824be70e87
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 19 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleInfoSProxy.cs

@@ -37,5 +37,24 @@ namespace GFGGame
             return RoleDataManager.slogan;
         }
 
+
+        //修改角色名称
+        public static async ETTask<bool> ReqModifyRoleName(string name)
+        {
+            // S2C_ModifyRoleName response = null;
+            // response = (S2C_ModifyRoleName)await MessageHelper.SendToServer(new C2S_ModifyRoleName() { Name = name });
+            // if (response != null)
+            // {
+            //     if (response.Error == ErrorCode.ERR_Success)
+            //     {
+            //         RoleDataManager.roleName = response.Name;
+            //         EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME);
+            //         return true;
+            //     }
+            // }
+            return false;
+        }
+
+
     }
 }

+ 84 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/ChangeNameView.cs

@@ -0,0 +1,84 @@
+using FairyGUI;
+using UI.Main;
+using System;
+using System.Text.RegularExpressions;
+using ET;
+using System.Threading.Tasks;
+
+namespace GFGGame
+{
+    public class ChangeNameView : BaseWindow
+    {
+        private UI_ChangeNameUI _ui;
+
+        public override void Dispose()
+        {
+            if (_ui != null)
+            {
+                _ui.Dispose();
+                _ui = null;
+            }
+            base.Dispose();
+        }
+
+        protected override void OnInit()
+        {
+            base.OnInit();
+            packageName = UI_ChangeNameUI.PACKAGE_NAME;
+            _ui = UI_ChangeNameUI.Create();
+            this.viewCom = _ui.target;
+            this.viewCom.Center();
+            this.modal = true;
+
+            _ui.m_btnSure.onClick.Add(OnClickBtnSureAsync);
+
+        }
+
+        protected override void OnShown()
+        {
+            base.OnShown();
+            this._ui.m_inputName.text = "";
+        }
+
+        protected override void OnHide()
+        {
+            base.OnHide();
+        }
+
+        private void OnClickBtnSureAsync()
+        {
+            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]+$"))//角色起名仅允许汉字、数字、底划线
+            {
+                PromptController.Instance.ShowFloatTextPrompt("角色名仅允许汉字、数字、下划线");
+                return;
+            }
+            string costName = ItemUtil.GetItemName(GlobalCfgArray.globalCfg.changeNameCostArr[0]);
+            int count = GlobalCfgArray.globalCfg.changeNameCostArr[1];
+
+            AlertUI.Show( string .Format("是否花费{0}个{1}改名1次?",count,costName))
+                .SetLeftButton(true).SetRightButton(true, "确定", async (object data) =>
+                {
+                    bool result = await RoleInfoSProxy.ReqModifyRoleName(roleName);
+                    if (result)
+                    {
+                        this.Hide();
+                    }
+                });
+
+        }
+
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/ChangeNameView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0a9b7a6dc73307d4e8062873a6f5e2b8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 1
GameClient/Assets/Game/HotUpdate/Views/MainUI/RoleInfoView.cs

@@ -35,7 +35,7 @@ namespace GFGGame
             _ui.m_btnMusic.onClick.Add(OnClickBtnMusic);
             _ui.m_btnHelp.onClick.Add(OnClickBtnHelp);
             _ui.m_txtSlogan.onFocusOut.Add(OnFocuseOut);
-
+            _ui.m_loaChangeName.onClick.Add(OnClickLoaChangeName);
         }
 
         protected override void OnShown()
@@ -111,5 +111,10 @@ namespace GFGGame
         {
             _ui.m_txtSlogan.text = await RoleInfoSProxy.ReqModifySlogan(_ui.m_txtSlogan.text);
         }
+
+        private void OnClickLoaChangeName()
+        {
+            ViewManager.Show<ChangeNameView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });
+        }
     }
 }

BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_1!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_1.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_2!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_2.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_3!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_3.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_4!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_4.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_5!a.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_atlas0_5.png


BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes