// --------------------------------------------------------------------------------------------
        protected override SharpUIBase BuildMainPanel()
        {
            SharpUINonDrawingGraphic toReturn = new SharpUINonDrawingGraphic("UIUnitOptionsView");

            toReturn.SetFillSize();

            toReturn.SubscribeToEvent(EEventType.Drag, (object sender, EventSystemEventArgs e) =>
            {
                if (_following == null)
                {
                    return;
                }

                PointerEventData pointerEventData = e.eventData as PointerEventData;

                if (_game.board.RaycastToPlane(pointerEventData.position, out Vector3 dragWorldPos))
                {
                    BoardTile draggingTile = _game.board.GetBoardTileAtPosition(dragWorldPos);
                    if (draggingTile != null && _targetableTiles.Contains(draggingTile))
                    {
                        _currentFacing     = Unit.VectorToFacing(draggingTile.Transform.position - _following.BoardTile.Transform.position);
                        _selectedBoardTile = draggingTile;
                        _following.BoardTile.AddChild(_facingArrow);

                        Quaternion facingRot       = Unit.FacingToRotation(_currentFacing);
                        _facingArrow.LocalRotation = Quaternion.Euler(90f, facingRot.eulerAngles.y - 90f, 0f);
                        _facingArrow.LocalPosition = Vector3.up + (Quaternion.Euler(0f, facingRot.eulerAngles.y - 90f, 0f) * (Vector3.right * 2f));
                    }
                    else
                    {
                        if (_facingArrow.IsBuilt)
                        {
                            _facingArrow.Destroy();
                        }

                        _selectedBoardTile = null;
                        _currentFacing     = _following.Facing;
                    }
                }
            });
            toReturn.SubscribeToEvent(EEventType.Drop, (object sender, EventSystemEventArgs e) =>
            {
                if (_facingArrow.IsBuilt)
                {
                    if (_selectedBoardTile != null)
                    {
                        _listener.OnUseSkillConfirmed(_following, _currentFacing, _selectedBoardTile.Coord);
                    }

                    _facingArrow.Destroy();
                }
                else
                {
                    Hide();
                }
            });

            return(toReturn);
        }
        protected override SharpUIBase BuildMainPanel()
        {
            // use non drawing graphic to block input
            SharpUINonDrawingGraphic toReturn = new SharpUINonDrawingGraphic("UIConfirmationDialog");

            toReturn.SetFillSize();

            toReturn.SubscribeToEvent(EEventType.PointerClick, (object sender, EventSystemEventArgs e) =>
            {
                OnCancelClicked?.Invoke();
            });

            _background = new SharpUIImage($"{toReturn.Name}_bg", null);
            _background.SetFixedSize(Size);
            _background.alignment = EAlignment.MiddleCenter;
            _background.Color     = new Color(0f, 0f, 0f, 0.5f);
            toReturn.AddChild(_background);

            SharpUIHorizontalLayout buttonLayout = new SharpUIHorizontalLayout($"{toReturn.Name}_button_layout");

            buttonLayout.SetFitSize();
            buttonLayout.spacing   = 40;
            buttonLayout.alignment = EAlignment.BottomCenter;
            buttonLayout.margin    = new RectOffset(0, 0, 0, 20);
            _background.AddChild(buttonLayout);

            ChoiceButton okButton = new ChoiceButton(() => { OnOKClicked?.Invoke(); }, $"{toReturn.Name}_ok_button", "OK");

            buttonLayout.AddChild(okButton);

            ChoiceButton cancelButton = new ChoiceButton(() => { OnCancelClicked?.Invoke(); }, $"{toReturn.Name}_cancel_button", "Cancel");

            buttonLayout.AddChild(cancelButton);

            return(toReturn);
        }
        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);
        }