Skip to content

Commit

Permalink
Update guis (ldtteam#6564)
Browse files Browse the repository at this point in the history
Bunch of additional UI fixes.
  • Loading branch information
Nightenom authored Feb 17, 2021
1 parent a16daca commit b9c007e
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.minecolonies.coremod.client.gui;

import com.ldtteam.blockout.Pane;
import com.ldtteam.blockout.PaneBuilders;
import com.ldtteam.blockout.controls.Button;
import com.ldtteam.blockout.controls.Text;
import com.ldtteam.blockout.controls.AbstractTextBuilder.TextBuilder;
import com.ldtteam.blockout.views.ScrollingList;
import com.ldtteam.structurize.util.LanguageHandler;
import com.minecolonies.api.colony.ICitizenDataView;
Expand All @@ -19,7 +21,10 @@
import com.minecolonies.coremod.network.messages.server.colony.citizen.RestartCitizenMessage;
import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;

import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -280,31 +285,32 @@ else if ((building.getWorkerId().size() >= building.getMaxInhabitants()) && !bui
rowPane.findPaneOfTypeByID(BUTTON_RESTART, Button.class).off();
}

final StringBuilder attributes = new StringBuilder();
final String intermString = " | ";
final StringTextComponent intermString = new StringTextComponent(" | ");
final TextBuilder textBuilder = PaneBuilders.textBuilder();
int skillCount = citizen.getCitizenSkillHandler().getSkills().entrySet().size();

final List<Map.Entry<Skill, Tuple<Integer, Double>>> list = new ArrayList<>(citizen.getCitizenSkillHandler().getSkills().entrySet());
for (int i = 0; i < list.size(); i++)
for (final Map.Entry<Skill, Tuple<Integer, Double>> entry : citizen.getCitizenSkillHandler().getSkills().entrySet())
{
final Map.Entry<Skill, Tuple<Integer, Double>> entry = list.get(i);
@NotNull final String text = createAttributeText(createColor(primary, secondary, entry.getKey()),
LanguageHandler.format("com.minecolonies.coremod.gui.citizen.skills." + entry.getKey().name().toLowerCase(Locale.US)) + ": " + entry.getValue().getA());
attributes.append(text).append(intermString);
final String skillName = entry.getKey().name().toLowerCase(Locale.US);
final int skillLevel = entry.getValue().getA();
final Style skillStyle = createColor(primary, secondary, entry.getKey());

textBuilder.append(new TranslationTextComponent("com.minecolonies.coremod.gui.citizen.skills." + skillName).setStyle(skillStyle));
textBuilder.append(new StringTextComponent(": " + skillLevel).setStyle(skillStyle));
if (--skillCount > 0)
{
textBuilder.append(intermString);
}
}
attributes.delete(attributes.length() - intermString.length(), attributes.length());
textBuilder.newLine(); // finish the current line

rowPane.findPaneOfTypeByID(CITIZEN_LABEL, Text.class)
.setText((citizen.getJob().isEmpty() ? "" : LanguageHandler.format(citizen.getJob()) + ": ") + citizen.getName());
rowPane.findPaneOfTypeByID(ATTRIBUTES_LABEL, Text.class).setText(attributes.toString());
rowPane.findPaneOfTypeByID(ATTRIBUTES_LABEL, Text.class).setText(textBuilder.getText());
}
});
}

private static String createAttributeText(final String color, final String text)
{
return color + text + TextFormatting.RESET.toString();
}

