Beispiel #1
0
        internal virtual void UnregisterCallBack(Transform root, Action <BaseNotice> notifyCallBack)
        {
            MonoNoticeAction monoNotice = root.GetComponent <MonoNoticeAction>();

            if (monoNotice != null)
            {
                monoNotice.SetOwn(parent);
                monoNotice.RemoveCallBack(notifyCallBack);
                if (monoNotice.CallCount == 0)
                {
                    GameObject.Destroy(monoNotice);
                }
            }
        }
Beispiel #2
0
        internal virtual void RegisterCallBack(Transform root, Action <BaseNotice> notifyCallBack)
        {
            MonoNoticeAction monoNotice = root.GetComponent <MonoNoticeAction>();

            if (monoNotice == null)
            {
                monoNotice = root.gameObject.AddComponent <MonoNoticeAction>();
                if (notifyCallBacks == null)
                {
                    notifyCallBacks = new List <MonoNoticeAction>();
                }
                monoNotice.SetOwn(parent);
                notifyCallBacks.Add(monoNotice);
            }
            monoNotice.AddCallBack(notifyCallBack);
        }