예제 #1
0
파일: Plugin.cs 프로젝트: metriics/SongCore
        private void BSEvents_levelSelected(LevelCollectionViewController arg1, IPreviewBeatmapLevel level)
        {
            if (level is CustomPreviewBeatmapLevel)
            {
                var customLevel = level as CustomPreviewBeatmapLevel;
                //       Logging.Log((level as CustomPreviewBeatmapLevel).customLevelPath);
                Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(customLevel), customLevel.customLevelPath);
                Collections.SaveExtraSongData();

                if (songData == null)
                {
                    //          Logging.Log("Null song Data");
                    return;
                }
                //      Logging.Log($"Platforms Installed: {PlatformsInstalled}. Platforms enabled: {customSongPlatforms}");
                if (PlatformsInstalled && customSongPlatforms)
                {
                    if (!string.IsNullOrWhiteSpace(songData._customEnvironmentName))
                    {
                        if (findCustomEnvironment(songData._customEnvironmentName) == -1)
                        {
                            Console.WriteLine("CustomPlatform not found: " + songData._customEnvironmentName);
                            if (!string.IsNullOrWhiteSpace(songData._customEnvironmentHash))
                            {
                                Console.WriteLine("Downloading with hash: " + songData._customEnvironmentHash);
                                SharedCoroutineStarter.instance.StartCoroutine(downloadCustomPlatform(songData._customEnvironmentHash, songData._customEnvironmentName));
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
파일: Plugin.cs 프로젝트: metriics/SongCore
 internal static void CheckCustomSongEnvironment(IDifficultyBeatmap song)
 {
     Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(song.level as CustomPreviewBeatmapLevel));
     if (songData == null)
     {
         return;
     }
     if (string.IsNullOrWhiteSpace(songData._customEnvironmentName))
     {
         _currentPlatform = -1;
         return;
     }
     try
     {
         int _customPlatform = customEnvironment(songData._customEnvironmentName);
         if (_customPlatform != -1)
         {
             _currentPlatform = CustomFloorPlugin.PlatformManager.CurrentPlatformIndex;
             if (customSongPlatforms && _customPlatform != _currentPlatform)
             {
                 CustomFloorPlugin.PlatformManager.TempChangeToPlatform(_customPlatform);
             }
         }
     }
     catch (Exception ex)
     {
         Logging.logger.Error($"Failed to Change to Platform {songData._customEnvironmentName}\n {ex}");
     }
 }
예제 #3
0
        private void BSEvents_levelSelected(LevelCollectionViewController arg1, IPreviewBeatmapLevel level)
        {
            if (level is CustomPreviewBeatmapLevel)
            {
                var customLevel = level as CustomPreviewBeatmapLevel;
                //       Logging.Log((level as CustomPreviewBeatmapLevel).customLevelPath);
                Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(customLevel), customLevel.customLevelPath);
                Collections.SaveExtraSongData();

                if (songData == null)
                {
                    //          Logging.Log("Null song Data");
                    return;
                }
                //      Logging.Log($"Platforms Installed: {PlatformsInstalled}. Platforms enabled: {customSongPlatforms}");

                if (customSongPlatforms && !string.IsNullOrWhiteSpace(songData._customEnvironmentName))
                {
                    Utilities.Logging.logger.Debug("Custom song with platform selected");
                    CustomSongPlatformSelectionDidChange?.Invoke(true, songData._customEnvironmentName, songData._customEnvironmentHash, level);
                }
                else
                {
                    CustomSongPlatformSelectionDidChange?.Invoke(false, songData._customEnvironmentName, songData._customEnvironmentHash, level);
                }
            }
        }
예제 #4
0
 internal static void CheckCustomSongEnvironment(IDifficultyBeatmap song)
 {
     Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(song.level as CustomPreviewBeatmapLevel));
     if (songData == null) return;
     if (string.IsNullOrWhiteSpace(songData._customEnvironmentName))
     {
         _currentPlatform = -1;
         return;
     }
     int _customPlatform = customEnvironment(songData._customEnvironmentName);
     if (_customPlatform != -1)
         _currentPlatform = CustomFloorPlugin.PlatformManager.CurrentPlatformIndex;
         if(customSongPlatforms && _customPlatform != _currentPlatform)
         {
             try {
             CustomFloorPlugin.PlatformManager.TempChangeToPlatform(_customPlatform);
             } catch (CustomFloorPlugin.Exceptions.StackedRequestsException){
                 CustomFloorPlugin.Exceptions.StackedRequestsException.OverridePreviousRequest();
             }
         }
     }
예제 #5
0
        private void CheckCustomSongEnvironment(IDifficultyBeatmap song)
        {
            Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(song.level as CustomPreviewBeatmapLevel));
            if (songData == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(songData._customEnvironmentName))
            {
                return;
            }
            int _customPlatform = customEnvironment(songData._customEnvironmentName);

            if (_customPlatform != -1)
            {
                _currentPlatform = CustomFloorPlugin.PlatformManager.Instance.currentPlatformIndex;
                if (customSongPlatforms && _customPlatform != _currentPlatform)
                {
                    CustomFloorPlugin.PlatformManager.Instance.ChangeToPlatform(_customPlatform, false);
                }
            }
        }