Ejemplo n.º 1
0
        private void OnReceiveCommand(object?sender, CommandReceivedEventArgs e)
        {
            switch (e.Command)
            {
            case ReceiveMessageNames.VRoidModelLoadCompleted:
                //WPF側のダイアログによるUIガードを終了: _isVRoidHubUiActiveフラグは別のとこで折るのでここでは無視でOK
                if (_isVRoidHubUiActive)
                {
                    MessageBoxWrapper.Instance.SetDialogResult(false);
                }

                //ファイルパスではなくモデルID側を最新情報として覚えておく
                Model.OnVRoidModelLoaded(e.Args);

                break;

            case ReceiveMessageNames.VRoidModelLoadCanceled:
                //WPF側のダイアログによるUIガードを終了
                if (_isVRoidHubUiActive)
                {
                    MessageBoxWrapper.Instance.SetDialogResult(false);
                }
                break;

            case ReceiveMessageNames.ModelNameConfirmedOnLoad:
                //ともかくモデルがロードされているため、実態に合わせておく
                Model.LoadedModelName = e.Args;
                break;
            }
        }
Ejemplo n.º 2
0
 private void OnReceiveCommand(object?sender, CommandReceivedEventArgs e)
 {
     if (e.Command == ReceiveMessageNames.UpdateDeviceLayout)
     {
         _deviceLayout = e.Args;
     }
 }
Ejemplo n.º 3
0
        private void OnReceiveCommand(object?sender, CommandReceivedEventArgs e)
        {
            if (e.Command != ReceiveMessageNames.RequestShowError)
            {
                return;
            }

            try
            {
                var jobj       = JObject.Parse(e.Args);
                var rawLevel   = jobj["level"];
                var rawContent = jobj["content"];
                var rawTitle   = jobj["title"];

                if (rawLevel == null || rawContent == null || rawTitle == null)
                {
                    return;
                }

                var image = (int)rawLevel switch
                {
                    0 => MessageBoxImage.Information,
                    1 => MessageBoxImage.Warning,
                    _ => MessageBoxImage.Error,
                };

                var content = (string?)rawContent ?? "";
                var title   = (string?)rawTitle ?? "";
                MessageBox.Show(content, title, MessageBoxButton.OK, image);
            }
            catch (Exception ex)
            {
                LogOutput.Instance.Write(ex);
            }
        }
 private void OnMessageReceived(object?sender, CommandReceivedEventArgs e)
 {
     if (e.Command == ReceiveMessageNames.ExtraBlendShapeClipNames)
     {
         try
         {
             //いちおう信頼はするけどIPCだし…みたいな書き方です
             var names = e.Args
                         .Split(',')
                         .Where(w => !string.IsNullOrEmpty(w))
                         .ToArray();
             _blendShapeNameStore.Refresh(names);
         }
         catch (Exception ex)
         {
             LogOutput.Instance.Write(ex);
         }
     }
     else if (e.Command == ReceiveMessageNames.ExTrackerCalibrateComplete)
     {
         //キャリブレーション結果を向こうから受け取る: この場合は、ただ覚えてるだけでよい
         _model.CalibrateData.SilentSet(e.Args);
     }
     else if (e.Command == ReceiveMessageNames.ExTrackerSetPerfectSyncMissedClipNames)
     {
         MissingBlendShapeNames.Value = e.Args;
     }
     else if (e.Command == ReceiveMessageNames.ExTrackerSetIFacialMocapTroubleMessage)
     {
         IFacialMocapTroubleMessage.Value = e.Args;
     }
 }
Ejemplo n.º 5
0
 private void OnReceiveCommand(object?sender, CommandReceivedEventArgs e)
 {
     if (e.Command == ReceiveMessageNames.UpdateDeviceLayout)
     {
         //NOTE: Unity側から来た値なため、送り返さないでよいことに注意
         _model.DeviceLayout.SilentSet(e.Args);
     }
 }
        private void OnReceive(object?sender, CommandReceivedEventArgs e)
        {
            if (e.Command != ReceiveMessageNames.MidiNoteOn)
            {
                return;
            }

            if (int.TryParse(e.Args, out var noteNumber))
            {
                MidiNoteOn?.Invoke(this, new MidiNoteEventArgs(noteNumber));
            }
        }
