public void Generate() { gameObject.SetActive(true); int diff = DayManager.instance.excitement - lastExcitement; graph.sprite = diff > 0 ? upwardGraph : diff < 0 ? downwardGraph : neutralGraph; lastExcitement = DayManager.instance.excitement; views.text = Mathf.RoundToInt( Random.value * Mathf.Pow(10, 1 + 2 * Mathf.Log(Mathf.Max(1, DayManager.instance.excitement)))).ToString(); advice.text = DayManager.note; foreach (Transform transform in comments) { Destroy(transform.gameObject); } foreach (CommentChain commentChain in CommentChainManager.comments.OrderBy(c => c.adviceRating).Take(3)) { CommentChain.Comment comment = commentChain.comments.OrderBy(c => Random.value).FirstOrDefault(); CommentChainManager.CreateComment(comments, commentChain, comment, messagePrefab).GetComponentInChildren <TextMeshProUGUI>().fontSize = 16; } DayManager.Delay(0, delegate { // Force layout rebuild VerticalLayoutGroup layout = comments.GetComponent <VerticalLayoutGroup>(); layout.enabled = false; layout.enabled = true; }); }
public void NewDay() { slugs = slugEnclosures.GetComponentsInChildren <Slug>(); foreach (Slug slug in slugs) { slug.Sleep(); } foreach (Transform enclosure in slugEnclosures.GetComponentsInChildren <Button>().Select(s => s.transform)) { if (enclosure.childCount > 3) { if (enclosure.GetChild(2).gameObject.activeSelf) { enclosure.GetChild(2).gameObject.SetActive(false); enclosure.GetChild(3).gameObject.SetActive(true); enclosure.GetChild(3).GetComponentInChildren <TextMeshProUGUI>().text = enclosure.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text; } } else { enclosure.GetChild(0).gameObject.SetActive(true); enclosure.GetChild(1).gameObject.SetActive(false); enclosure.GetChild(2).gameObject.SetActive(false); } } liveButton.interactable = true; endDayButton.gameObject.SetActive(false); endDayButton.GetComponentInParent <Canvas>().GetComponent <CanvasAnimator>().Reset(); DeskManager.instance.report.Generate(); if (day < procedures.Length) { DeskManager.instance.procedures.Generate(procedures[day++]); } else { DeskManager.instance.procedures.gameObject.SetActive(false); } CommentChainManager.Reset(); if (excitement > 0) { excitement -= 1; } fade.SetFloat("Speed", -1); }
void Awake() { instance = this; scrollRect = chat.GetComponentInParent <ScrollRect>(); }