|
|
@@ -58,23 +58,42 @@ public class ScrollViewScript : MonoBehaviour, IDropHandler {
|
|
|
return gameMode;
|
|
|
}
|
|
|
|
|
|
- private void ShowRoundButtons(bool ShowNextPlayer) {
|
|
|
- RoundButtonsScript rbs = GameObject.Find("NewQuestionButtonPanel").GetComponent<RoundButtonsScript>();
|
|
|
+ private void Awake() {
|
|
|
+ CheckActiveUserLoggedIn();
|
|
|
+ }
|
|
|
|
|
|
- if (ShowNextPlayer) {
|
|
|
- rbs.ActivateNextPlayer();
|
|
|
- } else {
|
|
|
- rbs.DeactivateNextPlayer();
|
|
|
+ public void CheckActiveUserLoggedIn() {
|
|
|
+ if (!Database.Instance.GetSignedInUser().Value.Equals(currentPlayer)) {
|
|
|
+ GameObject.Find("NewQuestionButtonPanel").GetComponent<RoundButtonsScript>().HidePanel();
|
|
|
+ if (nq != null) {
|
|
|
+ CanvasGroup newQuestionCanvasGroup = nq.GetComponent<CanvasGroup>();
|
|
|
+ newQuestionCanvasGroup.interactable = false;
|
|
|
+ newQuestionCanvasGroup.blocksRaycasts = false;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- rbs.ShowPanel();
|
|
|
-
|
|
|
- if (nq == null) {
|
|
|
- nq = gameManagerScript.db.GetNewQuestion(GetQuestionIdsInAnswerLine(), currentPlayer, GetGameMode());
|
|
|
+ private void ShowRoundButtons(bool ShowNextPlayer) {
|
|
|
+ if (Database.Instance.GetSignedInUser().Value.Equals(currentPlayer)) {
|
|
|
+ RoundButtonsScript rbs = GameObject.Find("NewQuestionButtonPanel").GetComponent<RoundButtonsScript>();
|
|
|
+
|
|
|
+ if (ShowNextPlayer) {
|
|
|
+ rbs.ActivateNextPlayer();
|
|
|
+ } else {
|
|
|
+ rbs.DeactivateNextPlayer();
|
|
|
+ }
|
|
|
+
|
|
|
+ rbs.ShowPanel();
|
|
|
+
|
|
|
+ if (nq == null) {
|
|
|
+ nq = gameManagerScript.db.GetNewQuestion(GetQuestionIdsInAnswerLine(), currentPlayer, GetGameMode());
|
|
|
+ }
|
|
|
+ nq.GetComponent<CanvasGroup>().alpha = 0;
|
|
|
+ nq.GetComponent<CanvasGroup>().interactable = false;
|
|
|
+ nq.GetComponent<CanvasGroup>().blocksRaycasts = false;
|
|
|
+ } else {
|
|
|
+ CheckActiveUserLoggedIn();
|
|
|
}
|
|
|
- nq.GetComponent<CanvasGroup>().alpha = 0;
|
|
|
- nq.GetComponent<CanvasGroup>().interactable = false;
|
|
|
- nq.GetComponent<CanvasGroup>().blocksRaycasts = false;
|
|
|
}
|
|
|
|
|
|
public void HideRoundButtons() {
|
|
|
@@ -108,10 +127,10 @@ public class ScrollViewScript : MonoBehaviour, IDropHandler {
|
|
|
List<int> saveQuestions = new List<int>();
|
|
|
for (int i = 0; i < contentPanel.childCount; i++) {
|
|
|
QuestionCard q = contentPanel.GetChild(i).GetComponent<QuestionCard>();
|
|
|
- q.SetQuestionSafe();
|
|
|
- if (needsSave) {
|
|
|
- Int32.TryParse(q.questionString, out int qId);
|
|
|
+ if (needsSave && !q.IsQuestionSafe()) {
|
|
|
+ Int32.TryParse(q.idString, out int qId);
|
|
|
saveQuestions.Add(qId);
|
|
|
+ q.SetQuestionSafe();
|
|
|
}
|
|
|
}
|
|
|
if (saveQuestions.Count > 0) {
|