Skip to main content

ServerSelectionMenu

A class in Root.Township, the global namespace.

The main menu server picker: switches between server boards (my servers, open servers and so on), scrolls them by rope or wheel, and joins the selected server. Sets up once logged in.

Constructors​

MemberWhat it is
ServerSelectionMenu()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

15 private and internal fields
MemberWhat it is
private SelectionLever[] boardLeversOne lever per board type, set when that board opens.
private ServerBoard[] boardsAll server boards.
private Dictionary<ServerBoardType, ServerBoard> boardsByTypeBoards keyed by type.
private ServerBoard currentBoardBacking field for CurrentBoard.
private ServerElementEvent elementSelectedInspector event raised with the newly selected server.
private TextRenderer headingTextHeading that shows the current board's title.
private RopeGrab[] ropeGrabsRopes the player pulls to scroll the list.
private float ropeSpeedMultiplierScroll speed for the ropes.
private ServerElement serverElementPrefabServer entry prefab. Not used by this class's code.
private ServerInfoBoard serverInfoBoardBoard that shows details of the selected server.
private ServerBoardType startingBoardBoard shown after log in, My Servers by default.
private TextRenderer updateCountdownTextCountdown text. Not used by this class's code.
private TextRenderer waitingForLoginTextText shown while not logged in.
private CaptainsWheel wheelCaptain's wheel that scrolls the list.
private float wheelSpeedMultiplierScroll speed for the wheel.

Properties​

MemberWhat it is
ServerBoard CurrentBoard { get; }The board being shown.

Events​

MemberWhat it is
event SelectedElementChanged SelectedChangedRaised when the selected server element changes.

Methods​

MemberWhat it is
void DisableUpdate()Pauses the current board's updates.
void JoinCurrentServer(ServerElement serverElement)Joins the given element's server through the VR main menu.
Task RefreshServersList()Refreshes the current board's server list.
void ResumeUpdate()Resumes the current board's updates.
void SelectServer(GameServerInfo server, ServerBoardType board)Switches to a board and selects a server on it.
void SwitchToBoard(int boardType)Shows another board and updates the heading, lever and info board.
void SwitchToBoard(ServerBoardType board)Shows another board and updates the heading, lever and info board.
8 private and internal methods
MemberWhat it is
private void CheckForEmpty()If My Servers is empty or only has the tutorial after refreshing, switches to Open Servers.
private void Clear()On log out, shows the waiting text and turns off the current board.
private void OnDestroy()Unhooks the login events.
private void OnSelectedChanged(ServerElement oldElement, ServerElement newElement)Raises SelectedChanged and elementSelected and shows the server on the info board.
private void ScrollServerList(float oldRopeValue, float ropeValue)Scrolls the current board by a rope's change times ropeSpeedMultiplier.
private void ScrollServerListFromWheel(float oldRopeValue, float ropeValue)Scrolls the current board by the wheel's change times wheelSpeedMultiplier.
private void Setup()On log in, hides the waiting text, opens the starting board and hooks the ropes and wheel.
private void Start()Indexes boards by type and hooks login events, setting up now if already logged in.

Used in​

Members of other types that take, return or hold a ServerSelectionMenu: