Skip to content

Commit

Permalink
Fix random crashes errors when quitting the game
Browse files Browse the repository at this point in the history
  • Loading branch information
slavidodo committed Apr 14, 2020
1 parent b86dcce commit 4250ea9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ private void HandleCommunicationTermination() {
_receiving = false;
_sending = false;

_socket.Dispose();
_socket = null;
if (_socket != null) {
_socket.Dispose();
_socket = null;
}

_packetQueue = null;

onConnectionTerminated.Invoke();
Expand Down
4 changes: 1 addition & 3 deletions OpenTibia/Assets/Scripts/Core/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ public UnityUI.GraphicRaycaster ActiveRaycaster {
get => ActiveCanvas ? ActiveCanvas.GetComponent<UnityUI.GraphicRaycaster>() : null;
}

public bool IsGameRunning {
get => !!ProtocolGame && ProtocolGame.IsGameRunning;
}
public bool IsGameRunning { get => !!ProtocolGame && ProtocolGame.IsGameRunning; }

public bool IsRealTibia { get => ClientSpecification == ClientSpecification.Cipsoft; }
public bool IsOpenTibia { get => ClientSpecification == ClientSpecification.OpenTibia; }
Expand Down
11 changes: 8 additions & 3 deletions OpenTibia/Assets/Scripts/UI/Legacy/WorldMapWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,14 @@ public void OnPointerEnter(PointerEventData eventData) {

public void OnPointerExit(PointerEventData _) {
_mouseCursorOverRenderer = false;
OpenTibiaUnity.WorldMapRenderer.HighlightTile = null;
OpenTibiaUnity.WorldMapRenderer.HighlightObject = OpenTibiaUnity.CreatureStorage.Aim;
OpenTibiaUnity.GameManager.CursorController.SetCursorState(CursorState.Default, CursorPriority.Medium);

if (OpenTibiaUnity.WorldMapRenderer != null) {
OpenTibiaUnity.WorldMapRenderer.HighlightTile = null;
OpenTibiaUnity.WorldMapRenderer.HighlightObject = OpenTibiaUnity.CreatureStorage.Aim;
}

if (OpenTibiaUnity.GameManager != null)
OpenTibiaUnity.GameManager.CursorController.SetCursorState(CursorState.Default, CursorPriority.Medium);
}

protected void RenderWorldMap() {
Expand Down
5 changes: 4 additions & 1 deletion OpenTibia/ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
serializedVersion: 13
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
Expand Down Expand Up @@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
Expand All @@ -62,3 +63,5 @@ GraphicsSettings:
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
m_LogWhenShaderIsCompiled: 0
m_AllowEnlightenSupportForUpgradedProject: 1

0 comments on commit 4250ea9

Please sign in to comment.