public void StartUpClient() { Debug.Log(NetworkServer.active); room.amountOfPlayers++; dbRoom.UpdateRoom(room); NetworkManager.singleton.StartClient(); }
public void exitRoom() { buttonSound.Play(); DbRoom dbRoom = new DbRoom(); Room room = dbRoom.getRoomInfo(); if (isServer && players.Count > 1) { return; } DbPlayer db = new DbPlayer(); PlayerData Info = db.GetPlayerByUserName(localPlayer.playerPanel.userNameText.text); Info.Money += localPlayer.money - 1000; db.UpdatePlayer(Info); RemovePlayer(localPlayer); room.amountOfPlayers--; dbRoom.UpdateRoom(room); if (isServer) { dbRoom.deleteRoom(room); NetworkManager.singleton.StopHost(); RemovePlayer(localPlayer); //Destroy(LobbyScene.singleton.gameObject); NetworkManager.singleton.StopClient(); Destroy(localPlayer); NetworkManager.Shutdown(); //Debug.Log("after destroying the local player"); return; } if (!isServer && isClient) { RemovePlayer(localPlayer); NetworkManager.singleton.StopClient(); Destroy(localPlayer); return; } }//exit the room after saving the player new score in the data base to the lobby scene