/// <summary> /// User full field update event /// </summary> /// <param name="userID">User ID</param> /// <param name="cells">Cells</param> private void UserFullFieldUpdateEvent(int userID, ECell[] cells) { if (users.IsIDValid(userID)) { IHostUser user = users[userID] as IHostUser; if (user != null) { ECell[] old_cells = new ECell[Field.width * Field.height]; if (user.FieldInternal.CopyCellsTo(old_cells, false)) { if (user.FieldInternal.UpdateCells(cells)) { OnUserFieldUpdate?.Invoke(user, old_cells, cells); } } } } }
/// <summary> /// User partial field update event /// </summary> /// <param name="userID">User ID</param> /// <param name="cellPositions">Cell positions</param> private void UserPartialFieldUpdateEvent(int userID, CellPosition[] cellPositions) { if (users.IsIDValid((int)userID)) { IHostUser user = users[(int)userID] as IHostUser; if (user != null) { ECell[] old_cells = new ECell[Field.width * Field.height]; if (user.FieldInternal.CopyCellsTo(old_cells, false)) { foreach (CellPosition cell_position in cellPositions) { user.FieldInternal.SetCell(cell_position.Cell, (int)(cell_position.X), (int)(cell_position.Y)); } ECell[] new_cells = new ECell[old_cells.Length]; if (user.FieldInternal.CopyCellsTo(new_cells, false)) { OnUserFieldUpdate?.Invoke(user, old_cells, new_cells); } } } } }