ResetSingleCategoryAsync() public static method

確認ダイアログを出したうえで、個別カテゴリの設定をリセットします。
public static ResetSingleCategoryAsync ( Action resetAction ) : void
resetAction Action
return void
        internal WindowSettingViewModel(WindowSettingSync model, IMessageSender sender) : base(sender)
        {
            _model = model;

            void UpdatePickerColor() =>
            PickerColor = Color.FromRgb((byte)_model.R.Value, (byte)_model.G.Value, (byte)_model.B.Value);

            _model.R.PropertyChanged += (_, __) => UpdatePickerColor();
            _model.G.PropertyChanged += (_, __) => UpdatePickerColor();
            _model.B.PropertyChanged += (_, __) => UpdatePickerColor();

            BackgroundImageSetCommand   = new ActionCommand(SetBackgroundImage);
            BackgroundImageClearCommand = new ActionCommand(
                () => _model.BackgroundImagePath.Value = ""
                );

            ResetBackgroundColorSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetBackgroundColor)
                );
            ResetWindowPositionCommand = new ActionCommand(_model.ResetWindowPosition);
            ResetOpacitySettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetOpacity)
                );

            //初期値を反映しないと変な事になるので注意
            UpdatePickerColor();
        }
Beispiel #2
0
        internal LightSettingViewModel(LightSettingSync model, IMessageSender sender) : base(sender)
        {
            _model = model;

            _lightColor = Color.FromRgb((byte)model.LightR.Value, (byte)model.LightG.Value, (byte)model.LightB.Value);
            model.LightR.PropertyChanged += (_, __) => UpdateLightColor();
            model.LightG.PropertyChanged += (_, __) => UpdateLightColor();
            model.LightB.PropertyChanged += (_, __) => UpdateLightColor();

            _bloomColor = Color.FromRgb((byte)model.BloomR.Value, (byte)model.BloomG.Value, (byte)model.BloomB.Value);
            model.BloomR.PropertyChanged += (_, __) => UpdateBloomColor();
            model.BloomG.PropertyChanged += (_, __) => UpdateBloomColor();
            model.BloomB.PropertyChanged += (_, __) => UpdateBloomColor();

            ResetLightSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(model.ResetLightSetting)
                );
            ResetShadowSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetShadowSetting)
                );
            ResetBloomSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetBloomSetting)
                );
            ResetWindSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetWindSetting)
                );
            ResetImageQualitySettingCommand = new ActionCommand(ResetImageQuality);

            //最初の時点で不整合しなければ後は何でもOK
            UpdateLightColor();
            UpdateBloomColor();
        }
Beispiel #3
0
        internal WordToMotionSettingViewModel(WordToMotionSettingSync model, IMessageSender sender, IMessageReceiver receiver) : base(sender)
        {
            _model = model;
            Items  = new ReadOnlyObservableCollection <WordToMotionItemViewModel>(_items);
            CustomMotionClipNames = new ReadOnlyObservableCollection <string>(_customMotionClipNames);
            Devices = WordToMotionDeviceItem.LoadAvailableItems();

            AddNewItemCommand = new ActionCommand(() => model.AddNewItem());
            OpenKeyAssignmentEditorCommand = new ActionCommand(() => OpenKeyAssignmentEditor());
            ResetByDefaultItemsCommand     = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(LoadDefaultItems)
                );

            _model.SelectedDeviceType.PropertyChanged += (_, __) =>
            {
                SelectedDevice           = Devices.FirstOrDefault(d => d.Index == _model.SelectedDeviceType.Value);
                EnableWordToMotion.Value = _model.SelectedDeviceType.Value != WordToMotionSetting.DeviceTypes.None;
            };
            SelectedDevice = Devices.FirstOrDefault(d => d.Index == _model.SelectedDeviceType.Value);
            //NOTE: シリアライズ文字列はどのみち頻繁に更新せねばならない
            //(並び替えた時とかもUnityにデータ送るために更新がかかる)ので、そのタイミングを使う
            _model.MidiNoteToMotionMapReloaded += (_, __) =>
            {
                if (!_model.IsLoading)
                {
                    LoadMidiSettingItems();
                }
            };
            _model.MotionRequestsReloaded += (_, __) =>
            {
                if (!_model.IsLoading)
                {
                    LoadMotionItems();
                }
            };

            _model.Loaded += (_, __) =>
            {
                LoadMidiSettingItems();
                LoadMotionItems();
            };

            _model.PreviewDataSender.PrepareDataSend +=
                (_, __) => _dialogItem?.WriteToModel(_model.PreviewDataSender.MotionRequest);
            receiver.ReceivedCommand += OnReceiveCommand;

            LoadDefaultItemsIfInitialStart();

            LoadMotionItems();
            LoadMidiSettingItems();
        }
        internal ExternalTrackerViewModel(
            ExternalTrackerSettingSync model,
            MotionSettingSync motionModel,
            IMessageSender sender,
            IMessageReceiver receiver
            ) : base(sender)
        {
            _model       = model;
            _motionModel = motionModel;

            //この辺はModel/VMの接続とかコマンド周りの設定
            UpdateTrackSourceType();
            model.TrackSourceType.PropertyChanged        += (_, __) => UpdateTrackSourceType();
            model.EnableExternalTracking.PropertyChanged += (_, __) => UpdateShouldNotifyMissingBlendShapeClipNames();

            MissingBlendShapeNames = new RProperty <string>(
                "", _ => UpdateShouldNotifyMissingBlendShapeClipNames()
                );

            model.FaceSwitchSettingReloaded += (_, __) =>
            {
                if (!model.IsLoading)
                {
                    LoadFaceSwitchSetting();
                }
            };
            model.Loaded += (_, __) => LoadFaceSwitchSetting();

            RefreshIFacialMocapTargetCommand = new ActionCommand(
                () => NetworkEnvironmentUtils.SendIFacialMocapDataReceiveRequest(IFacialMocapTargetIpAddress.Value)
                );
            OpenInstructionUrlCommand                = new ActionCommand(OpenInstructionUrl);
            OpenPerfectSyncTipsUrlCommand            = new ActionCommand(OpenPerfectSyncTipsUrl);
            OpenIFMTroubleShootCommand               = new ActionCommand(OpenIFMTroubleShoot);
            EndExTrackerIfNeededCommand              = new ActionCommand(EndExTrackerIfNeeded);
            ShowMissingBlendShapeNotificationCommand = new ActionCommand(ShowMissingBlendShapeNotification);
            ResetSettingsCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetToDefault)
                );

            //TODO: メッセージ受信の処理もモデル側案件のはず…うーん…
            receiver.ReceivedCommand += OnMessageReceived;

            LoadFaceSwitchSetting();
        }
