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(); }
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; }
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; }
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; }