Some fixes for achievements screen.
Give a bit more space for text, use separate table for main goal, avoid overlapped text in main goal table etc.
This commit is contained in:
parent
87ce3931e5
commit
bf26e4add3
@ -1,17 +1,40 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="2%" y="2%" width="100%" height="96%" layout="vertical-row">
|
<div x="2%" y="1%" width="96%" height="98%" layout="vertical-row">
|
||||||
<!-- The achievement's name is filled in the header at runtime -->
|
<!-- The achievement's name is filled in the header at runtime -->
|
||||||
<header id="title" width="100%" align="center" text_align="center"/>
|
<header id="title" width="100%" align="center" text_align="center"/>
|
||||||
|
|
||||||
<label id="description" width="90%" proportion="1" align="center"
|
<label id="description" width="100%" proportion="2" align="center"
|
||||||
text_align="center" word_wrap="true" text=""/>
|
text_align="center" word_wrap="true" text=""/>
|
||||||
|
|
||||||
<box width="90%" proportion="2" align="center" layout="vertical-row">
|
<div width="100%" proportion="2" layout="vertical-row">
|
||||||
|
<div width="100%" height="100%" layout="horizontal-row">
|
||||||
|
<div width="66%" height="100%" layout="vertical-row">
|
||||||
|
<spacer width="20" proportion="1"/>
|
||||||
|
<label width="100%" align="center"
|
||||||
|
text_align="center" text="Goal"/>
|
||||||
|
<spacer width="20" proportion="1"/>
|
||||||
|
<label id="main-goal-description" width="100%" align="center"
|
||||||
|
text_align="center" word_wrap="true" text=""/>
|
||||||
|
<spacer width="20" proportion="2"/>
|
||||||
|
</div>
|
||||||
|
<div width="33%" height="100%" layout="vertical-row">
|
||||||
|
<spacer width="20" proportion="1"/>
|
||||||
|
<label width="100%" align="center"
|
||||||
|
text_align="center" text="Progress"/>
|
||||||
|
<spacer width="20" proportion="1"/>
|
||||||
|
<label id="main-goal-progress" width="100%" align="center"
|
||||||
|
text_align="center" word_wrap="true" text=""/>
|
||||||
|
<spacer width="20" proportion="2"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<box width="100%" proportion="3" align="center" layout="vertical-row">
|
||||||
<list id="progress-tree" x="0" y="0" width="100%" height="100%" word_wrap="true"/>
|
<list id="progress-tree" x="0" y="0" width="100%" height="100%" word_wrap="true"/>
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<buttonbar id="options" width="90%" height="15%" align="center">
|
<buttonbar id="options" width="100%" height="14%" align="center">
|
||||||
<icon-button id="ok" width="128" height="128"
|
<icon-button id="ok" width="128" height="128"
|
||||||
icon="gui/icons/green_check.png" text="OK"
|
icon="gui/icons/green_check.png" text="OK"
|
||||||
label_location="bottom"/>
|
label_location="bottom"/>
|
||||||
|
@ -37,29 +37,40 @@ using namespace Online;
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
AchievementProgressDialog::AchievementProgressDialog(Achievement *achievement)
|
AchievementProgressDialog::AchievementProgressDialog(Achievement *achievement)
|
||||||
: ModalDialog(0.9f,0.9f), m_achievement(achievement),
|
: ModalDialog(0.95f,0.92f), m_achievement(achievement),
|
||||||
m_self_destroy(false)
|
m_self_destroy(false)
|
||||||
{
|
{
|
||||||
loadFromFile("online/achievement_progress_dialog.stkgui");
|
loadFromFile("online/achievement_progress_dialog.stkgui");
|
||||||
m_progress_table = getWidget<ListWidget>("progress-tree");
|
|
||||||
assert(m_progress_table != NULL);
|
|
||||||
|
|
||||||
m_depth = m_achievement->getInfo()->getDepth();
|
m_depth = m_achievement->getInfo()->getDepth();
|
||||||
|
|
||||||
|
m_progress_table = getWidget<ListWidget>("progress-tree");
|
||||||
|
assert(m_progress_table != NULL);
|
||||||
m_progress_table->clear();
|
m_progress_table->clear();
|
||||||
|
|
||||||
std::vector<ListWidget::ListCell> row;
|
m_main_goal_description = getWidget<LabelWidget>("main-goal-description");
|
||||||
for (int i=0;i<m_depth;i++)
|
assert(m_main_goal_description != NULL);
|
||||||
|
|
||||||
|
m_main_goal_progress = getWidget<LabelWidget>("main-goal-progress");
|
||||||
|
assert(m_main_goal_progress != NULL);
|
||||||
|
|
||||||
|
if (m_depth > 1)
|
||||||
{
|
{
|
||||||
row.push_back(ListWidget::ListCell
|
std::vector<ListWidget::ListCell> row;
|
||||||
(_C("achievement_info", "Goal"), -1, 2, true));
|
for (int i = 1; i < m_depth; i++)
|
||||||
row.push_back(ListWidget::ListCell
|
{
|
||||||
(_C("achievement_info", "Progress"), -1, 1, true));
|
row.push_back(ListWidget::ListCell
|
||||||
|
(_C("achievement_info", "Subgoals"), -1, 2, true));
|
||||||
|
row.push_back(ListWidget::ListCell
|
||||||
|
(_C("achievement_info", "Progress"), -1, 1, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_progress_table->addItem(StringUtils::toString(0), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_progress_table->addItem(StringUtils::toString(0), row);
|
|
||||||
m_row_counter = 1;
|
m_row_counter = 1;
|
||||||
recursiveFillTable(m_achievement->m_progress_goal_tree, m_achievement->m_achievement_info->m_goal_tree, 0);
|
recursiveFillTable(m_achievement->m_progress_goal_tree,
|
||||||
|
m_achievement->m_achievement_info->m_goal_tree, 0);
|
||||||
} // AchievementProgressDialog
|
} // AchievementProgressDialog
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -86,35 +97,50 @@ void AchievementProgressDialog::recursiveFillTable(AchievementInfo::goalTree &pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_achievement->isAchieved() || goal > target)
|
if (m_achievement->isAchieved() || goal > target)
|
||||||
goal = target;
|
|
||||||
|
|
||||||
std::vector<ListWidget::ListCell> row;
|
|
||||||
for (int i=0;i<m_depth;i++)
|
|
||||||
{
|
{
|
||||||
//TODO : for sum, indicate if a subgoal counts towards or against it
|
goal = target;
|
||||||
if (i==depth)
|
}
|
||||||
{
|
|
||||||
std::string temp = StringUtils::toString(goal) + "/" +
|
if (depth == 0)
|
||||||
StringUtils::toString(target);
|
{
|
||||||
core::stringw progress_string(temp.c_str());
|
std::string temp = StringUtils::toString(goal) + "/" +
|
||||||
core::stringw goal_name = niceGoalName(progress.type);
|
StringUtils::toString(target);
|
||||||
row.push_back(ListWidget::ListCell
|
core::stringw progress_string(temp.c_str());
|
||||||
(goal_name, -1, 2, true));
|
core::stringw goal_name = niceGoalName(progress.type);
|
||||||
row.push_back(ListWidget::ListCell
|
|
||||||
(progress_string, -1, 1, true));
|
m_main_goal_description->setText(goal_name, false);
|
||||||
}
|
m_main_goal_progress->setText(progress_string, false);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
row.push_back(ListWidget::ListCell
|
{
|
||||||
(" ", -1, 2, true));
|
std::vector<ListWidget::ListCell> row;
|
||||||
row.push_back(ListWidget::ListCell
|
for (int i = 1; i < m_depth; i++)
|
||||||
(" ", -1, 1, true));
|
{
|
||||||
}
|
//TODO : for sum, indicate if a subgoal counts towards or against it
|
||||||
|
if (i == depth)
|
||||||
|
{
|
||||||
|
std::string temp = StringUtils::toString(goal) + "/" +
|
||||||
|
StringUtils::toString(target);
|
||||||
|
core::stringw progress_string(temp.c_str());
|
||||||
|
core::stringw goal_name = niceGoalName(progress.type);
|
||||||
|
row.push_back(ListWidget::ListCell
|
||||||
|
(goal_name, -1, 2, true));
|
||||||
|
row.push_back(ListWidget::ListCell
|
||||||
|
(progress_string, -1, 1, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row.push_back(ListWidget::ListCell
|
||||||
|
(" ", -1, 2, true));
|
||||||
|
row.push_back(ListWidget::ListCell
|
||||||
|
(" ", -1, 1, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_progress_table->addItem(StringUtils::toString(m_row_counter), row);
|
||||||
|
m_row_counter++;
|
||||||
}
|
}
|
||||||
m_progress_table->addItem(StringUtils::toString(m_row_counter), row);
|
|
||||||
m_row_counter++;
|
|
||||||
|
|
||||||
for (unsigned int i=0;i<progress.children.size();i++)
|
for (unsigned int i = 0; i < progress.children.size(); i++)
|
||||||
{
|
{
|
||||||
recursiveFillTable(progress.children[i],reference.children[i],depth+1);
|
recursiveFillTable(progress.children[i],reference.children[i],depth+1);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ private:
|
|||||||
int m_row_counter;//Used in the recurisve table filling
|
int m_row_counter;//Used in the recurisve table filling
|
||||||
|
|
||||||
GUIEngine::ListWidget* m_progress_table;
|
GUIEngine::ListWidget* m_progress_table;
|
||||||
|
GUIEngine::LabelWidget* m_main_goal_description;
|
||||||
|
GUIEngine::LabelWidget* m_main_goal_progress;
|
||||||
|
|
||||||
GUIEngine::RibbonWidget* m_options_widget;
|
GUIEngine::RibbonWidget* m_options_widget;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user