Browse Source

improve quest detail view in quest dialog

Kolja Strohm 9 months ago
parent
commit
c2e95a95ef
3 changed files with 46 additions and 33 deletions
  1. 31 25
      FactoryCraft/QuestDialog.cpp
  2. 3 2
      FactoryCraft/QuestRequirement.cpp
  3. 12 6
      FactoryCraft/QuestReward.cpp

+ 31 - 25
FactoryCraft/QuestDialog.cpp

@@ -35,7 +35,7 @@ QuestDialog::QuestDialog(int playerId)
         << (Framework::Fenster::Style::Titel
                | Framework::Fenster::Style::Erlaubt
                | Framework::Fenster::Style::Sichtbar)
-        << "\" title-height=\"20\"/></dialog>";
+        << "\" title-height=\"30\" title-font-size=\"20\"/></dialog>";
     this->uiml = new Framework::XML::Element(uiml);
 }
 
@@ -264,8 +264,7 @@ void QuestDialog::api(
                 {
                     if (quest->getQuestId().istGleich(questId))
                     {
-                        for (QuestReward* reward :
-                            quest->rewards)
+                        for (QuestReward* reward : quest->rewards)
                         {
                             if (reward->getRewardId().istGleich(reqardId))
                             {
@@ -349,35 +348,35 @@ void QuestDialog::showQuestDetails(
 {
     zParent->setAttribute("title", zQuest->questName);
     zParent->addChild(new Framework::XML::Element(
-        (((Framework::Text(
-               "<text id=\"quest_description\" width=\"50%\" height=\"50%\" "
-               "align-left=\"start\" align-top=\"start\" vScroll=\"auto\" "
-               "style=\"")
+        (((Framework::Text("<text id=\"quest_description\" width=\"50% - 15\" "
+                           "height=\"50% - 10\" "
+                           "align-left=\"start\" margin-left=\"10\" "
+                           "align-top=\"start\" margin-top=\"10\" border=\"1\" "
+                           "border-color=\"0xFF52525E\" vScroll=\"auto\" "
+                           "style=\"")
               += Framework::TextFeld::Style::Text
                | Framework::TextFeld::Style::Mehrzeilig
                | Framework::TextFeld::Style::AutoLineBreak)
              += "\">")
             += zQuest->description)
         += "</text>"));
-    zParent->addChild(new Framework::XML::Element(
-        "<text id=\"quest_requirements_title\" width=\"50%\" height=\"30\" "
-        "align-left=\"quest_description\" align-top=\"start\" "
-        "text-align-horizontal=\"center\"  text-align-vertical=\"center\" "
-        "font-size\"20\">Requirements</text>"));
-    zParent->addChild(new Framework::XML::Element(
-        "<text id=\"quest_rewards_title\" width=\"50%\" height=\"30\" "
-        "align-left=\"start\" align-top=\"quest_description\" "
-        "text-align-horizontal=\"center\"  text-align-vertical=\"center\" "
-        "font-size\"20\">Rewards</text>"));
     Framework::XML::Element* requirementsContainer
         = new Framework::XML::Element(
-            "<frame id=\"quest_requirements\" align-left=\"start\" "
-            "align-top=\"quest_requirements_title\" width=\"50%\" "
+            "<frame id=\"quest_requirements\" align-left=\"quest_description\" "
+            "margin-left=\"10\" "
+            "align-top=\"start\" margin-top=\"10\" width=\"50% - 15\" "
             "height=\"100% - "
-            "70\" vScroll=\"auto\" display=\"column\" gap=\"10\"/>");
+            "50\" vScroll=\"auto\" display=\"column\" gap=\"10\" border=\"1\" "
+            "border-color=\"0xFF52525E\"/>");
+    requirementsContainer->addChild(new Framework::XML::Element(
+        "<text id=\"quest_requirements_title\" width=\"100%\" "
+        "height=\"30\" text-align-horizontal=\"center\"  "
+        "text-align-vertical=\"center\" "
+        "font-size=\"20\">Requirements</text>"));
     requirementsContainer->setAttribute("style",
         Framework::Text() += (Framework::Fenster::Style::Sichtbar
-                              | Framework::Fenster::Style::Erlaubt));
+                              | Framework::Fenster::Style::Erlaubt
+                              | Framework::Fenster::Style::Rahmen));
     for (QuestRequirement* requirement : zQuest->requirements)
     {
         requirement->addRequirementUIML(zStorage,
@@ -387,12 +386,19 @@ void QuestDialog::showQuestDetails(
     }
     zParent->addChild(requirementsContainer);
     Framework::XML::Element* rewardsContainer = new Framework::XML::Element(
-        "<frame id=\"quest_rewards\" align-left=\"start\" "
-        "align-top=\"quest_rewards_title\" width=\"50%\" height=\"50% - "
-        "30\" vScroll=\"auto\" display=\"column\" gap=\"10\"/>");
+        "<frame id=\"quest_rewards\" align-left=\"start\" margin-left=\"10\" "
+        "margin-top=\"10\" "
+        "align-top=\"quest_description\" width=\"50% - 15\" height=\"50% - "
+        "20\" vScroll=\"auto\" display=\"column\" gap=\"10\" border=\"1\" "
+        "border-color=\"0xFF52525E\"/>");
+    rewardsContainer->addChild(new Framework::XML::Element(
+        "<text id=\"quest_rewards_title\" width=\"100%\" height=\"30\" "
+        "text-align-horizontal=\"center\"  text-align-vertical=\"center\" "
+        "font-size=\"20\">Rewards</text>"));
     rewardsContainer->setAttribute("style",
         Framework::Text() += (Framework::Fenster::Style::Sichtbar
-                              | Framework::Fenster::Style::Erlaubt));
+                              | Framework::Fenster::Style::Erlaubt
+                              | Framework::Fenster::Style::Rahmen));
     for (QuestReward* reward : zQuest->rewards)
     {
         reward->addRewardUIML(rewardsContainer,

+ 3 - 2
FactoryCraft/QuestRequirement.cpp

@@ -66,15 +66,16 @@ void QuestRequirementOpenDialog::addRequirementUIML(QuestStorage* zStorage,
     container->addChild(text);
     auto status = new Framework::XML::Element("<text margin-top=\"10\" width=\"auto\" height=\"auto\"/>");
     status->setAttribute("align-top", text->getAttributeValue("id"));
+    status->setAttribute("align-x", text->getAttributeValue("id"));
     if (zStorage->zStorage(getRequirementId())->isFullfilled())
     {
         status->setText("Completed");
-        status->setAttribute("color", "0xFF00FF00");
+        status->setAttribute("text-color", "0xFF00FF00");
     }
     else
     {
         status->setText("Not completed");
-        status->setAttribute("color", "0xFFFF0000");
+        status->setAttribute("text-color", "0xFFFF0000");
     }
     container->addChild(status);
     zParent->addChild(container);

+ 12 - 6
FactoryCraft/QuestReward.cpp

@@ -111,14 +111,15 @@ void QuestRewardGiveItems::addRewardUIML(Framework::XML::Element* zParent,
     QuestStorage* zStorage,
     Framework::Text onClickPrefix)
 {
-    Framework::XML::Element* container = new Framework::XML::Element(
-        "<frame width=\"100%\" height=\"50\" display=\"column\" gap=\"10\"/>");
+    Framework::XML::Element* container
+        = new Framework::XML::Element("<frame width=\"100%\" height=\"auto\" "
+                                      "display=\"column\" gap=\"10\"/>");
     container->setAttribute("style",
         Framework::Text() += (Framework::Fenster::Style::Sichtbar
                               | Framework::Fenster::Style::Erlaubt));
     container->setAttribute("id", Framework::Text("reward_") += rewardId);
-    container->addChild(
-        new Framework::XML::Element("<text>Item Reward:</text>"));
+    container->addChild(new Framework::XML::Element(
+        "<text width=\"auto\" height=\"auto\">Item Reward:</text>"));
     for (ItemStackInfo* info : items)
     {
         auto stack = new Framework::XML::Element(
@@ -126,12 +127,17 @@ void QuestRewardGiveItems::addRewardUIML(Framework::XML::Element* zParent,
         stack->setAttribute(
             "id", (Framework::Text("reward_") += rewardId) += "_item_stack");
         stack->setAttribute("count", info->getCount());
+        stack->setAttribute("type", info->zItem()->getTypeId());
         stack->addChild(
             new Framework::XML::Element(info->zItem()->getTooltipUIML()));
-        auto text = new Framework::XML::Element("<text margin-left=\"10\"/>");
-        text->setText(info->zItem()->getName());
+        auto text = new Framework::XML::Element(
+            "<text margin-left=\"10\" width=\"auto\" height=\"auto\"/>");
+        text->setText((Framework::Text(info->getCount()) += " ")
+                      += info->zItem()->getName());
         text->setAttribute("align-left", stack->getAttributeValue("id"));
+        text->setAttribute("align-y", stack->getAttributeValue("id"));
         container->addChild(stack);
+        container->addChild(text);
     }
     zParent->addChild(container);
 }