public override void OnInitialize() { base.OnInitialize(); var width = choices.Count * SKILL_FRAME_DISTANCE + 2 * SKILL_FRAME_DISTANCE; var height = 100; skillPanel = new SkillPanel { HAlign = 0.5f, VAlign = 0.5f }; skillPanel.Width.Set(width, 0f); skillPanel.Height.Set(height, 0f); skillPanel.BackgroundColor = BACKGROUD_PANEL_COLOR; List <SkillButton> panels = choices .Select(choice => SkillButton.getSkillButton(choice, skill => onWayPicked.Invoke(skill as Way))) .ToList(); foreach (int i in Enumerable.Range(0, panels.Count)) { var currentPanel = panels[i]; currentPanel.Left.Set((i + 1) * SKILL_FRAME_DISTANCE, 0f); currentPanel.VAlign = 0.5f; skillPanel.Append(currentPanel); } Append(skillPanel); }
private void pairWithButtons() { foreach (var level in skillsByLevel) { var pairedLevel = level .Select(skillNode => { var button = SkillButton.getSkillButton(skillNode.getSkill(), skill => { onSkillPicked.Invoke(skill); }); skillNodeToButton.Add(skillNode, button); return(new Tuple <SkillNode, SkillButton>(skillNode, button)); }) .ToList(); nodesWithButtons.Add(pairedLevel); } }