From c6e0281a9ba7462cd0d919d3217779b4ca67bf46 Mon Sep 17 00:00:00 2001 From: asleal2 Date: Wed, 25 Apr 2018 19:59:40 -0500 Subject: [PATCH] multiple progress bars, text is overlapping though --- MoCha/Assets/Scripts/GetGoals.cs | 48 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/MoCha/Assets/Scripts/GetGoals.cs b/MoCha/Assets/Scripts/GetGoals.cs index 0e38cfd..bd49f7b 100644 --- a/MoCha/Assets/Scripts/GetGoals.cs +++ b/MoCha/Assets/Scripts/GetGoals.cs @@ -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 (); + 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"); + } } } }