コード例 #1
0
        internal void ToggleSelectedDifficultyHighlight()
        {
            if (selectedPlaylistSong != null)
            {
                List <SegmentedControlCell> difficultyCells = Accessors.SegmentedControllerCellsAccessor(ref beatmapDifficultySegmentedControl);
                if (IsSelectedDifficultyHighlighted)
                {
                    selectedPlaylistSong.Difficulties.RemoveAll(d => d.BeatmapDifficulty == beatmapDifficultySegmentedControlController.selectedDifficulty);
                    SegmentedControlCell cellToUnhighlight = difficultyCells[beatmapDifficultySegmentedControlController.GetClosestDifficultyIndex(beatmapDifficultySegmentedControlController.selectedDifficulty)];
                    CurvedTextMeshPro    textToUnhighlight = cellToUnhighlight.GetComponentInChildren <CurvedTextMeshPro>();
                    textToUnhighlight.faceColor = new UnityEngine.Color32(255, 255, 255, 255);
                }
                else
                {
                    if (selectedPlaylistSong.Difficulties == null)
                    {
                        selectedPlaylistSong.Difficulties = new List <Difficulty>();
                    }
                    Difficulty difficulty = new Difficulty();
                    difficulty.BeatmapDifficulty = beatmapDifficultySegmentedControlController.selectedDifficulty;
                    difficulty.Characteristic    = beatmapCharacteristicSegmentedControlController.selectedBeatmapCharacteristic.serializedName;
                    selectedPlaylistSong.AddDifficulty(difficulty);

                    SegmentedControlCell cellToHighlight = difficultyCells[beatmapDifficultySegmentedControlController.GetClosestDifficultyIndex(beatmapDifficultySegmentedControlController.selectedDifficulty)];
                    CurvedTextMeshPro    textToHighlight = cellToHighlight.GetComponentInChildren <CurvedTextMeshPro>();
                    textToHighlight.faceColor = new UnityEngine.Color32(255, 255, 0, 255);
                }
            }
        }
 static bool Prefix(SegmentedControlCell changedCell, ref int ____selectedCellNumber, Action <SegmentedControl, int> ___didSelectCellEvent, SegmentedControl __instance)
 {
     if (____selectedCellNumber == -1)
     {
         ____selectedCellNumber = changedCell.cellNumber;
         ___didSelectCellEvent?.Invoke(__instance, changedCell.cellNumber);
         return(false);
     }
     return(true);
 }
 static bool Prefix(SelectableCell selectableCell, SelectableCell.TransitionType transitionType, object changeOwner, ref int ____selectedCellNumber, Action <SegmentedControl, int> ___didSelectCellEvent, Dictionary <int, Action <int> > ____callbacks, SegmentedControl __instance)
 {
     if (____selectedCellNumber == -1)
     {
         SegmentedControlCell segmentedControlCell = (SegmentedControlCell)selectableCell;
         ____selectedCellNumber = segmentedControlCell.cellNumber;
         ___didSelectCellEvent?.Invoke(__instance, segmentedControlCell.cellNumber);
         if (____callbacks.TryGetValue(segmentedControlCell.cellNumber, out Action <int> value))
         {
             value?.Invoke(segmentedControlCell.cellNumber);
         }
         return(false);
     }
     return(true);
 }
コード例 #4
0
        private void HighlightDifficultiesForSelectedCharacteristic()
        {
            if (selectedPlaylistSong != null && selectedPlaylistSong.Difficulties != null && selectedPlaylistSong.Difficulties.Count != 0)
            {
                List <Difficulty>           difficultiesToHighlight = selectedPlaylistSong.Difficulties.FindAll(difficulty => difficulty.Characteristic.ToUpper() == beatmapCharacteristicSegmentedControlController.selectedBeatmapCharacteristic.serializedName.ToUpper());
                List <BeatmapDifficulty>    availaibleDifficulties  = Accessors.DifficultiesAccessor(ref beatmapDifficultySegmentedControlController);
                List <SegmentedControlCell> difficultyCells         = Accessors.SegmentedControllerCellsAccessor(ref beatmapDifficultySegmentedControl);

                foreach (var difficulty in difficultiesToHighlight)
                {
                    if (availaibleDifficulties.Contains(difficulty.BeatmapDifficulty))
                    {
                        SegmentedControlCell cellToHighlight = difficultyCells[beatmapDifficultySegmentedControlController.GetClosestDifficultyIndex(difficulty.BeatmapDifficulty)];
                        CurvedTextMeshPro    textToHighlight = cellToHighlight.GetComponentInChildren <CurvedTextMeshPro>();
                        textToHighlight.faceColor = new UnityEngine.Color32(255, 255, 0, 255);
                    }
                }
            }
        }