Преглед на файлове

Liten uppdatering av answerline info panel

Axel Bärbar преди 5 години
родител
ревизия
a7cf16599c
променени са 4 файла, в които са добавени 31 реда и са изтрити 10 реда
  1. 24 4
      Assets/AnswerLineInfoScript.cs
  2. 1 1
      Assets/Prefab/NEWAnswerlineQuestion.prefab
  3. 6 5
      Assets/Scenes/narKampen.unity
  4. BIN
      Assets/narKampenLocal.db

+ 24 - 4
Assets/AnswerLineInfoScript.cs

@@ -12,6 +12,8 @@ public class AnswerLineInfoScript : MonoBehaviour
     [SerializeField] Text lockedQuestionsText;
     [SerializeField] Text unlockedQuestionsText;
     [SerializeField] GameObject scrollView;
+
+    [SerializeField] GameObject gameManager;
     private void Start() {
         nextPlayerButton.onClick.AddListener(ShowPrevPlayerAnswerLine);
         prevPlayerButton.onClick.AddListener(ShoeNextPlayerAnswerLine);
@@ -22,12 +24,30 @@ public class AnswerLineInfoScript : MonoBehaviour
         UpdateLockedQuestionsText();
         UpdateUnlockedQuestionsText();        
     }
+
+    public void UpdateButtonsText() {
+        List<KeyValuePair<string, int>> players = gameManager.GetComponent<GameManagerScript>().GetPlayers();
+
+        if (players.Count <= 1) {
+            nextPlayerButton.gameObject.SetActive(false);
+            prevPlayerButton.gameObject.SetActive(false);
+        } else {
+            nextPlayerButton.gameObject.SetActive(true);
+            prevPlayerButton.gameObject.SetActive(true);
+        }
+    }
+
     private void UpdateUnlockedQuestionsText() {
         int unlockedQuestionCount = scrollView.GetComponent<ScrollViewScript>().GetUnlockedQuestionCount();
-        unlockedQuestionsText.text = String.Format(
-            LocalizationManager.Instance.GetText(
-                unlockedQuestionsText.GetComponent<TextLocalization>().key), 
-            unlockedQuestionCount);
+        if (unlockedQuestionCount <= 0) {
+            unlockedQuestionsText.gameObject.SetActive(false);
+        } else {
+            unlockedQuestionsText.gameObject.SetActive(true);
+            unlockedQuestionsText.text = String.Format(
+                LocalizationManager.Instance.GetText(
+                    unlockedQuestionsText.GetComponent<TextLocalization>().key), 
+                unlockedQuestionCount);
+        }
     }
 
     private void UpdateLockedQuestionsText() {

+ 1 - 1
Assets/Prefab/NEWAnswerlineQuestion.prefab

@@ -1060,7 +1060,7 @@ MonoBehaviour:
     rgba: 4061797012
   safeColor:
     serializedVersion: 2
-    rgba: 3458698286
+    rgba: 3458763816
   frosting: {fileID: 7008121538814858193}
   frontCategoryPanel: {fileID: 2809158028979498973}
   frontCategoryText: {fileID: 605763738357229519}

+ 6 - 5
Assets/Scenes/narKampen.unity

@@ -662,6 +662,7 @@ MonoBehaviour:
   lockedQuestionsText: {fileID: 1835093814}
   unlockedQuestionsText: {fileID: 1312570246}
   scrollView: {fileID: 1776196329}
+  gameManager: {fileID: 225506176}
 --- !u!114 &210243976
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1038,7 +1039,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: -0.000061035156, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 200, y: 30}
   m_Pivot: {x: 0, y: 0}
 --- !u!114 &343030763
@@ -3398,7 +3399,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 1, y: 0}
   m_AnchorMax: {x: 1, y: 0}
-  m_AnchoredPosition: {x: 0.000061035156, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 200, y: 30}
   m_Pivot: {x: 1, y: 0}
 --- !u!114 &1572950264
@@ -3439,7 +3440,7 @@ MonoBehaviour:
     m_PressedTrigger: Pressed
     m_SelectedTrigger: Selected
     m_DisabledTrigger: Disabled
-  m_Interactable: 0
+  m_Interactable: 1
   m_TargetGraphic: {fileID: 1572950266}
   m_OnClick:
     m_PersistentCalls:
@@ -3897,7 +3898,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0.5}
   m_AnchorMax: {x: 0, y: 0.5}
-  m_AnchoredPosition: {x: -0.000061035156, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 740, y: 30}
   m_Pivot: {x: 0, y: 0.5}
 --- !u!114 &1835093814
@@ -3913,7 +3914,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   m_Material: {fileID: 0}
-  m_Color: {r: 0.20390601, g: 0.70980394, b: 0.18614274, a: 1}
+  m_Color: {r: 0.15686275, g: 0.54901963, b: 0.15686275, a: 1}
   m_RaycastTarget: 1
   m_Maskable: 1
   m_OnCullStateChanged:

BIN
Assets/narKampenLocal.db