示例#1
0
        /// <inheritdoc/>
        public IPlaylistController GetPlaylistController(string deviceKey, ControllerActionType action)
        {
            var playlist = this.CreatePlaylistController(this.CreateAudioPlayer(deviceKey), action);

            this.Playback.Add(playlist);
            return(playlist);
        }
        protected string CreateMessage(ControllerActionType actionType, string type, Object id, Exception ex = null)
        {
            var msg = "";

            switch (actionType)
            {
                case ControllerActionType.Create:default:
                    msg = (ex == null) ? MSGCREATEOK : MSGCREATENOK;break;
                case ControllerActionType.Edit:
                    msg = (ex == null) ? MSGEDITOK : MSGEDITNOK; break;
                case ControllerActionType.Delete:
                    msg = (ex == null) ? MSGDELETEOK : MSGDELETENOK; break;
                case ControllerActionType.SoftDelete:
                    msg = (ex == null) ? MSGSOFTDELETEOK : MSGSOFTDELETENOK; break;
                case ControllerActionType.SoftUnDelete:
                    msg = (ex == null) ? MSGSOFTUNDELETEOK : MSGSOFTUNDELETENOK; break;
                case ControllerActionType.EnableTwoFactor:
                    msg = (ex == null) ? MSGENABLETWOFACTOROK : MSGENABLETWOFACTORNOK; break;
                case ControllerActionType.DisableTwoFactor:
                    msg = (ex == null) ? MSGDISABLETWOFACTOROK : MSGDISABLETWOFACTORNOK; break;
            }

            msg = String.Format(msg, type, id, ((ex != null)?ex.ToString():""));

            return msg;
        }
        protected string CreateMessage(ControllerActionType actionType, string type, Object id, Exception ex = null)
        {
            var msg = "";

            switch (actionType)
            {
            case ControllerActionType.Create:
            default:
                msg = (ex == null) ? MSGCREATEOK : MSGCREATENOK; break;

            case ControllerActionType.Edit:
                msg = (ex == null) ? MSGEDITOK : MSGEDITNOK; break;

            case ControllerActionType.Delete:
                msg = (ex == null) ? MSGDELETEOK : MSGDELETENOK; break;

            case ControllerActionType.SoftDelete:
                msg = (ex == null) ? MSGSOFTDELETEOK : MSGSOFTDELETENOK; break;

            case ControllerActionType.SoftUnDelete:
                msg = (ex == null) ? MSGSOFTUNDELETEOK : MSGSOFTUNDELETENOK; break;

            case ControllerActionType.EnableTwoFactor:
                msg = (ex == null) ? MSGENABLETWOFACTOROK : MSGENABLETWOFACTORNOK; break;

            case ControllerActionType.DisableTwoFactor:
                msg = (ex == null) ? MSGDISABLETWOFACTOROK : MSGDISABLETWOFACTORNOK; break;
            }

            msg = String.Format(msg, type, id, ((ex != null)?ex.ToString():""));

            return(msg);
        }
示例#4
0
        /// <summary>
        /// Creates a playlist controller with an audio player for the specified <paramref name="deviceId"/>.
        /// </summary>
        /// <param name="deviceId">The device identifier.</param>
        /// <param name="action">The action type.</param>
        /// <param name="playlist">The playlist.</param>
        /// <returns>The playlist player.</returns>
        public IPlaylistController CreatePlaylistController(string deviceId, ControllerActionType action)
        {
            var audioPlayer = this.GetAudioPlayer(deviceId);

            switch (action)
            {
            case ControllerActionType.LoopStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.SingleLoop));

            case ControllerActionType.LoopAllStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.ContiunousLoop));

            case ControllerActionType.LoopAllStopReset:
                return(new PlayStopResetController(audioPlayer, action, ContinuousPlaybackType.ContiunousLoop));

            case ControllerActionType.PlayNext:
                return(new PlayNextController(audioPlayer));

            case ControllerActionType.PlayStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.Single));

            case ControllerActionType.PlayAllStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.Continuous));
            }

            throw new NotSupportedException($"The provided playlist player action is not supported: {action}");
        }
示例#5
0
 void OnActionComplete(ControllerActionType type)
 {
     if (type == ControllerActionType.Move || type == ControllerActionType.Attack)
     {
         m_ControllerAction.ShowMoveAndAttackRange();
     }
     if (type == ControllerActionType.Move && m_NextStepAttackEntity != null)
     {
         m_ControllerAction.Attack(m_NextStepAttackEntity);
     }
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayStopResetController"/> class.
 /// </summary>
 /// <param name="audioPlayer">The audio player.</param>
 /// <param name="actionType">Type of the action.</param>
 /// <param name="playbackType">Type of the playback.</param>
 internal PlayStopResetController(IAudioPlayer audioPlayer, ControllerActionType actionType = ControllerActionType.PlayStop, ContinuousPlaybackType playbackType = ContinuousPlaybackType.Single)
     : base(audioPlayer, actionType, playbackType)
 {
 }
示例#7
0
        /// <summary>
        /// Creates a new <see cref="IPlaylistController"/>.
        /// </summary>
        /// <param name="audioPlayer">The audio player.</param>
        /// <param name="action">The action of the controller.</param>
        /// <returns>The playlist controller.</returns>
        private IPlaylistController CreatePlaylistController(IAudioPlayer audioPlayer, ControllerActionType action)
        {
            switch (action)
            {
            case ControllerActionType.LoopStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.SingleLoop));

            case ControllerActionType.LoopAllStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.ContiunousLoop));

            case ControllerActionType.LoopAllStopReset:
                return(new PlayStopResetController(audioPlayer, action, ContinuousPlaybackType.ContiunousLoop));

            case ControllerActionType.PlayNext:
                return(new PlayNextController(audioPlayer));

            case ControllerActionType.PlayStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.Single));

            case ControllerActionType.PlayAllStop:
                return(new PlayStopController(audioPlayer, action, ContinuousPlaybackType.Continuous));

            case ControllerActionType.PlayOverlap:
                return(new PlayOverlapController(audioPlayer));
            }

            throw new NotSupportedException($"The provided playlist player action is not supported: {action}");
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayStopController" /> class.
 /// </summary>
 /// <param name="audioPlayer">The audio player.</param>
 /// <param name="actionType">Type of the action.</param>
 /// <param name="playbackType">Type of the playback.</param>
 internal PlayStopController(IAudioPlayer audioPlayer, ControllerActionType actionType, ContinuousPlaybackType playbackType)
     : base(audioPlayer)
 {
     this.Action       = actionType;
     this.PlaybackType = playbackType;
 }