private void Awake() { logPanel = transform.Find("LogPanel").gameObject; scrollRect = logPanel.transform.Find("ScrollView").GetComponent <ScrollRect>(); logContent = scrollRect.transform.Find("Viewport/Content").gameObject; alertController = GameObject.FindWithTag("Alert").GetComponent <AlertController>(); gameState = Utils.FindNovaGameController().GetComponent <GameState>(); gameState.DialogueChanged += OnDialogueChanged; gameState.BookmarkWillLoad += OnBookmarkWillLoad; }
private void Awake() { maxSaveEntry = maxRow * maxCol; gameState = Utils.FindNovaGameController().GetComponent <GameState>(); checkpointManager = Utils.FindNovaGameController().GetComponent <CheckpointManager>(); savePanel = transform.Find("SavePanel").gameObject; backgroundButton = savePanel.transform.Find("Background").GetComponent <Button>(); thumbnailImage = savePanel.transform.Find("Background/Left/Thumbnail").GetComponent <Image>(); defaultThumbnailSprite = thumbnailImage.sprite; thumbnailText = savePanel.transform.Find("Background/Left/TextBox/Text").GetComponent <Text>(); var headerPanel = savePanel.transform.Find("Background/Right/Bottom").gameObject; saveButton = headerPanel.transform.Find("SaveButton").GetComponent <Button>(); loadButton = headerPanel.transform.Find("LoadButton").GetComponent <Button>(); var pagerPanel = headerPanel.transform.Find("Pager").gameObject; var leftButtonPanel = pagerPanel.transform.Find("LeftButton").gameObject; leftButton = leftButtonPanel.GetComponent <Button>(); // leftButtonText = leftButtonPanel.GetComponent<Text>(); var rightButtonPanel = pagerPanel.transform.Find("RightButton").gameObject; rightButton = rightButtonPanel.GetComponent <Button>(); // rightButtonText = rightButtonPanel.GetComponent<Text>(); pageText = pagerPanel.transform.Find("PageText").GetComponent <Text>(); backgroundButton.onClick.AddListener(() => { selectedSaveId = -1; }); if (canSave) { saveButton.onClick.AddListener(() => ShowSave()); } else { // Cannot SetActive(false), otherwise layout will break saveButton.GetComponent <CanvasGroup>().alpha = 0.0f; } loadButton.onClick.AddListener(() => ShowLoad()); leftButton.onClick.AddListener(() => PageLeft()); rightButton.onClick.AddListener(() => PageRight()); var saveEntryGrid = savePanel.transform.Find("Background/Right/Top").gameObject; for (int rowIdx = 0; rowIdx < maxRow; ++rowIdx) { var saveEntryRow = Instantiate(SaveEntryRowPrefab); saveEntryRow.transform.SetParent(saveEntryGrid.transform); saveEntryRow.transform.localScale = Vector3.one; for (int colIdx = 0; colIdx < maxCol; ++colIdx) { var saveEntry = Instantiate(SaveEntryPrefab); saveEntry.transform.SetParent(saveEntryRow.transform); saveEntry.transform.localScale = Vector3.one; saveEntries.Add(saveEntry); } } screenCapturer = gameObject.GetComponent <ScreenCapturer>(); alertController = GameObject.FindWithTag("Alert").GetComponent <AlertController>(); gameState.DialogueChanged += OnDialogueChanged; }