//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// /// <summary> /// Create /// </summary> private static void Create() { if (m_ChatCore != null) { return; } /// Init chat core m_ChatCore = BeatSaberPlusChatCore.ChatCoreInstance.Create(); m_ChatCore.OnLogReceived += ChatCore_OnLogReceived; /// Run all services m_ChatCoreMutiplixer = m_ChatCore.RunAllServices(); m_ChatCoreMutiplixer.OnChannelResourceDataCached += ChatCoreMutiplixer_OnChannelResourceDataCached; /// Init chat image provider singleton ChatImageProvider.TouchInstance(); }
/// <summary> /// Destroy /// </summary> private static void Destroy() { if (m_ChatCore == null) { return; } /// Clear cache ChatImageProvider.ClearCache(); /// Unbind services m_ChatCoreMutiplixer.OnChannelResourceDataCached -= ChatCoreMutiplixer_OnChannelResourceDataCached; m_ChatCoreMutiplixer = null; /// Stop all chat services m_ChatCore.StopAllServices(); m_ChatCore.OnLogReceived -= ChatCore_OnLogReceived; m_ChatCore = null; }