public MatchesUndoer(BoardData _boardData)
	{
		boardData = _boardData;
		matchesFinder = new MatchesFinder(boardData);
		
		lastMatchedBoardPieces = new List<Match3BoardPiece>(32);
	}
Example #2
0
    public MatchesUndoer(BoardData _boardData)
    {
        boardData     = _boardData;
        matchesFinder = new MatchesFinder(boardData);

        lastMatchedBoardPieces = new List <Match3BoardPiece>(32);
    }
Example #3
0
    public override void InitComponent()
    {
        Debug.Log("Match3BoardGameLogic InitComponent");
        base.InitComponent();

        SetupBoardHoles();

        // Create an instance of the board matches finder.
        matchesFinder = new MatchesFinder(boardData);
        //TODO:remove this bug trap after finishing the bug fix
//		matchesFinder.useBugTrap = true;

        // Register to AbstractBoardAnimations to receive animation events.
        BoardAnimations.OnTilesSwitchAnimFinished += OnTilesSwitchAnimFinished;

        Match3Tile.OnTileMovingChanged += OnTileMovingChanged;

        if (loseConditions != null)
        {
            loseConditions.gameObject.SetActive(true);
            loseConditions.Pause(true);
            loseConditions.OnLoseChecked += OnLoseChecked;
        }

        if (winConditions != null)
        {
            winConditions.gameObject.SetActive(true);
            loseConditions.Pause(true);
            winConditions.OnWinChecked += OnWinChecked;
        }

        // Pause the board game logic
        SetBoardEnabledState(false);
    }
Example #4
0
        public void TestGetAbsoluteTimeForFalse()
        {
            MatchesFinder finder = new MatchesFinder();
            List <double> list   = new List <double>();

            list.Add(8.02);
            double result = finder.getAbsoluteTime(list);

            Assert.AreNotEqual(8.03, result);
        }
	/// <summary>
	/// Defined to also give this component the ability to be enabled/disabled.
	/// </summary>
	void Start()
	{
		board = Match3BoardGameLogic.Instance.boardData;
		
		// Register to the board's OnStable event.
		Debug.Log("[BoardShuffleController] Registering to the board's OnStableBoard event...");
		Match3BoardGameLogic.OnStableBoard += OnStableBoardEvent;
		
		matchesFinder = new MatchesFinder(board);
		possibleMatchesFinder = new PossibleMatchesFinder(board);
		matchesUndoer = new MatchesUndoer(board);
		possibleMatchGenerator = new PossibleMatchGenerator(board);
	}
Example #6
0
    /// <summary>
    /// Defined to also give this component the ability to be enabled/disabled.
    /// </summary>
    void Start()
    {
        board = Match3BoardGameLogic.Instance.boardData;

        // Register to the board's OnStable event.
        Debug.Log("[BoardShuffleController] Registering to the board's OnStableBoard event...");
        Match3BoardGameLogic.OnStableBoard += OnStableBoardEvent;

        matchesFinder          = new MatchesFinder(board);
        possibleMatchesFinder  = new PossibleMatchesFinder(board);
        matchesUndoer          = new MatchesUndoer(board);
        possibleMatchGenerator = new PossibleMatchGenerator(board);
    }
Example #7
0
        public void TestGetMatchesForFalse()
        {
            MatchesFinder    finder = new MatchesFinder();
            List <DataPoint> micro  = new List <DataPoint>();
            List <DataPoint> song   = new List <DataPoint>();

            micro.Add(new DataPoint(1.0, 123, 1));
            song.Add(new DataPoint(2.0, 123, 1));
            double expected = 2;
            double result   = finder.getMatches(micro, song).totalMatches;

            Assert.AreNotEqual(expected, result);
        }
        private List <Match> findMatches(List <DataPoint> dataCheck, List <Song> songs)
        {
            if (songs == null)
            {
                return(null);
            }
            matchesFinder = new MatchesFinder();
            List <Match> matches = new List <Match>();
            int          n       = 0;

            foreach (var song in songs)
            {
                matches.Add(new Match(Path.GetFileNameWithoutExtension(song.songName), matchesFinder.getMatches(dataCheck, song.points)));
            }
            return(matches);
        }
Example #9
0
        public int Handle(FindTextOptions options)
        {
            var dir         = GetSearchingDirectory();
            var logFileName = GetLogFilename();

            Console.WriteLine($"looking for: \"{options.SearchText}\"");
            var matches = MatchesFinder.Find(dir, options.SearchText, options.UseRegex);
            var count   = 0;

            if (string.IsNullOrEmpty(options.ReplaceText))
            {
                var logger = new Logger(null);
                logger.Settings.EchoConsole = true;
                var result = JsonConvert.SerializeObject(matches, Formatting.Indented);
                logger.Log(result);
                count = matches.SelectMany(m => m.WorksheetMatches.SelectMany(wm => wm.CellMatches)).Count();
                Console.WriteLine($"{count} matches!");
            }
            else
            {
                var logger = new Logger(GetLogFilename());
                logger.Settings.EchoConsole = true;
                logger.Settings.WriteToFile = true;

                var replaces = MatchesFinder.Replace(matches, options.SearchText, options.ReplaceText, options.UseRegex);
                var result   = JsonConvert.SerializeObject(replaces, Formatting.Indented);
                logger.Log(result);
                count = replaces.SelectMany(m => m.WorksheetMatches.SelectMany(wm => wm.CellMatches)).Count();
                Console.WriteLine($"{count} replaces!");
            }

            if (count == 0)
            {
                Console.WriteLine("Nothing found :-\\ try another word :))");
            }
            Console.WriteLine("Press any key to quit...");
            Console.ReadKey();

            return(0);
        }
	public override void InitComponent() 
	{
		Debug.Log("Match3BoardGameLogic InitComponent");
		base.InitComponent();
		
		SetupBoardHoles();
		
		// Create an instance of the board matches finder.
		matchesFinder = new MatchesFinder(boardData);
		//TODO:remove this bug trap after finishing the bug fix
//		matchesFinder.useBugTrap = true;
		
		// Register to AbstractBoardAnimations to receive animation events.
		BoardAnimations.OnTilesSwitchAnimFinished += OnTilesSwitchAnimFinished;

		Match3Tile.OnTileMovingChanged += OnTileMovingChanged;

		if (loseConditions != null) {
			loseConditions.gameObject.SetActive(true);
			loseConditions.Pause(true);
			loseConditions.OnLoseChecked += OnLoseChecked;
		}

		if (winConditions != null) {
			winConditions.gameObject.SetActive(true);
			loseConditions.Pause(true);
			winConditions.OnWinChecked += OnWinChecked;
		}

		// Pause the board game logic
		SetBoardEnabledState(false);
	}