Skip to content

[#383] ListDialog custom value - #395

Closed
LDami wants to merge 1 commit into
ikkentim:masterfrom
LDami:listbox-custom-value
Closed

LDami wants to merge 1 commit into
ikkentim:masterfrom
LDami:listbox-custom-value

Conversation

@LDami

@LDami LDami commented Mar 12, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
LDami added a commit to LDami/SampSharp that referenced this pull request Sep 11, 2025
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