public void RecomposeTextOnMainThread(HudElementWaypoint wp) { mainThreadProcessing = true; capi.Event.EnqueueMainThreadTask(() => { if (wp != null) { if (wp.Dirty) { if (utils.WaypointsRel.Length > 0 && utils.WaypointsRel.Length >= wp.waypointID) { wp.waypoint = utils.WaypointsRel[wp.waypointID]; wp.UpdateEditDialog(); var dynText = wp.SingleComposer.GetDynamicText("text"); dynText.Font.Color = wp.dColor; dynText.RecomposeText(); WaypointTextUpdateSystem.EnqueueIfNotAlreadyFast(wp); wp.Dirty = false; } } else if (wp.displayText || wp.IsOpened()) { WaypointTextUpdateSystem.EnqueueIfNotAlready(wp); } } mainThreadProcessing = false; }, ""); while (mainThreadProcessing) { ; } }
public void RecomposeTextOnMainThread(HudElementWaypoint wp) { mainThreadProcessing = true; capi.Event.EnqueueMainThreadTask(() => { if (wp != null) { if (wp.Dirty) { var state = utils.WaypointsRel.Select(a => new WaypointRelative(capi, new Waypoint() { Color = a.Color, Icon = a.Icon, OwningPlayerGroupId = a.OwningPlayerGroupId, OwningPlayerUid = a.OwningPlayerUid, Pinned = a.Pinned, Position = a.Position.Clone(), ShowInWorld = a.ShowInWorld, Text = a.Text, Title = a.Title }, a.Index)).ToArray(); if (wp.waypointID <= state.Length && state.Length > 0) { try { wp.waypoint = state[wp.waypointID]; wp.UpdateEditDialog(); var dynText = wp.SingleComposer.GetDynamicText("text"); dynText.Font.Color = wp.dColor; dynText.RecomposeText(); WaypointTextUpdateSystem.EnqueueIfNotAlreadyFast(wp); wp.Dirty = false; } catch (System.IndexOutOfRangeException) { } } } else if (wp.displayText || wp.IsOpened()) { WaypointTextUpdateSystem.EnqueueIfNotAlready(wp); } } mainThreadProcessing = false; }, ""); while (mainThreadProcessing) { ; } }