added item probability
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -30,8 +30,8 @@ export interface JoinResult {
|
||||
|
||||
export interface PieceInfo {
|
||||
type: number;
|
||||
itemId: string | null;
|
||||
itemIndex: number;
|
||||
/** items[i] is the item in mino i, null if none. */
|
||||
items: (string | null)[];
|
||||
}
|
||||
|
||||
export interface ItemCell {
|
||||
@@ -43,8 +43,8 @@ export interface ItemCell {
|
||||
export interface ActivePieceState {
|
||||
type: number;
|
||||
cells: [number, number][];
|
||||
itemIndex: number;
|
||||
itemId: string | null;
|
||||
/** items[i] is the item in cells[i], null if none. */
|
||||
items: (string | null)[];
|
||||
}
|
||||
|
||||
export interface PlayerState {
|
||||
|
||||
@@ -115,7 +115,8 @@ export function drawBoard(
|
||||
active.cells.forEach(([x, y], index) => {
|
||||
if (y < 0) return;
|
||||
drawBlock(ctx, x * cell, y * cell, cell, color);
|
||||
if (active.itemId && index === active.itemIndex) drawItemIcon(ctx, x * cell, y * cell, cell, active.itemId);
|
||||
const itemId = active.items[index];
|
||||
if (itemId) drawItemIcon(ctx, x * cell, y * cell, cell, itemId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -141,6 +142,7 @@ export function drawPreviewPiece(
|
||||
const px = Math.round(ox + x * cell);
|
||||
const py = Math.round(oy + y * cell);
|
||||
drawBlock(ctx, px, py, cell, color);
|
||||
if (piece.itemId && index === piece.itemIndex) drawItemIcon(ctx, px, py, cell, piece.itemId);
|
||||
const itemId = piece.items[index];
|
||||
if (itemId) drawItemIcon(ctx, px, py, cell, itemId);
|
||||
});
|
||||
}
|
||||
|
||||