From db03acba6290a09418bcc0a05392a662cc39743e Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 28 一月 2026 19:31:24 +0800
Subject: [PATCH] 441 公会相关界面 公会日志

---
 Main/System/Guild/GuildManager.cs             |    7 
 Main/System/Guild/GuildNoteNormalCell.cs      |   30 +++++
 Main/System/Guild/GuildNoteHeaderCell.cs.meta |   11 +
 Main/System/Guild/GuildOPWin.cs               |    2 
 Main/System/Guild/GuildNoteWin.cs.meta        |   11 +
 Main/System/Guild/GuildNoteHeaderCell.cs      |   14 ++
 Main/System/Guild/GuildNoteNormalCell.cs.meta |   11 +
 Main/System/Guild/PlayerFairyData.cs          |    3 
 Main/System/Guild/GuildNoteWin.cs             |  227 +++++++++++++++++++++++++++++++++++++
 9 files changed, 313 insertions(+), 3 deletions(-)

diff --git a/Main/System/Guild/GuildManager.cs b/Main/System/Guild/GuildManager.cs
index f6e8e11..c3141b7 100644
--- a/Main/System/Guild/GuildManager.cs
+++ b/Main/System/Guild/GuildManager.cs
@@ -180,7 +180,7 @@
     public int zbgOrgPriceValue;
     public int zbgChangFamilyCD;
     public List<int> cutCntListForTalk = new List<int>();
-
+    public int familyRecordMaxCount;
 
     void ParseConfig()
     {
@@ -219,6 +219,9 @@
         zbgOrgPriceValue = int.Parse(config.Numerical2);
         zbgChangFamilyCD = int.Parse(config.Numerical3);
         cutCntListForTalk = JsonMapper.ToObject<List<int>>(config.Numerical4);
+
+        config = FuncConfigConfig.Get("FamilyNote");
+        familyRecordMaxCount = int.Parse(config.Numerical1);
     }
 
 
@@ -865,7 +868,7 @@
             return false;
         }
         bool restart = false;
