void Start () {
		m_ContextStack = new Stack<Context>();
		Enter(Context.Main);

		// multiplier
		m_HostButton = gameObject.AddComponent<HostButton>();
		m_JoinButton = gameObject.AddComponent<JoinButton>();
	}
    void Start()
    {
        m_ContextStack = new Stack <Context>();
        Enter(Context.Main);

        // multiplier
        m_HostButton = gameObject.AddComponent <HostButton>();
        m_JoinButton = gameObject.AddComponent <JoinButton>();
    }
Esempio n. 3
0
 public void JoinRoom(MatchInfoSnapshot _match)
 {
     if (!HostGame.creatingRoom && !JoiningGame)
     {
         JoiningGame = true;
         HostButton.SetActive(false);
         NicknameText.SetActive(false);
         RoomNameText.SetActive(false);
         RefreshButton.SetActive(false);
         Status.text = "Joining...";
         networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined);
         ClearRoomList();
     }
     else
     {
         Status.text = "Wait for the room to be created";
     }
 }
Esempio n. 4
0
 public void CreateRoom()
 {
     if (!JoinGame.JoiningGame && !creatingRoom)
     {
         if (roomName != "" && roomName != null && playerName != "" && playerName != null)
         {
             Status.text  = "Creating room...";
             creatingRoom = true;
             HostButton.SetActive(false);
             NicknameText.SetActive(false);
             RoomNameText.SetActive(false);
             RefreshButton.SetActive(false);
             joinGame.ClearRoomList();
             networkManager.matchMaker.CreateMatch(roomName, roomSize, true, "", "", "", 0, 0, networkManager.OnMatchCreate);
         }
         else
         {
             Debug.Log("erro");
         }
     }
 }
Esempio n. 5
0
    public override void _Ready()
    {
        GetTree().Connect("network_peer_connected", this, nameof(PlayerConnected));
        GetTree().Connect("network_peer_disconnected", this, nameof(PlayerDisconnected));
        GetTree().Connect("connected_to_server", this, nameof(ConnectedToServer));
        GetTree().Connect("connection_failed", this, nameof(ConnectionFailed));
        GetTree().Connect("server_disconnected", this, nameof(ServerDisconnected));

        HostButton = (Button)GetNode("MarginContainer/VBoxContainer/HostGameButton");
        HostButton.Connect("pressed", this, nameof(HostGame));

        JoinButton = (Button)GetNode("MarginContainer/VBoxContainer/JoinGameButton");
        JoinButton.Connect("pressed", this, nameof(JoinGame));

        LeaveButton = (Button)GetNode("MarginContainer/VBoxContainer/LeaveGameButton");
        LeaveButton.Connect("pressed", this, nameof(LeaveGame));
        LeaveButton.Disabled = true;

        AddressText = (TextEdit)GetNode("MarginContainer/VBoxContainer/Address");
        NameText    = (TextEdit)GetNode("MarginContainer/VBoxContainer/Name");
    }