[c5a3d1]: Classes / Field / Field.cs  Maximize  Restore  History

Download this file

34 lines (25 with data), 990 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace YuGiOh_Ultra {
public class Field : IEnumerable<ACard> {
public ObservableCollection<ACard> Cards { get; private set; }
public const uint MAX_CARDS = 5;
public Field() { Cards = new ObservableCollection<ACard>(); }
public bool Add( ACard c ) {
if( Cards.Count == MAX_CARDS ) return false;
Cards.Add( c );
return true;
}
public void Remove( ACard c ) { Cards.Remove( c ); }
public ACard this[int i] {
get { return Cards[i]; }
}
public ACard RemoveAt( int index ) {
ACard r = Cards[index];
Cards.RemoveAt(index);
return r;
}
public IEnumerator<ACard> GetEnumerator() { return Cards.GetEnumerator(); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}
}