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.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ServerSelectionMenu() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
15 private and internal fields
| Member | What it is |
|---|---|
private SelectionLever[] boardLevers | One lever per board type, set when that board opens. |
private ServerBoard[] boards | All server boards. |
private Dictionary<ServerBoardType, ServerBoard> boardsByType | Boards keyed by type. |
private ServerBoard currentBoard | Backing field for CurrentBoard. |
private ServerElementEvent elementSelected | Inspector event raised with the newly selected server. |
private TextRenderer headingText | Heading that shows the current board's title. |
private RopeGrab[] ropeGrabs | Ropes the player pulls to scroll the list. |
private float ropeSpeedMultiplier | Scroll speed for the ropes. |
private ServerElement serverElementPrefab | Server entry prefab. Not used by this class's code. |
private ServerInfoBoard serverInfoBoard | Board that shows details of the selected server. |
private ServerBoardType startingBoard | Board shown after log in, My Servers by default. |
private TextRenderer updateCountdownText | Countdown text. Not used by this class's code. |
private TextRenderer waitingForLoginText | Text shown while not logged in. |
private CaptainsWheel wheel | Captain's wheel that scrolls the list. |
private float wheelSpeedMultiplier | Scroll speed for the wheel. |
Properties
| Member | What it is |
|---|---|
ServerBoard CurrentBoard { get; } | The board being shown. |
Events
| Member | What it is |
|---|---|
event SelectedElementChanged SelectedChanged | Raised when the selected server element changes. |
Methods
| Member | What 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
| Member | What 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: