Skip to content

Sein Lobby View Model

Class · USeinLobbyViewModel : UObject

#include "ViewModel/SeinLobbyViewModel.h"

Lobby state for UI binding: the slot list, the local player’s slot, ready counts, and the selected map. Bind On Lobby Changed to refresh your slot panel. Get the shared instance with Get Or Create Lobby View Model.

Binds the view model to a world and to the replicated lobby state. Call it from a widget’s Construct event, or use Get Or Create Lobby View Model, which does it for you.

void Initialize(UWorld* InWorld);

Releases the view model’s bindings. It runs automatically when the world ends.

void Shutdown();

A copy of the current lobby slots. Refreshes whenever the lobby changes.

const TArray<FSeinLobbySlotState>& GetSlots() const;

Find a slot by its index (1-based). Returns false if not present.

bool TryGetSlot(int32 SlotIndex, FSeinLobbySlotState& OutSlot) const;

The slot the local player holds. Neutral until the player’s connection to the lobby is ready.

FSeinPlayerID GetLocalSlot() const;

True if the given slot number (starting at 1) is the local player’s. Use it so a slot tile can ask whether it is you. False if the local player has no slot yet.

bool IsLocalSlot(int32 SlotIndex) const;

True if this machine hosts the lobby: a listen server, a dedicated server or a standalone game.

bool IsHost() const;

True when a network session is active and the local player holds a slot, meaning the lobby panel can be used. False in a standalone game and before hosting or joining. Use it to grey out the panel until the player hosts or joins.

bool IsInLobbySession() const;

True if this machine is the host and at least one slot is claimed by a connected human. Add further rules, such as everyone ready, in your own UI.

bool CanStartMatch() const;

True on the host once the lobby has been locked in for the match to start. Always false on clients.

bool HasPublishedMatchSnapshot() const;

Local PC’s slot ready-flag (false until the local relay arrives).

bool IsLocalReady() const;

Number of claimed slots that are ready. AI slots always count as ready. Pair with Get Claimed Count for a ready-over-total display.

int32 GetReadyCount() const;

Number of claimed slots, human and AI. Pair with Get Ready Count for a ready-over-total display.

int32 GetClaimedCount() const;

Every available faction, for a faction picker. Filter the list yourself to limit factions per match type.

TArray<TSoftObjectPtr<USeinFaction>> GetAvailableFactionsForPicker() const;

The map currently selected in the lobby. None until the lobby state arrives or if no map is selected.

TSoftObjectPtr<UWorld> GetSelectedMap() const;

The playable maps listed in the Net settings, with display name, slot count, team count and thumbnail. Use it to fill a map picker.

TArray<FSeinLobbyMapEntry> GetAvailableMaps() const;

True if selecting this map would not remove any claimed slot, meaning the host can pick it. Use it to disable map options that would be rejected.

bool IsMapShrinkSafe(const FSeinLobbyMapEntry& Candidate) const;

Looks up the selected map in the Net settings’ available maps and returns its full entry. False if no map is selected or it is not in the list.

bool TryGetCurrentMapEntry(FSeinLobbyMapEntry& OutEntry) const;

Number of teams on the selected map, for filling team pickers with 1 through that number. Returns 2 if no map is selected or it is not in the available maps.

int32 GetCurrentMapTeamCount() const;

FOnLobbyChanged OnLobbyChanged

Fires when the lobby’s slots change. Bind it to refresh the slot panel.

FOnLocalSlotChanged OnLocalSlotChanged · passes FSeinPlayerID NewLocalSlot

Fires when the local player’s slot changes. Use it to update the faction picker, the ready button and similar controls.