game: add current crop to harvest dialog

This commit is contained in:
Crypto City 2020-08-24 22:09:10 +00:00
parent 3335f8d14f
commit 9582b834ff
3 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,9 @@ WindowInfo
TBLayout: axis: y, distribution-position: "left top", distribution: "gravity"
TBTextField: id: "date"
TBLayout: axis: x
TBTextField: text: "Currently growing:"
TBTextField: id: "crop"
TBLayout: axis: x
TBTextField: text: "Harvest season started"
TBTextField: id: "started-blocks"

View File

@ -47,6 +47,7 @@ UIHarvestDialog::UIHarvestDialog(Context *ctx, const GameState *game, const std:
throw std::runtime_error("Flag must be specified in harvest dialog");
dateWidget = GetWidgetByIDAndType<TBTextField>(TBIDC("date"));
cropWidget = GetWidgetByIDAndType<TBTextField>(TBIDC("crop"));
startedWidget = GetWidgetByIDAndType<TBTextField>(TBIDC("started-blocks"));
endsWidget = GetWidgetByIDAndType<TBTextField>(TBIDC("ends-blocks"));
sownWidget = GetWidgetByIDAndType<TBTextField>(TBIDC("sown-blocks"));
@ -116,6 +117,8 @@ void UIHarvestDialog::UpdateData(const std::shared_ptr<GameWallet> &w)
cc::get_calendar_date(game->top_height, &seasonal, day, month, year);
dateWidget->SetText(seasonal.c_str());
cropWidget->SetText(cc::get_crop_name(flag->crop));
const uint64_t next_height = game->top_height + 1;
uint64_t blocks = cc::get_blocks_since_harvest_season_start(flag->crop, next_height);

View File

@ -47,6 +47,7 @@ private:
std::shared_ptr<Flag> flag;
tb::TBTextField *dateWidget;
tb::TBTextField *cropWidget;
tb::TBTextField *startedWidget;
tb::TBTextField *endsWidget;
tb::TBTextField *sownWidget;