Axel Nordh 5 жил өмнө
parent
commit
6133cf5de0

+ 1 - 2
Assets/Scripts/MainGame/ScrollViewScript.cs

@@ -187,7 +187,6 @@ public class ScrollViewScript : MonoBehaviour {
     }
 
     public void RemoveEverythingFromAnswerline() {
-        
         foreach (Transform child in contentPanel.transform) {
             Destroy(child.gameObject);
         }
@@ -207,7 +206,7 @@ public class ScrollViewScript : MonoBehaviour {
             }
         }
         gameManagerScript.UpdateQuestiosLost(lostQuestions, currentPlayer);
-        statsScript.SetQuestionsInAnswerLine(currentPlayer, contentPanel.GetComponents<AnswerLineQuestionCard>().Length);
+        statsScript.SetQuestionsInAnswerLine(currentPlayer, contentPanel.GetComponentsInChildren<AnswerLineQuestionCard>().Length);
     }
 
  

BIN
Assets/narKampenLocal.db


+ 8 - 6
dbFiles/OnlineGames.php

@@ -47,12 +47,14 @@
 		} else {
 			$sql = "SELECT count(*) as c FROM gamePlayers WHERE gameId = $gameId AND status NOT LIKE 'DECLINED'";
 			$result = $conn->query($sql);
-			while ($data = $result->fetch_assoc()) { // TODO Kommer ge fel om man inte har några spel kvar i listan.
-				if ($data['c'] == 1) { // Alla utom den som startade spelet har nekat, ta bort spelet från game
-					$sql = "DELETE FROM game WHERE id = $gameId";
-					$result = $conn->query($sql);
-					if (!$result) {
-						echo "UPDATE game status failed " . $conn->error;
+			if ($result !== false) {
+				while ($data = $result->fetch_assoc()) {
+					if ($data['c'] == 1) { // Alla utom den som startade spelet har nekat, ta bort spelet från game
+						$sql = "DELETE FROM game WHERE id = $gameId";
+						$result = $conn->query($sql);
+						if (!$result) {
+							echo "UPDATE game status failed " . $conn->error;
+						}
 					}
 				}
 			}