Пример #1
0
 private void InitLanguageChooser()
 {
     new LabeledItemPickerControl <SystemLanguage>(
         languageChooser,
         translationManager.GetTranslatedLanguages())
     .Bind(() => translationManager.currentLanguage,
           newValue => SetLanguage(newValue));
 }
Пример #2
0
    private void InitMenu()
    {
        // Recording device
        recordingDevicePickerControl = new(recordingDevicePicker, Microphone.devices.ToList());
        recordingDevicePickerControl.SelectItem(settings.MicProfile.Name);
        recordingDevicePickerControl.Selection.Subscribe(newValue => settings.SetMicProfileName(newValue));

        // Language
        languagePickerControl = new LabeledItemPickerControl <SystemLanguage>(languagePicker, translationManager.GetTranslatedLanguages());
        languagePickerControl.SelectItem(settings.GameSettings.language);
        languagePickerControl.Selection.Subscribe(newValue => settings.GameSettings.language = newValue);
        settings.ObserveEveryValueChanged(it => it.GameSettings.language)
        .Subscribe(newValue =>
        {
            translationManager.currentLanguage = newValue;
            translationManager.ReloadTranslationsAndUpdateScene();
        });

        // Dev Mode
        devModePickerControl = new BoolPickerControl(devModePicker);
        devModePickerControl.SelectItem(settings.IsDevModeEnabled);
        devModePickerControl.Selection.Subscribe(newValue => settings.IsDevModeEnabled = newValue);
        settings
        .ObserveEveryValueChanged(it => it.IsDevModeEnabled)
        .Subscribe(newValue => OnDevModeEnabledChanged(newValue));

        // Show/hide menu overlay
        HideMenu();
        showMenuButton.RegisterCallbackButtonTriggered(() => ShowMenu());
        hiddenCloseMenuButton.RegisterCallbackButtonTriggered(() => HideMenu());
        closeMenuButton.RegisterCallbackButtonTriggered(() => HideMenu());
    }