diff --git a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/FrontendHandler.cs b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/FrontendHandler.cs index 318c459..c4a6e09 100644 --- a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/FrontendHandler.cs +++ b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/FrontendHandler.cs @@ -573,7 +573,7 @@ void PlayQueueList(int index, bool deleteOnly) { void RecordPlaybackHistory(VRCUrl url, byte playerIndex, string title) { if (historySize <= 0) return; - if (localHistoryUrls != null || localHistoryUrls.Length == 0) { + if (localHistoryUrls == null || localHistoryUrls.Length == 0) { localHistoryUrls = new VRCUrl[1] { url }; localHistoryPlayerIndex = new byte[1] { playerIndex }; localHistoryTitles = new string[1] { title }; diff --git a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/PooledScrollView.cs b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/PooledScrollView.cs index 33ac534..ec85709 100644 --- a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/PooledScrollView.cs +++ b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/PooledScrollView.cs @@ -120,6 +120,13 @@ void OnEnable() { scrollRect = GetComponent(); viewportRect = scrollRect.viewport; contentRect = scrollRect.content; + var transformsAfterEntry = new Transform[contentRect.childCount]; + int count = 0; + for (int i = contentRect.childCount - 1; i >= 0; i--) { + var child = contentRect.GetChild(i); + if (child == template.transform) break; + transformsAfterEntry[count++] = child; + } templateRect = template.GetComponent(); var templateHeight = templateRect.rect.height; var viewportHeight = viewportRect.rect.height; @@ -143,6 +150,8 @@ void OnEnable() { entry._OnParentScroll(); entries[i] = entry; } + for (int i = 0; i < count; i++) + transformsAfterEntry[i].SetAsLastSibling(); template.gameObject.SetActive(false); EventPrefix = eventPrefix; hasInit = true; diff --git a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/UIHandler.cs b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/UIHandler.cs index 1cffccd..0115a58 100644 --- a/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/UIHandler.cs +++ b/Packages/idv.jlchntoz.vvmw/Runtime/VVMW/UIHandler.cs @@ -143,16 +143,25 @@ int SelectedPlayListIndex { if (playListScrollView == null) return 0; int selectedIndex = playListScrollView.SelectedIndex; if (handler != null) { - if (handler.HistorySize > 0) selectedIndex--; - if (!handler.HasQueueList) selectedIndex++; + if (handler.HistorySize > 0) { + if (selectedIndex == 0) return -1; + if (handler.HasQueueList) selectedIndex--; + } else if (!handler.HasQueueList) + selectedIndex++; } return selectedIndex; } set { if (playListScrollView == null) return; + if (value < 0) { + playListScrollView.SelectedIndex = 0; + return; + } if (handler != null) { - if (handler.HistorySize > 0) value++; - if (!handler.HasQueueList) value--; + if (handler.HistorySize > 0) { + if (handler.HasQueueList) value++; + } else if (!handler.HasQueueList) + value--; } playListScrollView.SelectedIndex = value; } @@ -552,8 +561,6 @@ public void _OnUIUpdate() { } if (shuffleOnButton != null) shuffleOnButton.gameObject.SetActive(isShuffle); UpdatePlayList(); - if (playNextIndicator != null) - playNextIndicator.SetActive(!isShuffle && SelectedPlayListIndex == 0 && handler.PlayListIndex == 0 && handler.PendingCount > 0); SetText(queueModeText, queueModeTMPro, languageManager.GetLocale( handler.PlayListIndex == 0 && handler.HasQueueList && (core.IsReady || core.IsLoading || handler.QueueUrls.Length > 0) ? @@ -601,13 +608,15 @@ bool UpdatePlayList() { if (isEntryContainerInactive || isNotCoolingDown) SelectedPlayListIndex = selectedPlayListIndex = playListIndex; if (playNextButton != null) playNextButton.gameObject.SetActive(hasPending); - if (currentPlayListButton != null) currentPlayListButton.gameObject.SetActive(hasPending); + if (currentPlayListButton != null) currentPlayListButton.gameObject.SetActive(hasPending && selectedPlayListIndex >= 0); if (!string.IsNullOrEmpty(enqueueCountFormat)) SetText(enqueueCountText, enqueueCountTMPro, string.Format(enqueueCountFormat, pendingCount)); SetText(selectedPlayListText, selectedPlayListTMPro, selectedPlayListIndex > 0 ? handler.PlayListTitles[selectedPlayListIndex - 1] : selectedPlayListIndex < 0 ? languageManager.GetLocale("PlaybackHistory") : languageManager.GetLocale("QueueList") ); + if (playNextIndicator != null) + playNextIndicator.SetActive(!handler.Shuffle && selectedPlayListIndex == 0 && handler.PlayListIndex == 0 && handler.PendingCount > 0); bool shouldRefreshQueue = playListUpdateRequired || selectedPlayListIndex <= 0 || lastSelectedPlayListIndex != selectedPlayListIndex || lastPlayingIndex != playingIndex; lastSelectedPlayListIndex = selectedPlayListIndex; lastPlayingIndex = playingIndex;