M
M
maxemga2020-10-17 10:59:01
C++ / C#
maxemga, 2020-10-17 10:59:01

How to make the button Ready for the Lobby?

I need to make a ready button for the lobby
, that is, we create a room (I already have it, I use photon if anything) and players join there.
I want this lobby to have a ready button, and how to do it so that if all players press this button, then game starts?
And also how to implement the display of the number of players ready and in general how many of them are in the room?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DiSay, 2020-10-18
@maxemga

Do something like this honestly xs is it right
When you click on the button, make additions to the variable for example 1 (when the button is pressed, it’s not ready for the example of subtraction)
Displays, I think you know how to do it
And so on until the number of ready players is number of players in the room or max number of players in the room example:

public void Gotov(byte Go)
  {
    Go++;
  }
  public void NeGotov(byte NoGo)
  {
    NoGo--;
  }
  public void Play()
  {
    if(Go == MaxPlayerRoom)
    {
      //код запуска игры
    }
  }

This is an example (not ideal) I did not work with Photon, well, this is approximately a working example, logically it should work

V
Vladimir Korotenko, 2020-10-17
@firedragon

ReadyButton.Text = $”total: {total}”;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question