Skip to content

Commit

Permalink
Merge pull request #2 from rie-kumar/master
Browse files Browse the repository at this point in the history
Fixed titles and descriptions for showing a bunching missing text.
  • Loading branch information
b-rad15 authored Oct 21, 2019
2 parents 71c001a + bc1cbf9 commit c96941b
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 195 deletions.
4 changes: 2 additions & 2 deletions VideoPlayer/MusicVideoPlayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins"
copy /Y "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\VideoPlayer\bin\Release\HtmlAgilityPack.dll" "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup\Lib"
copy /Y "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\VideoPlayer\bin\Release\MusicVideoPlayer.dll" "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup\Plugins"
copy /Y "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\Youtube-dl" "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup"
</PostBuildEvent>
copy /Y "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\Youtube-dl" "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup\Youtube-dl"
7z a "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup.zip" "C:\Users\verte200\Documents\Mods\MusicVideoPlayerUpdated\zipitup\*"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
1 change: 0 additions & 1 deletion VideoPlayer/UI/VideoUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public void HandleDidSelectLevel(LevelPackLevelsViewController sender, IPreviewB
{
selectedLevel = level;
Plugin.logger.Info(level.levelID);
// UpdateVideoButton(VideoLoader.Instance.GetVideo(level));
}

private void UpdateVideoButton(VideoData selectedVideo)
Expand Down
81 changes: 40 additions & 41 deletions VideoPlayer/UI/VideosFlowCoordinator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class VideoFlowCoordinator : FlowCoordinator
private IPreviewBeatmapLevel selectedLevel;
private VideoData selectedLevelVideo;
private bool previewPlaying;
private bool offsetInSeconds;

public void Init()
{
Expand All @@ -45,66 +46,52 @@ public void Init()
protected override void DidActivate(bool firstActivation, ActivationType activationType)
{
title = "Video - " + selectedLevel.songName;
Plugin.logger.Info("Did Activate 01");

if (_videoDetailViewController == null)
{
_videoDetailViewController = BeatSaberUI.CreateViewController<MusicVideoPlayer.UI.ViewControllers.VideoDetailViewController>();
_videoDetailViewController.Init();
Plugin.logger.Info(_videoDetailViewController.ToString());
// _videoDetailViewController.Init();
Plugin.logger.Info("Did Activate 3");
_videoDetailViewController.backButtonPressed += DetailViewBackPressed;
Plugin.logger.Info("Did Activate 4");
_videoDetailViewController.addOffsetPressed += DetailViewAddOffsetPressed;
Plugin.logger.Info("Did Activate 5");
_videoDetailViewController.subOffsetPressed += DetailViewSubOffsetPressed;
Plugin.logger.Info("Did Activate 6");
_videoDetailViewController.changeOffsetMagnitudePressed += DetailsViewChangeMagnitudePressed;
_videoDetailViewController.previewButtonPressed += DetailViewPreviewPressed;
Plugin.logger.Info("Did Activate 7");
_videoDetailViewController.loopButtonPressed += DetailViewLoopPressed;
Plugin.logger.Info("Did Activate 8");
_videoDetailViewController.listButtonPressed += DetailViewSearchPressed;
Plugin.logger.Info("Did Activate 9");
_videoDetailViewController.downloadDeleteButtonPressed += DetailViewDownloadDeletePressed;
}
Plugin.logger.Info("Made _videoDetailViewController");

if (_videoListViewController == null)
{
_videoListViewController = BeatSaberUI.CreateViewController<VideoListViewController>();
_videoListViewController.backButtonPressed += ListViewBackPressed;
_videoListViewController.downloadButtonPressed += ListViewDownloadPressed;
_videoListViewController.searchButtonPressed += ListViewSearchPressed;
Plugin.logger.Info("vLVC Made");
}
Plugin.logger.Info("Made _videoListViewController y");

if (_simpleDialog == null)
{
_simpleDialog = Resources.FindObjectsOfTypeAll<SimpleDialogPromptViewController>().First();
_simpleDialog = Instantiate(_simpleDialog.gameObject, _simpleDialog.transform.parent).GetComponent<SimpleDialogPromptViewController>();
}
Plugin.logger.Info("Made _simpleDialog");

if (activationType == FlowCoordinator.ActivationType.AddedToHierarchy)
{
_videoDetailViewController.SetContent(selectedLevelVideo);
Plugin.logger.Info("Content Set");
previewPlaying = false;
_videoDetailViewController.SetPreviewState(previewPlaying);
Plugin.logger.Info("Preview State Set");

if (selectedLevelVideo != null)
{
Plugin.logger.Info("Showing Screen");
ScreenManager.Instance.ShowScreen();
Plugin.logger.Info("Showed Screen");
}
Plugin.logger.Info("activationType == FlowCoordinator.ActivationType.AddedToHierarchy");

ProvideInitialViewControllers(_videoDetailViewController, null, null);
}
Plugin.logger.Info("Made activationType == FlowCoordinator.ActivationType.AddedToHierarchy");
}

private void DetailViewDownloadDeletePressed()
{
Plugin.logger.Info("Downloaded-Delete");
switch (selectedLevelVideo.downloadState) {
case DownloadState.Downloaded:
VideoLoader.Instance.DeleteVideo(selectedLevelVideo);
Expand All @@ -130,17 +117,12 @@ public void Present()

private void DoSearch(string query)
{
Plugin.logger.Info("Do Search");
_videoListViewController.SetLoadingState(true);
_videoListViewController.SetContent(new List<YTResult>());
Plugin.logger.Info("Doing Search");

YouTubeSearcher.Search(query, selectedLevel, delegate () {
Plugin.logger.Info("YT Search done");
_videoListViewController.SetContent(YouTubeSearcher.searchResults);
Plugin.logger.Info("YT Set Content");
_videoListViewController.SetLoadingState(false);
Plugin.logger.Info("Set Loading State");
});
}

Expand All @@ -156,19 +138,13 @@ private void DetailViewBackPressed()

private void DetailViewSearchPressed()
{
Plugin.logger.Info("DVSP");
PresentViewController(_videoListViewController);
Plugin.logger.Info("PVC Complete");

DoSearch(selectedLevel.songName + " " + selectedLevel.songAuthorName);
Plugin.logger.Info("Did Search");
StopPreview();
Plugin.logger.Info("Stopped Preview");
}

private void DetailViewLoopPressed()
{
Plugin.logger.Info("DVLP");
selectedLevelVideo.loop = !selectedLevelVideo.loop;
_videoDetailViewController.UpdateContent();
}
Expand All @@ -192,19 +168,48 @@ private void DetailViewPreviewPressed()

private void DetailViewAddOffsetPressed()
{
Plugin.logger.Info("Pressed Subtract Offset");
selectedLevelVideo.offset += 100;
if (offsetInSeconds)
{
selectedLevelVideo.offset += 1000;
}
else
{
selectedLevelVideo.offset += 100;
}

_videoDetailViewController.SetOffsetText(selectedLevelVideo.offset.ToString());
StopPreview();
}

private void DetailViewSubOffsetPressed()
{
selectedLevelVideo.offset -= 100;
if (offsetInSeconds)
{
selectedLevelVideo.offset -= 1000;
}
else
{
selectedLevelVideo.offset -= 100;
}

_videoDetailViewController.SetOffsetText(selectedLevelVideo.offset.ToString());
StopPreview();
}

private void DetailsViewChangeMagnitudePressed()
{
if(offsetInSeconds)
{
_videoDetailViewController.ChangeOffsetMagnitude.SetButtonText("offset (ms)");
}
else
{
_videoDetailViewController.ChangeOffsetMagnitude.SetButtonText("offset (s)");
}

offsetInSeconds = !offsetInSeconds;
}

private void StopPreview()
{
previewPlaying = false;
Expand Down Expand Up @@ -234,7 +239,6 @@ private void ListViewDownloadPressed(YTResult result)
private void QueueDownload(YTResult result)
{
// Delete existing
Plugin.logger.Info("Queue Downloaded");
if (selectedLevelVideo != null)
{
VideoLoader.Instance.RemoveVideo(selectedLevelVideo);
Expand Down Expand Up @@ -285,12 +289,9 @@ private void ListViewBackPressed()

private void ListViewSearchPressed()
{
Plugin.logger.Info("List View Search Pressed");
if (_searchViewController == null)
{
Plugin.logger.Info("sVC null");
_searchViewController = BeatSaberUI.CreateViewController<SearchKeyboardViewController>();
Plugin.logger.Info("keyboard made");
_searchViewController.backButtonPressed += SearchViewControllerBackButtonPressed;
_searchViewController.searchButtonPressed += SearchViewControllerSearchButtonPressed;
}
Expand All @@ -315,7 +316,6 @@ private void SearchViewControllerBackButtonPressed()

public void VideoDownloaderDownloadProgress(VideoData video)
{
Plugin.logger.Info("VDDP");
if (selectedLevelVideo == video)
{
_videoDetailViewController.UpdateContent();
Expand Down Expand Up @@ -346,7 +346,6 @@ private void SongListTweaks_didFinishEvent(MainMenuViewController sender, MainMe

public void HandleDidSelectLevel(LevelPackLevelsViewController sender, IPreviewBeatmapLevel level)
{
Plugin.logger.Info(level.levelID);
selectedLevel = level;
selectedLevelVideo = VideoLoader.Instance.GetVideo(level);
ScreenManager.Instance.PrepareVideo(selectedLevelVideo);
Expand Down
Loading

0 comments on commit c96941b

Please sign in to comment.