예제 #1
0
        protected override void OnDestroy()
        {
            if (this._chatServiceMultiplexer != null)
            {
                try {
                    this._chatServiceMultiplexer.OnJoinChannel               -= this.QueueOrSendOnJoinChannel;
                    this._chatServiceMultiplexer.OnTextMessageReceived       -= this.QueueOrSendOnTextMessageReceived;
                    this._chatServiceMultiplexer.OnChatCleared               -= this.QueueOrSendOnClearChat;
                    this._chatServiceMultiplexer.OnMessageCleared            -= this.QueueOrSendOnClearMessage;
                    this._chatServiceMultiplexer.OnChannelResourceDataCached -= this.QueueOrSendOnChannelResourceDataCached;
                }
                catch (Exception e) {
                    Logger.Error(e);
                }
                BSEvents.lateMenuSceneLoadedFresh -= this.BSEvents_menuSceneLoadedFresh;
            }
            if (this._chatCoreInstance != null)
            {
#if DEBUG
                this._chatCoreInstance.OnLogReceived -= this._sc_OnLogReceived;
#endif
                try {
                    this._chatCoreInstance.StopAllServices();
                }
                catch (Exception e) {
                    Logger.Error(e);
                }
            }

            MainThreadInvoker.ClearQueue();
            ChatImageProvider.ClearCache();
            base.OnDestroy();
        }
예제 #2
0
 public override void OnEnable()
 {
     base.OnEnable();
     _sc = ChatCoreInstance.Create();
     //_sc.OnLogReceived += _sc_OnLogReceived;
     _svcs = _sc.RunAllServices();
     _svcs.OnJoinChannel               += QueueOrSendOnJoinChannel;
     _svcs.OnTextMessageReceived       += QueueOrSendOnTextMessageReceived;
     _svcs.OnChatCleared               += QueueOrSendOnClearChat;
     _svcs.OnMessageCleared            += QueueOrSendOnClearMessage;
     _svcs.OnChannelResourceDataCached += QueueOrSendOnChannelResourceDataCached;
     ChatImageProvider.TouchInstance();
     Task.Run(HandleOverflowMessageQueue);
     BSEvents.menuSceneLoadedFresh += BSEvents_menuSceneLoadedFresh;
 }
예제 #3
0
        private void Awake()
        {
            this._chatCoreInstance = ChatCoreInstance.Create();
#if DEBUG
            this._chatCoreInstance.OnLogReceived += this._sc_OnLogReceived;
#endif
            this._chatServiceMultiplexer = this._chatCoreInstance.RunAllServices();
            this._chatServiceMultiplexer.OnJoinChannel               += this.QueueOrSendOnJoinChannel;
            this._chatServiceMultiplexer.OnTextMessageReceived       += this.QueueOrSendOnTextMessageReceived;
            this._chatServiceMultiplexer.OnChatCleared               += this.QueueOrSendOnClearChat;
            this._chatServiceMultiplexer.OnMessageCleared            += this.QueueOrSendOnClearMessage;
            this._chatServiceMultiplexer.OnChannelResourceDataCached += this.QueueOrSendOnChannelResourceDataCached;
            ChatImageProvider.TouchInstance();
            _ = this.HandleOverflowMessageQueue();
            BSEvents.lateMenuSceneLoadedFresh += this.BSEvents_menuSceneLoadedFresh;
        }
예제 #4
0
 public void OnDisable()
 {
     if (_svcs != null)
     {
         _svcs.OnJoinChannel               -= QueueOrSendOnJoinChannel;
         _svcs.OnTextMessageReceived       -= QueueOrSendOnTextMessageReceived;
         _svcs.OnChatCleared               -= QueueOrSendOnClearChat;
         _svcs.OnMessageCleared            -= QueueOrSendOnClearMessage;
         _svcs.OnChannelResourceDataCached -= QueueOrSendOnChannelResourceDataCached;
         BSEvents.menuSceneLoadedFresh     -= BSEvents_menuSceneLoadedFresh;
     }
     if (_sc != null)
     {
         //_sc.OnLogReceived -= _sc_OnLogReceived;
         _sc.StopAllServices();
     }
     if (_chatDisplay != null)
     {
         Destroy(_chatDisplay.gameObject);
         _chatDisplay = null;
     }
     MainThreadInvoker.ClearQueue();
     ChatImageProvider.ClearCache();
 }
 public ChatMessageBuilder(ChatImageProvider chatImageProvider)
 {
     this._chatImageProvider = chatImageProvider;
 }