// call this to show the next line of the current message void ShowNextLine() { // get access to the game data GameData gameData = DataController.m_instance.m_gameData; // get the current notice GD_Notice currentNotice = gameData.m_noticeList[m_currentNoticeId]; // check if we are displaying the first line if (m_currentLine == 0) { // clear the text and add the date DateTime messageDate = DateTime.ParseExact(currentNotice.m_stardate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); m_messageText.text = messageDate.ToLongDateString(); // remember the newest notice read if (string.Compare(currentNotice.m_stardate, DataController.m_instance.m_playerData.m_starport.m_lastReadNoticeStardate) > 0) { DataController.m_instance.m_playerData.m_starport.m_lastReadNoticeStardate = currentNotice.m_stardate; } } // get the current line of the message string[] subStrings = currentNotice.m_message.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); if (m_currentLine < subStrings.Length) { m_messageText.text += "\r\n\r\n" + subStrings[m_currentLine]; m_currentLine++; // check if we have reached the end of this message if (m_currentLine == subStrings.Length) { m_endOfMessageReached = true; } } }
// call this to enter the notices screen public void ShowNotices() { // show and hide objects m_welcomeGameObject.SetActive(false); m_noticesGameObject.SetActive(true); m_evaluationGameObject.SetActive(false); // hide the main buttons m_noticesButton.gameObject.SetActive(false); m_evaluationButton.gameObject.SetActive(false); m_exitButton.gameObject.SetActive(false); // show the notices buttons m_moreButton.gameObject.SetActive(true); m_previousButton.gameObject.SetActive(true); m_nextButton.gameObject.SetActive(true); m_quitButton.gameObject.SetActive(true); // reset some variables m_latestNoticeId = 0; m_currentNoticeId = 0; // get access to the player progress PlayerData playerData = DataController.m_instance.m_playerData; // get access to the game data GameData gameData = DataController.m_instance.m_gameData; // update the stardate text DateTime dateTime = DateTime.ParseExact(playerData.m_general.m_currentStardateYMD, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); m_stardateText.text = "Today is " + dateTime.ToLongDateString(); // figure out which notice we should be showing (current notice) string earliestNewNoticeStardate = "9999-12-31"; for (int noticeId = 0; noticeId < gameData.m_noticeList.Length; noticeId++) { GD_Notice notice = gameData.m_noticeList[noticeId]; if (string.Compare(playerData.m_general.m_currentStardateYMD, notice.m_stardate) >= 0) { m_latestNoticeId = noticeId; if (string.Compare(notice.m_stardate, playerData.m_starport.m_lastReadNoticeStardate) >= 0) { if (string.Compare(earliestNewNoticeStardate, notice.m_stardate) >= 0) { if (notice.m_stardate != playerData.m_starport.m_lastReadNoticeStardate) { earliestNewNoticeStardate = notice.m_stardate; } m_currentNoticeId = noticeId; } } } } // show the current message ShowCurrentMessage(); }