C# Class BeardedManStudios.Network.SimpleNetworkedMonoBehavior

Inheritance: UnityEngine.MonoBehaviour, INetworkingSerialized
Mostrar archivo Open project: drakelinglabs/unityarmada Class Usage Examples

Public Properties

Property Type Description
allowOwnershipChange bool
destroyOnDisconnect bool
dontDestroyOnLoad bool
networkedBehaviors SimpleNetworkedMonoBehavior>.Dictionary
networkedBehaviorsMutex object

Protected Properties

Property Type Description
rpcStack List

Public Methods

Method Description
AuthoritativeRPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkingPlayer player, bool runOnServer ) : void

Used for the server to call an RPC method on a NetWorker(Socket) on a particular player

AuthoritativeURPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkingPlayer player, bool runOnServer ) : void

Used for the server to call an URPC method on a NetWorker(Socket) on a particular player

ChangeOwner ( ulong newOwnerPlayerId ) : void
Cleanup ( ) : void
Deserialize ( NetworkingStream stream ) : void

Deserialize the Networking Stream

Disconnect ( ) : void

Used to do final cleanup when disconnecting. This gets called currently on application quit and scene resets

ExecuteRPCStack ( ) : void
GenerateUniqueId ( ) : ulong

Get a generated Unique ID for the next simple networked mono behavior or its derivitive

GetRPC ( int id ) : MethodInfo
GetSceneNetworkedId ( ) : int
Initialize ( BeardedManStudios.Network.NetWorker socket ) : void

An initial setup to make sure that a networking manager exists before running any core logic

InvokeRPC ( NetworkingStreamRPC stream ) : bool

To Invoke an RPC on a given Networking Stream RPC

Locate ( ulong id ) : SimpleNetworkedMonoBehavior

Locate a Simple Networked Monobehavior given a ID

NetworkDestroy ( ulong networkId ) : bool

Destroy a Simple Networked Monobehavior or any of its derivitives with the given Network ID

OfflineStart ( ) : void
QueueRPCForInstantiate ( ulong id, NetworkingStream stream ) : void
RPC ( string methodName ) : void

Call an RPC method with arguments

RPC ( string methodName, BeardedManStudios.Network.NetWorker socket ) : void

Call an RPC method with a NetWorker(Socket) and arguments

RPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkReceivers receivers ) : void

Call an RPC method on a NetWorker(Socket) with receivers and arguments

RPC ( string methodName, NetworkReceivers rpcMode ) : void

Call an RPC method with a receiver and arguments

ResetAll ( ) : void
ResetBufferClear ( ) : void

Resets the buffer to be clear again so that it can start buffering

ResetForScene ( List skip ) : void
Serialized ( ) : BMSByte

Serialize the Simple Networked Monobehavior

SetSceneNetworkedId ( int id ) : void
Setup ( BeardedManStudios.Network.NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId ) : void

Setup the Simple Networked Monobehavior stack with a NetWorker, owner, network id, and owner id

Setup ( BeardedManStudios.Network.NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId, bool isSceneObject = false ) : void
SetupObjects ( SimpleNetworkedMonoBehavior behaviors, BeardedManStudios.Network.NetWorker owningSocket ) : void

Setup the Simple Networked Monobehavior stack with a NetWorker

URPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkReceivers receivers ) : void

Call an Unreliable RPC method on a NetWorker(Socket) with receivers and arguments

URPC ( string methodName, NetworkReceivers rpcMode ) : void

Call an Unreliable RPC method with a receiver and arguments

Protected Methods

Method Description
NetworkDisconnect ( ) : void
NetworkStart ( ) : void

A start method that is called after the object has been setup on the network

NonOwnerFixedUpdate ( ) : void
NonOwnerUpdate ( ) : void
OnApplicationQuit ( ) : void
OnDestroy ( ) : void
OwnerFixedUpdate ( ) : void
OwnerUpdate ( ) : void
Reflect ( ) : void

Get the RPC's of the simple networked monobehavior

UnityFixedUpdate ( ) : void
UnityUpdate ( ) : void

Private Methods

