Some design work for how sliders/toggles are going to interface with damage calc/stat agg pipeline

This commit is contained in:
hppeng 2022-07-06 20:13:28 -07:00
parent e69039eabd
commit 9f2235e889

View file

@ -558,7 +558,11 @@ const atree_collect_spells = new (class extends ComputeNode {
/** /**
* Make interactive elements (sliders, buttons) * 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 { const atree_make_actives = new (class extends ComputeNode {
constructor() { super('atree-make-sliders'); } 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 merged_abils = input_map.get('atree-merged');
const atree_order = input_map.get('atree-order'); const atree_order = input_map.get('atree-order');
const atree_html = input_map.get('atree-elements'); 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'); })().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); 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 //append node and active tooltips to corresponding parent elems
node_elem.appendChild(node_tooltip); node_elem.appendChild(node_tooltip);
//list_elem.appendChild(active_tooltip); NOTE: moved to `atree_render_active` //list_elem.appendChild(active_tooltip); NOTE: moved to `atree_render_active`