hch
3 天以前 9cbc08083fb2224dbc7994d901124074f6dc6a4f
0312 优化多父红点问题
2个文件已修改
31 ■■■■■ 已修改文件
Main/System/Redpoint/RedpointCenter.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Store/StoreModel.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
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;