public void OnGUI()
{
if (ScreenSpaceDebug.Instance.ShouldDraw)
{
OnDrawDebugStuff();
}
// Draw player names
if (networkView.isMine && Possession != null && Camera.current != null)
{
GUI.skin = Relay.Instance.BaseSkin;
GUIStyle boxStyle = new GUIStyle(Relay.Instance.BaseSkin.customStyles[2])
{
fixedWidth = 0,
fixedHeight = 18,
alignment = TextAnchor.MiddleCenter,
padding = new RectOffset(5, 5, 3, 3),
};
foreach (var character in PlayerScript.UnsafeAllEnabledPlayerScripts)
{
if (character == null) continue;
if (character == Possession) continue;
if (!Possession.ShootingScript.CharacterIsInTargets(character)) continue;
Vector3 screenPosition = Camera.current.WorldToScreenPoint(InfoPointForPlayerScript(character));
screenPosition.y = Screen.height - screenPosition.y;
if (screenPosition.z < 0) continue;
bool isVisible = Possession.CanSeeOtherPlayer(character);
if (!isVisible) continue;
string otherPlayerName;
if (character.Possessor == null)
otherPlayerName = "?";
else
otherPlayerName = character.Possessor.Name;
Vector2 baseNameSize = boxStyle.CalcSize(new GUIContent(otherPlayerName));
float baseNameWidth = baseNameSize.x + 10;
var rect = new Rect(screenPosition.x - baseNameWidth/2, screenPosition.y, baseNameWidth,
boxStyle.fixedHeight);
GUI.Box(rect, otherPlayerName, boxStyle);
}
}
if (networkView.isMine)
{
if (ShouldDisplayJoinPanel)
{
GUI.skin = Relay.Instance.BaseSkin;
GUILayout.Window(Definitions.PlayerGameChoicesWindowID, new Rect( 0, Screen.height - 110, Screen.width, 110), DrawGameChoices, string.Empty);
}
}
}