// -------------------------------------------------------------------------------------------- protected override SharpUIBase BuildMainPanel() { _cardLayout = new SharpUIHorizontalLayout("UIPlayerHand"); _cardLayout.SetFixedSize(EAxis.X, _player.Hand.Cards.Count * 200); _cardLayout.SetFixedSize(EAxis.Y, 150); _cardLayout.spacing = -50; _cardLayout.childAlignment = EAlignment.TopCenter; _cardLayout.alignment = EAlignment.BottomCenter; return(_cardLayout); }
protected override SharpUIBase BuildMainPanel() { SharpUINonDrawingGraphic toReturn = new SharpUINonDrawingGraphic("UIGameOverView"); toReturn.SetFillSize(); SharpUIImage background = new SharpUIImage($"{toReturn.Name}_bg", null); background.Color = new Color(0f, 0f, 0f, 0.5f); background.SetFixedSize(Size); background.alignment = EAlignment.MiddleCenter; toReturn.AddChild(background); SharpUITextMeshPro gameOverLabel = new SharpUITextMeshPro("GameOverLabel", "Game Over"); gameOverLabel.SetFillSize(EAxis.X, 0.8f); gameOverLabel.SetFixedSize(EAxis.Y, 200); gameOverLabel.alignment = EAlignment.TopCenter; gameOverLabel.AutoSizeFont(); gameOverLabel.Font = AppManager.AssetManager.Get <TMPro.TMP_FontAsset>(AssetPaths.Fonts.GravityBook); gameOverLabel.Color = Color.black; gameOverLabel.TextAlignment = TMPro.TextAlignmentOptions.Center; gameOverLabel.Color = Color.white; background.AddChild(gameOverLabel); List <Player> players = _game.GetWinners(); StringBuilder sb = new StringBuilder(); if (players.Count > 0) { sb.Append("Winner: "); } foreach (Player player in players) { sb.Append(player.name + ", "); } SharpUITextMeshPro winnerLabel = new SharpUITextMeshPro("WinnerLabel", sb.ToString()); winnerLabel.SetFillSize(EAxis.X, 0.6f); winnerLabel.SetFixedSize(EAxis.Y, 100); winnerLabel.margin = new RectOffset(0, 0, 200, 0); winnerLabel.alignment = EAlignment.TopCenter; winnerLabel.AutoSizeFont(); winnerLabel.Font = AppManager.AssetManager.Get <TMPro.TMP_FontAsset>(AssetPaths.Fonts.GravityItalic); winnerLabel.Color = Color.black; winnerLabel.TextAlignment = TMPro.TextAlignmentOptions.Center; winnerLabel.Color = Color.white; background.AddChild(winnerLabel); SharpUIHorizontalLayout buttonLayout = new SharpUIHorizontalLayout($"{toReturn.Name}_button_layout"); buttonLayout.SetFillSize(EAxis.X); buttonLayout.SetFixedSize(EAxis.Y, (int)ChoiceButton.Size.y); buttonLayout.alignment = EAlignment.BottomCenter; buttonLayout.margin = new RectOffset(0, 0, 0, 20); buttonLayout.childAlignment = EAlignment.MiddleCenter; background.AddChild(buttonLayout); buttonLayout.AddChild(new ChoiceButton("ReturnToStartButton", "Return to Start", () => { _listener.OnReturnToStartClicked(); })); return(toReturn); }