Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#383] ListDialog custom value #395

Closed
wants to merge 1 commit into from

Conversation

LDami
Copy link
Contributor

@LDami LDami commented Mar 12, 2022

The ListDialog can be used like this:

ListDialog<BasePlayer> listDialog = new ListDialog<BasePlayer>("Players", "Select", "Close");
listDialog.AddItems(BasePlayer.All);
listDialog.Response += (object sender, SampSharp.GameMode.Events.DialogResponseEventArgs<BasePlayer> e) =>
{
    player.SendClientMessage($"Dialog closed, selected player is \"{e.ListItem.Name}\"");
};
listDialog.Show(player);

ikkentim pushed a commit that referenced this pull request Mar 25, 2022
@ikkentim
Copy link
Owner

I've merged and refactored this in 1d74c22 .

  • It's generally not a good idea to rely on reflection when there other ways to to the same thing without reflection (getting the name of colors)
  • Because the implementation of ListDialog conficts with the goals of ListDialog<T>, I made it inherit directly from Dialog.
  • I've removed changes which change the existing behavior/are opinionated changes (ToString implementations of BasePlayer/BaseVehicle)
  • Added a ShowAsync implementation to ListDialog<T>
  • Some minor other changes

@ikkentim ikkentim closed this Mar 25, 2022
@LDami LDami deleted the listbox-custom-value branch March 25, 2022 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants