Show / Hide Table of Contents

Class NetObject

Inheritance
System.Object
NetObject
Namespace: Eco.Shared.Networking
Assembly: Eco.Shared.dll
Syntax
public sealed class NetObject : Object

Properties

Active

Declaration
public bool Active { get; set; }
Property Value
Type Description
System.Boolean

Controller

Declaration
public INetObject Controller { get; }
Property Value
Type Description
INetObject

EventHandler

Declaration
public static INetworkEventHandler EventHandler { set; }
Property Value
Type Description
INetworkEventHandler

ID

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

Methods

AddNetworkInteceptor(INetworkInterceptor)

Declaration
public static void AddNetworkInteceptor(INetworkInterceptor interceptor)
Parameters
Type Name Description
INetworkInterceptor interceptor

ClearEventHandler()

Declaration
public static void ClearEventHandler()

ClearNetworkInterceptors()

Declaration
public static void ClearNetworkInterceptors()

Create()

Declaration
public void Create()

Destroy()

Declaration
public void Destroy()

InstantiateAndCreate(INetObject, Boolean)

Makes new instance of NetObject for controller with Active set to active value and then Create() it.

Declaration
public static NetObject InstantiateAndCreate(INetObject controller, bool active)
Parameters
Type Name Description
INetObject controller
System.Boolean active
Returns
Type Description
NetObject

InstantiateAndCreate(INetObject, Int32)

Makes new instance of NetObject for controller with pre-defined id and then Create() it.

Declaration
public static NetObject InstantiateAndCreate(INetObject controller, int id)
Parameters
Type Name Description
INetObject controller
System.Int32 id
Returns
Type Description
NetObject

ReceiveEvent(INetClient, NetworkEvent, BSONValue)

Declaration
public static void ReceiveEvent(INetClient client, NetworkEvent netEvent, BSONValue bson)
Parameters
Type Name Description
INetClient client
NetworkEvent netEvent
BSONValue bson

RemoveNetworkInterceptor(INetworkInterceptor)

Declaration
public static bool RemoveNetworkInterceptor(INetworkInterceptor interceptor)
Parameters
Type Name Description
INetworkInterceptor interceptor
Returns
Type Description
System.Boolean

SendEvent(NetworkEvent, BSONObject, INetClient, INetObject)

Declaration
public static void SendEvent(NetworkEvent netEvent, BSONObject bsonObj, INetClient target, INetObject netObj = null)
Parameters
Type Name Description
NetworkEvent netEvent
BSONObject bsonObj
INetClient target
INetObject netObj

SendEvent<TScopeAwareEnumerable>(NetworkEvent, BSONObject, TScopeAwareEnumerable, INetObject)

Send event to multiple clients at once. It requires IScopeAwareEnumerable<T> for targets because may process them asynchronously and save reference to enumerable for future usage. Explicit scope control allow us to prevent errors when targets only valid in scope of calling method and avoid defensive copy to prevent such errors when targets safe to reference outside of scope (i.e. when they're immutable or unowned right after passing to method).

Declaration
public static void SendEvent<TScopeAwareEnumerable>(NetworkEvent netEvent, BSONObject bsonObj, TScopeAwareEnumerable targets, INetObject netObj = null)
    where TScopeAwareEnumerable : IScopeAwareEnumerable<INetClient>
Parameters
Type Name Description
NetworkEvent netEvent
BSONObject bsonObj
TScopeAwareEnumerable targets
INetObject netObj
Type Parameters
Name Description
TScopeAwareEnumerable

SendEventNow(NetworkEvent, BSONObject, INetClient)

Sends event immediately if possible ignoring previously queued messages. As side effect it makes encoding in current thread instead of network thread.

Declaration
public static void SendEventNow(NetworkEvent netEvent, BSONObject bsonObj, INetClient target)
Parameters
Type Name Description
NetworkEvent netEvent
BSONObject bsonObj
INetClient target

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
☀
☾