fixed oob error
This commit is contained in:
parent
83fbdcd8ed
commit
2b48b84ca9
1 changed files with 13 additions and 14 deletions
|
@ -89,18 +89,19 @@ namespace PedometerU.Tests
|
|||
// Create a new pedometer
|
||||
pedometer = new Pedometer(OnStep);
|
||||
// Reset UI
|
||||
stepText.text = savedSteps.ToString () + "/" + stepsGoal.ToString();
|
||||
if(PlayerPrefs.HasKey("totalPoints"))
|
||||
{
|
||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerPrefs.SetInt("totalPoints", 0);
|
||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
||||
}
|
||||
stepText.text = savedSteps.ToString () + "/" + stepsGoal.ToString();
|
||||
|
||||
if(prefKey == "daily")
|
||||
if(PlayerPrefs.HasKey("totalPoints"))
|
||||
{
|
||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerPrefs.SetInt("totalPoints", 0);
|
||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
||||
}
|
||||
|
||||
{
|
||||
if(PlayerPrefs.HasKey("goalDate"))
|
||||
{
|
||||
|
@ -112,6 +113,7 @@ namespace PedometerU.Tests
|
|||
System.DateTime.Now.AddDays(1).ToString("MM/dd/yyyy"));
|
||||
goalDayStr = PlayerPrefs.GetString("goalDate");
|
||||
}
|
||||
goalText.color = new Color(0f, 0f, 0f);
|
||||
}
|
||||
userSteps = savedSteps;
|
||||
userPoints = savedPoints;
|
||||
|
@ -119,9 +121,6 @@ namespace PedometerU.Tests
|
|||
//OnStep(savedSteps, 0); //necessary?
|
||||
Debug.Log(savedSteps);
|
||||
|
||||
|
||||
//goalText.text = prefKey;
|
||||
goalText.color = new Color(0f, 0f, 0f);
|
||||
Debug.Log(pbbg.rectTransform.anchoredPosition.x.ToString() + " " + pbbg.rectTransform.anchoredPosition.y.ToString());
|
||||
|
||||
//barPos = new Vector2(pbbg.transform.position.x, 1895 - pbbg.transform.position.y);
|
||||
|
@ -205,7 +204,7 @@ namespace PedometerU.Tests
|
|||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
}
|
||||
|
||||
userSteps = (int)(Time.time*10.0f);
|
||||
//userSteps = (int)(Time.time);
|
||||
//barDisplay = Time.time*0.05f;
|
||||
barDisplay = (float)userSteps/(float)stepsGoal;
|
||||
|
||||
|
|
Reference in a new issue