Ejemplo n.º 7
0
        private void OnReceivedCommand(object?sender, CommandReceivedEventArgs e)
        {
            switch (e.Command)
            {
            case ReceiveMessageNames.CloseConfigWindow:
                Application.Current.Dispatcher?.BeginInvoke(
                    new Action(() => Application.Current.MainWindow.Close()),
                    DispatcherPriority.ApplicationIdle
                    );
                break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
        private void OnReceivedCommand(object?sender, CommandReceivedEventArgs e)
        {
            switch (e.Command)
            {
            case ReceiveMessageNames.SetCalibrationFaceData:
                //NOTE: Unity側がすでにこの値を把握しているので、投げ返す必要がない
                _model.CalibrateFaceData.SilentSet(e.Args);
                break;

            case ReceiveMessageNames.AutoAdjustResults:
                _model.SetAutoAdjustResults(e.Args);
                break;

            case ReceiveMessageNames.MicrophoneVolumeLevel:
                if (ShowMicrophoneVolume.Value && int.TryParse(e.Args, out int i))
                {
                    MicrophoneVolumeValue.Value = i;
                }
                break;

            case ReceiveMessageNames.ExtraBlendShapeClipNames:
                try
                {
                    //いちおう信頼はするけどIPCだし…みたいな書き方。FaceSwitchと同じ
                    var names = e.Args
                                .Split(',')
                                .Where(w => !string.IsNullOrEmpty(w))
                                .ToArray();
                    _blendShapeNameStore.Refresh(names);
                }
                catch (Exception ex)
                {
                    LogOutput.Instance.Write(ex);
                }
                break;

            case ReceiveMessageNames.SetHandTrackingResult:
                HandTrackingResult.SetResult(HandTrackingResultBuilder.FromJson(e.Args));
                break;

            default:
                break;
            }
        }
Ejemplo n.º 9
0
        private void OnReceiveCommand(object?sender, CommandReceivedEventArgs e)
        {
            if (e.Command != ReceiveMessageNames.ExtraBlendShapeClipNames)
            {
                return;
            }

            //やることは2つ:
            // - 知らない名前のブレンドシェイプが飛んできたら記憶する
            // - アバターが持ってるExtraなクリップ名はコレですよ、というのを明示的に与える
            _latestAvaterExtraClipNames = e.Args
                                          .Split(',')
                                          .Where(n => !string.IsNullOrEmpty(n))
                                          .ToArray();

            bool hasNewBlendShape = false;

            foreach (var name in _latestAvaterExtraClipNames
                     .Where(n => !ExtraBlendShapeClipNames.Contains(n))
                     )
            {
                hasNewBlendShape = true;
                ExtraBlendShapeClipNames.Add(name);
            }

            if (hasNewBlendShape)
            {
                //新しい名称のクリップを子要素側に反映
                foreach (var item in _items)
                {
                    item.CheckBlendShapeClipNames();
                }
            }

            foreach (var item in _items)
            {
                item.CheckAvatarExtraClips();
            }
        }
        private void OnReceivedCommand(object?sender, CommandReceivedEventArgs e)
        {
            switch (e.Command)
            {
            case ReceiveMessageNames.SetCalibrationFaceData:
                CalibrateFaceData = e.Args;
                break;

            case ReceiveMessageNames.AutoAdjustResults:
                SetAutoAdjustResults(e.Args);
                break;

            case ReceiveMessageNames.MicrophoneVolumeLevel:
                if (ShowMicrophoneVolume && int.TryParse(e.Args, out int i))
                {
                    MicrophoneVolumeValue = i;
                }
                break;

            default:
                break;
            }
        }