Fixes and improvements, no more FindObjectsOfType
This commit is contained in:
1 parent
a740fec7c8
commit
fb002cbf0c
328 files changed
+4318
-299
No files matched your search
@@ -110,36 +110,7 @@ namespace Skopje.Minimap
|
||||
|
||||
internal static SkopjePlayer FindLocalPlayer()
|
||||
{
|
||||
if (LocalPlayer != null)
|
||||
return LocalPlayer;
|
||||
|
||||
var players = UnityEngine.Object.FindObjectsOfType<SkopjePlayer>();
|
||||
if (players == null)
|
||||
return null;
|
||||
|
||||
SkopjePlayer solo = null;
|
||||
int count = 0;
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
SkopjePlayer player = players[i];
|
||||
if (player == null)
|
||||
continue;
|
||||
count++;
|
||||
solo = player;
|
||||
if (player.IsOwner)
|
||||
{
|
||||
LocalPlayer = player;
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
LocalPlayer = solo;
|
||||
return solo;
|
||||
}
|
||||
|
||||
return null;
|
||||
return LocalPlayer;
|
||||
}
|
||||
|
||||
static Il2CppSystem.Action ToIl2Cpp(System.Action action)
|
||||
@@ -242,6 +213,13 @@ namespace Skopje.Minimap
|
||||
return;
|
||||
}
|
||||
|
||||
if (MinimapPlugin.LocalPlayer == null)
|
||||
{
|
||||
if (_root != null)
|
||||
_root.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
float now = Time.unscaledTime;
|
||||
bool hudMissing = _hud == null || !_hud.gameObject.activeInHierarchy;
|
||||
if ((_time == null || hudMissing || _mapSprite == null || _bounds == null) && now >= _nextSearch)
|
||||
|
||||
Reference in new issue
Block a user