/**
* Create the color scheme.
*
Expand All @@ -313,16 +319,16 @@ private static String createAttributeText(final String color, final String text)
* @param current the current skill to compare.
* @return the modifier string.
*/
protected String createColor(final Skill primary, final Skill secondary, final Skill current)
protected Style createColor(final Skill primary, final Skill secondary, final Skill current)
{
if (primary == current)
{
return TextFormatting.GREEN.toString() + TextFormatting.BOLD.toString();
return Style.EMPTY.applyFormatting(TextFormatting.GREEN).applyFormatting(TextFormatting.BOLD);
}
if (secondary == current)
{
return TextFormatting.YELLOW.toString() + TextFormatting.ITALIC.toString();
return Style.EMPTY.applyFormatting(TextFormatting.YELLOW).applyFormatting(TextFormatting.ITALIC);
}
return "";
return Style.EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!--Item icon -->
<itemicon id="guardicon" size="16 16" pos="1 3"/>
<!--Request name-->
<label id="guardtype" size="50 12" pos="20 1" color="black"/>
<label id="position" size="50 12" pos="20 13" color="black"/>
<label id="guardtype" size="130 12" pos="20 1" color="black"/>
<label id="position" size="130 12" pos="20 13" color="black"/>
<!-- button to cancel the request-->
<buttonimage id="remove" size="74 16" pos="74 25" textcolor="black"
label="$(com.minecolonies.coremod.item.bannerrallyguards.gui.remove)" source="minecolonies:textures/gui/citizen/colonist_button_medium.png"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<image id="deliveryImage" source="minecraft:textures/misc/shadow.png" size="16 16" pos="1 3" visible="false"/>
<!--Request name-->
<buttonimage id="detail" size="16 16" pos="1 23" source="minecolonies:textures/gui/citizen/detail_button.png"/>
<label id="shortDetail" size="130 12" pos="20 1" color="black"/>
<label id="requester" size="130 12" pos="20 13" color="black"/>
<label id="shortDetail" size="130 9" pos="20 2" color="black"/>
<label id="requester" size="130 9" pos="20 13" color="black"/>
<!-- button to cancel the request-->
<buttonimage id="cancel" size="37 16" pos="50 23" textcolor="black"
label="$(com.minecolonies.coremod.gui.citizen.requestsCancel)" source="minecolonies:textures/gui/citizen/colonist_button_small.png"/>
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/assets/minecolonies/gui/windowhutcrafter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
label="$(com.minecolonies.coremod.gui.workerhuts.crafter.tasks)"/>

<list id="tasks" size="164 185" pos="13 29">
<box size="100% 52" linewidth="2">
<box size="100% 43" linewidth="2">
<image id="deliveryImage" source="minecraft:textures/misc/shadow.png" size="16 16" pos="1 3"/>

<label id="shortDetail" size="50 12" pos="20 1" color="black"/>
<label id="requester" size="50 12" pos="20 13" color="black"/>
<label id="parent" size="50 12" pos="20 25" color="black"/>
<label id="priority" size="50 12" pos="20 37" color="black"/>
<label id="shortDetail" size="130 9" pos="20 2" color="black"/>
<label id="requester" size="130 9" pos="20 12" color="black"/>
<label id="parent" size="130 9" pos="20 22" color="black"/>
<label id="priority" size="130 9" pos="20 32" color="black"/>
</box>
</list>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
label="$(com.minecolonies.coremod.gui.workerhuts.deliveryman.deliveries):"/>

<list id="deliveries" size="164 185" pos="13 29">
<box size="100% 52" linewidth="2">
<box size="100% 42" linewidth="2">
<image id="deliveryImage" source="minecraft:textures/misc/shadow.png" size="16 16" pos="1 3"/>


<label id="shortDetail" size="130 12" pos="20 1" color="black"/>
<label id="requester" size="130 12" pos="20 13" color="black"/>
<label id="parent" size="130 12" pos="20 25" color="black"/>
<label id="priority" size="130 12" pos="20 37" color="black"/>
<label id="shortDetail" size="130 9" pos="20 1" color="black"/>
<label id="requester" size="130 9" pos="20 11" color="black"/>
<label id="parent" size="130 9" pos="20 21" color="black"/>
<label id="priority" size="130 9" pos="20 31" color="black"/>
</box>
</list>
</view>
Expand Down
22 changes: 10 additions & 12 deletions src/main/resources/assets/minecolonies/gui/windowhutfarmer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@
label="$(com.minecolonies.coremod.gui.hiring.off)"/>

<list id="fields" size="164 154" pos="13 60">
<view size="100% 30">
<box size="100% 30" linewidth="2">
<button id="assignFarm" pos="95 10" size="40 15"/>
<itemicon id="icon" size="16 16" pos="0 0"/>
<label id="worker" color="black" pos="20 5"/>
<label id="dist" color="black" pos="15 15"/>
<label id="dir" color="black" pos="35 15"/>
</box>
</view>
<box size="100% 34" linewidth="2">
<itemicon id="icon" size="16 16" pos="1 1"/>
<label id="worker" color="black" pos="20 2" size="130 9"/>
<label id="dist" color="black" pos="20 12" size="65 9"/>
<label id="dir" color="black" pos="20 22" size="65 9"/>
<button id="assignFarm" pos="100 16" size="50 15"/>
</box>
</list>
</view>
<view>com.minecolonies.coremod.gui.workerhuts.farmerhut.requestfertilizer
<view>
<image source="minecolonies:textures/gui/builderhut/builder_papper.png" size="190 244"/>
<label id="RequestFertilizerLabel" size="164 11" pos="13 29" color="black" textalign="MIDDLE"
<label id="RequestFertilizerLabel" size="164 18" pos="13 29" color="black" textalign="MIDDLE"
label="$(com.minecolonies.coremod.gui.workerhuts.farmerhut.requestfertilizer)"/>
<button id="requestFert" size="60 15" pos="65 42"
<button id="requestFert" size="60 15" pos="65 50"
label="$(com.minecolonies.coremod.gui.requestfert.on)"/>
</view>
</switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<box size="100% 30" linewidth="2">
<button id="prioUp" size="15 15" label="" pos="0 0"/>
<button id="prioDown" size="15 15" label="" pos="0 15"/>
<label id="name" size="50 12" pos="35 16" textalign="MIDDLE_LEFT" color="black"/>
<label id="name" size="120 12" pos="35 16" textalign="MIDDLE_LEFT" color="black"/>
<button id="switch" size="100 13" pos="5 1" align="TOP_RIGHT" label="$(com.minecolonies.coremod.gui.workerhuts.retrieveOn)"/>
</box>
</list>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/assets/minecolonies/gui/windowhuthome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<list id="assignedCitizen" size="164 60" pos="13 49">
<box size="100% 30" linewidth="2">
<label id="name" size="100 12" pos="5 2" color="black"/>
<button id="remove" size="80 12" pos="75 15" label="$(com.minecolonies.coremod.gui.workerhuts.unassign)"/>
<label id="dist" size="100 12" pos="5 15" color="black"/>
<label id="name" size="150 12" pos="5 2" color="black"/>
<button id="remove" size="80 13" pos="75 15" label="$(com.minecolonies.coremod.gui.workerhuts.unassign)"/>
<label id="dist" size="100 13" pos="5 15" color="black"/>

</box>
</list>
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/assets/minecolonies/gui/windowhutminer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
label="$(com.minecolonies.coremod.gui.workerhuts.minerNodeList):"/>
<list id="levels" size="164 185" pos="13 29">
<box size="100% 28" linewidth="2">
<label id="lvl" size="100 12" pos="5 2" textalign="MIDDLE_LEFT" color="black"/>
<button id="changeToLevel" size="100 12" pos="35 2"
<label id="lvl" size="50 13" pos="5 2" textalign="MIDDLE_LEFT" color="black"/>
<button id="changeToLevel" size="90 13" pos="60 2"
label="$(com.minecolonies.coremod.gui.workerhuts.minerMineNode)"/>
<label id="nONodes" size="50 12" pos="35 16" textalign="MIDDLE_LEFT" color="black"/>
<label id="yLevel" size="50 12" pos="100 16" textalign="MIDDLE_LEFT" color="black"/>
<label id="nONodes" size="90 12" pos="60 16" textalign="MIDDLE_LEFT" color="black"/>
<label id="yLevel" size="50 12" pos="5 16" textalign="MIDDLE_LEFT" color="black"/>
</box>
</list>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
label="$(com.minecolonies.coremod.gui.warehouse.upgrade)"/>
<box size="164 30" linewidth="2" pos="13 29">
<itemicon id="resourceIcon" size="16 16" pos="1 1"/>
<label id="resourceName" size="100 12" pos="20 3" textalign="MIDDLE_LEFT" color="black"/>
<label id="resourceMissing" size="50 12" pos="2 18" textalign="MIDDLE_LEFT" color="black"/>
<label id="resourceAvailableNeeded" size="100% 12" pos="0 18" textalign="MIDDLE" color="black"/>
<button id="resourceAdd" size="16 16" label="" pos="110 7"/>
<label id="resourceName" size="125 9" pos="18 2" color="black"/>
<button id="resourceAdd" size="16 16" label="" pos="145 2"/>
<label id="resourceMissing" size="65 9" pos="2 20" textalign="MIDDLE" color="black"/>
<label id="resourceAvailableNeeded" size="65 9" pos="67 20" textalign="MIDDLE" color="black"/>
<label id="upgradeProgress" size="40 9" pos="132 20" color="black"/>

<label id="resourceId" size="1 1" pos="100 100"/>
<label id="resourceQuantity" size="1 1" pos="100 100"/>
<label id="upgradeProgress" size="10 30" pos="130 3" color="black"/>
</box>
<buttonimage id="sort" size="86 17" pos="50 70" textcolor="black"
source="minecolonies:textures/gui/builderhut/builder_button_medium.png"
Expand Down
24 changes: 11 additions & 13 deletions src/main/resources/assets/minecolonies/gui/windowpostbox.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<window xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" size="190 244" pause="false"
<window xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" size="440 244" pause="false"
lightbox="false"
xsi:noNamespaceSchemaLocation="file:../../../../../api/java/com/minecolonies/blockout/blockOut.xsd">
<image source="minecolonies:textures/gui/citizen/colonist_papper.png" size="440 244" pos="-120 0"/>
<image source="minecolonies:textures/gui/citizen/colonist_papper.png" size="440 244" pos="0 0"/>

<label id="desc" size="130 11" pos="-60 14" color="black" textalign="MIDDLE" label="$(com.minecolonies.coremod.gui.citizen.stacks)"/>
<input id="name" size="150 18" pos="-70 30" maxlength="25"/>
<label id="desc" size="130 11" pos="60 14" color="black" textalign="MIDDLE" label="$(com.minecolonies.coremod.gui.citizen.stacks)"/>
<input id="name" size="150 18" pos="50 30" maxlength="25"/>

<list id="resources" size="215 136" pos="-87 50">
<list id="resources" size="215 136" pos="33 50">
<box size="100% 18" linewidth="2">
<itemicon id="resourceIcon" size="17 17" pos="0 0"/>
<label id="resourceName" size="100 12" pos="20 1" color="black"/>
Expand All @@ -17,9 +17,9 @@
</box>
</list>

<label size="158 11" pos="116 28" textalign="MIDDLE" color="black"
<label size="158 11" pos="236 28" textalign="MIDDLE" color="black"
label="$(com.minecolonies.coremod.gui.citizen.requests)"/>
<list id="requests" size="158 184" pos="136 44">
<list id="requests" size="158 184" pos="256 44">
<box id="requestx" size="100% 40" linewidth="2">
<!--Item icon -->
<itemicon id="requestStack" size="16 16" pos="1 3"/>
Expand All @@ -40,10 +40,8 @@
</box>
</list>

<button id="deliverAvailable" pos="-40 195" size="40 15"/>
<label id="test" pos="-10 195" size="158 11" textalign="MIDDLE" color="black"
label="Deliver what's available"/>
<buttonimage id="inventory" size="86 17" pos="52 210" textcolor="black"
source="minecolonies:textures/gui/builderhut/builder_button_medium.png"
label="$(container.inventory)"/>
<button id="deliverAvailable" pos="42 195" size="40 15"/>
<label id="test" pos="90 195" size="158 11" color="black" label="Deliver what's available"/>
<buttonimage id="inventory" size="86 17" pos="97 210" textcolor="black" label="$(container.inventory)"
source="minecolonies:textures/gui/builderhut/builder_button_medium.png"/>
</window>
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@

<image source="minecolonies:textures/gui/citizen/colonist_papper_sketch.png" size="100% 100%"/>

<label size="164 11" pos="0 13" textalign="MIDDLE" color="black" label="$(com.minecolonies.coremod.gui.citizen.requests)"/>
<label size="190 11" pos="0 13" textalign="MIDDLE" color="black" label="$(com.minecolonies.coremod.gui.citizen.requests)"/>

<itemicon id="requestStack" size="24 24" pos="14 34"/>
<image id="deliveryImage" source="minecraft:textures/misc/shadow.png" size="24 24" pos="14 34" visible="false"/>
<itemicon id="requestStack" size="24 24" pos="12 30"/>
<image id="deliveryImage" source="minecraft:textures/misc/shadow.png" size="24 24" pos="12 30" visible="false"/>

<box id="requestDetail" size="100% 50%" pos="20 70" linewidth="0" color="black">
<label id="requester" size="135 9" pos="40 30" color="black"/>
<label id="targetLocation" size="135 9" pos="40 40" color="black"/>
<label id="resolver" size="135 9" pos="40 50" color="black"/>

</box>

<label id="requester" size="50 12" pos="42 30" color="black"/>
<label id="targetLocation" size="50 12" pos="42 44" color="black"/>
<label id="resolver" size="50 12" pos="42 58" color="black"/>
<box id="requestDetail" size="175 40" pos="12 60" linewidth="0" color="black" />

<buttonimage id="back" size="37 16" pos="35 105" textcolor="black"
label="$(com.minecolonies.coremod.gui.back)" source="minecolonies:textures/gui/citizen/colonist_button_small.png"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<box size="100% 30" linewidth="2">
<itemicon id="resourceIcon" size="16 16" pos="1 1"/>
<image id="indeliveryicon" source="minecolonies:textures/gui/citizen/delivery_16x16.png" size="16 16" pos="120 12" visible="false"/>
<label id="indeliveryamount" size="100% 12" pos="140 15" textalign="MIDDLE_LEFT" color="green"/>
<label id="resourceName" size="100 12" pos="20 3" textalign="MIDDLE_LEFT" color="black"/>
<label id="resourceMissing" size="50 12" pos="2 18" textalign="MIDDLE_LEFT" color="black"/>
<label id="resourceAvailableNeeded" size="100% 12" pos="0 18" textalign="MIDDLE" color="black"/>
<label id="resourceName" size="135 9" pos="18 2" color="black"/>
<label id="resourceMissing" size="65 9" pos="2 18" textalign="MIDDLE" color="black"/>
<label id="resourceAvailableNeeded" size="65 9" pos="67 18" textalign="MIDDLE" color="black"/>
<label id="indeliveryamount" size="30 9" pos="132 18" textalign="MIDDLE" color="green"/>

<label id="resourceId" size="1 1" pos="100 100"/>
<label id="resourceQuantity" size="1 1" pos="100 100"/>
Expand Down

0 comments on commit b9c007e

Please sign in to comment.