예제 #1
0
        public IEnumerable <CommandSetting> Load()
        {
            var list = commandSettingUseCase.Load().ToList();

            onListChangedSubject.OnNext(list);
            return(list);
        }
        public void Send(string command)
        {
            if (!onAirSettingUseCase.OnAirSettingViewModel.IsOnAir)
            {
                Debug.Log($"Current not on air. but this command triggered : {command}");
                return;
            }

            // TODO: CommandSettingUseCaseにGetCurrentを実装する
            var commandData = commandSettingUseCase.Load()
                              .FirstOrDefault(element => element.CommandName == command);

            var endPoints = endPointSettingUseCase.GetCurrent();

            foreach (var endPoint in endPoints)
            {
                // 設定で有効じゃない場合はスキップ
                if (!endPoint.ConnectionEnabled)
                {
                    continue;
                }

                var ipEndPoint = endPoint.EndPoint;

                if (commandData != null)
                {
                    sendToEndpointUseCase.Send(ipEndPoint, commandData.CommandName, commandData.CommandArguments,
                                               commandData.CommandType);

                    overlayUseCase.Trigger(Color.red);
                }
            }

            // =================== OBS
            if (obsSettingUseCase.ViewModel.ChangeScene.Value)
            {
                obsCommunucationUseCase.SetScene(command);
            }

            if (obsSettingUseCase.ViewModel.RestartMedia.Value)
            {
                obsCommunucationUseCase.RestartMediaSource(command);
            }

            // =================== OBS
        }