kek, now fixed

This commit is contained in:
CWX 2023-01-17 23:08:02 +00:00
parent 65ba110674
commit 2a726ec4d7

View File

@ -21,6 +21,10 @@ namespace CWX_DebuggingTool
private GameWorld _gameWorld = null; private GameWorld _gameWorld = null;
private IBotGame _botGame; private IBotGame _botGame;
private Rect _rect; private Rect _rect;
private String _content = "";
private Vector2 _guiSize;
private float _distance;
private float _timer;
private BotmonClass() private BotmonClass()
{ {
@ -113,39 +117,36 @@ namespace CWX_DebuggingTool
_guiContent = new GUIContent(); _guiContent = new GUIContent();
} }
string content = null; _content = string.Empty;
if (_zoneAndPlayers != null) if (_zoneAndPlayers != null)
{ {
content += $"Total = {_gameWorld.AllPlayers.Count - 1}\n"; _content += $"Total = {_gameWorld.AllPlayers.Count - 1}\n";
foreach (var zone in _zoneAndPlayers) foreach (var zone in _zoneAndPlayers)
{ {
if (_zoneAndPlayers[zone.Key].Count > 0) _content += $"{zone.Key} = {_zoneAndPlayers[zone.Key].FindAll(x => x.HealthController.IsAlive).Count}\n";
{
content += $"{zone.Key} = {_zoneAndPlayers[zone.Key].Count}\n";
}
foreach (var player in _zoneAndPlayers[zone.Key]) foreach (var player in _zoneAndPlayers[zone.Key])
{ {
if (!player.HealthController.IsAlive) if (!player.HealthController.IsAlive)
{ {
return; continue;
} }
var distance = Vector3.Distance(player.Position, _player.Position); _distance = Vector3.Distance(player.Position, _player.Position);
content += $"> [{distance:n2}m] [{player.Profile.Info.Settings.Role}] [{player.Profile.Side}] [{player.Profile.Info.Settings.BotDifficulty}]{player.Profile.Nickname}\n"; _content += $"> [{_distance:n2}m] [{player.Profile.Info.Settings.Role}] [{player.Profile.Side}] [{player.Profile.Info.Settings.BotDifficulty}] {player.Profile.Nickname}\n";
} }
} }
} }
_guiContent.text = content; _guiContent.text = _content;
var size = _textStyle.CalcSize(_guiContent); _guiSize = _textStyle.CalcSize(_guiContent);
_rect.x = Screen.width - size.x - 5f; _rect.x = Screen.width - _guiSize.x - 5f;
_rect.width = size.x; _rect.width = _guiSize.x;
_rect.height = size.y; _rect.height = _guiSize.y;
GUI.Box(_rect, _guiContent, _textStyle); GUI.Box(_rect, _guiContent, _textStyle);
} }