From d3609e1aa5f39fa529e0bcac0d9bb54ce81ed924 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期一, 02 二月 2026 20:17:55 +0800
Subject: [PATCH] 441 公会相关界面 公会申请界面
---
Main/System/Guild/GuildManager.cs | 85 +++++++++++++
Main/System/Guild/GuildApplyListCell.cs | 38 ++++++
Main/System/Guild/GuildApplyListWin.cs.meta | 11 +
Main/System/Guild/GuildApplyListCell.cs.meta | 11 +
Main/System/Guild/GuildApplyListWin.cs | 180 ++++++++++++++++++++++++++++++
Main/System/Guild/GuildBaseWin.cs | 5
6 files changed, 326 insertions(+), 4 deletions(-)
diff --git a/Main/System/Guild/GuildApplyListCell.cs b/Main/System/Guild/GuildApplyListCell.cs
new file mode 100644
index 0000000..b6a15de
--- /dev/null
+++ b/Main/System/Guild/GuildApplyListCell.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+
+public class GuildApplyListCell : MonoBehaviour
+{
+ [SerializeField] AvatarCell avatarCell;
+ [SerializeField] OfficialTitleCell officialTitleCell;
+ [SerializeField] TextEx nameText;
+ [SerializeField] TextEx lvText;
+ [SerializeField] TextEx fightPointText;
+ [SerializeField] ButtonEx yesButton;
+ [SerializeField] ButtonEx noButton;
+ GuildManager manager { get { return GuildManager.Instance; } }
+ public void Display(int index, List<FairyApply> list)
+ {
+ if (list.IsNullOrEmpty() || index >= list.Count || index < 0)
+ return;
+ FairyApply data = list[index];
+ nameText.text = data.Name;
+ lvText.text = data.LV.ToString();
+ fightPointText.text = UIHelper.ReplaceLargeArtNum(data.FightPower);
+ avatarCell.InitUI(AvatarHelper.GetAvatarModel(data.PlayerID, data.Face, data.FacePic));
+ officialTitleCell.InitUI(data.RealmLV, data.TitleID);
+
+ yesButton.SetListener(() =>
+ {
+ manager.SendJoinFamilyReply(data.PlayerID, true);
+ });
+ noButton.SetListener(() =>
+ {
+ manager.SendJoinFamilyReply(data.PlayerID, false);
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/Main/System/Guild/GuildApplyListCell.cs.meta b/Main/System/Guild/GuildApplyListCell.cs.meta
new file mode 100644
index 0000000..71dbd17
--- /dev/null
+++ b/Main/System/Guild/GuildApplyListCell.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 17800eebe4bc3d046a2117b210d30fe3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Guild/GuildApplyListWin.cs b/Main/System/Guild/GuildApplyListWin.cs
new file mode 100644
index 0000000..8afb375
--- /dev/null
+++ b/Main/System/Guild/GuildApplyListWin.cs
@@ -0,0 +1,180 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Cysharp.Threading.Tasks;
+using UnityEngine;
+using UnityEngine.UI;
+
+/// <summary>
+/// 鍏細鐢宠鍒楄〃鐣岄潰
+/// </summary>
+public class GuildApplyListWin : UIBase
+{
+ [SerializeField] Transform noApply;
+ [SerializeField] Transform bgImage;
+ [SerializeField] ScrollerController scroller;
+ [SerializeField] Toggle lowOfficialToggle;
+ [SerializeField] Toggle joinFreeToggle;
+ [SerializeField] Toggle sortToggle;
+ [SerializeField] Dropdown dropdown;
+ [SerializeField] ButtonEx rejectAllButton;
+ [SerializeField] TextEx countText;
+ GuildManager manager { get { return GuildManager.Instance; } }
+ protected override void InitComponent()
+ {
+ lowOfficialToggle.AddListener((bool value) =>
+ {
+ if (!PlayerDatas.Instance.fairyData.HasFairy)
+ return;
+ int lv = GetLvByIndex(dropdown.value);
+ manager.SendChangeFamilyJoin(joinFreeToggle.isOn ? 0 : 1, value ? lv : 0);
+ });
+
+ joinFreeToggle.AddListener((bool value) =>
+ {
+ if (!PlayerDatas.Instance.fairyData.HasFairy)
+ return;
+ int lv = GetLvByIndex(dropdown.value);
+ manager.SendChangeFamilyJoin(value ? 0 : 1, PlayerDatas.Instance.fairyData.fairy.JoinLVMin);
+ });
+
+ sortToggle.AddListener((bool value) =>
+ {
+ manager.isPowerSort = value;
+ Display();
+ });
+
+ dropdown.SetListener(OnDropdownValueChanged);
+
+ rejectAllButton.SetListener(() =>
+ {
+ manager.SendJoinFamilyReply(0, false);
+ });
+ }
+
+ protected override void OnPreOpen()
+ {
+ scroller.lockType = EnhanceLockType.KeepVertical;
+ manager.OnRefreshApplyList += OnRefreshApplyList;
+ PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo;
+ GuildManager.Instance.EnterOrQuitGuildEvent += OnEnterOrQuitGuildEvent;
+ scroller.OnRefreshCell += OnRefreshCell;
+ Display();
+ }
+
+ protected override void OnPreClose()
+ {
+ manager.OnRefreshApplyList -= OnRefreshApplyList;
+ PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyInfo;
+ GuildManager.Instance.EnterOrQuitGuildEvent -= OnEnterOrQuitGuildEvent;
+ scroller.OnRefreshCell -= OnRefreshCell;
+ }
+
+ private void OnEnterOrQuitGuildEvent(bool isEnter)
+ {
+ DelayCloseWindow().Forget();
+ }
+
+ private void OnRefreshFairyInfo()
+ {
+ if (!PlayerDatas.Instance.fairyData.HasFairy || !PlayerDatas.Instance.fairyData.IsCanFunc(LimitFunc.CanCall))
+ {
+ DelayCloseWindow().Forget();
+ return;
+ }
+ Display();
+ }
+
+ private void OnRefreshApplyList()
+ {
+ Display();
+ }
+
+ List<FairyApply> list;
+ private void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+ var _cell = cell.GetComponent<GuildApplyListCell>();
+ _cell?.Display(cell.index, list);
+ }
+
+ List<int> optionKeys;
+ List<string> optionValues;
+
+ private int GetLvByIndex(int index)
+ {
+ if (!PlayerDatas.Instance.fairyData.HasFairy)
+ return 0;
+ if (index < 0 || index >= optionKeys.Count)
+ return 0;
+ int lv = optionKeys[index];
+ return lv;
+ }
+
+ private void OnDropdownValueChanged(int index)
+ {
+ int lv = GetLvByIndex(index);
+ if (PlayerDatas.Instance.fairyData.fairy.JoinLVMin == lv)
+ return;
+ if (lowOfficialToggle.isOn)
+ {
+ manager.SendChangeFamilyJoin(PlayerDatas.Instance.fairyData.fairy.JoinReview, lv);
+ }
+ }
+
+ private void CreateScroller()
+ {
+ scroller.Refresh();
+ if (!manager.isPowerSort)
+ {
+ list = new List<FairyApply>(manager.GetApplyList());
+ }
+ else
+ {
+ list = new List<FairyApply>(manager.GetApplyList().OrderByDescending(x => x.FightPower));
+ }
+ bool isNullOrEmpty = list.IsNullOrEmpty();
+ bgImage.SetActive(!isNullOrEmpty);
+ noApply.SetActive(isNullOrEmpty);
+ if (!isNullOrEmpty)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ scroller.AddCell(ScrollerDataType.Header, i);
+ }
+ }
+ scroller.Restart();
+ }
+
+ private void CreateDropdown()
+ {
+ if (!manager.TryGetApplyOptions(out optionKeys, out optionValues))
+ return;
+
+ dropdown.ClearOptions();
+ dropdown.AddOptions(optionValues);
+ int joinLVMin = PlayerDatas.Instance.fairyData.fairy.JoinLVMin;
+ int index = optionKeys.IndexOf(joinLVMin);
+ dropdown.value = index < 0 ? 0 : index;
+ }
+
+ private void CreateToggle()
+ {
+ lowOfficialToggle.SetIsOnWithoutNotify(PlayerDatas.Instance.fairyData.fairy.JoinLVMin > 0);
+ joinFreeToggle.SetIsOnWithoutNotify(PlayerDatas.Instance.fairyData.fairy.JoinReview == 0);
+ sortToggle.SetIsOnWithoutNotify(manager.isPowerSort);
+ }
+
+ private void Display()
+ {
+ if (!PlayerDatas.Instance.fairyData.HasFairy)
+ return;
+
+ CreateToggle();
+ CreateDropdown();
+ CreateScroller();
+
+ List<FairyApply> list = manager.GetApplyList();
+ countText.text = Language.Get("GuildApplyList05", list != null ? list.Count : 0, manager.requestPlayerCount);
+ }
+
+}
\ No newline at end of file
diff --git a/Main/System/Guild/GuildApplyListWin.cs.meta b/Main/System/Guild/GuildApplyListWin.cs.meta
new file mode 100644
index 0000000..817eb26
--- /dev/null
+++ b/Main/System/Guild/GuildApplyListWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0203bee4a8b78a44582611a1dff9ee8b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Guild/GuildBaseWin.cs b/Main/System/Guild/GuildBaseWin.cs
index 1c88162..1b3a829 100644
--- a/Main/System/Guild/GuildBaseWin.cs
+++ b/Main/System/Guild/GuildBaseWin.cs
@@ -48,7 +48,7 @@
requestBtn.AddListener(() =>
{
- // UIManager.Instance.OpenWindow<GuildRequestWin>();
+ UIManager.Instance.OpenWindow<GuildApplyListWin>();
});
guildHawkerBtn.AddListener(OpenHawker);
@@ -71,7 +71,7 @@
{
if (PlayerDatas.Instance.fairyData.fairy == null)
return;
-
+
GuildManager.Instance.RequestGuildData();
GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
GlobalTimeEvent.Instance.fiveSecondEvent += OnFiveSecondEvent;
@@ -114,6 +114,7 @@
void ShowGuildInfo()
{
+ requestBtn.SetActive(PlayerDatas.Instance.fairyData.HasFairy && PlayerDatas.Instance.fairyData.IsCanFunc(LimitFunc.CanCall));
emblemCell.Display(PlayerDatas.Instance.fairyData.fairy.EmblemID, PlayerDatas.Instance.fairyData.fairy.EmblemWord, 0.8f);
guildNameText.text = PlayerDatas.Instance.fairyData.fairy.FamilyName;
var config = FamilyConfig.Get(PlayerDatas.Instance.fairyData.fairy.FamilyLV);
diff --git a/Main/System/Guild/GuildManager.cs b/Main/System/Guild/GuildManager.cs
index 86c096c..8336836 100644
--- a/Main/System/Guild/GuildManager.cs
+++ b/Main/System/Guild/GuildManager.cs
@@ -50,6 +50,7 @@
DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
TimeMgr.Instance.OnHourEvent += UpdateZBGRedpoint;
+ PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo;
}
public override void Release()
{
@@ -58,8 +59,13 @@
DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
TimeMgr.Instance.OnHourEvent -= UpdateZBGRedpoint;
+ PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyInfo;
}
+ private void OnRefreshFairyInfo()
+ {
+ UpdateRequestRedpoint();
+ }
void OnBeforePlayerDataInitialize()
{
@@ -541,6 +547,19 @@
int queryPointNum; //鏌ヨ鐐�
public int rankShowMaxCnt;
+ public bool isPowerSort
+ {
+ get
+ {
+ return LocalSave.GetBool($"GuildApplyList_IsPowerSort_{PlayerDatas.Instance.PlayerId}");
+ }
+ set
+ {
+ LocalSave.SetBool($"GuildApplyList_IsPowerSort_{PlayerDatas.Instance.PlayerId}", value);
+ }
+ }
+
+
public FairyData GetFairyDataByRank(int rank)
{
if (rank < 1)
@@ -667,7 +686,6 @@
data.EmblemWord = view.EmblemWord;
data.totalFightPower = view.FightPowerEx * Constants.ExpPointValue + view.FightPower;
data.MemberCount = view.MemberCount;
-
}
#endregion
@@ -676,7 +694,7 @@
public event Action OnRefreshApplyList;
private List<FairyApply> applyList = new List<FairyApply>();
private Redpoint memberRedpoint = new Redpoint(107, 10702);
- private Redpoint applyRedpoint = new Redpoint(10702, 1070201);
+ private Redpoint applyRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, 1070201);
//鐢宠鍔犲叆鐨勭帺瀹朵俊鎭�
public void OnRefreshRequestJoinPlayerInfo(HA522_tagMCFamilyReqJoinInfo vNetData)
@@ -705,6 +723,9 @@
}
UpdateRequestRedpoint();
}
+
+
+
void UpdateRequestRedpoint()
{
@@ -760,6 +781,12 @@
SysNotifyMgr.Instance.ShowTip("jiazu_lhs_202580");
return;
}
+
+ if (guildsDict[id].JoinLVMin > PlayerDatas.Instance.baseData.realmLevel && RealmConfig.HasKey(guildsDict[id].JoinLVMin))
+ {
+ SysNotifyMgr.Instance.ShowTip("GuildApply01", RealmConfig.Get(guildsDict[id].JoinLVMin).Name);
+ return;
+ }
}
}
@@ -787,8 +814,62 @@
return 0;
}
+ public void SendJoinFamilyReply(int tagPlayerID, bool isOK)
+ {
+ CA621_tagCMJoinFamilyReply pack = new CA621_tagCMJoinFamilyReply();
+ pack.TagPlayerID = (uint)tagPlayerID;
+ pack.IsOK = (byte)(isOK ? 1 : 0);
+ GameNetSystem.Instance.SendInfo(pack);
+ }
+ public void SendChangeFamilyJoin(int joinReview, int joinLVMin)
+ {
+ CA622_tagCMChangeFamilyJoin pack = new CA622_tagCMChangeFamilyJoin();
+ pack.JoinReview = (byte)joinReview;
+ pack.JoinLVMin = (ushort)joinLVMin;
+ GameNetSystem.Instance.SendInfo(pack);
+ }
+ public void SendRequestJoinFamilyByPlayer(int tagPlayerID)
+ {
+ CA601_tagCMRequestJoinFamilyByPlayer pack = new CA601_tagCMRequestJoinFamilyByPlayer();
+ pack.TagPlayerID = (uint)tagPlayerID;
+ GameNetSystem.Instance.SendInfo(pack);
+ }
+
+ List<string> optionStrings = null;
+ List<int> options = null;
+ public bool TryGetApplyOptions(out List<int> optionKeys, out List<string> optionValues)
+ {
+ optionKeys = null;
+ optionValues = null;
+
+ if (options == null)
+ {
+ options = new List<int>();
+ options = new List<int>(RealmConfig.GetKeys());
+ options.Sort();
+ options.Remove(0);
+ }
+
+ if (optionStrings == null)
+ {
+ optionStrings = new List<string>();
+ foreach (int lv in options)
+ {
+ if (!RealmConfig.HasKey(lv))
+ continue;
+ RealmConfig realmConfig = RealmConfig.Get(lv);
+ optionStrings.Add(UIHelper.AppendColor(OfficialRankManager.Instance.GetOfficialRankColor(realmConfig.Quality), realmConfig.Name));
+ }
+ }
+
+ if (options.IsNullOrEmpty() || optionStrings.IsNullOrEmpty() || options.Count != optionStrings.Count)
+ return false;
+ optionKeys = options;
+ optionValues = optionStrings;
+ return true;
+ }
#endregion
float lastChangeMarkTime = 0; //鎵撳紑鐣岄潰鎯呭喌涓嬮伩鍏嶇煭鏃堕棿澶氭绔嬪嵆璇锋眰锛孋/S閫氫俊涔熸槸鏈夋椂闂撮棿闅�
--
Gitblit v1.8.0