private IEnumerator OnApplicationPause(bool paused) { if (CoopWebSocketSingleton <KtbWebSocket> .IsValidOpen()) { Logd("OnApplicationPause. pause={0}, is_connect={1}", paused, CoopWebSocketSingleton <KtbWebSocket> .IsValidOpen()); if (paused) { if (MonoBehaviourSingleton <CoopNetworkManager> .IsValid()) { MonoBehaviourSingleton <CoopNetworkManager> .I.LoopBackRoomLeave(true); } if (PartyManager.IsValidInParty() && !InGameManager.IsReentryNotLeaveParty()) { Protocol.Force(delegate { MonoBehaviourSingleton <PartyManager> .I.SendLeave(delegate(bool is_leave) { Logd("PartyLeave. {0}", is_leave); }); }); } MonoBehaviourSingleton <KtbWebSocket> .I.Close(1000, "Bye!"); } else { MonoBehaviourSingleton <KtbWebSocket> .I.ClearLastPacketReceivedTime(); } } yield break; }
public void SwitchOfflinePlay() { if (isOfflinePlay) { Logd("already offline."); } else { isOfflinePlay = true; Logd("SwitchOfflinePlay."); if ((!MonoBehaviourSingleton <InGameProgress> .IsValid() || !MonoBehaviourSingleton <InGameProgress> .I.isEnding) && (!QuestManager.IsValidInGameExplore() || (MonoBehaviourSingleton <InGameProgress> .IsValid() && !MonoBehaviourSingleton <InGameProgress> .I.isEnding))) { if (CoopWebSocketSingleton <KtbWebSocket> .IsValidOpen()) { MonoBehaviourSingleton <CoopNetworkManager> .I.Close(1000, "Bye!", delegate { }); } if (isOwnerFirstClear && !MonoBehaviourSingleton <CoopManager> .I.coopMyClient.isPartyOwner && !MonoBehaviourSingleton <CoopManager> .I.coopStage.isQuestClose) { forceRetire = true; } else if (NeedsForceLeave() && !MonoBehaviourSingleton <CoopManager> .I.coopStage.isQuestClose) { forceRetire = true; if (PartyManager.IsValidInParty()) { Protocol.Force(delegate { MonoBehaviourSingleton <PartyManager> .I.SendLeave(delegate(bool is_leave) { Logd("PartyLeave. {0}", is_leave); }); }); } } else { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnSwitchOfflinePlay(); if (PartyManager.IsValidInParty() && !InGameManager.IsReentryNotLeaveParty()) { Protocol.Force(delegate { MonoBehaviourSingleton <PartyManager> .I.SendLeave(delegate(bool is_leave) { Logd("PartyLeave. {0}", is_leave); }); }); } DestroyAllGuestClient(); } } } }