forked from townforge/townforge
game: better build/place ui
This commit is contained in:
parent
9854de369f
commit
96f7fc8677
@ -1,39 +1,40 @@
|
||||
WindowInfo
|
||||
title Build
|
||||
|
||||
TBLayout: axis: y, distribution-position: "left top", distribution: "available", skin: "notification"
|
||||
TBLayout: axis: y
|
||||
|
||||
TBTextField: text: "Build in progress"
|
||||
font: size: 24px
|
||||
|
||||
TBTextField: id: "flag-name"
|
||||
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
|
||||
TBButton: skin: "TBButton.spectator", text: " Approve " id: "build-overview-approve-build"
|
||||
TBLayout: axis x
|
||||
TBButton: text: " Approve " id: "build-overview-approve-build"
|
||||
font: size: 20px
|
||||
TBButton: skin: "TBButton.spectator", text: " Abandon " id: "build-overview-abandon-build"
|
||||
TBButton: text: " Abandon " id: "build-overview-abandon-build"
|
||||
font: size: 20px
|
||||
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBLayout: axis: y
|
||||
TBTextField: text: "Grow"
|
||||
TBTextField: text: "Shrink"
|
||||
TBTextField: text: "Move"
|
||||
TBLayout: axis: y
|
||||
TBLayout: axis x
|
||||
TBLayout: axis: y, size: "available", distribution: "available"
|
||||
TBTextField: text: "Grow", gravity: "all"
|
||||
TBTextField: text: "Shrink", gravity: "all"
|
||||
TBTextField: text: "Move", gravity: "all"
|
||||
TBLayout: axis: y, size: "available", distribution: "available"
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-extend-west", text: "West"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-extend-north", text: "North"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-extend-south", text: "South"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-extend-east", text: "East"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-extend-all", text: "All"
|
||||
TBButton: id: "edit-extend-west", text: "West"
|
||||
TBButton: id: "edit-extend-north", text: "North"
|
||||
TBButton: id: "edit-extend-south", text: "South"
|
||||
TBButton: id: "edit-extend-east", text: "East"
|
||||
TBButton: id: "edit-extend-all", text: "All"
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-shrink-west", text: "West"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-shrink-north", text: "North"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-shrink-south", text: "South"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-shrink-east", text: "East"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-shrink-all", text: "All"
|
||||
TBButton: id: "edit-shrink-west", text: "West"
|
||||
TBButton: id: "edit-shrink-north", text: "North"
|
||||
TBButton: id: "edit-shrink-south", text: "South"
|
||||
TBButton: id: "edit-shrink-east", text: "East"
|
||||
TBButton: id: "edit-shrink-all", text: "All"
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-move-west", text: "West"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-move-north", text: "North"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-move-south", text: "South"
|
||||
TBButton: skin: "TBButton.spectator", id: "edit-move-east", text: "East"
|
||||
TBButton: id: "edit-move-west", text: "West"
|
||||
TBButton: id: "edit-move-north", text: "North"
|
||||
TBButton: id: "edit-move-south", text: "South"
|
||||
TBButton: id: "edit-move-east", text: "East"
|
||||
TBButton: text: "All", visibility: "invisible", state: disabled, is-focusable: 0
|
||||
|
@ -1,20 +1,22 @@
|
||||
WindowInfo
|
||||
title Place model
|
||||
|
||||
TBLayout: axis: y, distribution-position: "left top", distribution: "available", skin: "notification"
|
||||
TBLayout: axis: y, distribution-position: "left top", distribution: "available"
|
||||
|
||||
TBTextField: text: "Place model"
|
||||
font: size: 24px
|
||||
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", text: " North " id: "place-model-north"
|
||||
TBButton: skin: "TBButton.spectator", text: " South " id: "place-model-south"
|
||||
TBButton: text: " North " id: "place-model-north"
|
||||
TBButton: text: " South " id: "place-model-south"
|
||||
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", text: " West " id: "place-model-west"
|
||||
TBButton: skin: "TBButton.spectator", text: " East " id: "place-model-east"
|
||||
TBButton: text: " West " id: "place-model-west"
|
||||
TBButton: text: " East " id: "place-model-east"
|
||||
|
||||
TBLayout: axis x, distribution-position: "left top", distribution: "available"
|
||||
TBButton: skin: "TBButton.spectator", text: " Up " id: "place-model-up"
|
||||
TBButton: skin: "TBButton.spectator", text: " Down " id: "place-model-down"
|
||||
TBButton: skin: "TBButton.spectator", text: " Rotate " id: "place-model-rotate"
|
||||
TBButton: skin: "TBButton.spectator", text: " OK " id: "place-model-done"
|
||||
TBButton: text: " Up " id: "place-model-up"
|
||||
TBButton: text: " Down " id: "place-model-down"
|
||||
|
||||
TBButton: text: " Rotate " id: "place-model-rotate"
|
||||
TBButton: text: " OK " id: "place-model-done"
|
||||
|
2
external/tb
vendored
2
external/tb
vendored
@ -1 +1 @@
|
||||
Subproject commit 6d430d7283c109723d8f42d6ed1c95c7fb687033
|
||||
Subproject commit 3f9379360425bcbfe1e7e11087a60dcfd7c8b246
|
@ -374,8 +374,7 @@ void UIUrho3D::CreateNodeNotificationWidget()
|
||||
void UIUrho3D::CreateBuildOverviewWidget()
|
||||
{
|
||||
auto* graphics = GetSubsystem<Graphics>();
|
||||
buildOverviewWidget = new UITBWindow(context_, "cc/build-overview.tb.txt", WINDOW_SETTINGS_NONE);
|
||||
buildOverviewWidget->SetSkinBg(TBIDC("0"));
|
||||
buildOverviewWidget = new UITBWindow(context_, "cc/build-overview.tb.txt", WINDOW_SETTINGS_TITLEBAR);
|
||||
TBRect rect = buildOverviewWidget->GetRect();
|
||||
rect.x = graphics->GetWidth() / 2 - rect.w / 2;
|
||||
rect.y = 0;
|
||||
@ -388,8 +387,7 @@ void UIUrho3D::CreateBuildOverviewWidget()
|
||||
void UIUrho3D::CreatePlaceModelWidget()
|
||||
{
|
||||
auto* graphics = GetSubsystem<Graphics>();
|
||||
placeModelWidget = new UITBWindow(context_, "cc/place-model.tb.txt", WINDOW_SETTINGS_NONE);
|
||||
placeModelWidget->SetSkinBg(TBIDC("0"));
|
||||
placeModelWidget = new UITBWindow(context_, "cc/place-model.tb.txt", WINDOW_SETTINGS_TITLEBAR);
|
||||
TBRect rect = placeModelWidget->GetRect();
|
||||
rect.x = graphics->GetWidth() / 2 - rect.w / 2;
|
||||
rect.y = buildOverviewWidget->GetRect().h;
|
||||
@ -707,6 +705,7 @@ nodeNotificationWidget->ResizeToFitContent();
|
||||
|
||||
void UIUrho3D::UpdateBuildOverview(const boost::optional<std::tuple<uint32_t, std::vector<uint16_t>, std::shared_ptr<TileData>, std::shared_ptr<Flag::unpacker>>> &flagUnderConstruction)
|
||||
{
|
||||
const bool was_visible = buildOverviewWidget->GetVisibility() == WIDGET_VISIBILITY_VISIBLE;
|
||||
if (!flagUnderConstruction)
|
||||
{
|
||||
buildOverviewWidget->SetVisibility(WIDGET_VISIBILITY_INVISIBLE);
|
||||
@ -715,6 +714,8 @@ void UIUrho3D::UpdateBuildOverview(const boost::optional<std::tuple<uint32_t, st
|
||||
const std::shared_ptr<Flag> flag = gameState->map.get_flag(std::get<0>(*flagUnderConstruction));
|
||||
buildOverviewFlagName->SetText(gameState->get_flag_name(std::get<0>(*flagUnderConstruction)));
|
||||
buildOverviewWidget->SetVisibility(WIDGET_VISIBILITY_VISIBLE);
|
||||
if (!was_visible)
|
||||
buildOverviewWidget->ResizeToFitContent();
|
||||
}
|
||||
|
||||
void UIUrho3D::UpdateLoadingWalletNotification(const std::shared_ptr<GameWallet> &w)
|
||||
@ -1908,6 +1909,7 @@ void UIUrho3D::OnExitRequest()
|
||||
void UIUrho3D::OnRequestModelPlacement(bool show)
|
||||
{
|
||||
placeModelWidget->SetVisibility(show ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_INVISIBLE);
|
||||
placeModelWidget->ResizeToFitContent();
|
||||
}
|
||||
|
||||
void UIUrho3D::OnSearchFlagByName()
|
||||
@ -3181,10 +3183,6 @@ bool UIUrho3D::IsClickPassthroughWidget(tb::TBWidget *w) const
|
||||
return true;
|
||||
if (queuedCommandsNotificationWidget->IsAncestorOf(w))
|
||||
return true;
|
||||
if (buildOverviewWidget->IsAncestorOf(w))
|
||||
return true;
|
||||
if (placeModelWidget->IsAncestorOf(w))
|
||||
return true;
|
||||
if (new_block_notification->IsAncestorOf(w))
|
||||
return true;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user