Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public void onStartScreen() {
hitPoints = playerChar.getAttribute(CharacterAttribute.HitPoints);
foodPoints = playerChar.getAttribute(CharacterAttribute.FoodPoints);
manaPoints = playerChar.getAttribute(CharacterAttribute.ManaPoints);
currentManaPoints = 0;
isMage = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import illarion.common.data.Skill;
import illarion.common.data.SkillGroup;
import illarion.common.data.SkillGroups;
import illarion.common.data.SkillLoader;
import org.illarion.engine.GameContainer;
import org.illarion.nifty.controls.Progress;
import org.illarion.nifty.controls.progress.builder.ProgressBuilder;
Expand Down Expand Up @@ -79,11 +80,13 @@ public void bind(@Nonnull Nifty nifty, @Nonnull Screen screen) {
skillWindow = screen.findNiftyControl("characterInformation", Window.class);
//skillWindow.getElement().getParent().layoutElements();

createSkillEntries();
SkillLoader.load();
}

@Override
public void onStartScreen() {
createSkillEntries();

Element skillWindowElement = getSkillWindowElement();
if (skillWindowElement != null) {
skillWindowElement.setConstraintX(new SizeValue(IllaClient.getCfg().getString("skillWindowPosX")));
Expand All @@ -105,7 +108,7 @@ public void onEndScreen() {
}

internalHideSkillWindow();
resetAllEntries();
removeSkillEntries();
}

@Override
Expand Down Expand Up @@ -153,6 +156,7 @@ private void createSkillEntries() {
if (content == null) {
return;
}
content.getChildren().forEach(Element::markForRemoval);

for (SkillGroup group : SkillGroups.getInstance().getSkillGroups()) {
String groupId = content.getId() + "#group" + Integer.toString(group.getGroupId());
Expand Down Expand Up @@ -216,6 +220,15 @@ private void createSkillEntries() {
}
}

private void removeSkillEntries() {
Element content = getContentPanel();

if (content != null) {
content.getChildren().forEach(Element::markForRemoval);
layoutDirty = true;
}
}

/**
* This value is set {@code true} in case the layout needs to be updated.
*/
Expand Down Expand Up @@ -277,27 +290,6 @@ private Element getSkillPanel(@Nonnull Skill skill) {
return null;
}

private void resetAllEntries() {
Element content = getContentPanel();

if (content != null) {
SizeValue zero = SizeValue.px(0);
for (@Nonnull Element groupPanel : content.getChildren()) {
groupPanel.setConstraintHeight(zero);
groupPanel.setMarginBottom(zero);

for (@Nonnull Element groupMember : groupPanel.getChildren()) {
groupMember.setConstraintHeight(zero);

for (@Nonnull Element skillEntry : groupMember.getChildren()) {
skillEntry.setConstraintHeight(zero);
}
}
}
layoutDirty = true;
}
}

/**
* This function will update the data of a single skill.
*
Expand Down