Improve planet name title
They began showing during the warp cinematic and their fade-out timing was wrong.
This commit is contained in:
parent
856e93be3f
commit
994c533a0f
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
// Change planet name to support the new internal string formatting.
|
// Change planet name to support the new internal string formatting.
|
||||||
"planetNameFormatString" : "- {} -",
|
"planetNameFormatString" : "- {} -",
|
||||||
|
"planetNameDirectives" : "?border=4;000;000",
|
||||||
|
|
||||||
"buttonClickSound" : [ "/sfx/interface/button/click.wav" ],
|
"buttonClickSound" : [ "/sfx/interface/button/click.wav" ],
|
||||||
"buttonReleaseSound" : [ "/sfx/interface/button/release.wav" ],
|
"buttonReleaseSound" : [ "/sfx/interface/button/release.wav" ],
|
||||||
|
@ -173,6 +173,7 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter,
|
|||||||
auto planetName = make_shared<Pane>();
|
auto planetName = make_shared<Pane>();
|
||||||
m_planetText = make_shared<LabelWidget>();
|
m_planetText = make_shared<LabelWidget>();
|
||||||
m_planetText->setFontSize(m_config->planetNameFontSize);
|
m_planetText->setFontSize(m_config->planetNameFontSize);
|
||||||
|
m_planetText->setFontMode(FontMode::Normal);
|
||||||
m_planetText->setAnchor(HorizontalAnchor::HMidAnchor, VerticalAnchor::VMidAnchor);
|
m_planetText->setAnchor(HorizontalAnchor::HMidAnchor, VerticalAnchor::VMidAnchor);
|
||||||
m_planetText->setDirectives(m_config->planetNameDirectives);
|
m_planetText->setDirectives(m_config->planetNameDirectives);
|
||||||
planetName->disableScissoring();
|
planetName->disableScissoring();
|
||||||
@ -698,29 +699,35 @@ void MainInterface::update(float dt) {
|
|||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto worldId = m_client->playerWorld();
|
bool playerInWorld = m_client->mainPlayer()->inWorld();
|
||||||
if (worldId.is<CelestialWorldId>()) {
|
if (m_cinematicOverlay->completed()) {
|
||||||
if (m_planetNameTimer.tick(dt))
|
if (m_planetNameTimer.tick(dt)) {
|
||||||
m_paneManager.dismissRegisteredPane(MainInterfacePanes::PlanetText);
|
m_paneManager.dismissRegisteredPane(MainInterfacePanes::PlanetText);
|
||||||
else
|
} else {
|
||||||
m_paneManager.displayRegisteredPane(MainInterfacePanes::PlanetText);
|
if (playerInWorld) {
|
||||||
|
String worldName;
|
||||||
|
if (auto worldTemplate = m_client->worldClient()->currentTemplate())
|
||||||
|
worldName = worldTemplate->worldName();
|
||||||
|
|
||||||
if (auto parameters = m_client->celestialDatabase()->parameters(worldId.get<CelestialWorldId>()))
|
if (!worldName.empty()) {
|
||||||
m_planetText->setText(strf(m_config->planetNameFormatString.utf8Ptr(), parameters->name()));
|
m_planetText->setText(strf(m_config->planetNameFormatString.utf8Ptr(), worldName));
|
||||||
|
m_paneManager.displayRegisteredPane(MainInterfacePanes::PlanetText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Color textColor = Color::White; // probably need to make this jsonable
|
Color textColor = Color::White; // probably need to make this jsonable
|
||||||
float fadeTimer = m_planetNameTimer.percent();
|
float fadeTimer = m_planetNameTimer.timer;
|
||||||
if (fadeTimer < m_config->planetNameFadeTime)
|
if (fadeTimer < m_config->planetNameFadeTime)
|
||||||
textColor.setAlphaF(fadeTimer / m_config->planetNameFadeTime);
|
textColor.setAlphaF(fadeTimer / m_config->planetNameFadeTime);
|
||||||
|
|
||||||
m_planetText->setColor(textColor);
|
m_planetText->setColor(textColor);
|
||||||
|
}
|
||||||
} else {
|
} else if (!playerInWorld) {
|
||||||
m_paneManager.dismissRegisteredPane(MainInterfacePanes::PlanetText);
|
|
||||||
m_planetNameTimer.reset();
|
m_planetNameTimer.reset();
|
||||||
|
m_paneManager.dismissRegisteredPane(MainInterfacePanes::PlanetText);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto containerResult : m_containerInteractor->pullContainerResults()) {
|
for (auto& containerResult : m_containerInteractor->pullContainerResults()) {
|
||||||
if (!m_containerPane || !m_containerPane->giveContainerResult(containerResult)) {
|
if (!m_containerPane || !m_containerPane->giveContainerResult(containerResult)) {
|
||||||
if (!m_inventoryWindow->giveContainerResult(containerResult)) {
|
if (!m_inventoryWindow->giveContainerResult(containerResult)) {
|
||||||
for (auto item : containerResult) {
|
for (auto item : containerResult) {
|
||||||
|
@ -87,7 +87,7 @@ void NameplatePainter::render() {
|
|||||||
auto color = Color::rgb(nametag.color);
|
auto color = Color::rgb(nametag.color);
|
||||||
color.setAlphaF(nametag.opacity);
|
color.setAlphaF(nametag.opacity);
|
||||||
context.setFontColor(color.toRgba());
|
context.setFontColor(color.toRgba());
|
||||||
context.setFontMode(FontMode::Shadow);
|
context.setFontMode(FontMode::Normal);
|
||||||
|
|
||||||
context.renderText(nametag.name, namePosition(bubble.currentPosition));
|
context.renderText(nametag.name, namePosition(bubble.currentPosition));
|
||||||
|
|
||||||
|
@ -189,6 +189,8 @@ void ItemSlotWidget::renderImpl() {
|
|||||||
context()->setFontColor(m_fontColor.toRgba());
|
context()->setFontColor(m_fontColor.toRgba());
|
||||||
context()->setFontMode(m_countFontMode);
|
context()->setFontMode(m_countFontMode);
|
||||||
context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
|
context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
|
||||||
|
context()->setFontMode(FontMode::Normal);
|
||||||
|
context()->setDefaultFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (m_drawBackingImageWhenEmpty && m_backingImage != "") {
|
} else if (m_drawBackingImageWhenEmpty && m_backingImage != "") {
|
||||||
|
@ -41,6 +41,10 @@ void LabelWidget::setFontSize(int fontSize) {
|
|||||||
updateTextRegion();
|
updateTextRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LabelWidget::setFontMode(FontMode fontMode) {
|
||||||
|
m_fontMode = fontMode;
|
||||||
|
}
|
||||||
|
|
||||||
void LabelWidget::setColor(Color newColor) {
|
void LabelWidget::setColor(Color newColor) {
|
||||||
m_color = move(newColor);
|
m_color = move(newColor);
|
||||||
}
|
}
|
||||||
@ -82,6 +86,7 @@ RectI LabelWidget::getScissorRect() const {
|
|||||||
void LabelWidget::renderImpl() {
|
void LabelWidget::renderImpl() {
|
||||||
context()->setFont(m_font);
|
context()->setFont(m_font);
|
||||||
context()->setFontSize(m_fontSize);
|
context()->setFontSize(m_fontSize);
|
||||||
|
context()->setFontMode(m_fontMode);
|
||||||
context()->setFontColor(m_color.toRgba());
|
context()->setFontColor(m_color.toRgba());
|
||||||
context()->setFontProcessingDirectives(m_processingDirectives);
|
context()->setFontProcessingDirectives(m_processingDirectives);
|
||||||
|
|
||||||
@ -93,6 +98,7 @@ void LabelWidget::renderImpl() {
|
|||||||
context()->renderInterfaceText(m_text, {Vec2F(screenPosition()), m_hAnchor, m_vAnchor, m_wrapWidth, m_textCharLimit});
|
context()->renderInterfaceText(m_text, {Vec2F(screenPosition()), m_hAnchor, m_vAnchor, m_wrapWidth, m_textCharLimit});
|
||||||
|
|
||||||
context()->setDefaultFont();
|
context()->setDefaultFont();
|
||||||
|
context()->setFontMode(FontMode::Normal);
|
||||||
context()->setFontProcessingDirectives("");
|
context()->setFontProcessingDirectives("");
|
||||||
context()->setDefaultLineSpacing();
|
context()->setDefaultLineSpacing();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
Maybe<unsigned> getTextCharLimit() const;
|
Maybe<unsigned> getTextCharLimit() const;
|
||||||
void setText(String newText);
|
void setText(String newText);
|
||||||
void setFontSize(int fontSize);
|
void setFontSize(int fontSize);
|
||||||
|
void setFontMode(FontMode fontMode);
|
||||||
void setColor(Color newColor);
|
void setColor(Color newColor);
|
||||||
void setAnchor(HorizontalAnchor hAnchor, VerticalAnchor vAnchor);
|
void setAnchor(HorizontalAnchor hAnchor, VerticalAnchor vAnchor);
|
||||||
void setWrapWidth(Maybe<unsigned> wrapWidth);
|
void setWrapWidth(Maybe<unsigned> wrapWidth);
|
||||||
@ -37,6 +38,7 @@ private:
|
|||||||
|
|
||||||
String m_text;
|
String m_text;
|
||||||
int m_fontSize;
|
int m_fontSize;
|
||||||
|
FontMode m_fontMode;
|
||||||
Color m_color;
|
Color m_color;
|
||||||
HorizontalAnchor m_hAnchor;
|
HorizontalAnchor m_hAnchor;
|
||||||
VerticalAnchor m_vAnchor;
|
VerticalAnchor m_vAnchor;
|
||||||
|
Loading…
Reference in New Issue
Block a user