Skip to content

Commit

Permalink
inventory tooltip anchor base
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Aug 2, 2024
1 parent 69e4773 commit d2a45ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ui:VisualElement name="Spacer" style="flex-grow: 1;" />
</ui:VisualElement>
<ui:VisualElement name="UIContainerPopup" focusable="false" usage-hints="None" picking-mode="Ignore" style="opacity: 1; display: flex; background-color: rgba(173, 110, 0, 0); flex-grow: 0; width: 100%; height: 100%; flex-shrink: 0;" />
<ui:VisualElement name="UIContainerTooltip" focusable="false" usage-hints="None" picking-mode="Ignore" style="opacity: 1; display: flex; background-color: rgba(173, 110, 0, 0); flex-grow: 0; width: 100%; height: 100%; flex-shrink: 0; position: absolute;" />
<ui:VisualElement name="Loading" style="flex-grow: 1; position: absolute; background-color: rgb(0, 0, 0); width: 100%; height: 100%; align-self: center; justify-content: flex-end; display: none;">
<ui:Label tabindex="-1" text="Loading..." parse-escape-sequences="true" display-tooltip-when-elided="true" style="justify-content: space-around; align-items: flex-end; -unity-text-align: upper-right; -unity-font: resource(&apos;Data/UI/Font/tahoma&apos;); -unity-font-definition: initial; color: rgb(255, 255, 255); margin-bottom: 17px; margin-left: 3px; margin-right: 19px; font-size: 25px;" />
</ui:VisualElement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ui:VisualElement name="L2Logo" style="flex-grow: 0; background-image: resource(&apos;Data/UI/Login/l2logo-white&apos;); width: 160px; height: 150px; flex-shrink: 0; justify-content: flex-start; margin-top: 5%;" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="UIContainerTooltip" focusable="false" usage-hints="None" picking-mode="Ignore" style="opacity: 1; display: flex; background-color: rgba(173, 110, 0, 0); flex-grow: 0; width: 100%; height: 100%; flex-shrink: 0; position: absolute;" />
<ui:VisualElement name="Loading" style="flex-grow: 1; position: absolute; background-color: rgb(0, 0, 0); width: 100%; height: 100%; align-self: center; justify-content: flex-end; visibility: visible; display: none;">
<ui:Label tabindex="-1" text="Loading..." parse-escape-sequences="true" display-tooltip-when-elided="true" style="justify-content: space-around; align-items: flex-end; -unity-text-align: upper-right; -unity-font: resource(&apos;Data/UI/Font/tahoma&apos;); -unity-font-definition: initial; color: rgb(255, 255, 255); margin-bottom: 17px; margin-left: 3px; margin-right: 19px; font-size: 25px;" />
</ui:VisualElement>
Expand Down
4 changes: 2 additions & 2 deletions l2-unity/Assets/Scripts/UI/L2GameUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ protected override void LoadUI() {
TargetWindow.Instance.AddWindow(_rootVisualContainer);
}
if (L2ToolTip.Instance != null) {
L2ToolTip.Instance.AddWindow(_rootVisualContainer);
L2ToolTip.Instance.HideWindow();
L2ToolTip.Instance.AddWindow(_tooltipVisualContainer);
// L2ToolTip.Instance.HideWindow();
}
}

Expand Down
6 changes: 4 additions & 2 deletions l2-unity/Assets/Scripts/UI/L2Tooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ protected override IEnumerator BuildWindow(VisualElement root) {

public void UpdateTooltip(string title, VisualElement target) {
_windowEle.style.left = -1000;
_windowEle.style.opacity = 0;

_tooltipTarget = target;

ShowWindow();
Expand All @@ -54,12 +56,12 @@ IEnumerator UpdateToolTipCoroutine(string title, VisualElement target) {
while(true) {
_title.text = title;

BringToFront();

yield return new WaitForEndOfFrame();

_windowEle.style.left = target.worldBound.x;
_windowEle.style.top = target.worldBound.y - _windowEle.resolvedStyle.height;

_windowEle.style.opacity = 100;
}
}

Expand Down
2 changes: 2 additions & 0 deletions l2-unity/Assets/Scripts/UI/L2UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public abstract class L2UI : MonoBehaviour

protected VisualElement _rootVisualContainer;
protected VisualElement _popupVisualContainer;
protected VisualElement _tooltipVisualContainer;

public bool MouseOverUI { get { return _mouseOverUI; } set { _mouseOverUI = value; } }
public bool UILoaded { get { return _uiLoaded; } set { _uiLoaded = value; } }
Expand Down Expand Up @@ -40,6 +41,7 @@ public void BlurFocus() {
protected virtual void LoadUI() {
_rootVisualContainer = _rootElement.Q<VisualElement>("UIContainer");
_popupVisualContainer = _rootElement.Q<VisualElement>("UIContainerPopup");
_tooltipVisualContainer = _rootElement.Q<VisualElement>("UIContainerTooltip");
_loadingElement = _rootElement.Q<VisualElement>("Loading");
}

Expand Down

0 comments on commit d2a45ce

Please sign in to comment.