本文整理汇总了C#中Chain.ReportMatch方法的典型用法代码示例。如果您正苦于以下问题:C# Chain.ReportMatch方法的具体用法?C# Chain.ReportMatch怎么用?C# Chain.ReportMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chain
的用法示例。
在下文中一共展示了Chain.ReportMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMatch
//.........这里部分代码省略.........
{
if (StateAt(left - 1, y) != GridElement.ElementState.Block)
break;
if (!MatchAt(left - 1, y, block))
break;
left--;
}
int right = x + 1;
while (right < PlayWidth)
{
if (StateAt(right, y) != GridElement.ElementState.Block)
break;
if (!MatchAt(right, y, block))
break;
right++;
}
int bottom = y;
while (bottom > 1)
{
if (StateAt(x, bottom - 1) != GridElement.ElementState.Block)
break;
if (!MatchAt(x, bottom - 1, block))
break;
bottom--;
}
int top = y + 1;
while (top < PlayHeight)
{
if (StateAt(x, top) != GridElement.ElementState.Block)
break;
if (!MatchAt(x, top, block))
break;
top++;
}
int width = right - left;
int height = top - bottom;
int magnitude = 0;
bool horizontalPattern = false;
bool verticalPattern = false;
if (width >= MinimumPatternLength)
{
horizontalPattern = true;
magnitude += width;
}
if (height >= MinimumPatternLength)
{
verticalPattern = true;
magnitude += height;
}
if (!horizontalPattern && !verticalPattern)
{
block.EndChainInvolvement(chain);
return;
}
if (chain == null)
{
chain = ChainManager.CreateChain();
}
// if pattern matches both directions
if (horizontalPattern && verticalPattern)
magnitude--;
// kill the pattern's blocks and look for touching garbage
block.StartDying(chain, magnitude);
if (horizontalPattern)
{
// kill the pattern's blocks
for (int killX = left; killX < right; killX++)
{
if (killX != x)
{
BlockAt(killX, y).StartDying(chain, magnitude);
}
}
}
if (verticalPattern)
{
// kill the pattern's blocks
for (int killY = bottom; killY < top; killY++)
{
if (killY != y)
{
BlockAt(x, killY).StartDying(chain, magnitude);
}
}
}
chain.ReportMatch(magnitude, block);
}