1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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(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();
- }
- }
- }
- }
|