/// <summary> /// デバッグ枠を表示する /// </summary> /// <param name="g">描画先グラフィックオブジェクト</param> /// <param name="field">フィールド状態</param> private void DrawDebugField(Graphics g, CaptureField field) { for (int y = 0; y < CaptureField.Y_MAX; y++) { for (int x = 0; x < CaptureField.X_MAX; x++) { PuyoType type = field.GetPuyoType(x, y); Rectangle rect = field.GetRect(x, y); DrawDebugRect(g, type, rect); } } }
/// <summary> /// キャプチャ範囲の差分からツモの設置情報を特定する /// </summary> /// <param name="f2">ツモを設置後のキャプチャフィールド</param> /// <param name="pp">設置したツモ</param> /// <returns>ツモの設置情報</returns> public ColorPairPuyo GetStepFromDiff(CaptureField f2, ColorPairPuyo pp) { CaptureField f1 = this; bool foundPivot = false; bool foundSatellite = false; ColorPairPuyo p2 = new ColorPairPuyo(); Point pivotPt = new Point(-1, -1); Point satellitePt = new Point(-1, -1); for (int x = 0; x < X_MAX; x++) { for (int y = 0; y < Y_MAX; y++) { PuyoType pt1 = f1.GetPuyoType(x, y); PuyoType pt2 = f2.GetPuyoType(x, y); if (pt1 != pt2) { if (!foundPivot && pp.Pivot == pt2) { p2.Pos = x; p2.Pivot = pt2; foundPivot = true; pivotPt.X = x; pivotPt.Y = y; } else if (pp.Satellite == pt2) { p2.Satellite = f2.GetPuyoType(x, y); foundSatellite = true; satellitePt.X = x; satellitePt.Y = y; } else { return(null); } if (foundPivot && foundSatellite) { if (pivotPt.X == satellitePt.X && pivotPt.Y < satellitePt.Y) { p2.Dir = Direction4.UP; } else if (pivotPt.X == satellitePt.X) { p2.Dir = Direction4.DOWN; } else if (pivotPt.X < satellitePt.X) { p2.Dir = Direction4.RIGHT; } else { p2.Dir = Direction4.LEFT; } p2.Pos++; return(p2); } } } } return(null); }