Method Description
AssignNewOwner ( ulong newOwnerPlayerId ) : void
AuthRPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkingPlayer player, bool runOnServer, string uniqueIdentifier, bool reliable ) : void
DelayedInitialize ( BeardedManStudios.Network.NetWorker socket ) : void
DoOwnerFixedUpdate ( ) : void
DoOwnerUpdate ( ) : void
GetStreamRPC ( string methodName, NetworkReceivers receivers ) : int

Creates a network stream for the method with the specified string name and returns the method info

ServerChangeOwner ( ulong newOwnerPlayerId ) : void
ThrowNetworkerException ( ) : void

Method Details

AuthoritativeRPC() public method

Used for the server to call an RPC method on a NetWorker(Socket) on a particular player
public AuthoritativeRPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkingPlayer player, bool runOnServer ) : void
methodName string Method(Function) name to call
socket BeardedManStudios.Network.NetWorker The NetWorker(Socket) being used
player NetworkingPlayer The NetworkingPlayer who will execute this RPC
runOnServer bool
return void

AuthoritativeURPC() public method

Used for the server to call an URPC method on a NetWorker(Socket) on a particular player
public AuthoritativeURPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkingPlayer player, bool runOnServer ) : void
methodName string Method(Function) name to call
socket BeardedManStudios.Network.NetWorker The NetWorker(Socket) being used
player NetworkingPlayer The NetworkingPlayer who will execute this RPC
runOnServer bool
return void

ChangeOwner() public method

public ChangeOwner ( ulong newOwnerPlayerId ) : void
newOwnerPlayerId ulong
return void

Cleanup() public method

public Cleanup ( ) : void
return void

Deserialize() public method

Deserialize the Networking Stream
public Deserialize ( NetworkingStream stream ) : void
stream NetworkingStream Stream to be deserialized
return void

Disconnect() public method

Used to do final cleanup when disconnecting. This gets called currently on application quit and scene resets
public Disconnect ( ) : void
return void

ExecuteRPCStack() public method

public ExecuteRPCStack ( ) : void
return void

GenerateUniqueId() public static method

Get a generated Unique ID for the next simple networked mono behavior or its derivitive
public static GenerateUniqueId ( ) : ulong
return ulong

GetRPC() public method

public GetRPC ( int id ) : MethodInfo
id int
return System.Reflection.MethodInfo

GetSceneNetworkedId() public method

public GetSceneNetworkedId ( ) : int
return int

Initialize() public static method

An initial setup to make sure that a networking manager exists before running any core logic
public static Initialize ( BeardedManStudios.Network.NetWorker socket ) : void
socket BeardedManStudios.Network.NetWorker
return void

InvokeRPC() public method

To Invoke an RPC on a given Networking Stream RPC
public InvokeRPC ( NetworkingStreamRPC stream ) : bool
stream NetworkingStreamRPC Networking Stream RPC to read from
return bool

Locate() public static method

Locate a Simple Networked Monobehavior given a ID
public static Locate ( ulong id ) : SimpleNetworkedMonoBehavior
id ulong ID of the Simple Networked Monobehavior
return SimpleNetworkedMonoBehavior

NetworkDestroy() public static method

Destroy a Simple Networked Monobehavior or any of its derivitives with the given Network ID
public static NetworkDestroy ( ulong networkId ) : bool
networkId ulong Network ID to be destroyed
return bool

NetworkDisconnect() protected method

protected NetworkDisconnect ( ) : void
return void

NetworkStart() protected method

A start method that is called after the object has been setup on the network
protected NetworkStart ( ) : void
return void

NonOwnerFixedUpdate() protected method

protected NonOwnerFixedUpdate ( ) : void
return void

NonOwnerUpdate() protected method

protected NonOwnerUpdate ( ) : void
return void

OfflineStart() public method

public OfflineStart ( ) : void
return void

OnApplicationQuit() protected method

protected OnApplicationQuit ( ) : void
return void

OnDestroy() protected method

protected OnDestroy ( ) : void
return void

OwnerFixedUpdate() protected method

protected OwnerFixedUpdate ( ) : void
return void

OwnerUpdate() protected method

protected OwnerUpdate ( ) : void
return void

QueueRPCForInstantiate() public static method

public static QueueRPCForInstantiate ( ulong id, NetworkingStream stream ) : void
id ulong
stream NetworkingStream
return void

RPC() public method

Call an RPC method with arguments
public RPC ( string methodName ) : void
methodName string Method(Function) name to call
return void

RPC() public method

