private void InitClassScreen() { ClearButtons(); foreach (var classes in actualHero.GetPossibleClasses()) { GameButton button = new ImageGameButton(new ScaledImage(new Vector2(20, 150), classes.GetImage(), 0.5f)); button.RegisterOnFocus(OnFocus); button.RegisterOnFocusLost(OnFocusLost); button.RegisterOnClick(OnClassChoose); button.RegisterCallbackObject(classes); AddButton(button); } }
public ChooseHeroDialog(int width, int height, List<Hero> heroes) : base(width, height, "Choose hero") { this.heroes = heroes; int i = 0; foreach (var character in this.heroes) { var image = new ScaledImage(new Vector2(50 + 50 * i, 50), character.GetImage(), 0.35f); image.AlterPositionX(image.GetWidth() * i); ImageGameButton button = new ImageGameButton(image); button.RegisterCallbackObject(character); AddRendable(i, button); i++; } }