public HBContainer(Action action, Rectangle rect) { this.action = action; this.function = () => false; texture = new HotbarTexture(rect); implemented = false; }
public HBContainer(Action action, HotbarTexture hbt) { this.action = action; this.function = () => false; this.texture = hbt; this.implemented = false; }
public static int Add(HotbarTexture icon, Action callback, Func<bool> isActive) { //Select the first uninitialized button HotbarButton button; try { //whoo LINQ button = (from hotbarbutton in hotbarButtons where (hotbarbutton.callback == null && hotbarbutton.iconTexture == null) select hotbarbutton).First(); } catch { //Buttons full return -1; } button.iconTexture = icon; button.callback = callback; button.isActive = isActive ?? (Func<bool>)(() => false); return button.index; }
public static void Add(int index, HotbarTexture icon, Action callback, Func<bool> isActive) { hotbarButtons[index].iconTexture = icon; hotbarButtons[index].callback = callback; hotbarButtons[index].isActive = isActive ?? (Func<bool>)(() => false); }