Example #1
0
    public void RemoveObserver(GameEventType eventType, IGameEventObserver observer)
    {
        IGameEventSubject sub = GetGameEvent(eventType);

        if (sub != null)
        {
            sub.RemoveObserver(observer);
            observer.SetSubject(null);
        }
    }
Example #2
0
    //移除
    public void RemoveObserver(GameEventType gameEventType, IGameEventObserver eventObserver)
    {
        IGameEventSubject sub = GetGameEventSubject(gameEventType);

        if (sub == null)
        {
            return;
        }
        sub.RemoveObserver(eventObserver);
        eventObserver.SetSubject(null);
    }
Example #3
0
    /// <summary>
    /// 移除
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="observer"></param>
    public void RemoveObserver(GameEventType eventType, IGameEventObserver observer)
    {
        IGameEventSubject subject = GetGameEventSubject(eventType);

        if (subject == null)
        {
            return;
        }
        subject.RemoveObserver(observer);
        observer.SetSubject(null);
    }
Example #4
0
    public void RemoveObserver(GameEventType eventType, IGameEventObserver observer)
    {
        //if (mGameEvents.ContainsKey(eventType))
        //{
        //    IGameEventSubject sub = mGameEvents[eventType];
        //    sub.RemoveObserver(observer);  //注册sub事件的观察者
        //    observer.SetSubject(null); // 设置观察者观察的主题。
        //}
        //else
        //{
        //    Debug.LogError("没有对应被观察事件类型:" + eventType + "的主题类!");

        //}

        IGameEventSubject sub = GetGameEventSub(eventType);

        if (sub == null)
        {
            return;
        }
        sub.RemoveObserver(observer); //注册sub事件的观察者
        observer.SetSubject(null);    // 设置观察者观察的主题。
    }