12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System.Text.RegularExpressions;
- using ET;
- using FairyGUI;
- using UI.League;
- using UnityEngine;
- namespace GFGGame
- {
- //修改联盟公告
- public class LeagueChangeNoticeView : BaseWindow
- {
- private UI_LeagueChangeNoticeUI _ui;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_LeagueChangeNoticeUI.PACKAGE_NAME;
- _ui = UI_LeagueChangeNoticeUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
- _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
- _ui.m_txtContent.onFocusOut.Add(OnFocuseOut);
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void OnFocuseOut()
- {
- _ui.m_txtCount.SetVar("value", _ui.m_txtContent.text.Length.ToString());
- _ui.m_txtCount.SetVar("maxValue", "50");
- }
- private async void OnBtnSaveClick()
- {
- if (!Regex.IsMatch(_ui.m_txtContent.text, @"^[\u4e00-\u9fa5_0-9]+$"))
- {
- PromptController.Instance.ShowFloatTextPrompt("雅集公告仅允许汉字、数字、下划线");
- return;
- }
- bool result = await LeagueSproxy.ReqChangeLeagueNotice(_ui.m_txtContent.text);
- if (result)
- {
- Hide();
- }
- }
- }
- }
|