void HideLatestNews() { LatestNewsTypeIconImageCarrier.SetActive(false); LatestNewsTextObject.GetComponent <Text>().text = ""; LatestNewsTextCarrier.GetComponent <RectTransform>().sizeDelta = new Vector2(0, CallPanelController.CurrentUIsize); NewsDisplayTimeLimit = 0; Canvas.ForceUpdateCanvases(); CallPanelController.ContentSizeFitterReseter(FunctionItem); CallPanelController.ContentSizeFitterReseter(NewsCarrier); }
void DisplayLatestNews() { if (NewsList.Count == 0) { return; } Sprite TypeIcon = null; switch (NewsList[NewsList.Count - 1].Type) { case "Attention": TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/AttentionIcon"); break; case "Info": TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/InfoIcon"); break; case "Award": TypeIcon = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/AwardIcon"); break; } LatestNewsTypeIconImageCarrier.SetActive(true); LatestNewsTypeIconImageCarrier.transform.GetChild(0).gameObject.GetComponent <Image>().sprite = TypeIcon; LatestNewsTextObject.GetComponent <Text>().text = NewsList[NewsList.Count - 1].Content; float TextPanelSize = LatestNewsTextObject.GetComponent <Text>().text.Length * 9 * CallPanelController.UIscale; if (TextPanelSize > CallPanelController.CurrentUIsize * 10f) { TextPanelSize = CallPanelController.CurrentUIsize * 10f; } LatestNewsTextCarrier.GetComponent <RectTransform>().sizeDelta = new Vector2(TextPanelSize, CallPanelController.CurrentUIsize); Canvas.ForceUpdateCanvases(); CallPanelController.ContentSizeFitterReseter(FunctionItem); CallPanelController.ContentSizeFitterReseter(NewsCarrier); NewsDisplayTimeLimit = 300; // CallPanelController.ContentSizeFitterReseter(LatestNewsTextCarrier); // Canvas.ForceUpdateCanvases(); }