// Update the scrollable wheel with entries of the month private void UpdateDailyEntries() { // Get rid of all entries foreach (Transform child in dayContent.transform) { GameObject.Destroy(child.gameObject); } List <Entry> myEntries = curProject.getEntries(curYear, curMonth, curDay + 1); System.DateTime dt = new System.DateTime(curYear, curMonth, curDay + 1); if (myEntries.Count > 0) { for (int i = 0; i < myEntries.Count; i++) { GameObject newEntry = Instantiate(entryPrefab) as GameObject; EntryPrefab node = newEntry.GetComponent <EntryPrefab>(); node.dude.sprite = mons[myEntries[i].getMonID()]; node.log.text = myEntries[i].getLog(); node.date.text = dt.ToString("D"); node.dt = dt; newEntry.transform.SetParent(dayContent.transform); newEntry.transform.localScale = Vector3.one; } } entryAmt.text = "entries: " + myEntries.Count.ToString(); dayText.text = dt.ToString("D"); }
public void UpdateProjList() { // Get rid of all entries foreach (Transform child in projContent.transform) { GameObject.Destroy(child.gameObject); } if (SaveManager.myProjects.Count > 0) { noEntryTitle.enabled = false; for (int i = 0; i < SaveManager.myProjects.Count; i++) { GameObject newEntry = Instantiate(projEntryPrefab) as GameObject; EntryPrefab node = newEntry.GetComponent <EntryPrefab>(); node.dude.sprite = mons[SaveManager.myProjects[i].getMonID()]; node.date.text = SaveManager.myProjects[i].getName(); node.log.text += SaveManager.myProjects[i].getEntryAmt(); node.count = i; newEntry.transform.SetParent(projContent.transform); newEntry.transform.localScale = Vector3.one; } } else { noEntryTitle.enabled = true; } }
// Update the scrollable wheel with entries of the month private void UpdateMonthlyEntries() { // Get rid of all entries foreach (Transform child in monthlyContent.transform) { GameObject.Destroy(child.gameObject); } List <Entry> myEntries = GetMonthEntry(); if (myEntries.Count > 0) { noEntryMsg.enabled = false; for (int i = 0; i < myEntries.Count; i++) { int thisYear = myEntries[i].getYear(); int thisMonth = myEntries[i].getMonth(); int thisDay = myEntries[i].getDay(); System.DateTime dt = new System.DateTime(thisYear, thisMonth, thisDay); GameObject newEntry = Instantiate(entryPrefab) as GameObject; EntryPrefab node = newEntry.GetComponent <EntryPrefab>(); node.dude.sprite = mons[myEntries[i].getMonID()]; node.log.text = myEntries[i].getLog(); node.date.text = dt.ToString("D"); node.dt = dt; newEntry.transform.SetParent(monthlyContent.transform); newEntry.transform.localScale = Vector3.one; } } else { noEntryMsg.enabled = true; } }
public void ViewEntry() { Debug.Log("click"); var theClick = EventSystem.current.currentSelectedGameObject; if (theClick != null) { EntryPrefab e = theClick.GetComponent <EntryPrefab>(); if (e != null) { Debug.Log("click2"); curMenu = menu.Entry; DisplayMonthUI(false); DisplayDayUI(false); DisplayEntryUI(true); curEntry = e; entryDay.text = e.date.text; entryLog.text = e.log.text; dudeImage.GetComponent <SpriteRenderer>().sprite = e.dude.sprite; } else if (theClick.tag == "byDate") { Debug.Log("check"); // Check if the button was avaiable for a day System.DateTime dt = new System.DateTime(curYear, curMonth, 1); int firstDay = (int)dt.DayOfWeek; int clickedDay = -1; for (int i = firstDay; i < System.DateTime.DaysInMonth(curYear, curMonth) + firstDay; i++) { string target = "day (" + i.ToString() + ")"; if (theClick.name == target) { clickedDay = i - firstDay; curDay = i - firstDay; List <Entry> entriesOfDate = new List <Entry>(); List <Entry> entriesOfDay = curProject.getEntries(curYear, curMonth, i - firstDay + 1); for (int j = 0; j < entriesOfDay.Count; j++) { entriesOfDate.Add(entriesOfDay[j].copy()); } break; } } // Checkpoint if (clickedDay >= 0) { // CHANGE DISPLAY MENU TO DATE MODE DisplayMonthUI(false); DisplayDayUI(true); UpdateDailyEntries(); curMenu = menu.Day; } } } }
public void GetProj() { var theClick = EventSystem.current.currentSelectedGameObject; if (theClick != null) { EntryPrefab e = theClick.GetComponent <EntryPrefab>(); if (e != null) { SelProj(e); } } }
public void SelProj(EntryPrefab e) { curMenu = menu.Month; curProject = SaveManager.myProjects[e.count]; DisplayMonthUI(true); titleThings.SetActive(false); curYear = System.DateTime.Now.Year; curMonth = System.DateTime.Now.Month; UpdateMonth(); UpdateMonthlyEntries(); AskEntry(false); }