Class KaijuUser
Store the information of a user.
Inheritance
Implements
Namespace: KaijuSolutions.MultiplayerEngine
Syntax
public class KaijuUser : MonoBehaviour, IKaijuVoice
Fields
filters
The voice filters to apply directly to the voice source of this user. These will run in the order they are assigned, not based on the order property of the KaijuVoiceFilter.
Declaration
public KaijuVoiceFilter[] filters
Field Value
| Type | Description |
|---|---|
| KaijuVoiceFilter[] |
OnChat
Called when a chat message arrives for this user.
Declaration
public KaijuMultiplayerManager.UserChatEventHandler OnChat
Field Value
| Type | Description |
|---|---|
| KaijuMultiplayerManager.UserChatEventHandler |
OnIcon
Called when an icon for this user has loaded.
Declaration
public KaijuMultiplayerManager.EmptyEventHandler OnIcon
Field Value
| Type | Description |
|---|---|
| KaijuMultiplayerManager.EmptyEventHandler |
OnRichPresence
Called when rich presence for this user has updated.
Declaration
public KaijuMultiplayerManager.UserRichPresenceEventHandler OnRichPresence
Field Value
| Type | Description |
|---|---|
| KaijuMultiplayerManager.UserRichPresenceEventHandler |
OnStatsReceived
Callback for receiving the stats of this player.
Declaration
public KaijuStats.CurrentUserStatsReceivedHandler OnStatsReceived
Field Value
| Type | Description |
|---|---|
| KaijuStats.CurrentUserStatsReceivedHandler |
OnStatsUnloaded
Callback for this player's stats being unloaded.
Declaration
public KaijuMultiplayerManager.EmptyEventHandler OnStatsUnloaded
Field Value
| Type | Description |
|---|---|
| KaijuMultiplayerManager.EmptyEventHandler |
OnUser
Called when information of this user has updated.
Declaration
public KaijuMultiplayerManager.EmptyEventHandler OnUser
Field Value
| Type | Description |
|---|---|
| KaijuMultiplayerManager.EmptyEventHandler |
Properties
Display
Get rich presence localization token that will be displayed in a user's selected language in the Steam client UI of this user.
Declaration
public string Display { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Group
Get the rich presence group of this user.
Declaration
public string Group { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
GroupSize
Get the rich presence group size of this user.
Declaration
public int GroupSize { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Icon
The icon of this user.
Declaration
public Texture2D Icon { get; }
Property Value
| Type | Description |
|---|---|
| Texture2D |
IconSize
The size of icon we want for the user.
Large = 128 x 128.
Medium = 64 x 64.
Small = 32 x 32.
None = No icon.
Declaration
public KaijuIconSize IconSize { get; set; }
Property Value
| Type | Description |
|---|---|
| KaijuIconSize |
Id
The ID of the user this is for.
Declaration
public ulong Id { get; set; }
Property Value
| Type | Description |
|---|---|
| System.UInt64 |
Level
Get the level of this user.
Declaration
public int Level { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Name
The name of the user.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Relationship
The relationship with this user.
Declaration
public KaijuRelationship Relationship { get; }
Property Value
| Type | Description |
|---|---|
| KaijuRelationship |
RichPresence
All rich presence for this user.
Declaration
public Dictionary<string, string> RichPresence { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<System.String, System.String> |
State
The state of this user.
Declaration
public KaijuState State { get; }
Property Value
| Type | Description |
|---|---|
| KaijuState |
Status
Get the rich presence status to display when someone views this user's game info.
Declaration
public string Status { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Valid
Check if this user is valid or not.
Declaration
public bool Valid { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Voice
The voice playback source for this user.
Declaration
public AudioSource Voice { get; set; }
Property Value
| Type | Description |
|---|---|
| AudioSource |
Methods
AddVoice()
Add a voice source to this if there is currently none.
Declaration
public void AddVoice()
Assign(Boolean)
Assign this to a user.
Declaration
public void Assign(bool lobbyOnly = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | lobbyOnly | Only assign to us or members of our current lobby, or otherwise also try friends. |
ConfigureVoice()
Match this listener with the voice settings of the KaijuMultiplayerManager.
Declaration
public void ConfigureVoice()
GetAchievement(String)
Gets the unlock status of an achievement of this user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public bool GetAchievement(string achievement)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | achievement | The API name of the achievement. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement. |
GetAchievement(String, out DateTime)
Gets the unlock status of an achievement and the time it was unlocked at for this user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public bool GetAchievement(string achievement, out DateTime time)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | achievement | The API name of the achievement. |
| DateTime | time | The time the achievement was unlocked at if it has been. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement. |
GetAchievement(UInt32)
Gets the unlock status of an achievement of this user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public bool GetAchievement(uint index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | index | The achievement's index. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement. |
GetAchievement(UInt32, out DateTime)
Gets the unlock status of an achievement and the time it was unlocked at for this user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public bool GetAchievement(uint index, out DateTime time)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | index | The achievement's index. |
| DateTime | time | The time the achievement was unlocked at if it has been. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement. |
GetMemberData(String)
Get a data value for this user in our lobby.
Declaration
public string GetMemberData(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The value to get. |
Returns
| Type | Description |
|---|---|
| System.String | The given value. Will return an empty string if we are not in a lobby, the assigned user is not in our lobby, the data did not exist, or there was an error. |
GetRichPresence(String)
Get a rich presence of this user.
Declaration
public string GetRichPresence(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The key. |
Returns
| Type | Description |
|---|---|
| System.String | The rich presence value or an empty string if it was not set. |
GetStatFloat(String, Single)
Get a float stat for this user. If this is an integer stat as set in Steamworks, it will cast it to a float. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public float GetStatFloat(string stat, float fallback = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | stat | The API name of the stat. |
| System.Single | fallback | The value to return if there is an error getting the achievement. |
Returns
| Type | Description |
|---|---|
| System.Single | The value of the stat for the user or the fallback value if there is an error. |
GetStatInteger(String, Int32)
Get an integer stat for this user. If this is a float stat as set in Steamworks, it will cast it to an integer. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived or OnStatsReceived callbacks triggered before accessing this.
Declaration
public int GetStatInteger(string stat, int fallback = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | stat | The API name of the stat. |
| System.Int32 | fallback | The value to return if there is an error getting the achievement. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The value of the stat for the user or the fallback value if there is an error. |
Overlay()
Open the Steam overlay to this user.
Declaration
public bool Overlay()
Returns
| Type | Description |
|---|---|
| System.Boolean | If the overlay was opened or not. |
OverlayBindable()
Open the Steam overlay to this user.
Declaration
public void OverlayBindable()
ReceiveAudio(Single[], UInt32)
Receive audio from the KaijuMultiplayerManager.
Declaration
public void ReceiveAudio(float[] sound, uint length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single[] | sound | The received audio which has been uncompressed from a single-channel 16-bit PCM audio. |
| System.UInt32 | length | The length of the received audio. The length of the array may be greater than this, and the audio data is from the start of the array to this. |
RequestStats()
Request the stats for this user. Listen for a OnUserStatsReceived callback to get the result.
Declaration
public bool RequestStats()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the request was made, false otherwise. |
RequestStatsBindable()
Request the stats for this user. Listen for a OnUserStatsReceived callback to get the result.
Declaration
public void RequestStatsBindable()
UpdateIcon()
Update the cached icon of the user.
Declaration
public void UpdateIcon()
UpdateName()
Update the cached name of the user.
Declaration
public void UpdateName()