public CellRange Copy() { CellRange r = new CellRange(); r.CellNumber = this.CellNumber; r.Xindex = this.Xindex; r.Yindex = this.Yindex; r.Dimension1Start = this.Dimension1Start; r.Dimension1End = this.Dimension1End; r.Dimension2Start = this.Dimension2Start; r.Dimension2End = this.Dimension2End; return r; }
public SingleItemBox(CellRange range) { InitializeComponent(); _range = range; idLabel.Content = _range.CellNumber; }
private T_Item SelectNextItemByRange(CellRange cellInfo, String dmId) { if (_items == null) return null; List<T_Item> matchingItems = new List<T_Item>(); int ind = 0; foreach (T_Item item in _items.Values) { if (item.Parameters.FF_Difficulty >= cellInfo.Dimension1Start && item.Parameters.FF_Difficulty <= cellInfo.Dimension1End && item.Parameters.TT_Difficulty >= cellInfo.Dimension2Start && item.Parameters.TT_Difficulty <= cellInfo.Dimension2End) { matchingItems.Add(item.DeepCopy()); } } if (matchingItems.Count == 0) return null; Random r = new Random(); ind = Convert.ToInt32(Math.Round(r.NextDouble() * (matchingItems.Count()-1))); return matchingItems[ind]; }