public void SetFunction() { GameObject BackGround = sprite.parent.parent.parent.gameObject; BackGround.transform.Find("LetterInterface").gameObject.SetActive(false); GameObject LetterDisplay = BackGround.transform.Find("LetterDisplay").gameObject; LetterDisplay.SetActive(true); UILabel Date = LetterDisplay.transform.Find("Date").gameObject.GetComponent <UILabel>(); Date.text = "Day" + sprite.name; UILabel SendContent = LetterDisplay.transform.Find("SenderContent").gameObject.transform.Find("Label").gameObject.GetComponent <UILabel>(); UILabel ReceivedContent = LetterDisplay.transform.Find("ReceivedContent").gameObject.transform.Find("Label").gameObject.GetComponent <UILabel>(); try { SendContent.text = GetSendContent(); //Debug.Log(SendContent.text); } catch (System.Exception) { SendContent.text = "暂未收到来信"; } try { ReceivedContent.text = GetReceivedContent(); } catch (System.Exception) { ReceivedContent.text = "暂未收到来信"; } Letter_DB.CloseTheDataBase(); }
private string GetReceivedContent() { return(Letter_DB.GetContent(int.Parse(sprite.name), "青")); }
private string GetSendContent() { return(Letter_DB.GetContent(int.Parse(sprite.name), "灰")); }