IEnumerator yearGoesBy(chapter4 root) { WaitForSeconds Longws = new WaitForSeconds(0.7f); yield return(Longws); int year = DateTime.Now.Year + 1; string[] months = new string[] { "January", "February", "march", "april", "may", "june", }; int i; for (int j = 0; j < months.Length; j++) { i = UnityEngine.Random.Range(4, 7 * 5); int row = i / 7; int column = (i % 7) - 3; button.rectTransform.anchoredPosition = new Vector2(column * 33.5f + 14f, 44.5f - 39 * row); text.text = months[j] + "\n<size=80%>" + year; yield return(Longws); } yield return(Longws); slideOut(root.canvas); root.scrollSnap.ScrollToSnapPosition(7, 1, null); }
public void three(chapter4 root) { //year goes by slideIn(root.canvas, () => { StartCoroutine(yearGoesBy(root)); }); }
public void two(chapter4 root) { // 2 months go by slideIn(root.canvas, () => { StartCoroutine(monthsGoBy(root)); }); }
public void one(chapter4 root) { text.text = "october\n<size=80%>" + DateTime.Now.Year; //days go by slideIn(root.canvas, () => { StartCoroutine(daysGoBy(root)); }); }
IEnumerator daysGoBy(chapter4 root) { float sec = 0.3f; for (int i = 4; i < 17; i++) { int row = i / 7; int column = (i % 7) - 3; button.rectTransform.anchoredPosition = new Vector2(column * 33.5f + 14f, 44.5f - 39 * row); yield return(new WaitForSeconds(sec)); sec *= 0.85f; } yield return(new WaitForSeconds(1)); slideOut(root.canvas); root.scrollSnap.ScrollToSnapPosition(1, 1, null); }
IEnumerator monthsGoBy(chapter4 root) { float sec = 0.3f; int year = DateTime.Now.Year; for (int i = 18; i < 7 * 5; i++) { int row = i / 7; int column = (i % 7) - 3; button.rectTransform.anchoredPosition = new Vector2(column * 33.5f + 14f, 44.5f - 39 * row); yield return(new WaitForSeconds(sec)); sec *= 0.92f; } WaitForSeconds ws = new WaitForSeconds(sec); yield return(ws); text.text = "november\n<size=80%>" + year; for (int i = 4; i < 7 * 5; i++) { int row = i / 7; int column = (i % 7) - 3; button.rectTransform.anchoredPosition = new Vector2(column * 33.5f + 14f, 44.5f - 39 * row); yield return(ws); } yield return(ws); text.text = "december\n<size=80%>" + year; for (int i = 4; i < 12; i++) { int row = i / 7; int column = (i % 7) - 3; button.rectTransform.anchoredPosition = new Vector2(column * 33.5f + 14f, 44.5f - 39 * row); yield return(ws); } yield return(new WaitForSeconds(0.5f)); slideOut(root.canvas); root.scrollSnap.ScrollToSnapPosition(4, 1, null); }