跳到主要内容
版本:0.2.1

Interface IWukongSynchronizationApi

Namespace: WukongMp.Sdk.Api
Assembly: WukongMp.Sdk.dll

Provides methods related to synchronizing game state between players in a multiplayer session.

public interface IWukongSynchronizationApi

Properties

AllMainCharacters

Gets a list of all main characters.

EntityList<ReadyMainCharacter> AllMainCharacters { get; }

Property Value

EntityList<ReadyMainCharacter>

AllPlayers

Gets a list of all players on the server.

IReadOnlyList<PlayerId> AllPlayers { get; }

Property Value

IReadOnlyList<PlayerId>

AllTamers

Gets a list of all tamers (monsters).

EntityList<ReadyTamer> AllTamers { get; }

Property Value

EntityList<ReadyTamer>

AreaMainCharacters

Gets a list of main characters in the current area.

EntityList<ReadyMainCharacter> AreaMainCharacters { get; }

Property Value

EntityList<ReadyMainCharacter>

AreaPlayers

Gets a list of players in the current area.

IReadOnlyList<PlayerId> AreaPlayers { get; }

Property Value

IReadOnlyList<PlayerId>

AreaTamers

Gets a list of tamers (monsters) in the current area.

EntityList<ReadyTamer> AreaTamers { get; }

Property Value

EntityList<ReadyTamer>

CurrentAreaId

Gets the current area ID.

AreaId? CurrentAreaId { get; }

Property Value

AreaId?

InArea

Gets a value indicating whether the player is in an area.

bool InArea { get; }

Property Value

bool

IsConnected

Gets a value indicating whether the player is connected to the server.

bool IsConnected { get; }

Property Value

bool

IsMasterClient

Gets a value indicating whether the player is the master client in an area.

bool IsMasterClient { get; }

Property Value

bool

LocalMainCharacter

Gets the local main character.

ReadyMainCharacter? LocalMainCharacter { get; }

Property Value

ReadyMainCharacter?

LocalPlayerId

Gets the local player's ID.

PlayerId? LocalPlayerId { get; }

Property Value

PlayerId?

Methods

DisableSpectatorMode(ReadyMainCharacter)

Disables spectator mode for the specified character.

void DisableSpectatorMode(ReadyMainCharacter character)

Parameters

character ReadyMainCharacter

The character to disable spectator mode for.

EnableSpectatorMode(ReadyMainCharacter, SpectatorReason)

Enables spectator mode for the specified character.

void EnableSpectatorMode(ReadyMainCharacter character, SpectatorReason reason)

Parameters

character ReadyMainCharacter

The character to enable spectator mode for.

reason SpectatorReason

The reason for enabling spectator mode.

GetDisconnectReasonAndInvoke(Action<DisconnectReason>)

Retrieves the disconnect reason and invokes the provided callback with it.

void GetDisconnectReasonAndInvoke(Action<DisconnectReason> callback)

Parameters

callback Action<DisconnectReason>

The callback to invoke with the disconnect reason.

GetMainCharacterByPlayerId(PlayerId)

Gets the main character associated with the specified player ID.

ReadyMainCharacter? GetMainCharacterByPlayerId(PlayerId playerId)

Parameters

playerId PlayerId

The player ID.

Returns

ReadyMainCharacter?

The main character, or null if not found.

GetPlayerEntityByActor(AActor?)

Gets the player entity associated with the specified actor.

ReadyMainCharacter? GetPlayerEntityByActor(AActor? actor)

Parameters

actor AActor?

The actor to find the player entity for.

Returns

ReadyMainCharacter?

The player entity, or null if not found.

GetPlayerEntityByLastTransformation(BGUCharacterCS?)

Gets the player entity associated with the last transformation of the specified character.

ReadyMainCharacter? GetPlayerEntityByLastTransformation(BGUCharacterCS? targetCharacter)

Parameters

targetCharacter BGUCharacterCS?

The character to find the player entity for.

Returns

ReadyMainCharacter?

The player entity, or null if not found.

SpawnEnemy(TamerKind, Vector3, int, int)

Spawns an enemy of the specified kind at the given position.

void SpawnEnemy(TamerKind kind, Vector3 position, int count = 1, int teamId = 2)

Parameters

kind TamerKind

The kind of enemy to spawn.

position Vector3

The position to spawn the enemy at.

count int

The number of enemies to spawn. Defaults to 1.

teamId int

The team ID for the spawned enemies. Defaults to the default monster team ID (2).

SyncMonstersInArea()

Register all monsters in the current area to be synchronized over the network. This should be called whenever the first player enters a new area.

void SyncMonstersInArea()

TryGetPlayerInfoById(PlayerId, out string?, out int?)

Tries to get player information by ID.

bool TryGetPlayerInfoById(PlayerId player, out string? nickname, out int? team)

Parameters

player PlayerId

The player ID.

nickname string?

The player's nickname, if found.

team int?

The player's team ID, if found.

Returns

bool

true if the player information was found; otherwise, false.

  • Properties
    • AllMainCharacters
    • AllPlayers
    • AllTamers
    • AreaMainCharacters
    • AreaPlayers
    • AreaTamers
    • CurrentAreaId
    • InArea
    • IsConnected
    • IsMasterClient
    • LocalMainCharacter
    • LocalPlayerId
  • Methods
    • DisableSpectatorMode(ReadyMainCharacter)
    • EnableSpectatorMode(ReadyMainCharacter, SpectatorReason)
    • GetDisconnectReasonAndInvoke(Action<DisconnectReason>)
    • GetMainCharacterByPlayerId(PlayerId)
    • GetPlayerEntityByActor(AActor?)
    • GetPlayerEntityByLastTransformation(BGUCharacterCS?)
    • SpawnEnemy(TamerKind, Vector3, int, int)
    • SyncMonstersInArea()
    • TryGetPlayerInfoById(PlayerId, out string?, out int?)