From 6a7fc98a5264bc3d6174cdb7e68c4f99c4ec0024 Mon Sep 17 00:00:00 2001 From: karu Date: Mon, 6 Jan 2020 19:55:08 +0200 Subject: [PATCH] Added: Show disabled until timer on icon --- .../client/src/interface_v3/dbctrl_sheet.cpp | 39 +++++++++++++++++++ .../client/src/interface_v3/dbctrl_sheet.h | 3 ++ 2 files changed, 42 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 8a3064a12..a5a07420f 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -535,6 +535,9 @@ CCtrlDraggable(param) _SapBuffIcon = "ico_sap.tga"; _StaBuffIcon = "ico_stamina.tga"; _FocusBuffIcon = "ico_focus.tga"; + + _RegenText = NULL; + _RegenTextValue = 0; } // ---------------------------------------------------------------------------- @@ -2040,6 +2043,12 @@ void CDBCtrlSheet::draw() if (!_LastSheetId) { _RegenTickRange = CTickRange(); + if (_RegenText) + { + delete _RegenText; + _RegenText = NULL; + _RegenTextValue = 0; + } } else { @@ -2066,6 +2075,36 @@ void CDBCtrlSheet::draw() { rVR.drawQuad(_RenderLayer + 1, regenTris[tri], backTex, CRGBA::White, false); } + + if (!_RegenText) { + _RegenText = new CViewText(CViewBase::TCtorParam()); + _RegenText->setId(getId() + ":regen"); + _RegenText->setParent(_Parent); + _RegenText->setOverflowText(ucstring("")); + _RegenText->setModulateGlobalColor(false); + _RegenText->setMultiLine(false); + _RegenText->setTextMode(CViewText::ClipWord); + _RegenText->setFontSizing("0", "0"); + // TODO: font size / color hardcoded. + _RegenText->setFontSize(8); + _RegenText->setColor(CRGBA::White); + _RegenText->setShadow(true); + _RegenText->setActive(true); + _RegenText->updateTextContext(); + } + + // TODO: ticks in second hardcoded + uint32 nextValue = _RegenTickRange.EndTick > LastGameCycle ? (_RegenTickRange.EndTick - LastGameCycle) / 10 : 0; + if (_RegenTextValue != nextValue) + { + _RegenTextValue = nextValue; + _RegenText->setText(toString("%d", _RegenTextValue)); + _RegenText->updateTextContext(); + } + _RegenText->setXReal(_XReal+1); + _RegenText->setYReal(_YReal+2); + _RegenText->setRenderLayer(_RenderLayer+2); + _RegenText->draw(); } } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h index 28d7a1ddf..4abc16f4b 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -51,6 +51,7 @@ class COutpostBuildingSheet; namespace NLGUI { class CViewRenderer; + class CViewText; } class CDBCtrlSheet; @@ -731,6 +732,8 @@ protected: sint8 _ArmourColorIndex; CTickRange _RegenTickRange; + NLGUI::CViewText *_RegenText; + uint32 _RegenTextValue; /// D'n'd sint32 _DragX, _DragY;