Ejemplo n.º 1
0
        public void SendRedPointNotify(ERedPointType redPointType)
        {
            if (redPointType == ERedPointType.None)
            {
                return;
            }

            RedPointDelegateInfo delegateInfo = GetRedPointDelegate(redPointType);

            if (delegateInfo != null)
            {
                int num = GetRedPointNum(redPointType);
                for (int i = 0; i < delegateInfo.delegates.Count; i++)
                {
                    if (delegateInfo.delegates[i] != null)
                    {
                        delegateInfo.delegates[i].OnTipsChanged(redPointType, num);
                    }
                }
            }

            ERedPointType parentType = RedPointParentData.GetRedPointParentType(redPointType);

            if (parentType != ERedPointType.None)
            {
                SendRedPointNotify(parentType);
            }
        }
Ejemplo n.º 2
0
        public bool UnRegisterTipsDelegate(ERedPointType redPointType)
        {
            if (redPointType == ERedPointType.None)
            {
                return(false);
            }

            bool result = false;

            RedPointDelegateInfo delegateInfo = GetRedPointDelegate(redPointType);

            if (delegateInfo != null)
            {
                result = redPointDelegateDict.Remove(redPointType);
                delegateInfo.OnRecycle();
                SimplePool <RedPointDelegateInfo> .Release(delegateInfo);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public bool UnRegisterRedPointDelegate(ERedPointType redPointType, IRedPointDelegate callback)
        {
            if (redPointType == ERedPointType.None || callback == null)
            {
                return(false);
            }

            bool result = false;

            RedPointDelegateInfo delegateInfo = GetRedPointDelegate(redPointType);

            if (delegateInfo != null)
            {
                result = delegateInfo.delegates.Remove(callback);
                if (delegateInfo.delegates.Count == 0)
                {
                    UnRegisterTipsDelegate(redPointType);
                }
            }

            return(result);
        }
Ejemplo n.º 4
0
        public bool RegisterRedPointDelegate(ERedPointType redPointType, IRedPointDelegate callback)
        {
            if (redPointType == ERedPointType.None || callback == null)
            {
                return(false);
            }

            bool alreadyRegister = false;
            RedPointDelegateInfo delegateInfo = GetRedPointDelegate(redPointType);

            if (delegateInfo != null)
            {
                for (int i = 0; i < delegateInfo.delegates.Count; i++)
                {
                    if (delegateInfo.delegates[i] == callback)
                    {
                        alreadyRegister = true;
                        break;
                    }
                }
            }

            if (!alreadyRegister)
            {
                if (delegateInfo == null)
                {
                    delegateInfo = SimplePool <RedPointDelegateInfo> .Get();

                    delegateInfo.redPointType          = redPointType;
                    redPointDelegateDict[redPointType] = delegateInfo;
                }
                delegateInfo.delegates.Add(callback);
            }

            return(true);
        }