Call an RPC method with a NetWorker(Socket) and arguments
public RPC ( string methodName, BeardedManStudios.Network.NetWorker socket ) : void
methodName string Method(Function) name to call
socket BeardedManStudios.Network.NetWorker The NetWorker(Socket) being used
return void

RPC() public method

Call an RPC method on a NetWorker(Socket) with receivers and arguments
public RPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkReceivers receivers ) : void
methodName string Method(Function) name to call
socket BeardedManStudios.Network.NetWorker The NetWorker(Socket) being used
receivers NetworkReceivers Who shall receive the RPC
return void

RPC() public method

Call an RPC method with a receiver and arguments
public RPC ( string methodName, NetworkReceivers rpcMode ) : void
methodName string Method(Function) name to call
rpcMode NetworkReceivers Who shall receive the RPC
return void

Reflect() protected method

Get the RPC's of the simple networked monobehavior
protected Reflect ( ) : void
return void

ResetAll() public static method

public static ResetAll ( ) : void
return void

ResetBufferClear() public method

Resets the buffer to be clear again so that it can start buffering
public ResetBufferClear ( ) : void
return void

ResetForScene() public static method

public static ResetForScene ( List skip ) : void
skip List
return void

Serialized() public method

Serialize the Simple Networked Monobehavior
public Serialized ( ) : BMSByte
return BMSByte

SetSceneNetworkedId() public method

public SetSceneNetworkedId ( int id ) : void
id int
return void

Setup() public method

Setup the Simple Networked Monobehavior stack with a NetWorker, owner, network id, and owner id
public Setup ( BeardedManStudios.Network.NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId ) : void
owningSocket BeardedManStudios.Network.NetWorker The NetWorker to be setup with
isOwner bool If this object is the owner
networkId ulong The NetworkID for this Simple Networked Monobehavior
ownerId ulong The OwnerID for this Simple Networked Monobehavior
return void

Setup() public method

public Setup ( BeardedManStudios.Network.NetWorker owningSocket, bool isOwner, ulong networkId, ulong ownerId, bool isSceneObject = false ) : void
owningSocket BeardedManStudios.Network.NetWorker
isOwner bool
networkId ulong
ownerId ulong
isSceneObject bool
return void

SetupObjects() public static method

Setup the Simple Networked Monobehavior stack with a NetWorker
public static SetupObjects ( SimpleNetworkedMonoBehavior behaviors, BeardedManStudios.Network.NetWorker owningSocket ) : void
behaviors SimpleNetworkedMonoBehavior
owningSocket BeardedManStudios.Network.NetWorker The NetWorker to be setup with
return void

URPC() public method

Call an Unreliable RPC method on a NetWorker(Socket) with receivers and arguments
public URPC ( string methodName, BeardedManStudios.Network.NetWorker socket, NetworkReceivers receivers ) : void
methodName string Method(Function) name to call
socket BeardedManStudios.Network.NetWorker The NetWorker(Socket) being used
receivers NetworkReceivers Who shall receive the RPC
return void

URPC() public method

Call an Unreliable RPC method with a receiver and arguments
public URPC ( string methodName, NetworkReceivers rpcMode ) : void
methodName string Method(Function) name to call
rpcMode NetworkReceivers Who shall receive the RPC
return void

UnityFixedUpdate() protected method

protected UnityFixedUpdate ( ) : void
return void

UnityUpdate() protected method

protected UnityUpdate ( ) : void
return void

Property Details

allowOwnershipChange public_oe property

Determines if this object has the ability to change owners
public bool allowOwnershipChange
return bool

destroyOnDisconnect public_oe property

If this is true, then a network destroy will be called on disconnect
public bool destroyOnDisconnect
return bool

dontDestroyOnLoad public_oe property

If this is marked as true then this object will not be cleaned up by the network on level load
public bool dontDestroyOnLoad
return bool

networkedBehaviors public_oe static_oe property

A list of all of the current networked behaviors
public static Dictionary networkedBehaviors
return SimpleNetworkedMonoBehavior>.Dictionary

networkedBehaviorsMutex public_oe static_oe property

Used for when creating new networked behaviors
public static object networkedBehaviorsMutex
return object

rpcStack protected_oe property

A list of RPC (remote methods) that are pending to be called for this object
protected List rpcStack
return List