Skip to content

Commit 1f7da28

Browse files
committed
1.2.6-pre.2
1 parent 6832b89 commit 1f7da28

35 files changed

+895
-242
lines changed

LevelUP/Client/CharacterView.cs

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ class CharacterView
1313
GuiDialogCharacterBase characterView;
1414
private GuiElementContainer levelContainer;
1515

16-
byte page = 0;
17-
1816
public void Init(Instance _instance)
1917
{
2018
instance = _instance;
@@ -27,7 +25,7 @@ public void Init(Instance _instance)
2725
characterView = instance.api.Gui.LoadedGuis.Find((GuiDialog dlg) => dlg is GuiDialogCharacterBase) as GuiDialogCharacterBase;
2826
characterView.Tabs.Add(new GuiTab
2927
{
30-
Name = "Level",
28+
Name = Lang.Get("levelup:levels_tab"),
3129
DataInt = characterView.Tabs.Count
3230
});
3331
characterView.RenderTabHandlers.Add(ComposeLevelTab);
@@ -103,6 +101,11 @@ private void ComposeLevelTab(GuiComposer composer)
103101
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:shield")}: {GetLevelByLevelName("Shield")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
104102
#endregion
105103

104+
#region hand
105+
levelContainer.Add(new GuiElementImage(instance.api, containerBounds = containerBounds.BelowCopy(), new AssetLocation("levelup:hand.png")));
106+
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:hand")}: {GetLevelByLevelName("Hand")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
107+
#endregion
108+
106109
#region farming
107110
levelContainer.Add(new GuiElementImage(instance.api, containerBounds = containerBounds.BelowCopy(), new AssetLocation("levelup:farming.png")));
108111
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:farming")}: {GetLevelByLevelName("Farming")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
@@ -113,6 +116,11 @@ private void ComposeLevelTab(GuiComposer composer)
113116
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:cooking")}: {GetLevelByLevelName("Cooking")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
114117
#endregion
115118

119+
#region panning
120+
levelContainer.Add(new GuiElementImage(instance.api, containerBounds = containerBounds.BelowCopy(), new AssetLocation("levelup:panning.png")));
121+
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:panning")}: {GetLevelByLevelName("Panning")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
122+
#endregion
123+
116124
#region vitality
117125
levelContainer.Add(new GuiElementImage(instance.api, containerBounds = containerBounds.BelowCopy(), new AssetLocation("levelup:vitality.png")));
118126
levelContainer.Add(new GuiElementStaticText(instance.api, $"{Lang.Get("levelup:vitality")}: {GetLevelByLevelName("Vitality")}", EnumTextOrientation.Left, containerBounds.RightCopy().ForkChildOffseted(0, 25, 500, 0), CairoFont.WhiteSmallText()));
@@ -133,7 +141,7 @@ private void ComposeLevelTab(GuiComposer composer)
133141

134142
// Adding the size of scroll button
135143
GuiElementScrollbar scrollBar = composer.GetScrollbar("LevelUP_Scrollbar");
136-
scrollBar.SetHeights((float)containerBounds.fixedHeight, (float)(clippingBounds.fixedHeight * 3.5));
144+
scrollBar.SetHeights((float)containerBounds.fixedHeight, (float)(clippingBounds.fixedHeight * 3.7));
137145
}
138146

139147
private void OnNewScrollbarValue(float value)
@@ -143,39 +151,4 @@ private void OnNewScrollbarValue(float value)
143151
}
144152

145153
private int GetLevelByLevelName(string levelName) => instance.api.World.Player.Entity.WatchedAttributes.GetInt($"LevelUP_Level_{levelName}");
146-
147-
private static void SetComposerLevel(GuiComposer composer, ElementBounds position, int level)
148-
{
149-
// Single Digits
150-
if (level < 10)
151-
// Creating the imagem
152-
composer.AddImage(position, new AssetLocation($"levelup:{level}.png"));
153-
// Double Digits
154-
else if (level < 100)
155-
{
156-
string levelStr = level.ToString();
157-
int firstDigit = int.Parse(levelStr[0].ToString());
158-
int secondDigit = int.Parse(levelStr[1].ToString());
159-
160-
// First digit instanciation
161-
ElementBounds firstDigitPosition = ElementBounds.Fixed(
162-
position.fixedX - 15,
163-
position.fixedY,
164-
position.fixedWidth,
165-
position.fixedHeight
166-
);
167-
composer.AddImage(firstDigitPosition, new AssetLocation($"levelup:{firstDigit}.png"));
168-
169-
// Second digit instanciation
170-
ElementBounds secondDigitPosition = ElementBounds.Fixed(
171-
position.fixedX + 15,
172-
position.fixedY,
173-
position.fixedWidth,
174-
position.fixedHeight
175-
);
176-
composer.AddImage(secondDigitPosition, new AssetLocation($"levelup:{secondDigit}.png"));
177-
}
178-
179-
Debug.Log("Ops, you reached the gui limit :P ");
180-
}
181154
}

0 commit comments

Comments
 (0)