PartnerPlanRenamePanelCtrl.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using FL.Data;
  8. using XGame.Framework.UI;
  9. namespace FL.FGUI
  10. {
  11. /// <summary>
  12. /// UI逻辑处理类
  13. /// </summary>
  14. /// <typeparam name=""></typeparam>
  15. public partial class PartnerPlanRenamePanelCtrl : UIController<PartnerPlanRenamePanelVM>
  16. {
  17. private int _planId;
  18. protected override void OnEnable(object intent)
  19. {
  20. _planId = (int)intent;
  21. AddUIListenres();
  22. }
  23. protected override void OnDisable()
  24. {
  25. RemoveUIListenres();
  26. }
  27. #region UI事件
  28. private void AddUIListenres()
  29. {
  30. VM.ConfirmBtn.onClick.Add(OnConfirm);
  31. }
  32. private void RemoveUIListenres()
  33. {
  34. VM.ConfirmBtn.onClick.Remove(OnConfirm);
  35. }
  36. private void OnConfirm(EventContext eventContext)
  37. {
  38. var str = VM.Input.text;
  39. if (str.Length > 0)
  40. {
  41. PartnersService.Instance.RequestRenamePlan(_planId, str);
  42. Context.ClosePanel();
  43. }
  44. else
  45. {
  46. Context.ShowTips(StringDefine.RenameEmptyStrTips);
  47. }
  48. }
  49. #endregion
  50. }
  51. }