protected override void onObjectRemoved(RectTransform item, int index) { AudioScreenButton component = item.GetComponent <AudioScreenButton>(); component.Apply -= onApplyButton; component.Preview -= onPreviewButton; component.Stop -= onStopButton; component.Pause -= onPauseButton; }
private void SetupAudioButton(AudioScreenButton button, int index) { MusicTrackDefinition key = inventoryCountPairs[index - numberOfStaticButtons].Key; AudioScreenButton.ButtonState state = AudioScreenButton.ButtonState.Normal; if (sceneLayoutData != null) { if (sceneLayoutData.MusicTrackId == key.Id) { state = AudioScreenButton.ButtonState.Selected; } else if (currentlyPreviewedTrack == key.Id) { state = AudioScreenButton.ButtonState.Preview; } } button.Init(key, state, index); button.Apply += onApplyButton; button.Preview += onPreviewButton; button.Stop += onStopButton; button.Pause += onPauseButton; inventoryProgressionStatus.TryGetValue(key.Id, out var value); SetLockableButtonLockedStatus(button, key, value); }