I have some problems with the creation of user labels. Basically I want to use gpMakeUserLabel to create a user label for each waypoint of an air group, and than use gpMakeUserLabel to draw it to the player. This is needed to show the waypoints to the players under full real realism settings.
Код:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
if (actor is AiAircraft)
{
AiAircraft aiAircraft = actor as AiAircraft;
AiAirGroup aiAirGroup = aiAircraft.AirGroup();
if (aiAirGroup != null)
{
AiWayPoint[] waypoints = aiAirGroup.GetWay();
foreach (AiWayPoint waypoint in waypoints)
{
GPUserLabel userLabel = GamePlay.gpMakeUserLabel(new maddox.GP.Point2d(waypoint.P.x, waypoint.P.x), player, waypoint.P.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat), GamePlay.gpTimeofDay(), (int)GPUserIconType.Waypoint);
GamePlay.gpDrawUserLabel(new Player[] { player }, userLabel);
}
}
}
}
The problem is that the labels are not displayed. The creation seems to have been successful, at least gpMakeUserLabel didn't return null. There is also no error or exception in the log.
Am I missing something? Do I have to store the created user label in order to display it? Is it because the same player is used to create and draw it?