From 9cbc08083fb2224dbc7994d901124074f6dc6a4f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 06 十一月 2025 11:49:40 +0800
Subject: [PATCH] 0312 优化多父红点问题
---
Main/System/Redpoint/RedpointCenter.cs | 26 ++++++++++++++++++++++++--
Main/System/Store/StoreModel.cs | 5 ++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/Main/System/Redpoint/RedpointCenter.cs b/Main/System/Redpoint/RedpointCenter.cs
index 69b7ae9..c0a7f71 100644
--- a/Main/System/Redpoint/RedpointCenter.cs
+++ b/Main/System/Redpoint/RedpointCenter.cs
@@ -22,6 +22,7 @@
{
redpoint.state = RedPointState.None;
}
+ RemoverOtherParent();
}
public void Register(Redpoint _redpoint)
@@ -50,7 +51,7 @@
}
}
- //棰濆娣诲姞鐖剁孩鐐圭敤
+ //棰濆娣诲姞鐖剁孩鐐圭敤锛屼細灞忚斀閲嶅娣诲姞锛屽灞傚彲鐩存帴閲嶅璋冪敤
public void AddParent(int _parentId, int _childId)
{
Redpoint child = null;
@@ -59,7 +60,11 @@
Debug.LogErrorFormat("娣诲姞鐖跺瓙鍏崇郴澶辫触锛屽瓙鑺傜偣涓嶅瓨鍦細id->{0}", _childId);
return;
}
-
+ if (child.otherParent > 0)
+ {
+ //涓嶉噸澶嶆坊鍔�
+ return;
+ }
child.otherParent = _parentId;
List<int> children = null;
@@ -74,6 +79,23 @@
}
}
+ public void RemoverOtherParent()
+ {
+ List<int> otherParents = new List<int>();
+ foreach (var redpoint in redpoints.Values)
+ {
+ if (redpoint.otherParent > 0)
+ {
+ otherParents.Add(redpoint.otherParent);
+ }
+ redpoint.otherParent = 0;
+ }
+ foreach (var parentId in otherParents)
+ {
+ parentChildren.Remove(parentId);
+ }
+ }
+
public void Report(Redpoint _redpoint)
{
if (redpointValueChangeEvent != null)
diff --git a/Main/System/Store/StoreModel.cs b/Main/System/Store/StoreModel.cs
index 5b1ffd7..d0b8220 100644
--- a/Main/System/Store/StoreModel.cs
+++ b/Main/System/Store/StoreModel.cs
@@ -43,7 +43,6 @@
public override void Init()
{
- RedpointCenter.Instance.AddParent(MainRedDot.MainGuildRedpoint, MainRedDot.Store_REDPOINT);
FuncOpen.Instance.OnFuncStateChangeEvent += FuncStateChange;
TimeMgr.Instance.OnDayEvent += RefreshDay;
GuildManager.Instance.EnterOrQuitGuildEvent += EnterOrQuitGuildEvent;
@@ -455,6 +454,10 @@
{
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
+ if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Guild) && PlayerDatas.Instance.fairyData.HasFairy)
+ {
+ RedpointCenter.Instance.AddParent(MainRedDot.MainGuildRedpoint, MainRedDot.Store_REDPOINT);
+ }
normalRedpoint.state = RedPointState.None;
guildRedpoint.state = RedPointState.None;
--
Gitblit v1.8.0