예제 #1
0
        /// <summary>
        ///  Método que recibe una jugada y la efectúa en el tablero poniendo en la columna correspondiente el string del jugador que realiza
        ///  la jugada
        /// </summary>
        /// <param name="play"></param>
        /// <param name="current_player_info"></param>
        public void Play(IPlay <FourInLine> play, PlayerInfo current_player_info)
        {
            var my_new_play = play as FourInLinePlay;
            var row         = GetCurrentRow(my_new_play.Column);

            Board[row + 1, my_new_play.Column] = current_player_info.player_id;
        }
예제 #2
0
        protected override void Update(TimeSpan gameTime)
        {
            this.Member.Position  = this.Trans2D.Position;
            this.Member.Rotation  = this.Trans2D.Rotation;
            this.Member.Rectangle = this.RectangleCollider.Transform2D.Rectangle;

            IPlay play = this.Member.Turn();

            if (play == null)
            {
                return;
            }

            this.Trans2D.Position += play.GetMoveDirection() * this.Member.GetSpeed() * (float)gameTime.TotalSeconds;
            this.Trans2D.Rotation  = Utilities.WrapFloat(this.Trans2D.Rotation + play.GetRotation(), 0, 2 * Math.PI);

            if (play.GetMessage() != null)
            {
                play.GetMessage().Sender = this.Member;
                this.Member.GetTeam().AddMessage(play.GetMessage());
            }

            if (play.IsUsingAttack())
            {
                this.UseAttack();
            }
        }
예제 #3
0
		private Yield UpdateHelper(string id, string rev, IPlay aDoc, Result<IPlay> aResult)
		{
			//Check if a play with this id exists.
			Result<IPlay> validPlayResult = new Result<IPlay>();
			yield return thePlayDataMapper.Retrieve(aDoc.Id, validPlayResult);
			if (validPlayResult.Value == null)
			{
				aResult.Throw(new ArgumentException());
				yield break;
			}

			//Check if the current user has the update rights.
			if (!HasAuthorization(validPlayResult.Value))
			{
				aResult.Throw(new UnauthorizedAccessException());
				yield break;
			}

			//Check if the source in the play exist and are not null.
			Coroutine.Invoke(CheckSource, aDoc, new Result());

			//Update and return the updated play.
			Result<IPlay> playResult = new Result<IPlay>();
			yield return thePlayDataMapper.Update(id, rev, aDoc, playResult);
			aResult.Return(playResult.Value);
		}
예제 #4
0
파일: PlayUI.cs 프로젝트: radmars/skoops
 private void RunPlay(IPlay play, Ballman player, Ballman target)
 {
     play.ShootTheJ(player, target);
     turnOrder.FinishTurn();
     UpdateSelectedPlayer();
     StartCoroutine(ResetSelector());
 }
예제 #5
0
        /// <summary>
        /// 演奏します。
        /// </summary>
        /// <param name="dynamics">強弱</param>
        public void Play(string dynamics)
        {
            switch (dynamics)
            {
            case "pp":
                _currentPlay = new Dynamics.Pianissimo();
                break;

            case "p":
                _currentPlay = new Dynamics.Piano();
                break;

            case "f":
                _currentPlay = new Dynamics.Forte();
                break;

            case "ff":
                _currentPlay = new Dynamics.Fortessimo();
                break;

            default:     //他の強弱記号あるけど、めんどくさいので省略
                break;
            }
            _currentPlay.Play();
        }
예제 #6
0
        private void IPlayBaseTest(IPlay device, string expectedResult, FakeOutput output)
        {
            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedResult);
        }
예제 #7
0
		public Result<IPlay> Insert(IPlay aDoc, Result<IPlay> aResult)
		{
			ArgCheck.NotNull("aDoc", aDoc);
			Coroutine.Invoke(CreateHelper, aDoc, new Result<IPlay>()).WhenDone(
				aResult.Return,
				aResult.Throw
				);
			return aResult;
		}
