123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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_btnClose.onClick.Add(Hide);
- _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
- _ui.m_txtContent.onFocusOut.Add(UpdateView);
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _ui.m_txtContent.text = LeagueDataManager.Instance.LeagueData.Notice;
- UpdateView();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void UpdateView()
- {
- _ui.m_txtCount.SetVar("value", _ui.m_txtContent.text.Length.ToString()).FlushVars();
- _ui.m_txtCount.SetVar("maxValue", "50").FlushVars();
- }
- 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();
- }
- }
- }
- }
|