コード例 #1
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();
        }
 internal MotionSettingViewModel(IMessageSender sender, IMessageReceiver receiver) : base(sender)
 {
     receiver.ReceivedCommand += OnReceivedCommand;
     ShowInstallPathWarning    = InstallPathChecker.HasMultiByteCharInInstallPath();
 }