Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.37.5' into 1.37.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermanest committed Sep 28, 2024
2 parents 30fc794 + d361b0c commit 8c9a268
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 50 deletions.
6 changes: 5 additions & 1 deletion Source/2_Core/Installers/OnMenuInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using BeatLeader.DataManager;
using BeatLeader.DataManager;
using BeatLeader.Interop;
using BeatLeader.ViewControllers;
using BeatLeader.Replayer;
using JetBrains.Annotations;
using Zenject;
using BeatLeader.Components;

namespace BeatLeader.Installers {
[UsedImplicitly]
Expand Down Expand Up @@ -36,6 +37,9 @@ private void BindLeaderboard() {
Container.Bind<BeatLeaderMenuButtonManager>().FromNewComponentOnNewGameObject().AsSingle().NonLazy();
Container.Bind<BeatLeaderFlowCoordinator>().FromNewComponentOnNewGameObject().AsSingle().NonLazy();
Container.Bind<ReplayLaunchViewController>().FromNewComponentAsViewController().AsSingle();

_ = BeatmapDifficultyPanel.BeatmapDifficultySegmentedControl;
_ = BeatmapCharacteristicPanel.BeatmapCharacteristicSegmentedControl;
}
}
}
4 changes: 2 additions & 2 deletions Source/8_UI/BSML Addons/BSMLAddonsLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ internal static class BSMLAddonsLoader {
new GenericSettingExtensionHandler(),
new GraphicExtensionHandler(),
new ImageViewExtensionHandler(),
new LayoutElementExtensionHandler(),
new ModalViewExtensionHandler()
};

private static bool _ready;

