Class NetworkAuthority
Manages authority over child authoritative components.
Implements
Inherited Members
Namespace: SuperNet.Unity.Components
Assembly: cs.temp.dll.dll
Syntax
public sealed class NetworkAuthority : NetworkComponent, INetworkAuthoritative
Fields
Locked
True if only authority can claim access. Set to false to let anybody claim.
Declaration
public bool Locked
Field Value
| Type | Description |
|---|---|
| System.Boolean |
SyncChannel
Network channel to use.
Declaration
public byte SyncChannel
Field Value
| Type | Description |
|---|---|
| System.Byte |
Properties
IsAuthority
True if we can grant and revoke ownership to peers.
Declaration
public bool IsAuthority { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsOwner
True if we have local ownership over child authoritative components.
Declaration
public bool IsOwner { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Owner
Current owner of the components or null if unknown.
Declaration
public Peer Owner { get; }
Property Value
| Type | Description |
|---|---|
| Peer |
Timestamp
Timestamp when the ownership was last changed.
Declaration
public HostTimestamp Timestamp { get; }
Property Value
| Type | Description |
|---|---|
| HostTimestamp |
Methods
Claim(UInt32)
Claim local ownership access.
Declaration
public void Claim(uint priority = 1U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | priority | Claim priority. Higher values have more claim. |
GetAuthoritativeComponents()
Return all authoritative components managed by this authority.
Declaration
public IReadOnlyList<INetworkAuthoritative> GetAuthoritativeComponents()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<INetworkAuthoritative> | All authoritative components. |
Grant(Peer)
Grant ownership access to a specific peer.
Declaration
public void Grant(Peer peer)
Parameters
| Type | Name | Description |
|---|---|---|
| Peer | peer | New owner. |
OnNetworkConnect(Peer)
Declaration
public override void OnNetworkConnect(Peer peer)
Parameters
| Type | Name | Description |
|---|---|---|
| Peer | peer |
Overrides
OnNetworkDisconnect(Peer)
Declaration
public override void OnNetworkDisconnect(Peer peer)
Parameters
| Type | Name | Description |
|---|---|---|
| Peer | peer |
Overrides
OnNetworkMessage(Peer, Reader, MessageReceived)
Declaration
public override void OnNetworkMessage(Peer peer, Reader reader, MessageReceived info)
Parameters
| Type | Name | Description |
|---|---|---|
| Peer | peer | |
| Reader | reader | |
| MessageReceived | info |
Overrides
OnNetworkRegister()
Declaration
public override void OnNetworkRegister()
Overrides
OnNetworkResend(Peer, Peer, Reader, MessageReceived)
Declaration
public override bool OnNetworkResend(Peer origin, Peer peer, Reader reader, MessageReceived info)
Parameters
| Type | Name | Description |
|---|---|---|
| Peer | origin | |
| Peer | peer | |
| Reader | reader | |
| MessageReceived | info |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Rebind()
Force an update to the list of child components this authority has control over.
Declaration
public void Rebind()
SetAuthority(Boolean)
Update authority on this component.
Declaration
public void SetAuthority(bool authority)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | authority | Authority to set. |
Start()
Declaration
protected override void Start()
Overrides
Explicit Interface Implementations
INetworkAuthoritative.OnNetworkAuthorityUpdate(Boolean, HostTimestamp)
Declaration
void INetworkAuthoritative.OnNetworkAuthorityUpdate(bool authority, HostTimestamp timestamp)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | authority | |
| HostTimestamp | timestamp |