public void RemoveItem(Item item) { if (item == outputItem) { // Removed output item ConsumeRecipeItems(); CreateOutput(); OnGridChanged?.Invoke(this, EventArgs.Empty); } else { // Removed item from grid for (int x = 0; x < GRID_SIZE; x++) { for (int y = 0; y < GRID_SIZE; y++) { if (GetItem(x, y) == item) { // Removed this one RemoveItem(x, y); } } } } }
public void SetItem(Item item, int x, int y) { if (item != null) { item.RemoveFromItemHolder(); item.SetItemHolder(this); } itemArray[x, y] = item; CreateOutput(); OnGridChanged?.Invoke(this, EventArgs.Empty); }
public void DecreaseItemAmount(int x, int y) { if (GetItem(x, y) != null) { GetItem(x, y).amount--; if (GetItem(x, y).amount == 0) { RemoveItem(x, y); } OnGridChanged?.Invoke(this, EventArgs.Empty); } }
private void GridChanged() { _isSaveDirty = true; OnGridChanged?.Invoke(); if (_grid is not null && _grid.IsSudokuSolved()) { _gameTimerManager.StopTimer(); if (CurrentModalState == ModalState.None) { SetModalState(ModalState.EndGame); } } }
public void IncreaseItemAmount(int x, int y) { GetItem(x, y).amount++; OnGridChanged?.Invoke(this, EventArgs.Empty); }
public GridListener(OnGridChanged onGridChanged) { this.ActionOnGridChange = onGridChanged; }