public override void Start() { Plugin.Log?.Info("Installing Interface"); HostLobbySetupViewController hostViewController = Container.Resolve <HostLobbySetupViewController>(); Container.InstantiateComponent <HostLobbySetupPanel>(hostViewController.gameObject); ClientLobbySetupViewController clientViewController = Container.Resolve <ClientLobbySetupViewController>(); Container.InstantiateComponent <ClientLobbySetupPanel>(clientViewController.gameObject); CenterStageScreenController centerScreenController = Container.Resolve <CenterStageScreenController>(); Container.InstantiateComponent <CenterScreenLoadingPanel>(centerScreenController.gameObject); ServerPlayerListController playerListController = Container.Resolve <ServerPlayerListController>(); GameServerPlayersTableView playersTableView = playerListController.GetField <GameServerPlayersTableView, ServerPlayerListController>("_gameServerPlayersTableView"); GameServerPlayerTableCell playerTableCell = playersTableView.GetField <GameServerPlayerTableCell, GameServerPlayersTableView>("_gameServerPlayerCellPrefab"); GameServerPlayerTableCell newPlayerTableCell = GameObject.Instantiate(playerTableCell); newPlayerTableCell.gameObject.SetActive(false); PlayerTableCellStub playerTableCellStub = newPlayerTableCell.gameObject.AddComponent <PlayerTableCellStub>(); playerTableCellStub.Construct(newPlayerTableCell); Destroy(newPlayerTableCell.GetComponent <GameServerPlayerTableCell>()); playersTableView.SetField <GameServerPlayersTableView, GameServerPlayerTableCell>("_gameServerPlayerCellPrefab", playerTableCellStub); }
internal void Construct(GameServerPlayerTableCell playerTableCell) { // Player _playerNameText = playerTableCell.GetField <CurvedTextMeshPro, GameServerPlayerTableCell>("_playerNameText"); _localPlayerBackgroundImage = playerTableCell.GetField <Image, GameServerPlayerTableCell>("_localPlayerBackgroundImage"); // Suggested Level _suggestedLevelText = playerTableCell.GetField <CurvedTextMeshPro, GameServerPlayerTableCell>("_suggestedLevelText"); _suggestedCharacteristicIcon = playerTableCell.GetField <ImageView, GameServerPlayerTableCell>("_suggestedCharacteristicIcon"); _suggestedDifficultyText = playerTableCell.GetField <TextMeshProUGUI, GameServerPlayerTableCell>("_suggestedDifficultyText"); _emptySuggestedLevelText = playerTableCell.GetField <CurvedTextMeshPro, GameServerPlayerTableCell>("_emptySuggestedLevelText"); // Suggested Modifiers _suggestedModifiersList = playerTableCell.GetField <GameplayModifierInfoListItemsList, GameServerPlayerTableCell>("_suggestedModifiersList"); _emptySuggestedModifiersText = playerTableCell.GetField <CurvedTextMeshPro, GameServerPlayerTableCell>("_emptySuggestedModifiersText"); // Buttons _kickPlayerButton = playerTableCell.GetField <Button, GameServerPlayerTableCell>("_kickPlayerButton"); _useBeatmapButton = playerTableCell.GetField <Button, GameServerPlayerTableCell>("_useBeatmapButton"); _useModifiersButton = playerTableCell.GetField <Button, GameServerPlayerTableCell>("_useModifiersButton"); _useBeatmapButtonHoverHint = playerTableCell.GetField <HoverHint, GameServerPlayerTableCell>("_useBeatmapButtonHoverHint"); // Status Icons _statusImageView = playerTableCell.GetField <ImageView, GameServerPlayerTableCell>("_statusImageView"); _readyIcon = playerTableCell.GetField <Sprite, GameServerPlayerTableCell>("_readyIcon"); _spectatingIcon = playerTableCell.GetField <Sprite, GameServerPlayerTableCell>("_spectatingIcon"); // Helpers _gameplayModifiers = playerTableCell.GetField <GameplayModifiersModelSO, GameServerPlayerTableCell>("_gameplayModifiers"); // TableCellWithSeparator _separator = playerTableCell.GetField <GameObject, TableCellWithSeparator>("_separator"); }
public static void UpdateColor(IConnectedPlayer player) { GameServerPlayerTableCell cell = cells[player.userId]; ILobbyPlayerDataModel model = models[player.userId]; UpdateColor(player, model, cell); }
public void SetTableCellData(string userId, GameServerPlayerTableCell tableCell) { PlayerTableCellIcon?icon = tableCell.gameObject.GetComponent <PlayerTableCellIcon>(); if (icon == null) { icon = tableCell.gameObject.AddComponent <PlayerTableCellIcon>(); } icon.SetPlayerId(userId); }
public static void UpdateColor(IConnectedPlayer connectedPlayer, ILobbyPlayerDataModel playerDataModel, GameServerPlayerTableCell __instance) { Image background = __instance.GetField <Image>("_localPlayerBackgroundImage"); if (playerDataModel.beatmapLevel != null) { background.enabled = true; PreviewBeatmapManager.GetPopulatedPreview(playerDataModel.beatmapLevel.levelID).ContinueWith(r => { PreviewBeatmapStub preview = r.Result; float transparency = connectedPlayer.isMe ? 0.4f : 0.1f; Color color = connectedPlayer.HasState("bmlocal") ? green : connectedPlayer.HasState("bmcloud") ? yellow : red; color.a = transparency; HMMainThreadDispatcher.instance.Enqueue(() => { background.color = color; }); }); } else { background.color = normal; } }
static void Postfix(IConnectedPlayer connectedPlayer, ILobbyPlayerDataModel playerDataModel, GameServerPlayerTableCell __instance) { cells[connectedPlayer.userId] = __instance; models[connectedPlayer.userId] = playerDataModel; UpdateColor(connectedPlayer, playerDataModel, __instance); }
static void Postfix(IConnectedPlayer connectedPlayer, ILobbyPlayerDataModel playerDataModel, GameServerPlayerTableCell __instance) { cells[connectedPlayer.userId] = __instance; SessionTracker?tracker = SessionTracker; if (tracker != null) { tracker.SetTableCellData(connectedPlayer.userId, __instance); } }