mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Add player tab list select animation, fixes #270
This commit is contained in:
parent
4017b988ab
commit
f6391555fe
@ -411,7 +411,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
int height = normalChat.GetUsedHeight();
|
||||
int y = normalChat.Y + normalChat.Height - height;
|
||||
if (new Rectangle(normalChat.X, y, normalChat.Width, height).Contains(mouseX, mouseY))
|
||||
if (GuiElement.Contains(normalChat.X, y, normalChat.Width, height, mouseX, mouseY))
|
||||
return HandlesChatClick(mouseX, mouseY);
|
||||
return false;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ namespace ClassicalSharp {
|
||||
U2 = u2; V2 = v2;
|
||||
}
|
||||
|
||||
public Rectangle Bounds { get { return new Rectangle(X, Y, Width, Height); } }
|
||||
public bool IsValid { get { return ID > 0; } }
|
||||
public int X1 { get { return X; } set { X = (short)value; } }
|
||||
public int Y1 { get { return Y; } set { Y = (short)value; } }
|
||||
|
@ -139,7 +139,7 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
public string GetSelected(int mouseX, int mouseY) {
|
||||
for (int i = 0; i < Textures.Length; i++) {
|
||||
Texture tex = Textures[i];
|
||||
if (tex.IsValid && tex.Bounds.Contains(mouseX, mouseY))
|
||||
if (tex.IsValid && GuiElement.Contains(tex.X, tex.Y, tex.Width, tex.Height, mouseX, mouseY))
|
||||
return GetUrl(i, mouseX) ?? lines[i];
|
||||
}
|
||||
return null;
|
||||
|
@ -58,9 +58,13 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
overview.Reposition();
|
||||
overview.Render(delta);
|
||||
|
||||
int highlightedI = HighlightedName(game.Mouse.X, game.Mouse.Y);
|
||||
for (int i = 0; i < namesCount; i++) {
|
||||
if (!textures[i].IsValid) continue;
|
||||
|
||||
Texture tex = textures[i];
|
||||
if (tex.IsValid) tex.Render(gfx);
|
||||
if (i == highlightedI) tex.X += 4;
|
||||
tex.Render(gfx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,16 +81,20 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
game.EntityEvents.TabListEntryRemoved -= TabEntryRemoved;
|
||||
}
|
||||
|
||||
public string GetNameUnder(int mouseX, int mouseY) {
|
||||
int HighlightedName(int mouseX, int mouseY) {
|
||||
for (int i = 0; i < namesCount; i++) {
|
||||
Texture tex = textures[i];
|
||||
if (!tex.IsValid || IDs[i] == groupNameID) continue;
|
||||
if (!textures[i].IsValid || IDs[i] == groupNameID) continue;
|
||||
|
||||
if (tex.Bounds.Contains(mouseX, mouseY)) {
|
||||
return TabList.Entries[IDs[i]].PlayerName;
|
||||
}
|
||||
Texture t = textures[i];
|
||||
if (GuiElement.Contains(t.X, t.Y, t.Width, t.Height, mouseX, mouseY)) return i;
|
||||
}
|
||||
return null;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public string GetNameUnder(int mouseX, int mouseY) {
|
||||
int i = HighlightedName(mouseX, mouseY);
|
||||
if (i == -1) return null;
|
||||
return TabList.Entries[IDs[i]].PlayerName;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user