public static void LoadAddons() {
if (_ready) return;
if (!_ready) {
foreach (var sprite in spritesToCache)
BSMLUtility
.AddSpriteToBSMLCache("bl-" + sprite.Key, sprite.Value);
}
foreach (var tag in addonTags) BSMLParser.Instance.RegisterTag(tag);
foreach (var handler in addonHandlers) BSMLParser.Instance.RegisterTypeHandler(handler);
_ready = true;
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions Source/8_UI/FlowCoordinator/BeatLeaderMenuButtonManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ private void Start() {
MenuButtonClickedEvent += HandleMenuButtonClicked;
}

private void OnDestroy() {
MenuButtonClickedEvent -= HandleMenuButtonClicked;
}

#endregion

#region Callbacks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace BeatLeader.Components {
internal class BeatmapCharacteristicPanel : ReeUIComponentV2 {
#region Prefab

private static Transform BeatmapCharacteristicSegmentedControl => _beatmapCharacteristicSegmentedControl ?
_beatmapCharacteristicSegmentedControl! : _beatmapCharacteristicSegmentedControl = Resources
.FindObjectsOfTypeAll<BeatmapCharacteristicSegmentedControlController>().First().transform.parent;
public static Transform BeatmapCharacteristicSegmentedControl => _beatmapCharacteristicSegmentedControl ?
_beatmapCharacteristicSegmentedControl! : _beatmapCharacteristicSegmentedControl = Instantiate(Resources
.FindObjectsOfTypeAll<BeatmapCharacteristicSegmentedControlController>().First().transform.parent);

private static Transform? _beatmapCharacteristicSegmentedControl;

Expand Down Expand Up @@ -88,8 +88,8 @@ public void SetData(IEnumerable<BeatmapCharacteristicSO>? beatmapCharacteristics
private List<BeatmapCharacteristicSO>? _beatmapCharacteristics;

protected override void OnInitialize() {
var characteristicPanel = Instantiate(
BeatmapCharacteristicSegmentedControl, _container, true);
var characteristicPanel = BeatmapCharacteristicSegmentedControl;
characteristicPanel.SetParent(_container, true);
characteristicPanel.localScale = Vector3.one;
characteristicPanel.localPosition = Vector3.zero;
characteristicPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace BeatLeader.Components {
internal class BeatmapDifficultyPanel : ReeUIComponentV2 {
#region Prefab

private static Transform BeatmapDifficultySegmentedControl => _beatmapDifficultySegmentedControl ?
_beatmapDifficultySegmentedControl! : _beatmapDifficultySegmentedControl = Resources
.FindObjectsOfTypeAll<BeatmapDifficultySegmentedControlController>().First().transform.parent;
public static Transform BeatmapDifficultySegmentedControl => _beatmapDifficultySegmentedControl ?
_beatmapDifficultySegmentedControl! : _beatmapDifficultySegmentedControl = Instantiate(Resources
.FindObjectsOfTypeAll<BeatmapDifficultySegmentedControlController>().First().transform.parent);

private static Transform? _beatmapDifficultySegmentedControl;

Expand Down Expand Up @@ -88,11 +88,8 @@ public void SetData(IReadOnlyList<BeatmapDifficulty>? difficulties) {
#region Init

protected override void OnInitialize() {
var characteristicPanel = Instantiate(
BeatmapDifficultySegmentedControl,
_container,
true
);
var characteristicPanel = BeatmapDifficultySegmentedControl;
characteristicPanel.SetParent(_container, true);
characteristicPanel.localScale = Vector3.one;
characteristicPanel.localPosition = Vector3.zero;
characteristicPanel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using BGLib.Polyglot;
using HMUI;
using IPA.Utilities;
using UnityEngine;
Expand Down Expand Up @@ -33,6 +34,7 @@ internal class BeatmapSelectorViewController : DummyViewController {
private SelectLevelCategoryViewController.LevelCategory _lastSelectedLevelCategory = SelectLevelCategoryViewController.LevelCategory.All;
private BeatmapLevel? _originalPreviewBeatmapLevel;
private bool _isInitialized;
private string _defaultPlayButtonText = Localization.Get("BUTTON_PLAY");

public void Init(
LevelSelectionNavigationController levelSelectionNavigationController,
Expand Down Expand Up @@ -66,23 +68,27 @@ public override void OnDestroy() {
public override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
if (!_isInitialized) throw new UninitializedComponentException();
if (firstActivation) {
_levelSelectionNavigationController.Setup(
SongPackMask.all,
BeatmapDifficultyMask.All,
Array.Empty<BeatmapCharacteristicSO>(),
false,
false,
"SELECT",
null,
SelectLevelCategoryViewController.LevelCategory.None,
null,
true);
if (_levelSelectionNavigationController._actionButtonText == null) {
_levelSelectionNavigationController.Setup(
SongPackMask.all,
BeatmapDifficultyMask.All,
Array.Empty<BeatmapCharacteristicSO>(),
false,
false,
"SELECT",
null,
SelectLevelCategoryViewController.LevelCategory.None,
null,
true);
}
_levelDetailWrapper = ReeUIComponentV2.Instantiate<LevelDetailWrapper>(_levelDetail.parent);
_levelDetailWrapper.SelectButtonPressedEvent += HandleSelectButtonPressed;
_closeButton = ReeUIComponentV2.Instantiate<CloseButton>(_levelFilteringNavigationController.transform);
_closeButton.ManualInit(_closeButton.transform);
_closeButton.ButtonPressedEvent += HandleCloseButtonPressed;
}
_levelSelectionNavigationController._actionButtonText = "SELECT";

_originalLevelCategory = _levelSelectionNavigationController.selectedLevelCategory;
_originalPreviewBeatmapLevel = _levelCollectionNavigationController.beatmapLevel;
SetLevelDetailWrapperEnabled(true);
Expand All @@ -93,6 +99,7 @@ public override void DidActivate(bool firstActivation, bool addedToHierarchy, bo
}

public override void DidDeactivate(bool removedFromHierarchy, bool screenSystemDisabling) {
_levelSelectionNavigationController._actionButtonText = _defaultPlayButtonText;
SetLevelDetailWrapperEnabled(false);
SetCloseButtonEnabled(false);
_lastSelectedLevelCategory = _levelSelectionNavigationController.selectedLevelCategory;
Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/Results/ResultsScreenUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private void Awake() {
LeaderboardEvents.VotingWasPressedEvent += PresentVotingModal;
}

protected override void OnDispose() {
protected override void OnDestroy() {
_replayButton.ReplayButtonClickedEvent -= HandleReplayButtonClicked;
LeaderboardEvents.VotingWasPressedEvent -= PresentVotingModal;
}
Expand Down

0 comments on commit 8c9a268

Please sign in to comment.