-        
+
         for (int i = 0; i < vNetData.FamilyActionList.Length; i++)
         {
             int playerID = (int)vNetData.FamilyActionList[i].Value1;
diff --git a/Main/System/Guild/GuildNoteHeaderCell.cs b/Main/System/Guild/GuildNoteHeaderCell.cs
new file mode 100644
index 0000000..650ae82
--- /dev/null
+++ b/Main/System/Guild/GuildNoteHeaderCell.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+public class GuildNoteHeaderCell : MonoBehaviour
+{
+    [SerializeField] TextEx date;
+    public void Display(int index, List<GuildNoteData> datas)
+    {
+        if (datas.IsNullOrEmpty() || index < 0 || index >= datas.Count)
+            return;
+        date.text = datas[index].Info;
+    }
+
+}
\ No newline at end of file
diff --git a/Main/System/Guild/GuildNoteHeaderCell.cs.meta b/Main/System/Guild/GuildNoteHeaderCell.cs.meta
new file mode 100644
index 0000000..086a892
--- /dev/null
+++ b/Main/System/Guild/GuildNoteHeaderCell.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c3a277ed730042a4987a4cc292e794a5
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Main/System/Guild/GuildNoteNormalCell.cs b/Main/System/Guild/GuildNoteNormalCell.cs
new file mode 100644
index 0000000..124ec3c
--- /dev/null
+++ b/Main/System/Guild/GuildNoteNormalCell.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class GuildNoteNormalCell : MonoBehaviour
+{
+    [SerializeField] TextEx time;
+    [SerializeField] TextEx content;
+
+    public void Display(int index, List<GuildNoteData> datas)
+    {
+        if (datas.IsNullOrEmpty() || index < 0 || index >= datas.Count)
+            return;
+
+        DateTime currentTime = TimeUtility.GetTime(datas[index].Time);
+        time.text = currentTime.ToString("HH:mm");
+        content.text = datas[index].Info;
+    }
+
+    public float GetHeight(string info)
+    {
+        float height = 0f;
+        if (string.IsNullOrEmpty(info))
+            return height;
+
+        content.text = info;
+        height = content.preferredHeight;
+        return height;
+    }
+}
\ No newline at end of file
diff --git a/Main/System/Guild/GuildNoteNormalCell.cs.meta b/Main/System/Guild/GuildNoteNormalCell.cs.meta
new file mode 100644
index 0000000..32b7684
--- /dev/null
+++ b/Main/System/Guild/GuildNoteNormalCell.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e8536aad1963a3244986aedefefbcd5c
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Main/System/Guild/GuildNoteWin.cs b/Main/System/Guild/GuildNoteWin.cs
new file mode 100644
index 0000000..73bcaac
--- /dev/null
+++ b/Main/System/Guild/GuildNoteWin.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Cysharp.Threading.Tasks;
+using UnityEngine;
+
+/// <summary>
+/// 鍏細鏃ュ織鐣岄潰
+/// </summary>
+public class GuildNoteWin : UIBase
+{
+    [SerializeField] Color32 nameColor;
+    [SerializeField] Transform noNote;
+    [SerializeField] Transform hasNote;
+    [SerializeField] GuildNoteNormalCell guildNoteNormalCell;
+    [SerializeField] ScrollerController scroller;
+    [SerializeField] TextEx maxCount;
+    protected override void OnPreOpen()
+    {
+        GuildManager.Instance.EnterOrQuitGuildEvent += OnEnterOrQuitGuildEvent;
+        GuildManager.Instance.FamilyActionInfoEvent += OnFamilyActionInfoEvent;
+        scroller.OnGetDynamicSize += OnGetChatDynamicSize;
+        scroller.OnRefreshCell += OnRefreshCell;
+
+        maxCount.text = Language.Get("Guild_82", GuildManager.Instance.familyRecordMaxCount);
+
+        GuildManager.Instance.QueryFamilyAction(PlayerDatas.Instance.fairyData.fairy.FamilyID, GuildManager.MemberChangeActionType);
+    }
+
+
+    protected override void OnPreClose()
+    {
+        GuildManager.Instance.EnterOrQuitGuildEvent -= OnEnterOrQuitGuildEvent;  
+        GuildManager.Instance.FamilyActionInfoEvent -= OnFamilyActionInfoEvent;
+        scroller.OnGetDynamicSize -= OnGetChatDynamicSize;
+        scroller.OnRefreshCell -= OnRefreshCell;
+    }
+
+    private void OnEnterOrQuitGuildEvent(bool isEnter)
+    {
+        DelayCloseWindow().Forget();
+    }
+
+    private bool OnGetChatDynamicSize(ScrollerDataType type, int index, out float height)
+    {
+        height = 0;
+        if (list.IsNullOrEmpty() || index < 0 || index >= list.Count)
+            return false;
+        var data = list[index];
+        switch (type)
+        {
+            case ScrollerDataType.Header:
+                height = 19;
+                return true;
+            case ScrollerDataType.Normal:
+                height = guildNoteNormalCell.GetHeight(data.Info);
+                return true;
+        }
+        return true;
+    }
+
+    private void OnRefreshCell(ScrollerDataType type, CellView cell)
+    {
+        if (type == ScrollerDataType.Header)
+        {
+            var _cell = cell.GetComponent<GuildNoteHeaderCell>();
+            _cell?.Display(cell.index, list);
+        }
+        else
+        {
+            var _cell = cell.GetComponent<GuildNoteNormalCell>();
+            _cell?.Display(cell.index, list);
+        }
+    }
+
+    private void OnFamilyActionInfoEvent(int familyID, int actionType)
+    {
+        if (familyID != PlayerDatas.Instance.fairyData.fairy.FamilyID)
+            return;
+        if (actionType != GuildManager.MemberChangeActionType)
+            return;
+        Display();
+    }
+
+    List<GuildNoteData> list;
+    private void Display()
+    {
+        if (!GuildManager.Instance.TryGetFamilyActions(GuildManager.MemberChangeActionType, out var actions))
+        {
+            hasNote.SetActive(false);
+            noNote.SetActive(true);
+            return;
+        }
+
+        list = GetShowGuildNoteDataList(actions);
+        bool isNullOrEmpty = list.IsNullOrEmpty();
+        if (isNullOrEmpty)
+        {
+            hasNote.SetActive(false);
+            noNote.SetActive(true);
+            return;
+        }
+
+        scroller.Refresh();
+        if (!isNullOrEmpty)
+        {
+            for (int i = 0; i < list.Count; i++)
+            {
+                if (list[i].ShowType == 0)
+                {
+                    scroller.AddCell(ScrollerDataType.Header, i);
+                }
+                else
+                {
+                    scroller.AddCell(ScrollerDataType.Normal, i);
+                }
+            }
+        }
+        scroller.Restart();
+
+        noNote.SetActive(isNullOrEmpty);
+        hasNote.SetActive(!isNullOrEmpty);
+
+    }
+
+
+    private List<GuildNoteData> GetShowGuildNoteDataList(HA513_tagMCFamilyActionInfo.tagMCFamilyAction[] actions)
+    {
+        List<GuildNoteData> list = GetGuildNoteDataList(actions);
+        if (list.IsNullOrEmpty())
+            return null;
+
+        var result = new List<GuildNoteData>();
+
+        int lastDay = -1;
+
+        foreach (var noteData in list)
+        {
+            // 鑾峰彇褰撳墠鏉$洰鎵�灞炴棩鏈�
+            DateTime currentTime = TimeUtility.GetTime(noteData.Time);
+            int currentDay = TimeUtility.GetPassDays((int)noteData.Time);
+
+            // 妫�鏌ユ槸鍚﹂渶瑕佹彃鍏ユ棩鏈熸爣棰�
+            if (lastDay == -1 || currentDay != lastDay)
+            {
+                // 鑾峰彇鐩爣澶╃殑鍑屾櫒鏃堕棿鎴�
+                DateTime dayStartTime = TimeUtility.GetDayStartTime(currentTime.Year, currentTime.Month, currentTime.Day);
+                int dayStartSeconds = (int)(dayStartTime - TimeUtility.OriginalTime).TotalSeconds;
+
+                result.Add(new GuildNoteData
+                {
+                    ShowType = 0, // 鏍囬绫诲瀷
+                    Time = (uint)dayStartSeconds,
+                    Info = currentTime.ToString("yyyy-MM-dd"),
+                });
+            }
+
+            result.Add(noteData);
+            lastDay = currentDay;
+        }
+
+        return result;
+    }
+
+    private List<GuildNoteData> GetGuildNoteDataList(HA513_tagMCFamilyActionInfo.tagMCFamilyAction[] actions)
+    {
+        if (actions.IsNullOrEmpty())
+            return null;
+
+        var result = new List<GuildNoteData>();
+        int maxCount = GuildManager.Instance.familyRecordMaxCount;
+        // 鍊掑簭閬嶅巻actions锛屽苟闄愬埗鏁伴噺
+        int count = 0;
+        for (int i = actions.Length - 1; i >= 0 && count < maxCount; i--)
+        {
+            var action = actions[i];
+            string info = GetInfo(action);
+            result.Add(new GuildNoteData
+            {
+                ShowType = 1, // 鍐呭绫诲瀷
+                Time = action.Time,
+                Info = info,
+            });
+            count++;
+        }
+        return result.OrderBy(a => a.Time).ToList();
+    }
+
+    private string GetInfo(HA513_tagMCFamilyActionInfo.tagMCFamilyAction data)
+    {
+        if (data == null || data.Value1 != 2)
+            return string.Empty;
+        switch (data.Value2)
+        {
+            case 0:
+                return Language.Get("Guild_52", GetColorStr(data.Name));
+            case 1:
+                return Language.Get("Guild_53", GetColorStr(data.Name));
+            case 2:
+                return Language.Get("Guild_55", GetColorStr(data.Name));
+            case 4:
+                if (data.Value3 > data.Value4)
+                {
+                    return Language.Get("Guild_54", GetColorStr(data.Name), GetColorStr(RichTextMsgReplaceConfig.GetRichReplace("FAMILY", (int)data.Value3)));
+                }
+                else
+                {
+                    return Language.Get("Guild_83", GetColorStr(data.Name), GetColorStr(RichTextMsgReplaceConfig.GetRichReplace("FAMILY", (int)data.Value3)));
+                }
+            case 3:
+            default:
+                return string.Empty;
+        }
+    }
+
+    private string GetColorStr(string name)
+    {
+        return UIHelper.AppendColor(nameColor, name);
+    }
+}
+
+public class GuildNoteData
+{
+    public uint Time;          //鏃堕棿鎴�
+    public int ShowType;       //鏄剧ず鐢ㄩ�旂被鍨� 0-鏍囬锛堝勾-鏈�-鏃ワ級 1-鍐呭
+    public string Info;        //淇℃伅
+}
\ No newline at end of file
diff --git a/Main/System/Guild/GuildNoteWin.cs.meta b/Main/System/Guild/GuildNoteWin.cs.meta
new file mode 100644
index 0000000..7c4bfd2
--- /dev/null
+++ b/Main/System/Guild/GuildNoteWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f0e090843a250514f8fabb9b8713e625
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Main/System/Guild/GuildOPWin.cs b/Main/System/Guild/GuildOPWin.cs
index 2298c04..aecd11e 100644
--- a/Main/System/Guild/GuildOPWin.cs
+++ b/Main/System/Guild/GuildOPWin.cs
@@ -43,7 +43,7 @@
         
         noteBtn.AddListener(() =>
         {
-            // UIManager.Instance.OpenWindow<GuildNoteWin>();
+            UIManager.Instance.OpenWindow<GuildNoteWin>();
         });
         
     }
diff --git a/Main/System/Guild/PlayerFairyData.cs b/Main/System/Guild/PlayerFairyData.cs
index d27d51d..29e2508 100644
--- a/Main/System/Guild/PlayerFairyData.cs
+++ b/Main/System/Guild/PlayerFairyData.cs
@@ -29,6 +29,7 @@
 
     // 0-鎴愬憳锛�1-绮捐嫳锛�2-鍓洘涓伙紝3-鐩熶富
     public int leaderID;
+    public string leaderName;
     // // 绮捐嫳
     public List<int> elitePlayerIDList = new List<int>();
     // // 鍓洘涓�
@@ -102,6 +103,7 @@
             if (member.FmLV == 3)
             {
                 leaderID = (int)member.PlayerID;
+                leaderName = member.Name;
             }
         }
 
@@ -142,6 +144,7 @@
         memberDic.Clear();
         memberIDList.Clear();
         leaderID = 0;
+        leaderName = string.Empty;
     }
 
     int SortMember(int id1, int id2)

--
Gitblit v1.8.0