private void PopulateList() { if (assignedComp == null) return; components.Clear(); int pos_y = 10; foreach (PlayerAction act in assignedComp.Actions) { var newButt = new PlayerActionButton(act, _resourceManager); newButt.Position = new Point(10, pos_y); newButt.Update(0); var newLabel = new Label(act.Name, "CALIBRI", _resourceManager); newLabel.Update(0); newLabel.Position = new Point(10 + newButt.ClientArea.Width + 5, pos_y + (int) (newButt.ClientArea.Height/2f) - (int) (newLabel.ClientArea.Height/2f)); components.Add(newButt); components.Add(newLabel); pos_y += 5 + newButt.ClientArea.Height; } }
private void PopulateList() { if (assignedComp == null) { return; } components.Clear(); int pos_y = 10; foreach (PlayerAction act in assignedComp.Actions) { var newButt = new PlayerActionButton(act, _resourceManager); newButt.Position = new Point(10, pos_y); newButt.Update(0); var newLabel = new Label(act.Name, "CALIBRI", _resourceManager); newLabel.Update(0); newLabel.Position = new Point(10 + newButt.ClientArea.Width + 5, pos_y + (int)(newButt.ClientArea.Height / 2f) - (int)(newLabel.ClientArea.Height / 2f)); components.Add(newButt); components.Add(newLabel); pos_y += 5 + newButt.ClientArea.Height; } }
private void assignAction(int slot, IPlayerAction act) { slots[slot] = new PlayerActionButton(act, _resourceManager); slots[slot].UserData = slot; }