void DoMatch() { //将确定要消除哪些元素,将其放入markCells列表中 foreach (var _cell in dirtyCells) { int countV; int countH; List <CellPrefabs> _tmpList; GetsameCellsV(_cell, out _tmpList); countV = _tmpList.Count; if (_tmpList.Count > 2) { foreach (var token in _tmpList) { SetToMark(token); } } GetsameCellsH(_cell, out _tmpList); countH = _tmpList.Count; if (_tmpList.Count > 2) { foreach (var token in _tmpList) { SetToMark(token); } } if (SpecialMatch.IsSpecialMatch(_cell, countV, countH)) { ClearMark(_cell); } } }
public static bool IsSpecialMatch(CellPrefabs _cell, int v, int h) { SpecialMatch _sm = new SpecialMatch(); _sm.markCellcountV = v; _sm.markCellcountH = h; _sm.targetCell = _cell; _sm.CheckEleState(); if (_sm._eleState > ElementState.Normal) { _sm.targetCell.bandingElement.IsEffected = false; _sm.targetCell.bandingElement.ChangeElementState(_sm._eleState); return(true); } return(false); }