本文整理汇总了C++中unit::get_ability_list方法的典型用法代码示例。如果您正苦于以下问题:C++ unit::get_ability_list方法的具体用法?C++ unit::get_ability_list怎么用?C++ unit::get_ability_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit
的用法示例。
在下文中一共展示了unit::get_ability_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_displayed_unit
//.........这里部分代码省略.........
label_level_->set_use_markup(true);
}
if(icon_race_) {
icon_race_->set_label("icons/unit-groups/race_" + u.race()->id() + "_30.png");
icon_race_->set_tooltip(u.race()->name(u.gender()));
}
if(icon_alignment_) {
const std::string& alignment_name = u.alignment().to_string();
icon_alignment_->set_label("icons/alignments/alignment_" + alignment_name + "_30.png");
icon_alignment_->set_tooltip(unit_type::alignment_description(
u.alignment(),
u.gender()));
}
if(label_details_minimal_) {
std::stringstream str;
const std::string name = "<span size='large'>" + (!u.name().empty() ? u.name() : " ") + "</span>";
str << name << "\n";
str << "<span color='#a69275'>" << u.type_name() << "</span>" << "\n";
str << "Lvl " << u.level() << "\n";
str << u.alignment() << "\n";
str << utils::join(u.trait_names(), ", ") << "\n";
str << font::span_color(u.hp_color())
<< _("HP: ") << u.hitpoints() << "/" << u.max_hitpoints() << "</span>" << "\n";
str << font::span_color(u.xp_color())
<< _("XP: ") << u.experience() << "/" << u.max_experience() << "</span>";
label_details_minimal_->set_label(str.str());
label_details_minimal_->set_use_markup(true);
}
if(tree_details_) {
std::stringstream str;
str << "<small>";
str << font::span_color(u.hp_color())
<< "<b>" << _("HP: ") << "</b>" << u.hitpoints() << "/" << u.max_hitpoints() << "</span>" << " | ";
str << font::span_color(u.xp_color())
<< "<b>" << _("XP: ") << "</b>" << u.experience() << "/" << u.max_experience() << "</span>" << " | ";
str << "<b>" << _("MP: ") << "</b>"
<< u.movement_left() << "/" << u.total_movement();
str << "</small>";
tree_details_->clear();
add_name_tree_node(
tree_details_->get_root_node(),
"item",
str.str()
);
if (!u.trait_names().empty()) {
auto& header_node = add_name_tree_node(
tree_details_->get_root_node(),
"header",
"<b>" + _("Traits") + "</b>"
);
assert(u.trait_names().size() == u.trait_descriptions().size());
for (size_t i = 0; i < u.trait_names().size(); ++i) {
add_name_tree_node(
header_node,
"item",
u.trait_names()[i],
u.trait_descriptions()[i]
);
}
}
if (!u.get_ability_list().empty()) {
auto& header_node = add_name_tree_node(
tree_details_->get_root_node(),
"header",
"<b>" + _("Abilities") + "</b>"
);
for (const auto& ab : u.ability_tooltips()) {
add_name_tree_node(
header_node,
"item",
std::get<1>(ab),
std::get<2>(ab)
);
}
}
print_attack_details(u.attacks(), tree_details_->get_root_node());
}
}