multiple progress bars, text is overlapping though
This commit is contained in:
parent
9b7c5de385
commit
c6e0281a9b
1 changed files with 38 additions and 10 deletions
|
@ -9,24 +9,35 @@ using UnityEngine.UI;
|
|||
|
||||
public class GetGoals : MonoBehaviour {
|
||||
|
||||
public Text objectText;
|
||||
public Text goalText;
|
||||
|
||||
public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy/mm");
|
||||
public string goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy/mm");
|
||||
public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
public string goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
|
||||
public string prefKey;
|
||||
|
||||
void Start () {
|
||||
objectText = GetComponent<Text> ();
|
||||
goalText.text = prefKey;
|
||||
goalText.color = new Color(1f, 0.5f, 0.8f);
|
||||
|
||||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
Debug.Log(goalDayStr);
|
||||
Debug.Log("hoauaouou");
|
||||
|
||||
if(prefKey == "daily")
|
||||
savePersistantGoalDate("daily");
|
||||
}
|
||||
|
||||
|
||||
public float goalValue;
|
||||
|
||||
//Progress Bar...
|
||||
public float barDisplay; //current progress
|
||||
public Vector2 barPos = new Vector2(20,190);
|
||||
public Vector2 barSize = new Vector2(60,20);
|
||||
|
||||
//Texture the progress bar using these parameters
|
||||
public Texture2D emptyTex;
|
||||
public Texture2D fullTex;
|
||||
|
||||
|
@ -66,19 +77,36 @@ public class GetGoals : MonoBehaviour {
|
|||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
barDisplay = Time.time*0.05f; //put actual progress here (current/total)
|
||||
|
||||
//failed to complete goal
|
||||
if(currentDayStr != goalDayStr)
|
||||
{
|
||||
//check if goal is complete or not, the day is over
|
||||
Debug.Log(currentDayStr);
|
||||
Debug.Log(goalDayStr);
|
||||
|
||||
barDisplay = 1.0f;
|
||||
Debug.Log("DAY HAS PASSED!!");
|
||||
|
||||
//make it so user dismisses the goal instead!
|
||||
//Destroy(this);
|
||||
//destroy the goal and set a new one?
|
||||
|
||||
}
|
||||
if(checkNewDay("daily"))
|
||||
//goal complete
|
||||
if(barDisplay >= 1.0f)
|
||||
{
|
||||
Debug.Log("You failed your goal"); //not true if progress is actually complete!
|
||||
goalDayStr = currentDayStr;
|
||||
savePersistantGoalDate("daily");
|
||||
Debug.Log("Goal complete! +100pts!");
|
||||
|
||||
//destroy the goal and set a new one?
|
||||
}
|
||||
|
||||
//only applies if "daily" goal
|
||||
if(prefKey == "daily")
|
||||
{
|
||||
if(checkNewDay(prefKey))
|
||||
{
|
||||
Debug.Log("You failed your goal"); //not true if progress is actually complete!
|
||||
goalDayStr = currentDayStr;
|
||||
savePersistantGoalDate("daily");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue