From c58421be3cd50d4a51cb76b90de54976eec727f2 Mon Sep 17 00:00:00 2001 From: in0finite Date: Thu, 11 Jul 2019 19:09:20 +0200 Subject: [PATCH] map window works when there is no local ped --- Assets/Scripts/UI/MapWindow.cs | 20 +++++++++++--------- Docs/Multiplayer.md | 2 -- Docs/TODO.md | 2 ++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/UI/MapWindow.cs b/Assets/Scripts/UI/MapWindow.cs index d91f450b..2e880733 100644 --- a/Assets/Scripts/UI/MapWindow.cs +++ b/Assets/Scripts/UI/MapWindow.cs @@ -347,8 +347,6 @@ namespace SanAndreasUnity.UI { if (null == MiniMap.Instance) return; - if (null == Ped.Instance) - return; int uiSize = (int) this.windowRect.width; @@ -547,10 +545,13 @@ namespace SanAndreasUnity.UI { // second row - info GUILayout.BeginHorizontal (GUILayout.MaxWidth (infoAreaRect.width)); - GUILayout.Label ("Player world pos: " + Ped.Instance.transform.position); - GUILayout.Space (5); - GUILayout.Label ("Player minimap pos: " + MiniMap.WorldPosToMapPos (Ped.Instance.transform.position)); - GUILayout.Space (5); + if (Ped.Instance != null) + { + GUILayout.Label ("Player world pos: " + Ped.Instance.transform.position); + GUILayout.Space (5); + GUILayout.Label ("Player minimap pos: " + MiniMap.WorldPosToMapPos (Ped.Instance.transform.position)); + GUILayout.Space (5); + } GUILayout.Label ("Focus pos: " + this.GetFocusPosition ()); GUILayout.Space (5); Vector2 cursorMapPos; @@ -592,9 +593,10 @@ namespace SanAndreasUnity.UI { onDrawMapItems(); // draw player pointer - this.DrawItemOnMapRotated( MiniMap.Instance.PlayerBlip, Ped.Instance.transform.position, Ped.Instance.transform.forward, (int) m_playerPointerSize ); - // this.DrawItemOnMapRotated( MiniMap.Instance.PlayerBlip, Player.Instance.transform.position, Player.Instance.transform.forward, 10 ); - // this.DrawItemOnMap( blackPixel, Player.Instance.transform.position, 50 ); + if (Ped.Instance != null) + { + this.DrawItemOnMapRotated( MiniMap.Instance.PlayerBlip, Ped.Instance.transform.position, Ped.Instance.transform.forward, (int) m_playerPointerSize ); + } // draw all zones if (m_drawZones) { diff --git a/Docs/Multiplayer.md b/Docs/Multiplayer.md index 19448854..af0910b9 100644 --- a/Docs/Multiplayer.md +++ b/Docs/Multiplayer.md @@ -12,8 +12,6 @@ - shooting is inaccurate - clients should send fire event with fire pos and fire dir -- add dates to logs - - remove spamming logs: - sometimes, current vehicle is null on client diff --git a/Docs/TODO.md b/Docs/TODO.md index b9686302..82ec21c5 100644 --- a/Docs/TODO.md +++ b/Docs/TODO.md @@ -24,6 +24,8 @@ - Check how much RAM textures use +- Map window: increase buttons' height ; add shortcut for teleport (key 'T') ; draw vehicles ; + - Script execution order: HUD before pause menu and windows ; fps counter after all ; - Add option to change fixed delta time ?