| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 | 
							- using System.Collections.Generic;
 
- using ET;
 
- using FairyGUI;
 
- using UI.League;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     //申请加入联盟
 
-     public class LeagueJoinView : BaseWindow
 
-     {
 
-         private UI_LeagueJoinUI _ui;
 
-         private List<long> _leagueIds;
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_LeagueJoinUI.PACKAGE_NAME;
 
-             _ui = UI_LeagueJoinUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing");
 
-             _ui.m_btnBack.onClick.Add(OnBtnBackClick);
 
-             _ui.m_btnSearch.onClick.Add(OnBtnSearchClick);
 
-             _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
 
-             _ui.m_btnCreat.onClick.Add(OnBtnCreatClick);
 
-             _ui.m_txtSearch.onFocusOut.Add(OnFocuseOut);
 
-             _ui.m_list.itemRenderer = RenderListItem;
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _leagueIds = new List<long>(LeagueDataManager.Instance.ListDatas.Keys);
 
-             _ui.m_list.numItems = _leagueIds.Count;
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-         }
 
-         private void OnBtnBackClick()
 
-         {
 
-             ViewManager.GoBackFrom(typeof(LeagueJoinView).FullName);
 
-         }
 
-         private void OnBtnSearchClick()
 
-         {
 
-             ReqLeagueList(_ui.m_txtSearch.text);
 
-         }
 
-         private void OnBtnChangeClick()
 
-         {
 
-             ReqLeagueList("");
 
-         }
 
-         private void OnFocuseOut()
 
-         {
 
-             if (string.IsNullOrEmpty(_ui.m_txtSearch.text))
 
-             {
 
-                 ReqLeagueList("");
 
-             }
 
-         }
 
-         private void OnBtnCreatClick()
 
-         {
 
-             ViewManager.Show<LeagueCreatView>(null, new object[] { typeof(LeagueJoinView).FullName, null });
 
-         }
 
-         private async void ReqLeagueList(string leagueName)
 
-         {
 
-             bool result = await LeagueSproxy.ReqSearchLeagueInfo(leagueName);
 
-             if (result)
 
-             {
 
-                 _leagueIds = new List<long>(LeagueDataManager.Instance.ListDatas.Keys);
 
-                 _ui.m_list.numItems = _leagueIds.Count;
 
-             }
 
-         }
 
-         private void RenderListItem(int index, GObject obj)
 
-         {
 
-             LeagueListData leagueListData = LeagueDataManager.Instance.ListDatas[_leagueIds[index]];
 
-             UI_ListJoinItem item = UI_ListJoinItem.Proxy(obj);
 
-             item.m_comLeagueHead.m_loaUnionIcon.url = ResPathUtil.GetLeagueIconPath(leagueListData.Icon);
 
-             item.m_comLeagueHead.m_txtUnionLv.text = leagueListData.Level.ToString();
 
-             item.m_txtLeagueName.text = leagueListData.Name;
 
-             item.m_imgAd.visible = leagueListData.IsAd;
 
-             item.m_txtMemberCount.SetVar("value", leagueListData.Num.ToString()).FlushVars();
 
-             item.m_txtMemberCount.SetVar("maxValue", leagueListData.MaxNum.ToString()).FlushVars();
 
-             item.m_txtCheck.text = leagueListData.NeedAudit ? "是" : "否";
 
-             item.m_btnJoin.title = "申请";
 
-             if (item.m_btnJoin.data == null)
 
-             {
 
-                 item.m_btnJoin.onClick.Add(OnBtnJoinClick);
 
-             }
 
-             item.m_btnJoin.data = leagueListData.LeagueId;
 
-             UI_ListJoinItem.ProxyEnd();
 
-         }
 
-         private async void OnBtnJoinClick(EventContext context)
 
-         {
 
-             GButton obj = context.sender as GButton;
 
-             long leagueId = (long)obj.data;
 
-             LeagueListData listData = LeagueDataManager.Instance.ListDatas[leagueId];
 
-             if (listData.Num == listData.MaxNum)
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("雅集满员啦,换个雅集申请吧");
 
-                 return;
 
-             }
 
-             if (LeagueDataManager.Instance.ListDatas[leagueId].NeedAudit)
 
-             {
 
-                 AlertUI.Show("该雅集需要审批同意后才可加入,是否仍需要申请?").
 
-                 SetLeftButton(true, "取消").
 
-                  SetRightButton(true, "申请", async (object param) =>
 
-                  {
 
-                      bool result = await LeagueSproxy.ReqJoinLeague(leagueId);
 
-                      if (result)
 
-                      {
 
-                          obj.title = "已申请";
 
-                      }
 
-                  });
 
-             }
 
-             else
 
-             {
 
-                 bool result = await LeagueSproxy.ReqJoinLeague(leagueId);
 
-                 if (result)
 
-                 {
 
-                     OnBtnBackClick();
 
-                     ViewManager.Show<LeagueView>(null, new object[] { typeof(MainUIView).FullName, null });
 
-                 }
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |