These are chat archives for ikkentim/SampSharp

22nd
Jun 2015
Florian van Dillen
@fvandillen
Jun 22 2015 09:49
Morning! Got a little piece of doubt on how to do the following.
I have a class with multiple levels of dialogs (list dialogs) that are used to manage the group system on my server. When choosing the option to manage the ranks, it will display a list with group ranks that exists, with the top option being "Add rank". All works fine displaying that. When adding the rank, the same dialog should be displayed, but with the new rank visible as well. Simply modiying my listitems list/array doesn't work, since the dialog is defined by doing new Dialog().
On the other hand, creating a completely new dialog isn't my preference either, since that would mean I cannot use the existing response.
Florian van Dillen
@fvandillen
Jun 22 2015 09:59
The else-statement starting at line 46 is where it goes quirky.
Tim Potze
@ikkentim
Jun 22 2015 15:19
Hmm, interesting... I think Dialog needs setters since it reuses these value at every Show call this can be easily done.
Florian van Dillen
@fvandillen
Jun 22 2015 15:20
So how would I "replace" the items and simply show the "upstream" dialog?
Tim Potze
@ikkentim
Jun 22 2015 15:21
With how the dialog class currently works, you simply can't do it, let me change the Dialog class then you can either use the master version of the framework or or copy the updated class to your own dialog implementation...
Florian van Dillen
@fvandillen
Jun 22 2015 15:21
Sweet :)
I figured because you simply do new dialog and that has the listitems "hard"coded
Thanks for your trouble.
Tim Potze
@ikkentim
Jun 22 2015 15:27
On second thoughts, I'm going to overhaul the whole Dialog class. I'm going to add several subclasses for the different types (List, Columned, etc. etc.) and give it helper methods (AddRow, etc.)
Florian van Dillen
@fvandillen
Jun 22 2015 15:28
Sounds good. The whole list, convert to array, adding newlines. It felt kinda sluggish.
Tim Potze
@ikkentim
Jun 22 2015 16:14
Alright, I've created the classes InputDialog, ListDialog, MessageDialog and TablistDialog. None have been documented and none have been tested, I'm certain InputDialog, ListDialog and MessageDialog work but TablistDialog requires some testing, but I currently do not have time to do this.
Florian van Dillen
@fvandillen
Jun 22 2015 18:25
No worries, input list and message are the only ones i'm using anyway
Will checkout the master in a sec and test!
So instead of new Dialog with the dialog contents, I now simply create a new ListDialog and call AddItem and Show methods?
That would mean I can modify/remove/add listitems, show the dialog again with updated contents?
Florian van Dillen
@fvandillen
Jun 22 2015 19:03
Running into some trouble after the update. While my own script was easily updated, the streamer functions cause trouble because they expect a Vector class present in SampSharp.GameMode.World, which it isn't any longer. I've casted the Vectors to Vector3 for now.
Florian van Dillen
@fvandillen
Jun 22 2015 19:16
The Vector error occurs too when I try to compile the streamer manually
Florian van Dillen
@fvandillen
Jun 22 2015 19:35
Ah well, rewrote the streamer so it uses Vector2 and Vector3, stubborn as fuck :smile:
And it worked on first attempt, I can be proud of myself
Florian van Dillen
@fvandillen
Jun 22 2015 19:42
And please give me some feedback on how I handled the Pull Request! ikkentim/SampSharp-streamer#11
Florian van Dillen
@fvandillen
Jun 22 2015 20:02
The ListDialog had the issue of having no message argument which caused a ArgumentNullException("button1")
The reason being button1 being the third argument because there was no message argument passed on by ListDialog.
Created a temp fix by adding string message to the constructor of ListDialog
Tim Potze
@ikkentim
Jun 22 2015 22:42
Thanks for the PR for the streamer extension, saves me some work :)
Ah yea i see the list dialog calls the constructor with button2=null
Fixed it.
:sparkles: