From 9f2235e88900fd955ea28c60b5d1d21c3383562d Mon Sep 17 00:00:00 2001 From: hppeng Date: Wed, 6 Jul 2022 20:13:28 -0700 Subject: [PATCH] Some design work for how sliders/toggles are going to interface with damage calc/stat agg pipeline --- js/atree.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/js/atree.js b/js/atree.js index 945cab7..76b1840 100644 --- a/js/atree.js +++ b/js/atree.js @@ -558,7 +558,11 @@ const atree_collect_spells = new (class extends ComputeNode { /** * Make interactive elements (sliders, buttons) * - * Signature: AbilityActiveUINode(atree-merged: MergedATree) => List[ + * Signature: AbilityActiveUINode(atree-merged: MergedATree) => List[ElemState] + * + * ElemState: { + * value: int // value for sliders; 0-1 for toggles + * } */ const atree_make_actives = new (class extends ComputeNode { constructor() { super('atree-make-sliders'); } @@ -567,6 +571,21 @@ const atree_make_actives = new (class extends ComputeNode { const merged_abils = input_map.get('atree-merged'); const atree_order = input_map.get('atree-order'); const atree_html = input_map.get('atree-elements'); + const ret_states = []; + const slider_map = new Map(); + + // first, pull out all the sliders. + //add in slider(s) +// for (const effect of ability.effects) { +// if (effect['type'] === "stat_scaling" && effect['slider'] === true) { +// let slider_container = gen_slider_labeled(effect['slider_name'], [], effect['min'], effect['max'], effect['slider_step'], effect['default_val'], "ability-slider" + ability.id, effect['slider_color'], []); +// active_tooltip.appendChild(slider_container); +// } +// } +// active_tooltip.id = "atree-ab-" + ability.id; +// +// active_tooltip.appendChild(tooltip_cost.cloneNode(true)); + return ret_states; } })().link_to(atree_node, 'atree-order').link_to(atree_merge, 'atree-merged').link_to(atree_render_active, 'atree-elements'); @@ -871,17 +890,6 @@ function render_AT(UI_elem, list_elem, tree) { active_tooltip.append(active_tooltip_blockers); } - //add in slider(s) - for (const effect of ability.effects) { - if (effect['type'] === "stat_scaling" && effect['slider'] === true) { - let slider_container = gen_slider_labeled(effect['slider_name'], [], effect['min'], effect['max'], effect['slider_step'], effect['default_val'], "ability-slider" + ability.id, effect['slider_color'], []); - active_tooltip.appendChild(slider_container); - } - } - active_tooltip.id = "atree-ab-" + ability.id; - - active_tooltip.appendChild(tooltip_cost.cloneNode(true)); - //append node and active tooltips to corresponding parent elems node_elem.appendChild(node_tooltip); //list_elem.appendChild(active_tooltip); NOTE: moved to `atree_render_active`