Beispiel #5
0
        internal LayoutSettingViewModel(
            LayoutSettingSync model, GamepadSettingSync gamepadModel, IMessageSender sender, IMessageReceiver receiver
            ) : base(sender)
        {
            _model        = model;
            _gamepadModel = gamepadModel;

            QuickSaveViewPointCommand = new ActionCommand <string>(async s => await _model.QuickSaveViewPoint(s));
            QuickLoadViewPointCommand = new ActionCommand <string>(_model.QuickLoadViewPoint);

            OpenTextureReplaceTipsUrlCommand = new ActionCommand(
                () => UrlNavigate.Open(LocalizedString.GetString("URL_tips_texture_replace"))
                );

            ResetCameraPositionCommand = new ActionCommand(() => SendMessage(MessageFactory.Instance.ResetCameraPosition()));

            ResetCameraSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetCameraSetting)
                );

            ResetDeviceLayoutCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetDeviceLayout)
                );

            ResetHidSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetHidSetting)
                );
            ResetCameraSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetCameraSetting)
                );
            ResetMidiSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetMidiSetting)
                );

            _model.SelectedTypingEffectId.PropertyChanged += (_, __) =>
            {
                TypingEffectItem = TypingEffectSelections
                                   .FirstOrDefault(v => v.Id == _model.SelectedTypingEffectId.Value);
            };

            _typingEffectItem         = TypingEffectSelections[0];
            receiver.ReceivedCommand += OnReceiveCommand;
        }
Beispiel #6
0
        internal MotionSettingViewModel(MotionSettingSync model, IMessageSender sender, IMessageReceiver receiver) : base(sender)
        {
            _model = model;

            ResetFaceBasicSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(ResetFaceBasicSetting)
                );
            ResetFaceEyeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceEyeSetting)
                );
            ResetFaceBlendShapeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceBlendShapeSetting)
                );
            ResetArmMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetArmSetting)
                );
            ResetHandMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetHandSetting)
                );
            ResetWaitMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetWaitMotionSetting)
                );

            CalibrateFaceCommand = new ActionCommand(() => SendMessage(MessageFactory.Instance.CalibrateFace()));
            OpenFullEditionDownloadUrlCommand = new ActionCommand(() => UrlNavigate.Open("https://baku-dreameater.booth.pm/items/3064040"));
            OpenHandTrackingPageUrlCommand    = new ActionCommand(() => UrlNavigate.Open(LocalizedString.GetString("URL_docs_hand_tracking")));

            ShowMicrophoneVolume = new RProperty <bool>(false, b =>
            {
                SendMessage(MessageFactory.Instance.SetMicrophoneVolumeVisibility(b));
                if (!b)
                {
                    MicrophoneVolumeValue.Value = 0;
                }
            });

            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdateKeyboardAndMouseMotionMode();
            UpdateKeyboardAndMouseMotionMode();
            _model.GamepadMotionMode.PropertyChanged += (_, __) => UpdateGamepadMotionMode();
            UpdateGamepadMotionMode();

            _model.EyeBoneRotationScale.PropertyChanged += (_, __) => UpdateEyeRotRangeText();
            _model.EnableLipSync.PropertyChanged        += (_, __) =>
            {
                if (!_model.EnableLipSync.Value)
                {
                    ShowMicrophoneVolume.Value = false;
                }
            };

            _model.FaceNeutralClip.PropertyChanged += (_, __) =>
                                                      _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);
            _model.FaceOffsetClip.PropertyChanged += (_, __) =>
                                                     _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);

            //両方trueのときだけポインターを表示したいので、それのチェック
            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdatePointerVisibility();
            _model.ShowPresentationPointer.PropertyChanged    += (_, __) => UpdatePointerVisibility();
            //通常発生しないが、VMの初期化時点でポインター表示が必要ならそうする
            UpdatePointerVisibility();

            UpdateEyeRotRangeText();

            receiver.ReceivedCommand    += OnReceivedCommand;
            ShowInstallPathWarning.Value = InstallPathChecker.HasMultiByteCharInInstallPath();
        }