Page 1 of 2
How to display an identical window to all players ?
Posted: 30 Sep 2011, 10:35
by Fadden
Hi,
I want to display an identical window to all players.
I know it's possible to do that :
Code: Select all
foreach ($this->storage->players as $login => $player)
{
$window = MyWindow::Create($login);
$window->show();
}
But this will be recalculate the window for all players, despite the window is not depending of the player... so a lot of unnecessary calculations will be done again.
How I can do, please ?
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 13:14
by oliverde8
You can do it quite easily with
Code: Select all
$window = MyWindow::Create($login, false);
$window->show();
I don't know exactly what to pass in argument to replace $login. I pass Window::RECIPIENT_ALL and it seems to work. Need to do more testing

Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 13:49
by The_Big_Boo
Indeed, you need to use Window::RECIPIENT_ALL

Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 14:09
by oliverde8
The_Big_Boo wrote:Indeed, you need to use Window::RECIPIENT_ALL

Thanks
Do I need to make a ->show for new comers to see the widget or is it done automatically?
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 17:31
by The_Big_Boo
Yes, you have to call show() for newcomers. You can even call show($login) with the login of the new player so it won't be sent again to every other players (if the window doesn't need to be refreshed for them).
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 17:48
by oliverde8
The_Big_Boo wrote:Yes, you have to call show() for newcomers. You can even call show($login) with the login of the new player so it won't be sent again to every other players (if the window doesn't need to be refreshed for them).
this don't work well. Exemple :
ManiaLive starts I do
Every one sees the Window, great until there.
Then player p2 connectes the game. I do
Great new player sees the window.
Now end Race I want to hide the window. I do
All windows but the one of p2 hides.
I suppose it is a Bug? I will recheck later today if I have time but I am sure this is what happened on a earlier test.
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 19:26
by The_Big_Boo
That's weird indeed... Anyway, I'm currently working on a new windowing system so it should be fixed when it'll be finished ^^
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 20:37
by oliverde8
may I ask

Will all windows we have coded need recoding?
(I am writing a note that I stick on my desk : If I am found dead in fron of my PC it is because The_Big_Boo from Nadeo pushed me to commit suicide.)We would need at least a good week to get over that at MLEPP. Supposing that text entry will also work.
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 21:14
by The_Big_Boo
Maybe there will be some changes in the interface for plugin coders but not a lot. Anyway the windowing system really needs to be improved (and I can assure you it takes much more time on my side ^^).
Re: How to display an identical window to all players ?
Posted: 09 Oct 2011, 21:21
by Fadden
The_Big_Boo wrote:Indeed, you need to use Window::RECIPIENT_ALL

Thanks, I found it a few days ago

I use it but I didn't noticed this bug.