|
|
@@ -9,8 +9,8 @@ using System.IO;
|
|
|
using System.Text;
|
|
|
|
|
|
public class OnlineDatabase : MonoBehaviour {
|
|
|
- private const string onlineQuestionsUrl = "narkampen.nordh.xyz/narKampen/dbFiles/Question.php";
|
|
|
- private const string serverUrl = "narkampen.nordh.xyz/narKampen/dbFiles/";
|
|
|
+ private const string onlineQuestionsUrl = "nordh.xyz/narKampen/dbFiles/Question.php";
|
|
|
+ private const string serverUrl = "nordh.xyz/narKampen/dbFiles/";
|
|
|
string gameMode;
|
|
|
int winAmount = -1;
|
|
|
|
|
|
@@ -312,25 +312,29 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
ogs = onlineGameObject.GetComponent<OnlineGameScript>();
|
|
|
gameId = currentGameId;
|
|
|
|
|
|
- if (game.currentPlayer.Equals(game.userId)) {
|
|
|
+ if (game.currentPlayer.Equals(userId.ToString())) {
|
|
|
playerToAct = game.username;
|
|
|
ogs.CurrentPlayer = game.username;
|
|
|
ogs.addPlayer(game.username);
|
|
|
ogs.SetGameStatus("YOUR_TURN");
|
|
|
+ } else if (game.currentPlayer.Equals(game.userId)) {
|
|
|
+ ogs.CurrentPlayer = game.username;
|
|
|
}
|
|
|
} else {
|
|
|
ogs.addPlayer(game.username);
|
|
|
- if (game.currentPlayer.Equals(game.userId)) {
|
|
|
+ if (game.currentPlayer.Equals(userId.ToString())) {
|
|
|
ogs.SetGameStatus("YOUR_TURN");
|
|
|
playerToAct = game.username;
|
|
|
ogs.CurrentPlayer = game.username;
|
|
|
ogs.addPlayer(game.username);
|
|
|
+ } else if (game.currentPlayer.Equals(game.userId)) {
|
|
|
+ ogs.CurrentPlayer = game.username;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ogs.SetGameStatus(game.status);
|
|
|
//ogs.CurrentPlayer = game.currentPlayer;
|
|
|
- List<KeyValuePair<string, string>> playerInfos = GetGameInfo(gameId);
|
|
|
+ List<KeyValuePair<string, string>> playerInfos = GetGameInfo(gameId); // TODO, This is not good, too many db calls!
|
|
|
if (game.status.Equals("PENDING")) {
|
|
|
string extraInfo = "";
|
|
|
foreach (KeyValuePair<string, string> s in playerInfos) {
|
|
|
@@ -700,7 +704,7 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
form.AddField("f", "FindRandomPlayers");
|
|
|
|
|
|
String response = CallOnlineDatabaseWithResponse("PlayerSearch.php", form);
|
|
|
-
|
|
|
+ response = "{\"usernamesList\" : " + response + " }";
|
|
|
UserNames uNames = new UserNames();
|
|
|
|
|
|
JsonUtility.FromJsonOverwrite(response, uNames);
|