From 5cf0257e181451aa6c819ed13800965adf6d62a7 Mon Sep 17 00:00:00 2001 From: asleal2 Date: Wed, 25 Apr 2018 13:47:56 -0500 Subject: [PATCH] Added progress bars, working on integrating the actual fitbit data and goal system --- MoCha/Assets/Prefabs/ProgressBar.prefab | Bin 0 -> 5292 bytes MoCha/Assets/Prefabs/ProgressBar.prefab.meta | 10 +++ MoCha/Assets/Scripts/GetGoals.cs | 84 ++++++++++++++++++ .../{Goals.cs.meta => GetGoals.cs.meta} | 4 +- MoCha/Assets/Scripts/Goals.cs | 16 ---- MoCha/ProjectSettings/ProjectVersion.txt | 2 +- 6 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 MoCha/Assets/Prefabs/ProgressBar.prefab create mode 100644 MoCha/Assets/Prefabs/ProgressBar.prefab.meta create mode 100644 MoCha/Assets/Scripts/GetGoals.cs rename MoCha/Assets/Scripts/{Goals.cs.meta => GetGoals.cs.meta} (77%) delete mode 100644 MoCha/Assets/Scripts/Goals.cs diff --git a/MoCha/Assets/Prefabs/ProgressBar.prefab b/MoCha/Assets/Prefabs/ProgressBar.prefab new file mode 100644 index 0000000000000000000000000000000000000000..f735d608f81871d1152eba96ade16bbe7630da10 GIT binary patch literal 5292 zcmeHLU2GIp6h5>4x?SAvmf2}#Nep8G z#;C*>1u-!x4-%0kMkC=T#y~=1cmTr#CK5$r^g-iaAdy6a_51GKyPetH7z|G)4jlHL zZ|?o>nRD;??hGOmKNFcWEF!mwOuU3&X{>KpT-Q`r-_sy}jf{*~<-mR@!#^VDE7fshM`9*`EXS0xSZ%7!iN5h>sy7aM2R6@aI68_#au~lg7#$TOzl^*q`Gq zpZ6nj7Cf`y-vr~VdQ6#I1Y;9?@@Os}_sXOW{0{*e1FL{xD#ddi_)7TXuO#mCUYXSZ z9vbl~;wOlgEBW@P@K0Aj}os6#d#}nWmWPRVq~23C**O>zXLw`vBo9&ClZeq z^K*Sl@lVR*IuEp)zPE2OLRv zZgIN2^-hli{w@c+>z%&zpwr!&?(0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ezgKW>M{vfGJo>rITOl-?@E0z3pVfEu)BZL1eNrD_z~FA--loO>Cj$l3OalYzYNB{ zv`g6!@UL!5^tXMlOr5#r*LNYIpKU69Xzw|q=>(K)WSUr zy;9FvYChACzb5B}T!lWraeF#;*Ilt`;cGmP!h F*WZ-SCJX=o literal 0 HcmV?d00001 diff --git a/MoCha/Assets/Prefabs/ProgressBar.prefab.meta b/MoCha/Assets/Prefabs/ProgressBar.prefab.meta new file mode 100644 index 0000000..0ce5346 --- /dev/null +++ b/MoCha/Assets/Prefabs/ProgressBar.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 76a3a676c97c14505abe10fa7fa30134 +timeCreated: 1524600874 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/MoCha/Assets/Scripts/GetGoals.cs b/MoCha/Assets/Scripts/GetGoals.cs new file mode 100644 index 0000000..0e38cfd --- /dev/null +++ b/MoCha/Assets/Scripts/GetGoals.cs @@ -0,0 +1,84 @@ +using System; +using System.Globalization; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +//Pretty much a copy of GetData... + +public class GetGoals : MonoBehaviour { + + public Text objectText; + + public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy/mm"); + public string goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy/mm"); + + public string prefKey; + + void Start () { + objectText = GetComponent (); + + currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); + goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); + } + + //Progress Bar... + public float barDisplay; //current progress + public Vector2 barPos = new Vector2(20,190); + public Vector2 barSize = new Vector2(60,20); + public Texture2D emptyTex; + public Texture2D fullTex; + + //on a button press? begin a goal? + void startGoal() + { + } + + void savePersistantGoalDate(string key) + { + PlayerPrefs.SetString(key, goalDayStr); + } + + bool checkNewDay(string key) + { + string checkDay = PlayerPrefs.GetString(key); + if(checkDay == currentDayStr) + return false; + return true; + } + + void OnGUI() { + //draw the background: + GUI.BeginGroup(new Rect(barPos.x, barPos.y, barSize.x, barSize.y)); + GUI.Box(new Rect(0,0, barSize.x, barSize.y), emptyTex); + + //draw the filled-in part: + GUI.BeginGroup(new Rect(0,0, barSize.x * barDisplay, barSize.y)); + GUI.Box(new Rect(0,0, barSize.x, barSize.y), fullTex); + GUI.EndGroup(); + GUI.EndGroup(); + } + + void Update() { + //needs current points counting toward this goal (daily?) + //needs the total required points for this goal + currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); + barDisplay = Time.time*0.05f; //put actual progress here (current/total) + + if(currentDayStr != goalDayStr) + { + //check if goal is complete or not, the day is over + + barDisplay = 1.0f; + Debug.Log("DAY HAS PASSED!!"); + + } + if(checkNewDay("daily")) + { + Debug.Log("You failed your goal"); //not true if progress is actually complete! + goalDayStr = currentDayStr; + savePersistantGoalDate("daily"); + } + } +} diff --git a/MoCha/Assets/Scripts/Goals.cs.meta b/MoCha/Assets/Scripts/GetGoals.cs.meta similarity index 77% rename from MoCha/Assets/Scripts/Goals.cs.meta rename to MoCha/Assets/Scripts/GetGoals.cs.meta index dbac0c0..d0d081d 100644 --- a/MoCha/Assets/Scripts/Goals.cs.meta +++ b/MoCha/Assets/Scripts/GetGoals.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 5f138b644c262457385474b2256308a7 -timeCreated: 1524165858 +guid: 040f99a891f1b4fed92f5a44e33fc47f +timeCreated: 1524166714 licenseType: Free MonoImporter: externalObjects: {} diff --git a/MoCha/Assets/Scripts/Goals.cs b/MoCha/Assets/Scripts/Goals.cs deleted file mode 100644 index 7273f2d..0000000 --- a/MoCha/Assets/Scripts/Goals.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Goals : MonoBehaviour { - - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } -} diff --git a/MoCha/ProjectSettings/ProjectVersion.txt b/MoCha/ProjectSettings/ProjectVersion.txt index 27997c5..ac7d214 100644 --- a/MoCha/ProjectSettings/ProjectVersion.txt +++ b/MoCha/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.3.1f1 +m_EditorVersion: 2017.4.0f1