Class MirrorExtensions
A set of extensions for Mirror Networking.
Inheritance
Inherited Members
Namespace: Exiled.API.Extensions
Assembly: Exiled.API.dll
Syntax
public static class MirrorExtensions
Properties
| Improve this Doc View SourceRpcFullNames
Gets Rpc's FullName System.String corresponding to StringExtensions(format:classname.methodname).
Declaration
public static ReadOnlyDictionary<string, string> RpcFullNames { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyDictionary<System.String, System.String> |
SendSpawnMessageMethodInfo
Gets a NetworkServer.SendSpawnMessage's System.Reflection.MethodInfo.
Declaration
public static MethodInfo SendSpawnMessageMethodInfo { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
SetDirtyBitsMethodInfo
Gets a Mirror.NetworkBehaviour.SetSyncVarDirtyBit(System.UInt64)'s System.Reflection.MethodInfo.
Declaration
public static MethodInfo SetDirtyBitsMethodInfo { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
SyncVarDirtyBits
Gets a all DirtyBit System.UInt64 from StringExtensions(format:classname.methodname).
Declaration
public static ReadOnlyDictionary<string, ulong> SyncVarDirtyBits { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyDictionary<System.String, System.UInt64> |
WriterExtensions
Gets System.Reflection.MethodInfo corresponding to System.Type.
Declaration
public static ReadOnlyDictionary<Type, MethodInfo> WriterExtensions { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyDictionary<System.Type, System.Reflection.MethodInfo> |
Methods
| Improve this Doc View SourceChangeAppearance(Player, RoleTypeId, Boolean, Byte)
Change Player character model for appearance. It will continue until Player's PlayerRoles.RoleTypeId changes.
Declaration
public static void ChangeAppearance(this Player player, RoleTypeId type, bool skipJump = false, byte unitId = 0)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Player to change. |
PlayerRoles.RoleTypeId | type | Model type. |
System.Boolean | skipJump | Whether or not to skip the little jump that works around an invisibility issue. |
System.Byte | unitId | The UnitNameId to use for the player's new role, if the player's new role uses unit names. (is NTF). |
ChangeAppearance(Player, RoleTypeId, IEnumerable<Player>, Boolean, Byte)
Change Player character model for appearance. It will continue until Player's PlayerRoles.RoleTypeId changes.
Declaration
public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumerable<Player> playersToAffect, bool skipJump = false, byte unitId = 0)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Player to change. |
PlayerRoles.RoleTypeId | type | Model type. |
System.Collections.Generic.IEnumerable<Player> | playersToAffect | The players who should see the changed appearance. |
System.Boolean | skipJump | Whether or not to skip the little jump that works around an invisibility issue. |
System.Byte | unitId | The UnitNameId to use for the player's new role, if the player's new role uses unit names. (is NTF). |
EditNetworkObject(NetworkIdentity, Action<NetworkIdentity>)
Edit Mirror.NetworkIdentity's parameter and sync.
Declaration
public static void EditNetworkObject(NetworkIdentity identity, Action<NetworkIdentity> customAction)
Parameters
Type | Name | Description |
---|---|---|
Mirror.NetworkIdentity | identity | Target object. |
System.Action<Mirror.NetworkIdentity> | customAction | Edit function. |
MessageTranslated(Player, String, String, Boolean, Boolean, Boolean)
Send CASSIE announcement with custom subtitles for translation that only Player can hear and see it.
Declaration
public static void MessageTranslated(this Player player, string words, string translation, bool makeHold = false, bool makeNoise = true, bool isSubtitles = true)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Target to send. |
System.String | words | The message to be reproduced. |
System.String | translation | The translation should be show in the subtitles. |
System.Boolean | makeHold | Same on MessageTranslated(String, String, Boolean, Boolean, Boolean)'s isHeld. |
System.Boolean | makeNoise | Same on MessageTranslated(String, String, Boolean, Boolean, Boolean)'s isNoisy. |
System.Boolean | isSubtitles | Same on MessageTranslated(String, String, Boolean, Boolean, Boolean)'s isSubtitles. |
PlayBeepSound(Player)
Plays a beep sound that only the target player
can hear.
Declaration
public static void PlayBeepSound(this Player player)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Target to play sound to. |
PlayCassieAnnouncement(Player, String, Boolean, Boolean, Boolean)
Send CASSIE announcement that only Player can hear.
Declaration
public static void PlayCassieAnnouncement(this Player player, string words, bool makeHold = false, bool makeNoise = true, bool isSubtitles = false)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Target to send. |
System.String | words | Announcement words. |
System.Boolean | makeHold | Same on Message(String, Boolean, Boolean, Boolean)'s isHeld. |
System.Boolean | makeNoise | Same on Message(String, Boolean, Boolean, Boolean)'s isNoisy. |
System.Boolean | isSubtitles | Same on Message(String, Boolean, Boolean, Boolean)'s isSubtitles. |
PlayGunSound(Player, Vector3, ItemType, Byte, Byte)
Plays a gun sound that only the player
can hear.
Declaration
public static void PlayGunSound(this Player player, Vector3 position, ItemType itemType, byte volume, byte audioClipId = 0)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Target to play. |
UnityEngine.Vector3 | position | Position to play on. |
ItemType | itemType | Weapon' sound to play. |
System.Byte | volume | Sound's volume to set. |
System.Byte | audioClipId | GunAudioMessage's audioClipId to set (default = 0). |
ResyncSyncVar(NetworkIdentity, Type, String)
Force resync to client's Mirror.SyncVarAttribute.
Declaration
public static void ResyncSyncVar(NetworkIdentity behaviorOwner, Type targetType, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
Mirror.NetworkIdentity | behaviorOwner | Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. |
System.Type | targetType | Mirror.NetworkBehaviour's type. |
System.String | propertyName | Property name starting with Network. |
SendFakeSyncObject(Player, NetworkIdentity, Type, Action<NetworkWriter>)
Send fake values to client's Mirror.SyncObject.
Declaration
public static void SendFakeSyncObject(Player target, NetworkIdentity behaviorOwner, Type targetType, Action<NetworkWriter> customAction)
Parameters
Type | Name | Description |
---|---|---|
Player | target | Target to send. |
Mirror.NetworkIdentity | behaviorOwner | Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. |
System.Type | targetType | Mirror.NetworkBehaviour's type. |
System.Action<Mirror.NetworkWriter> | customAction | Custom writing action. |
Examples
EffectOnlySCP207.
MirrorExtensions.SendCustomSync(player, player.ReferenceHub.networkIdentity, typeof(PlayerEffectsController), (writer) => {
writer.WriteUInt64(1ul); // DirtyObjectsBit
writer.WriteUInt32(1); // DirtyIndexCount
writer.WriteByte((byte)SyncList<byte>.Operation.OP_SET); // Operations
writer.WriteUInt32(17); // EditIndex
writer.WriteByte(1); // Value
});
|
Improve this Doc
View Source
SendFakeSyncVar(Player, NetworkIdentity, Type, String, Object)
Send fake values to client's Mirror.SyncVarAttribute.
Declaration
public static void SendFakeSyncVar(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, object value)
Parameters
Type | Name | Description |
---|---|---|
Player | target | Target to send. |
Mirror.NetworkIdentity | behaviorOwner | Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. |
System.Type | targetType | Mirror.NetworkBehaviour's type. |
System.String | propertyName | Property name starting with Network. |
System.Object | value | Value of send to target. |
SendFakeTargetRpc(Player, NetworkIdentity, Type, String, Object[])
Send fake values to client's Mirror.ClientRpcAttribute.
Declaration
public static void SendFakeTargetRpc(Player target, NetworkIdentity behaviorOwner, Type targetType, string rpcName, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
Player | target | Target to send. |
Mirror.NetworkIdentity | behaviorOwner | Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. |
System.Type | targetType | Mirror.NetworkBehaviour's type. |
System.String | rpcName | Property name starting with Rpc. |
System.Object[] | values | Values of send to target. |
SetName(Player, Player, String)
Sets DisplayNickname of a player
that only the target
player can see.
Declaration
public static void SetName(this Player target, Player player, string name)
Parameters
Type | Name | Description |
---|---|---|
Player | target | Only this player can see the name changed. |
Player | player | Player that will desync the CustomName. |
System.String | name | Nickname to set. |
SetPlayerInfoForTargetOnly(Player, Player, String)
Set CustomInfo on the target
player that only the player
can see.
Declaration
public static void SetPlayerInfoForTargetOnly(this Player player, Player target, string info)
Parameters
Type | Name | Description |
---|---|---|
Player | player | Only this player can see info. |
Player | target | Target to set info. |
System.String | info | Setting info. |
SetRoomColorForTargetOnly(Room, Player, Color)
Sets Color of a room
that only the target
player can see.
Declaration
public static void SetRoomColorForTargetOnly(this Room room, Player target, Color color)
Parameters
Type | Name | Description |
---|---|---|
Room | room | Room to modify. |
Player | target | Only this player can see room color. |
UnityEngine.Color | color | Color to set. |
SetRoomLightIntensityForTargetOnly(Room, Player, Single)
Sets Room of a room
that only the target
player can see.
Declaration
[Obsolete("This features has been remove by NW", true)]
public static void SetRoomLightIntensityForTargetOnly(this Room room, Player target, float multiplier)
Parameters
Type | Name | Description |
---|---|---|
Room | room | Room to modify. |
Player | target | Only this player can see room color. |
System.Single | multiplier | Light intensity multiplier to set. |