Show / Hide Table of Contents

Class NetObjectManager

Inheritance
System.Object
NetObjectManager
Implements
INetObjectManager
Namespace: Eco.Shared.Networking
Assembly: Eco.Shared.dll
Syntax
public class NetObjectManager : Object, INetObjectManager

Constructors

NetObjectManager(INetObjectViewerCollection, INetObjectCollection, Boolean)

Declaration
public NetObjectManager(INetObjectViewerCollection viewerCollection = null, INetObjectCollection collection = null, bool allowNewObjects = true)
Parameters
Type Name Description
INetObjectViewerCollection viewerCollection
INetObjectCollection collection
System.Boolean allowNewObjects

Fields

DestroyedObjectsKey

Declaration
public const string DestroyedObjectsKey = "destroyed"
Field Value
Type Description
System.String

MaxNewObjectsPerUpdate

Declaration
public const int MaxNewObjectsPerUpdate = 10
Field Value
Type Description
System.Int32

NewObjectsKey

Declaration
public const string NewObjectsKey = "newObjs"
Field Value
Type Description
System.String

OnNewNetworkObject

Declaration
public Func<int, BSONObject, INetObject> OnNewNetworkObject
Field Value
Type Description
System.Func<System.Int32, BSONObject, INetObject>

OnRemoveNetworkObject

Declaration
public Action<int> OnRemoveNetworkObject
Field Value
Type Description
System.Action<System.Int32>

UpdatedObjectsKey

Declaration
public const string UpdatedObjectsKey = "objs"
Field Value
Type Description
System.String

Properties

Default

Declaration
public static NetObjectManager Default { get; set; }
Property Value
Type Description
NetObjectManager

NumObjects

Declaration
public int NumObjects { get; }
Property Value
Type Description
System.Int32

PrepareNetworkTrafficPayload

Declaration
public Func<INetObjectViewer, object, BSONValue, BSONValue> PrepareNetworkTrafficPayload { get; set; }
Property Value
Type Description
System.Func<INetObjectViewer, System.Object, BSONValue, BSONValue>

Methods

Add(INetObject, Int32)

Declaration
public void Add(INetObject netObj, int id)
Parameters
Type Name Description
INetObject netObj
System.Int32 id

Clear()

Declaration
public void Clear()

CollectObjectStats()

Collect stats about existing network objects in NetObjectManager. May be used for statistic and leaks detection.

Declaration
public IEnumerable<IGrouping<string, INetObject>> CollectObjectStats()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.Linq.IGrouping<System.String, INetObject>>

ForEachViewer(Action<INetObjectViewer>)

Declaration
public void ForEachViewer(Action<INetObjectViewer> action)
Parameters
Type Name Description
System.Action<INetObjectViewer> action

GetInitialObjectStates(IEnumerable<INetObject>, INetObjectViewer, INetObjectContainer, ClientUpdate[])

Declaration
public void GetInitialObjectStates(IEnumerable<INetObject> newObjects, INetObjectViewer viewer, INetObjectContainer monitored, ClientUpdate[] clientUpdates)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<INetObject> newObjects
INetObjectViewer viewer
INetObjectContainer monitored
ClientUpdate[] clientUpdates

GetNetObject(Int32)

Declaration
public INetObject GetNetObject(int id)
Parameters
Type Name Description
System.Int32 id
Returns
Type Description
INetObject

GetNetObjectsOfType<T>()

Declaration
public IEnumerable<T> GetNetObjectsOfType<T>()
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

GetNewRelevantObjects(INetObjectViewer, INetObjectContainer, Boolean)

Declaration
public IEnumerable<INetObject> GetNewRelevantObjects(INetObjectViewer viewer, INetObjectContainer alreadyRelevant, bool fullSearch)
Parameters
Type Name Description
INetObjectViewer viewer
INetObjectContainer alreadyRelevant
System.Boolean fullSearch
Returns
Type Description
System.Collections.Generic.IEnumerable<INetObject>

GetNextID()

Declaration
public int GetNextID()
Returns
Type Description
System.Int32

GetObject<T>(Int32)

Declaration
public T GetObject<T>(int id)
    where T : class
Parameters
Type Name Description
System.Int32 id
Returns
Type Description
T
Type Parameters
Name Description
T

GetObjectsWithin(Vector2, Single)

Declaration
public IEnumerable<INetObject> GetObjectsWithin(Vector2 position, float range)
Parameters
Type Name Description
Vector2 position
System.Single range
Returns
Type Description
System.Collections.Generic.IEnumerable<INetObject>

GetObjectsWithin(WrappedPosition3, Single)

Declaration
public IEnumerable<INetObject> GetObjectsWithin(WrappedPosition3 position, float range)
Parameters
Type Name Description
WrappedPosition3 position
System.Single range
Returns
Type Description
System.Collections.Generic.IEnumerable<INetObject>

GetObjectsWithin<T>(Vector2, Single)

Declaration
public IEnumerable<T> GetObjectsWithin<T>(Vector2 position, float range)
    where T : INetObjectPosition
Parameters
Type Name Description
Vector2 position
System.Single range
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

GetObjectUpdates(IEnumerable<INetObject>, INetObjectViewer, ClientUpdate[])

Declaration
public void GetObjectUpdates(IEnumerable<INetObject> objects, INetObjectViewer viewer, ClientUpdate[] clientUpdates)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<INetObject> objects
INetObjectViewer viewer
ClientUpdate[] clientUpdates

GetUpdatedObjects(INetObjectViewer)

Declaration
public BSONArray GetUpdatedObjects(INetObjectViewer viewer = null)
Parameters
Type Name Description
INetObjectViewer viewer
Returns
Type Description
BSONArray

HandleDestroyObject(Int32)

Declaration
public void HandleDestroyObject(int id)
Parameters
Type Name Description
System.Int32 id

HandleNewObject(BSONObject)

Declaration
public void HandleNewObject(BSONObject bsonObj)
Parameters
Type Name Description
BSONObject bsonObj

HandleUpdateObject(BSONObject)

Declaration
public void HandleUpdateObject(BSONObject bsonObj)
Parameters
Type Name Description
BSONObject bsonObj

OnObjectMoved(INetObjectPosition)

Declaration
public void OnObjectMoved(INetObjectPosition obj)
Parameters
Type Name Description
INetObjectPosition obj

PauseSendUpdates(INetObject)

Declaration
public void PauseSendUpdates(INetObject obj)
Parameters
Type Name Description
INetObject obj

Remove(INetObject)

Declaration
public void Remove(INetObject netObject)
Parameters
Type Name Description
INetObject netObject

ResumeSendUpdates(INetObject)

Declaration
public void ResumeSendUpdates(INetObject obj)
Parameters
Type Name Description
INetObject obj

TryGetNetObject(Int32, out INetObject)

Declaration
public bool TryGetNetObject(int id, out INetObject obj)
Parameters
Type Name Description
System.Int32 id
INetObject obj
Returns
Type Description
System.Boolean

UpdateObjects(BSONObject)

Declaration
public void UpdateObjects(BSONObject bsonRoot)
Parameters
Type Name Description
BSONObject bsonRoot

Implements

INetObjectManager

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