Class ConstantHighlightSetting
Syncs which Objects need to be highlighted. Every User now has this. So any
object that must be constantly highlighted on the user's client, must be added through TryAddOrUpdate(INetObjectPosition, HighlightPurpose, Double) giving the objects that implements
INetObjectPosition, purpose HighlightPurpose for the objects to be differed what for they are added, and time for highlighting
(this could be set to infinite). There is TryRemove(INetObjectPosition, HighlightPurpose) if you know what you need to remove and TryRemoveByFunc(Func<SimplePriorityQueue<ConstantHighlightInfo, Double>, User, IEnumerable<ConstantHighlightInfo>>) if you need to remove objects
from highlight by some rules or checks, gives ability to remove a collection of objects.
Now used only for MasterTracker talent. This by event gets user and through the user adds(TryAddOrUpdate) here an object(animal) with time limit -
this will trigger an update for client. And would be immediately highlighted. After this due to limitations for this talent it checks objects for deletion
through TryRemoveByFunc, this would also trigger an update for client to immediately remove highlight for client. All removals passed to private TryRemove method
to make a proper deletion. Do not change objsToHighlight collection by hand.
Inheritance
System.Object
ConstantHighlightSetting
Assembly: Eco.Gameplay.dll
Syntax
public class ConstantHighlightSetting : Object, IController, IViewController, IHasUniversalID
Constructors
ConstantHighlightSetting(User)
Declaration
public ConstantHighlightSetting(User owner)
Parameters
Type |
Name |
Description |
User |
owner |
|
Fields
ObjectRemoved
Raised for every object that removed from highlight both by time or removed by hand.
Declaration
public readonly ThreadSafeAction<ConstantHighlightSetting, ConstantHighlightInfo> ObjectRemoved
Field Value
Properties
ControllerID
Declaration
public ref int ControllerID { get; }
Property Value
Type |
Description |
System.Int32 |
|
IDsObjectToHighLight
This dictionary sends to client ids of objects to highlight as key
Declaration
public List<int> IDsObjectToHighLight { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.Int32> |
|
Methods
ClearExpired()
Removes all entities expired by time. If time set to 0 or lower are not removed by this method.
Declaration
public void ClearExpired()
TryAddOrUpdate(INetObjectPosition, HighlightPurpose, Double)
Adding Object to Priority_Queue.SimplePriorityQueue`2. Use zero or less as infinite time to highlight. And populates to client
Declaration
public bool TryAddOrUpdate(INetObjectPosition obj, HighlightPurpose highlightPurpose, double timeToHighlight)
Parameters
Returns
Type |
Description |
System.Boolean |
|
TryRemove(INetObjectPosition, HighlightPurpose)
Removes Object from highlight and from dict with timers.
Declaration
public bool TryRemove(INetObjectPosition obj, HighlightPurpose highlightPurpose)
Parameters
Returns
Type |
Description |
System.Boolean |
|
TryRemoveByFunc(Func<SimplePriorityQueue<ConstantHighlightInfo, Double>, User, IEnumerable<ConstantHighlightInfo>>)
Remove entities from list by passed Func. If func returns null - do nothing. Does not populates to client, client handles invalidation for itself.
If one of items failed to remove because of no such item in queue - returns false.
Declaration
public bool TryRemoveByFunc(Func<SimplePriorityQueue<ConstantHighlightInfo, double>, User, IEnumerable<ConstantHighlightInfo>> removeCall)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
Extension Methods