public void ChangeSlotColor(UI_LobbySlot slot) { if (Type == GameType.Singleplayer) { UpdatePlayerColor(slot.Slot.Id, GetRandomNewColorFor(slot.Slot.Id)); } else { NetworkPlayer.Server.RequestColorChangeServerRpc(slot.Slot.Id); } }
public void RemovePlayer(UI_LobbySlot slot) { slot.SetInactive(); UsedColors.Remove(slot.Slot.GetColor()); if (Type == GameType.MultiplayerHost) { NetworkPlayer.Server.UpdateLobbySlotsServerRpc(); } else { OrganizeSlots(); } }
/// <summary> /// Gets called on the server whenever a connected player leaves. /// </summary> public void PlayerLeft(ulong clientId) { UI_LobbySlot slot = UiSlots.First(x => x.Slot.ClientId == clientId); RemovePlayer(slot); }