From bd41d84bbd61de37bd880c591ecce690ebe294bd Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期日, 19 十月 2025 18:12:49 +0800 Subject: [PATCH] 65 子 【公会】基础主体 / 【公会】基础主体-客户端 --- Main/System/Guild/GuildJoinWin.cs | 89 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 77 insertions(+), 12 deletions(-) diff --git a/Main/System/Guild/GuildJoinWin.cs b/Main/System/Guild/GuildJoinWin.cs index db9a591..10aeb88 100644 --- a/Main/System/Guild/GuildJoinWin.cs +++ b/Main/System/Guild/GuildJoinWin.cs @@ -4,7 +4,7 @@ using UnityEngine.UI; /// <summary> -/// 鍔犲叆鍏細鐣岄潰 +/// 鍔犲叆鍏細鐣岄潰 锛氬叕浼氭煡鎵惧垪琛紝涔熸槸鎺掕姒� /// </summary> public class GuildJoinWin : UIBase { @@ -19,7 +19,7 @@ int lastPage = 0; protected override void InitComponent() { - findBtn.AddListener(OnFindBtnClick); + findBtn.AddListener(() => OnFindBtnClick()); createGuildBtn.AddListener(OnCreateGuildBtnClick); quicklyJoinGuildBtn.AddListener(OnQuicklyJoinGuildBtnClick); } @@ -27,9 +27,34 @@ { findText.text = ""; //鎵撳紑鐣岄潰榛樿璇锋眰锛屾粴鍔ㄧ殑鏃跺�欓渶瑕佸鐞嗛〉鏁� - OnFindBtnClick(); + QueryGuild(); GuildManager.Instance.OnRefreshFairyList += OnRefreshGuildList; + GuildManager.Instance.MyRequestJoinEvent += MyRequestJoinEvent; + PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo; + guildListScroller.OnRefreshCell += RefreshCell; Display(); + } + + protected override void OnPreClose() + { + GuildManager.Instance.OnRefreshFairyList -= OnRefreshGuildList; + GuildManager.Instance.MyRequestJoinEvent -= MyRequestJoinEvent; + guildListScroller.OnRefreshCell -= RefreshCell; + PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyInfo; + + var win = UIManager.Instance.GetUI<MainWin>(); + if (win) + win.RestoreFuncBtn(); + + } + + void OnRefreshFairyInfo() + { + //褰撳墠鐣岄潰涓嬫湁鍒锋柊鑷鐨勫叕浼氭暟鎹紝璇存槑涓�瀹氭槸鍔犲叆浜嗗叕浼氾紝闇�涓诲姩璺宠浆鍒板叕浼氱晫闈� + CloseWindow(); + var win = UIManager.Instance.GetUI<MainWin>(); + if (win) + win.ClickFunc(4); } void Display() @@ -37,10 +62,24 @@ CreateScroller(); } + void MyRequestJoinEvent() + { + guildListScroller.m_Scorller.RefreshActiveCellViews(); + } + //鍒楄〃鍙樺皬鐨勮瘽 閲嶆柊鍒涘缓锛涘垪琛ㄥ彉澶х殑璇濓紝鍙坊鍔� void CreateScroller() { + if (GuildManager.Instance.pageIndexList.Count == 0) + { + noGuildTf.SetActive(true); + guildListScroller.SetActive(false); + return; + } + noGuildTf.SetActive(false); + guildListScroller.SetActive(true); + var startCount = guildListScroller.GetNumberOfCells(); if (startCount > GuildManager.Instance.pageIndexList.Count) { @@ -53,12 +92,6 @@ guildListScroller.Restart(); } - protected override void OnPreClose() - { - GuildManager.Instance.OnRefreshFairyList -= OnRefreshGuildList; - } - - void OnRefreshGuildList() @@ -66,9 +99,36 @@ CreateScroller(); } + void RefreshCell(ScrollerDataType type, CellView cell) + { + var _cell = cell.GetComponent<GuildViewListCell>(); + _cell.Display(cell.index); + } + private void OnFindBtnClick() { - lastQuery = findText.text; + var nowQuery = findText.text; + if (string.IsNullOrEmpty(nowQuery) && string.IsNullOrEmpty(lastQuery)) + { + SysNotifyMgr.Instance.ShowTip("GuildSys5"); + return; + } + if (nowQuery.Length < 2 && nowQuery.Length > 0) + { + SysNotifyMgr.Instance.ShowTip("GuildSys7"); + return; + } + + lastQuery = nowQuery; + lastPage = 0; + guildListScroller.Refresh(); + GuildManager.Instance.SendFindGuild(lastQuery); + } + + + void QueryGuild() + { + lastQuery = ""; lastPage = 0; guildListScroller.Refresh(); GuildManager.Instance.SendFindGuild(lastQuery); @@ -76,12 +136,17 @@ private void OnCreateGuildBtnClick() { - // TODO: 瀹炵幇鍒涘缓鍏細閫昏緫 + UIManager.Instance.OpenWindow<GuildCreateWin>(); } private void OnQuicklyJoinGuildBtnClick() { - // TODO: 瀹炵幇蹇�熷姞鍏ュ叕浼氶�昏緫 + if (GuildManager.Instance.pageIndexList.Count == 0) + { + SysNotifyMgr.Instance.ShowTip("QuickEnterFamilyFail"); + return; + } + GuildManager.Instance.SendApplyGuild(0, 0); } -- Gitblit v1.8.0