Beispiel #1
0
        private void ShowPossibleActions(Character character)
        {
            ClearButtons();

            if (character != null)
            {
                List<IAction> actions = character.GetPossibleActions();

                var i = 0;
                foreach (var action in actions)
                {
                    var labelSize = FontFactory.Font.MeasureString(action.GetLabel());
                    TextGameButton button = new TextGameButton(new Vector2(labelSize.X / 2 + 40, 40), new Vector2(Rect.X + Rect.Width / 2 - (labelSize.X / 2 + 40) / 2, 500 + 50 * i), action.GetLabel());
                    button.Show();
                    button.RegisterCallbackObject(action);
                    button.RegisterOnClick(OnActionClick);
                    buttons.Add(button);
                    i++;
                }
            }
        }