예제 #8
0
파일: Form1.cs 프로젝트: TRSASC/Lab3old
 public PhoneForm()
 {
     InitializeComponent();
     simCorp = new SimCorpMobile(new TextBoxOutput(PlayTextBox));
     simCorp.PlaybackDevice = simCorp.Speaker;
     unofficialHeadset      = new UnofficialHeadset(new RealSpeaker(0.2), new RealSpeaker(0.2), 50, new TextBoxOutput(PlayTextBox));
     samsungHeadset         = new SamsungHeadset(new RealSpeaker(0.5), new RealSpeaker(0.5), 20, new TextBoxOutput(PlayTextBox));
     externalSpeaker        = new ExternalSpeaker(new RealSpeaker(10), 20, new TextBoxOutput(PlayTextBox));
 }
 /// <summary>
 /// 带参构造函数
 /// </summary>
 /// <param name="iplay"></param>
 public ParagraphIntListPlayerLaunchpadPro(IPlay iplay) : base()
 {
     //这里可以自定义笔刷数组
     brushList  = StaticConstant.brushList;
     this.iplay = iplay;
     worker.WorkerReportsProgress = true;
     worker.DoWork                    += new DoWorkEventHandler(worker_DoWork);
     worker.ProgressChanged           += worker_ProgressChanged;
     worker.WorkerSupportsCancellation = true;
 }
예제 #10
0
파일: Othello.cs 프로젝트: menasheh/othello
 public Othello(IPlay <Othello> p1, IPlay <Othello> p2)
 {
     _board       = new int[BoardHeight, BoardWidth];
     _board[3, 3] = 1;
     _board[3, 4] = 2;
     _board[4, 3] = 2;
     _board[4, 4] = 1;
     _score[0]    = _score[1] = 2;
     Players      = new[] { p1, p2 };
 }
예제 #11
0
        public PlayTest()
        {
            var game        = new Game();
            var playMessage = new PlayMessage();

            _play       = new Play(game, playMessage);
            _playerMock = new Mock <IPlayer>();
            _playerMock.Setup(x => x.CurrentPosition).Returns(50);
            _playerMock.Setup(x => x.Move()).Callback(() => _playerMock.Setup(x => x.CurrentPosition).Returns(53));
        }
예제 #12
0
 private void btnPlayAd_Click(object sender, EventArgs e)
 {
     if (m_media is IPlay)
     {
         IPlay video = m_media as IPlay;
         AdvertisementPlayer adMedia = new AdvertisementPlayer(video);
         adMedia.Advertisement = new Advertisement("http://www.agiledon.com");
         adMedia.Play();
     }
 }
예제 #13
0
 private void btnPlayCR_Click(object sender, EventArgs e)
 {
     if (m_media is IPlay)
     {
         IPlay           video          = m_media as IPlay;
         CopyRightPlayer copyrightMedia = new CopyRightPlayer(video);
         copyrightMedia.CopyRightMark = new CopyRight(@"Copyright @2006");
         copyrightMedia.Play();
     }
 }
예제 #14
0
        public void ExternalSpeakerTest()
        {
            output          = new FakeOutput();
            device          = new ExternalSpeaker(new RealSpeaker(2), 20, output);
            expectedMessage = $"{nameof(ExternalSpeaker)} sound";

            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedMessage);
        }
예제 #15
0
        public void SamsungHeadsetTest()
        {
            output          = new FakeOutput();
            device          = new SamsungHeadset(new RealSpeaker(2), new RealSpeaker(2), 20, output);
            expectedMessage = $"{nameof(SamsungHeadset)} sound";

            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedMessage);
        }
