void OnRefreshPlayerListEvent(RefreshPlayerListEvent e) { buttons.Clear(); string[] names = e.playerNames; for (int i = 0; i < names.Length; i++) { string name = names[i]; string id = "name" + i.ToString(); ScreenElements.Remove(id); ButtonElement button = CreateButton("Name-Decider-" + name, i + 2, name); ScreenElements.AddEnabled(id, button); button.Color = "blue"; buttons.Add(button); } }
void OnRefreshPlayerListEvent(RefreshPlayerListEvent e) { playerNames = e.playerNames; hosting = MultiplayerManager.instance.Hosting; int namesCount = playerNames.Length; bool showPlay = hosting && namesCount > minPlayers; ScreenElements.SuspendUpdating(); for (int i = 0; i < 5; i++) { string id = "name" + i.ToString(); ScreenElements.Remove(id); } for (int i = 0; i < namesCount; i++) { string id = "name" + i.ToString(); ScreenElements.Remove(id); ScreenElements.AddEnabled(id, new LabelElement(playerNames[i], i + 1)); } if (showPlay) { ScreenElements.Enable("play"); } else { ScreenElements.Disable("play"); } if (namesCount >= 4) { ScreenElements.Disable("invite"); } else { if (MultiplayerManager.instance.Hosting && !MultiplayerManager.instance.UsingWifi) { ScreenElements.Enable("invite"); } } ScreenElements.EnableUpdating(); }
/** * Messages */ void OnRefreshPlayerListEvent(RefreshPlayerListEvent e) { clientCount = e.playerNames.Length - 1; // subtract 1 because we don't include the host }
void OnRefreshPlayerListEvent(RefreshPlayerListEvent e) { playerCount = e.playerNames.Length; }
/** * Events */ void OnRefreshPlayerListEvent(RefreshPlayerListEvent e) { players = e.playerNames; messages = new string[players.Length]; }