|
|
@ -9,9 +9,6 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
public GameObject prefab, panel;
|
|
|
|
public GameObject prefab, panel;
|
|
|
|
public GameObject[] positionArray;
|
|
|
|
public GameObject[] positionArray;
|
|
|
|
public Transform parentTf;
|
|
|
|
public Transform parentTf;
|
|
|
|
//public Text[] values;
|
|
|
|
|
|
|
|
// public int[] minValues;
|
|
|
|
|
|
|
|
// public int[] maxValues;
|
|
|
|
|
|
|
|
public List<LevelGroup> levelGroups;
|
|
|
|
public List<LevelGroup> levelGroups;
|
|
|
|
public int minIndex = 0;
|
|
|
|
public int minIndex = 0;
|
|
|
|
public int maxIndex = 8;
|
|
|
|
public int maxIndex = 8;
|
|
|
@ -25,10 +22,8 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
private List<Slider> sliders = new List<Slider>();
|
|
|
|
private List<Slider> sliders = new List<Slider>();
|
|
|
|
public GamePlayManager gameplay;
|
|
|
|
public GamePlayManager gameplay;
|
|
|
|
public Slider sliderprefabalue, hintcheckvalue;
|
|
|
|
public Slider sliderprefabalue, hintcheckvalue;
|
|
|
|
public string[] ModeNames;
|
|
|
|
|
|
|
|
public int value;
|
|
|
|
private LevelGroupButton levelGroupButton;
|
|
|
|
// public GameObject level;
|
|
|
|
|
|
|
|
public LevelGroupButton levelGroupButton;
|
|
|
|
|
|
|
|
public void Awake()
|
|
|
|
public void Awake()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
levelGroupButton=GetComponent<LevelGroupButton>();
|
|
|
|
levelGroupButton=GetComponent<LevelGroupButton>();
|
|
|
@ -45,10 +40,10 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InstantiateSSlider(positionArray.Length, new Vector3(0, -100, 0));
|
|
|
|
InstantiateExtraSlider(positionArray.Length, new Vector3(0, -100, 0));
|
|
|
|
InstantiateSSlider(positionArray.Length + 1, new Vector3(0, -200, 0));
|
|
|
|
InstantiateExtraSlider(positionArray.Length + 1, new Vector3(0, -200, 0));
|
|
|
|
InstantiateSSlider(positionArray.Length + 2, new Vector3(0, -300, 0));
|
|
|
|
InstantiateExtraSlider(positionArray.Length + 2, new Vector3(0, -300, 0));
|
|
|
|
InstantiateSSlider(positionArray.Length + 3, new Vector3(0, -400, 0));
|
|
|
|
InstantiateExtraSlider(positionArray.Length + 3, new Vector3(0, -400, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add listener to the button
|
|
|
|
// Add listener to the button
|
|
|
@ -97,7 +92,7 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void InstantiateSSlider(int index, Vector3 position)
|
|
|
|
public void InstantiateExtraSlider(int index, Vector3 position)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GameObject sliderObject = Instantiate(prefab, position, Quaternion.identity, parentTf);
|
|
|
|
GameObject sliderObject = Instantiate(prefab, position, Quaternion.identity, parentTf);
|
|
|
|
sliderObject.GetComponent<ScoreButton>().myIndex = index + 1;
|
|
|
|
sliderObject.GetComponent<ScoreButton>().myIndex = index + 1;
|
|
|
@ -110,7 +105,7 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sliderObject.name = "Slider - Extra " + (index - manger.AchievementList.Count + 1);
|
|
|
|
sliderObject.name = "" + (index - manger.AchievementList.Count + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set the Mode text for extra sliders
|
|
|
|
// Set the Mode text for extra sliders
|
|
|
@ -121,13 +116,14 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
Text modeText = child.GetComponent<Text>();
|
|
|
|
Text modeText = child.GetComponent<Text>();
|
|
|
|
if (modeText != null)
|
|
|
|
if (modeText != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (index < ModeNames.Length)
|
|
|
|
// Set mode text based on the achievement name if within the achievement list range
|
|
|
|
|
|
|
|
if (index < manger.AchievementList.Count)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
modeText.text = ModeNames[index];
|
|
|
|
modeText.text = manger.AchievementList[index].DisplayName.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
modeText.text = "Extra Mode " + (index - ModeNames.Length + 1);
|
|
|
|
modeText.text = "" + (index - manger.AchievementList.Count + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -140,13 +136,14 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
"0 / 10"; // Fallback for extra sliders
|
|
|
|
"0 / 10"; // Fallback for extra sliders
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Slider slider = sliderObject.GetComponent<Slider>();
|
|
|
|
Slider slider = sliderObject.GetComponent<Slider>();
|
|
|
|
if (slider != null)
|
|
|
|
if (slider != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
slider.minValue = 0;
|
|
|
|
slider.minValue = 0;
|
|
|
|
slider.maxValue = (index < manger.AchievementList.Count) ? manger.AchievementList[index].ProgressGoal : 10;
|
|
|
|
slider.maxValue = (index < manger.AchievementList.Count) ? manger.AchievementList[index].ProgressGoal : 10;
|
|
|
|
// slider.value = (index < manger.AchievementList.Count) ? manger.AchievementList[index].ProgressCurrent : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sliders.Add(slider); // Store the slider in the list
|
|
|
|
sliders.Add(slider); // Store the slider in the list
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -160,7 +157,7 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
sliderAtIndex7.value += 1;
|
|
|
|
sliderAtIndex7.value += 1;
|
|
|
|
sliderAtIndex7.maxValue = 10;
|
|
|
|
sliderAtIndex7.maxValue = 10;
|
|
|
|
sliderAtIndex7.minValue = 0;
|
|
|
|
sliderAtIndex7.minValue = 0;
|
|
|
|
// Ensure the name of the slider at index 7 matches the AchievementList
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -177,33 +174,9 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void Update()
|
|
|
|
public void Update()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
SliderValueAtIndex9();
|
|
|
|
SliderValueAtIndex9();
|
|
|
|
SliderValueAtIndex10();
|
|
|
|
SliderValueAtIndex10();
|
|
|
|
for (int i = 0; i < sliders.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (levelGroups[i].CompletedLevel == levelGroups[i].TotalLevel)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sliders[i].maxValue = levelGroups[i].TotalLevel;
|
|
|
|
|
|
|
|
// Increment the TotalLevel by 5 immediately
|
|
|
|
|
|
|
|
levelGroups[i].TotalLevel += 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
score.completetargets += 1;
|
|
|
|
|
|
|
|
score.points += 50 *score.myIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// score. targetText.text = "" + completetargets.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (levelGroupButton != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
levelGroupButton.UpdateUI();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void SliderValueAtIndex9()
|
|
|
|
public void SliderValueAtIndex9()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -249,5 +222,32 @@ public class instantiateprefab : MonoBehaviour
|
|
|
|
panel.SetActive(false);
|
|
|
|
panel.SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeTotalvalue()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < sliders.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (levelGroups[i].CompletedLevel == levelGroups[i].TotalLevel)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sliders[i].maxValue = levelGroups[i].TotalLevel;
|
|
|
|
|
|
|
|
// Increment the TotalLevel by 5 immediately
|
|
|
|
|
|
|
|
levelGroups[i].TotalLevel += 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
score.completetargets += 1;
|
|
|
|
|
|
|
|
score.points += 50 * score.myIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// score. targetText.text = "" + completetargets.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (levelGroupButton != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
levelGroupButton.UpdateUI();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|