Exemple #1
0
        public void Initialize()
        {
            HashDifMode levelInfo = Utilities.DifficultyBeatmapToHashDifMode(difficultyBeatmap);

            foreach (var pauseData in PluginConfig.Instance.PauseDataList)
            {
                if (pauseData.LevelInfo.Equals(levelInfo))
                {
                    currentPauseData = pauseData;
                    currentPauseData.PausePoints.Sort();
                    PausePoints = new List <float>(pauseData.PausePoints);
                    break;
                }
            }

            // If we are in practice or if there is no pausedata
            if ((gameplayCoreSceneSetupData != null && gameplayCoreSceneSetupData.practiceSettings != null) || currentPauseData == null)
            {
                GameObject.Destroy(this);
                return;
            }

            //if (PausePoints.Count > Utilities.GetMaxPausePoints(difficultyBeatmap.level.songDuration) || Utilities.FindInvalidConsecutivePoints(PausePoints).Count != 0)
            //{
            submission?.DisableScoreSubmission(Assembly.GetExecutingAssembly().GetName().Name, "Beta moment"); // #Cancel moment
            //}
        }
        public void AddRemovePoint()
        {
            if (buttonAddsPoint)
            {
                if (currentPauseData == null)
                {
                    currentPauseData           = new PauseData();
                    currentPauseData.LevelInfo = levelInfo;
                    PluginConfig.Instance.PauseDataList.Add(currentPauseData);
                }

                int currentPausePointIndex = currentPauseData.PausePoints.FindIndex(x => x > audioTimeSyncController.songTime);
                if (currentPausePointIndex == -1)
                {
                    currentPauseData.PausePoints.Add(audioTimeSyncController.songTime);
                    currentPausePointIndex = currentPauseData.PausePoints.Count - 1;
                }
                else
                {
                    currentPauseData.PausePoints.Insert(currentPausePointIndex, audioTimeSyncController.songTime);
                }

                buttonAddsPoint = false;
            }
            else if (!buttonAddsPoint)
            {
                buttonAddsPoint = true;
                currentPauseData.PausePoints.RemoveAt(currentPausePointIndex);

                if (currentPauseData.PausePoints.Count == 0)
                {
                    PluginConfig.Instance.PauseDataList.Remove(currentPauseData);
                    currentPauseData = null;
                }
            }
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AddRemovePointButtonText)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalPointsText)));
        }
 public WrapRefPauseData(PauseData value)
 {
     this.value = value;
     HasValue   = true;
 }