Ejemplo n.º 1
0
        protected async override Task OnAfterRenderAsync(bool isFirstRender)
        {
            await JSRuntime.InvokeVoidAsync("doUserSelectDir");

            var queryString = QueryHelpers.ParseQuery(new Uri(NavigationManager.Uri).Query);

            ResourceReader = await BeatmapHelper.LoadNetworkResources(94790);

            /*
             * if (queryString.TryGetValue("sid", out var beatmapSetId))
             *  ResourceReader = await BeatmapHelper.LoadNetworkResources(int.Parse(beatmapSetId.ToString()));
             * else
             *  //尝试发起本地上传文件请求
             *  ResourceReader = await BeatmapHelper.LoadLocalResources();
             *
             * if (ResourceReader is null)
             * {
             *  //错误处理
             *  return;
             * }
             */

            Console.WriteLine("Start to select a .osb file and a .osu file (if it exist.)");
            var osbFilePath = ResourceReader.EnumeratePath("*.osb").FirstOrDefault();
            var osuFilePath = ResourceReader.EnumeratePath("*.osu").FirstOrDefault();

            Console.WriteLine("osu file : " + osuFilePath);
            Console.WriteLine("osb file : " + osbFilePath);

            var updater = StoryboardHelper.ParseStoryboard(ResourceReader.ReadFile(osuFilePath), ResourceReader.ReadFile(osbFilePath));

            Console.WriteLine($"Storyboard objects count : {updater.StoryboardObjectList.Count}");

            Console.WriteLine($"Start load render resource...");
            await StoryboardWindow.PrepareRenderResource(updater, ResourceReader);

            Console.WriteLine($"Render resource loading DONE!");

            StoryboardWindow.Play();

            Console.WriteLine($"OnAfterRenderAsync() end");
        }