예제 #16
0
파일: Game.cs 프로젝트: AnnieHdez/BoardGame
        // Método que valida la jugada, viendo si cumple las reglas del juego
        public bool ValidatePlay(IPlay <TGameKind> play)
        {
            foreach (IRule <TGameKind> rule in rules)
            {
                if (!rule.Evaluate(play, table.GetTableState()))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #17
0
        public override IPlay <TGameKind> GetPlay(TableState <TGameKind> table)
        {
            double            maxScoresPlay = double.MinValue;
            IPlay <TGameKind> result        = null;

            foreach (var play in table.PossiblesPlays())
            {
                double score = table.PlayScore(play);
                if (score > maxScoresPlay)
                {
                    maxScoresPlay = score;
                    result        = play;
                }
            }

            return(result);
        }
        static void Main(string[] args)
        {
            //Redactor redactor = new Redactor("test.txt");
            //redactor.Open();
            //redactor.Edit();
            //redactor.Save();


            Player player = new Player();
            //(player as IRecord).Stop();
            IRecord record = player;

            record.Stop();
            IPlay play = player;

            play.Stop();
        }
예제 #19
0
		private Yield CreateHelper(IPlay aDoc, Result<IPlay> aResult)
		{
			//Check if user is set as we need to know the creator.
			if (Context.Current.User == null)
			{
				aResult.Throw(new UnauthorizedAccessException());
				yield break;
			}

			//Check that the sources aren't null and does exists
			yield return Coroutine.Invoke(CheckSource, aDoc, new Result());

			//Insert a the score and return
			Result<IPlay> resultCreate = new Result<IPlay>();
			yield return thePlayDataMapper.Create(aDoc, resultCreate);
			aResult.Return(resultCreate.Value);
		}
예제 #20
0
		private Yield CheckSource(IPlay aPlay, Result aResult)
		{
			//can't be null, it must have a source
			if (aPlay.SourceId == null)
			{
				aResult.Throw(new ArgumentException());
				yield break;
			}

			// if this source exists
			Result<bool> validSourceResult = new Result<bool>();
			yield return Context.Current.Instance.SourceController.Exists(aPlay.SourceId, validSourceResult);
			if (!validSourceResult.Value)
			{
				aResult.Throw(new ArgumentException());
				yield break;
			}
			aResult.Return();
		}
예제 #21
0
    //private int delegateIndex;
    //private int taskIndex;

    //private bool isDelegate;
    //private int nextIndex;
    //private void GetNextIndex()
    //{

    //}
    /// <summary>
    /// Adds the play.
    /// </summary>
    /// <param name="play">Play.</param>
    /// <param name="index">Index. -1表示添加在末尾</param>
    public void AddPlay(IPlay play, int index = -1)
    {
        if (play == null)
        {
            return;
        }
        if (index == -1)
        {
            playList.Add(play);
        }
        else if (index < 0 || index > playList.Count)
        {
            return;
        }
        else
        {
            playList.Insert(index, play);
        }
    }
예제 #22
0
        public bool Evaluate(IPlay <TicTacToe> play, TableState <TicTacToe> tableState)
        {
            var ttt_play       = play as TicTacToePlay;
            var ttt_tableState = tableState as TicTacToeTableState;

            //verifica que no se salga de los límites del tablero
            if (ttt_play.Row >= 0 && ttt_play.Row < ttt_tableState.CountRows && ttt_play.Column >= 0 && ttt_play.Column < ttt_tableState.CountColumns)
            {
                //verifica que en esa posición no haya nada
                if (ttt_tableState[ttt_play.Row, ttt_play.Column] != null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #23
0
        public bool Evaluate(IPlay <FourInLine> play, TableState <FourInLine> tableState)
        {
            var f_play       = play as FourInLinePlay;
            var f_tableState = tableState as FourInLineTableState;

            //verifica que no se salga de los límites del tablero
            if (f_play.Column >= 0 && f_play.Column < f_tableState.CountColumns)
            {
                //verifica que en esa columna no esté llena
                for (int i = 0; i < f_tableState.CountColumns; i++)
                {
                    if (f_tableState[i, f_play.Column] == null)
                    {
                        return(true);
                    }
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
예제 #24
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         IPlay objPlay = null;
         if (comboBox1.Text == "DekTec101")
         {
             objPlay = new DekTec101();
         }
         else if (comboBox1.Text == "DekTec102")
         {
             objPlay = new DekTec102();
         }
         else if (comboBox1.Text == "DekTec103")
         {
             objPlay = new DekTec103();
         }
         lblResult.Text = objPlay.Play();
     }
     catch
     {
         lblResult.Text = "Invalid selection";
     }
 }
예제 #25
0
 public AdvertisementPlayer(IPlay player)
 {
     m_player = player;
 }
예제 #26
0
        /// <summary>
        /// Método que le da valores a las jugadas según las ventajas que le puedan brindar a los jugadores realizarlas
        /// </summary>
        /// <param name="play"></param>
        /// <returns></returns>
        public override double PlayScore(IPlay <TicTacToe> play)
        {
            TicTacToePlay my_play = play as TicTacToePlay;
            int           row     = 0;
            int           column  = 0;
            int           count   = 0;
            bool          same    = true;

            for (int x = 0; x < board.GetLength(0); x++)
            {
                for (int i = 0; i < board.GetLength(1); i++)
                {
                    if (board[x, 0] != board[x, i])
                    {
                        row    = x;
                        column = i;
                        same   = false;
                    }
                    if (same)
                    {
                        count++;
                    }
                }
                if (count == board.GetLength(0) - 1)
                {
                    if (board[row, column] == null)
                    {
                        if (my_play.Row == row && my_play.Column == column)
                        {
                            return(4);
                        }
                    }
                }
            }
            count = 0;
            same  = true;
            for (int y = 0; y < board.GetLength(0); y++)
            {
                for (int i = 0; i < board.GetLength(1); i++)
                {
                    if (board[0, y] != board[i, y])
                    {
                        row    = i;
                        column = y;
                        same   = false;
                    }
                    if (same)
                    {
                        count++;
                    }
                }
                if (count == board.GetLength(1) - 1)
                {
                    if (board[row, column] == null)
                    {
                        if (my_play.Row == row && my_play.Column == column)
                        {
                            return(4);
                        }
                    }
                }
            }

            count = 0;
            same  = true;
            for (int x = 0; x < board.GetLength(0); x++)
            {
                for (int y = 0; y < board.GetLength(1); y++)
                {
                    if (x == y)
                    {
                        if (board[0, 0] != board[x, y])
                        {
                            row    = x;
                            column = y;
                            same   = false;
                        }
                        if (same)
                        {
                            count++;
                        }
                    }
                }
            }
            if (count == board.GetLength(1) - 1)
            {
                if (board[row, column] == null)
                {
                    if (my_play.Row == row && my_play.Column == column)
                    {
                        return(4);
                    }
                }
            }

            count = 0;
            same  = true;
            for (int x = 0; x < board.GetLength(0); x++)
            {
                for (int y = board.GetLength(1) - 1; y > 0; y--)
                {
                    if (x == y)
                    {
                        if (board[0, board.GetLength(0) - 1] != board[x, y])
                        {
                            row    = x;
                            column = y;
                            same   = false;
                        }
                        if (same)
                        {
                            count++;
                        }
                    }
                }
            }
            if (count == board.GetLength(1) - 1)
            {
                if (board[row, column] == null)
                {
                    if (my_play.Row == row && my_play.Column == column)
                    {
                        return(4);
                    }
                }
            }
            if (my_play.Row == 0 && my_play.Column == 0)//jugue en la esqina superior izquierda
            {
                return(2);
            }
            if (my_play.Row == 0 && my_play.Column == board.GetLength(1) - 1) //jugue en la esqina superior derecha
            {
                return(2);
            }
            if (my_play.Row == board.GetLength(0) - 1 && my_play.Column == board.GetLength(1) - 1)//jugue en la esqina inferior derecha
            {
                return(2);
            }
            if (my_play.Row == board.GetLength(0) - 1 && my_play.Column == 0)//jugue en la esqina inferior izquierda
            {
                return(2);
            }
            if (my_play.Column == 1 && my_play.Row == 1)//Juegue en el centro
            {
                return(3);
            }
            else
            {
                return(1);
            }
        }
예제 #27
0
        /// <summary>
        ///  Método que recibe una jugada y la efectúa en el tablero poniendo en la fila y la columna correspondientes el
        ///  string del jugador que realiza la jugada
        /// </summary>
        /// <param name="play"></param>
        /// <param name="current_player_info"></param>
        public void Play(IPlay <TicTacToe> play, PlayerInfo current_player_info)
        {
            var my_new_play = play as TicTacToePlay;

            Board[my_new_play.Row, my_new_play.Column] = current_player_info.player_id;
        }
예제 #28
0
파일: Form1.cs 프로젝트: imrole/c-
 private void button1_Click(object sender, EventArgs e)
 {
     m  = new MP3();
     ip = (IPlay)m;
 }
예제 #29
0
		private bool IsCreator(IPlay aDoc)
		{
			return true;// aDoc.CreatorId == Context.Current.User.Id;
		}
예제 #30
0
 public string ToJson(IPlay anObject)
 {
     throw new NotImplementedException();
 }
예제 #31
0
 public void Init()
 {
     PersonalList = new List <Personal>();
     play         = new Running();
 }
예제 #32
0
 public MindTouch.Tasking.Result<IPlay> Insert(IPlay aDoc, MindTouch.Tasking.Result<IPlay> aResult)
 {
     throw new NotImplementedException();
 }
예제 #33
0
		public string ToJson(IPlay anObject)
		{
			ArgCheck.NotNull("anObject", anObject);
			return thePlayDataMapper.ToJson(anObject);
		}
예제 #34
0
		public Result<IPlay> Update(string id,string rev, IPlay aDoc, Result<IPlay> aResult)
		{
			ArgCheck.NotNull("aDoc", aDoc);
			ArgCheck.NotNullNorEmpty("id", id);
			ArgCheck.NotNullNorEmpty("rev", rev);
			Coroutine.Invoke(UpdateHelper, id, rev, aDoc, new Result<IPlay>()).WhenDone(
				aResult.Return,
				aResult.Throw
				);
			return aResult;
		}
예제 #35
0
 public People(IPlay play)
 {
     _play = play;
 }
예제 #36
0
 public void Register(IPlay iPlay)
 {
     this.iPlay = iPlay;
 }
예제 #37
0
		private bool HasAuthorization(IPlay aDoc)
		{
			//Check if user isn't set, or if he isn't creator or collaborator.
			if (Context.Current.User == null || (!IsCreator(aDoc) && !IsCollaborator(aDoc)))
				return false;
			return true;
		}
예제 #38
0
 public MindTouch.Xml.XDoc ToXml(IPlay anObject)
 {
     throw new NotImplementedException();
 }
예제 #39
0
 public PlayGameController(ILogger <AuthController> logger, IPlay play)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _play   = play;
 }
예제 #40
0
 public MindTouch.Tasking.Result<IPlay> Update(string id, string rev, IPlay aDoc, MindTouch.Tasking.Result<IPlay> aResult)
 {
     throw new NotImplementedException();
 }
예제 #41
0
 public void Play(IPlay day)
 {
     day.PlayToday();
 }
예제 #42
0
		private bool IsCollaborator(IPlay aDoc)
		{
			IUser current = Context.Current.User;

			foreach (string collab in aDoc.CollaboratorsId)
			{
				if (current.Groups.Contains(collab) || collab == current.Id)
					return true;
			}
			return false;
		}
예제 #43
0
파일: Home.cs 프로젝트: monsterNY/vlxm
 public void Init()
 {
     PersonalList = new List <Personal>();
     play         = new WatchTv();
 }