Skip to content

Commit

Permalink
Merge pull request #9 from denpadokei/8-official-editor
Browse files Browse the repository at this point in the history
GameCoreとMenu以外ではアクティブにしないよう変更
Close #8
  • Loading branch information
denpadokei authored May 28, 2022
2 parents 09dad56 + d1af1ad commit 31283b7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 42 deletions.
76 changes: 36 additions & 40 deletions Chat/ChatDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,11 @@ private void FloatingScreenOnRelease(in Vector3 pos, in Quaternion rot)
private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1)
{
if (arg1.name != s_game && arg1.name != s_menu) {
this._isInGame = false;
this._rootGameObject.SetActive(false);
return;
}
this._rootGameObject.SetActive(true);
if (arg1.name == s_game) {
this._isInGame = true;
foreach (var canvas in this._chatScreen.GetComponentsInChildren<Canvas>(true)) {
Expand Down Expand Up @@ -507,6 +510,39 @@ protected virtual void Dispose(bool disposing)
if (disposing) {
try {
this._connectSemaphore.Dispose();
this._chatConfig.OnConfigChanged -= this.Instance_OnConfigChanged;
SceneManager.activeSceneChanged -= this.SceneManager_activeSceneChanged;
this._catCoreManager.OnChatConnected -= this.CatCoreManager_OnChatConnected;
this._catCoreManager.OnJoinChannel -= this.CatCoreManager_OnJoinChannel;
this._catCoreManager.OnLeaveChannel -= this.CatCoreManager_OnLeaveChannel;
this._catCoreManager.OnTwitchTextMessageReceived -= this.CatCoreManager_OnTwitchTextMessageReceived;
this._catCoreManager.OnMessageDeleted -= this.OnCatCoreManager_OnMessageDeleted;
this._catCoreManager.OnChatCleared -= this.OnCatCoreManager_OnChatCleared;
this._catCoreManager.OnFollow -= this.OnCatCoreManager_OnFollow;
this._catCoreManager.OnRewardRedeemed -= this.OnCatCoreManager_OnRewardRedeemed;
TwitchIrcServicePatch.UnRegistIrcReceiver(this);
TwitchIrcServicePatch.UnRegistPubSubReceiver(this);
this.StopAllCoroutines();
while (this._messages.TryDequeue(out var msg)) {
if (msg != null) {
msg.RemoveReciver(this);
}
if (msg.Text.ChatMessage != null) {
s_backupMessageQueue.Enqueue(new KeyValuePair<DateTime, IESCChatMessage>(msg.ReceivedDate, msg.Text.ChatMessage));
}
this._textPoolContaner?.Despawn(msg);
}
if (this._chatMoverMaterial != null) {
Destroy(this._chatMoverMaterial);
this._chatMoverMaterial = null;
}
if (this._bg != null) {
Destroy(this._bg.material);
}
if (this._chatScreen != null) {
Destroy(this._chatScreen);
this._chatScreen = null;
}
if (this._rootGameObject != null) {
Destroy(this._rootGameObject);
}
Expand All @@ -532,46 +568,6 @@ protected void Awake()
DontDestroyOnLoad(this.gameObject);
}

protected override void OnDestroy()
{
Logger.Debug("OnDestroy()");
base.OnDestroy();
this._chatConfig.OnConfigChanged -= this.Instance_OnConfigChanged;
SceneManager.activeSceneChanged -= this.SceneManager_activeSceneChanged;
this._catCoreManager.OnChatConnected -= this.CatCoreManager_OnChatConnected;
this._catCoreManager.OnJoinChannel -= this.CatCoreManager_OnJoinChannel;
this._catCoreManager.OnLeaveChannel -= this.CatCoreManager_OnLeaveChannel;
this._catCoreManager.OnTwitchTextMessageReceived -= this.CatCoreManager_OnTwitchTextMessageReceived;
this._catCoreManager.OnMessageDeleted -= this.OnCatCoreManager_OnMessageDeleted;
this._catCoreManager.OnChatCleared -= this.OnCatCoreManager_OnChatCleared;
this._catCoreManager.OnFollow -= this.OnCatCoreManager_OnFollow;
this._catCoreManager.OnRewardRedeemed -= this.OnCatCoreManager_OnRewardRedeemed;
TwitchIrcServicePatch.UnRegistIrcReceiver(this);
TwitchIrcServicePatch.UnRegistPubSubReceiver(this);
this.StopAllCoroutines();
while (this._messages.TryDequeue(out var msg)) {
if (msg != null) {
msg.RemoveReciver(this);
}
if (msg.Text.ChatMessage != null) {
s_backupMessageQueue.Enqueue(new KeyValuePair<DateTime, IESCChatMessage>(msg.ReceivedDate, msg.Text.ChatMessage));
}
this._textPoolContaner?.Despawn(msg);
}

if (this._chatScreen != null) {
Destroy(this._chatScreen);
this._chatScreen = null;
}
if (this._chatMoverMaterial != null) {
Destroy(this._chatMoverMaterial);
this._chatMoverMaterial = null;
}
if (this._bg != null) {
Destroy(this._bg.material);
}
}

protected void Update()
{
if (!this._updateMessagePositions) {
Expand Down
2 changes: 1 addition & 1 deletion EnhancedStreamChat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NoWarn>1591</NoWarn>
<AssemblyName>EnhancedStreamChat</AssemblyName>
<RootNamespace>EnhancedStreamChat</RootNamespace>
<Version>5.0.2</Version>
<Version>5.0.3</Version>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<DebugType>embedded</DebugType>
<AssemblySearchPath>$(ReferencePath)</AssemblySearchPath>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "EnhancedStreamChat",
"name": "Enhanced Stream Chat",
"author": "denpadokei",
"version": "5.0.2",
"version": "5.0.3",
"description": "Enhanced Stream Chat is a rich text chat integration mod, with full unicode, emote, and emoji support.",
"gameVersion": "1.22.0",
"dependsOn": {
Expand Down

0 comments on commit 31283b7

Please sign in to comment.