Ejemplo n.º 1
0
AboutWorkingBuilding::AboutWorkingBuilding( Widget* parent, WorkingBuildingPtr building)
  : AboutConstruction( parent, Rect( 0, 0, 510, 256 ), Rect( 16, 136, 510 - 16, 136 + 62 ) )
{
  _working = building;

  setBase( ptr_cast<Construction>( _working ) );
  _setWorkingVisible( true );

  std::string title = MetaDataHolder::findPrettyName( _working->type() );
  setTitle( _(title) );

  _updateWorkersLabel( Point( 32, 150 ), 542, _working->maximumWorkers(), _working->numberWorkers() );

  Label* lb = new Label( this, Rect( 16, 50, width() - 16, 130 ), "", false, Label::bgNone, lbHelpId );
  lb->setFont( Font::create( FONT_2 ) );
  lb->setWordwrap( true );

  setText( "" );

  std::string text = utils::format( 0xff, "%d%% damage - %d%% fire",
                                           (int)_working->state( Construction::damage ),
                                           (int)_working->state( Construction::fire ));
  if( is_kind_of<ServiceBuilding>( _working ) )
  {
    ServiceBuildingPtr srvc = ptr_cast<ServiceBuilding>( _working );
    DateTime time = srvc->lastSendService();
    text += utils::format( 0xff, " Srvc: %04d.%02d.%02d", time.year(), time.month(), time.day() );
  }

  new Label( this, Rect( 50, height() - 30, width() - 50, height() - 10 ), text );
}
Ejemplo n.º 2
0
AboutWarehouse::AboutWarehouse(Widget* parent, PlayerCityPtr city, const Tile& tile )
  : AboutConstruction( parent, Rect( 0, 0, 510, 360 ), Rect( 16, 225, 510 - 16, 225 + 62 ) )
{
  setupUI( ":/gui/warehouseinfo.gui" );

  _warehouse = ptr_cast<Warehouse>( tile.overlay() );

  setBase( ptr_cast<Construction>( _warehouse ) );
  _setWorkingVisible( true );

  /*StringArray warnings;
  if( _warehouse->onlyDispatchGoods() )  { warnings << "##warehouse_low_personal_warning##";  }
  if( _warehouse->getGoodStore().freeQty() == 0 ) { warnings << "##warehouse_full_warning##";  }

  if( !warnings.empty() )
  {
    Label* lb = new Label( this, Rect( 20, height() - 54, width() - 20, height() - 34 ), _(warnings.rand()) );
    lb->setTextAlignment( alignCenter, alignCenter );
  }*/

  PushButton* btnOrders;
  GET_WIDGET_FROM_UI( btnOrders );
  CONNECT( btnOrders, onClicked(), this, AboutWarehouse::showSpecialOrdersWindow );

  std::string title = MetaDataHolder::findPrettyName( _warehouse->type() );
  setTitle( _(title) );

  // summary: total stock, free capacity
  int _paintY = _lbTitleRef() ? _lbTitleRef()->bottom() : 50;

  drawGood(good::wheat,     0, _paintY+0);
  drawGood(good::vegetable, 0, _paintY+25);
  drawGood(good::fruit,     0, _paintY+50);
  drawGood(good::olive,     0, _paintY+75);
  drawGood(good::grape,     0, _paintY+100);
  drawGood(good::fish,      0, _paintY+125);

  drawGood(good::meat,      1, _paintY+0);
  drawGood(good::wine,      1, _paintY+25);
  drawGood(good::oil,       1, _paintY+50);
  drawGood(good::iron,      1, _paintY+75);
  drawGood(good::timber,    1, _paintY+100);

  drawGood(good::clay,      2, _paintY+0);
  drawGood(good::marble,    2, _paintY+25);
  drawGood(good::weapon,    2, _paintY+50);
  drawGood(good::furniture, 2, _paintY+75);
  drawGood(good::pottery,   2, _paintY+100);

  _updateWorkersLabel( Point( 20, 10 ), 542, _warehouse->maximumWorkers(), _warehouse->numberWorkers() );
}
Ejemplo n.º 3
0
AboutSenate::AboutSenate(Widget* parent, PlayerCityPtr city, const Tile& tile )
  : Simple( parent, Rect( 0, 0, 510, 290 ), Rect( 16, 126, 510 - 16, 126 + 62 ) )
{
  SenatePtr senate = ptr_cast<Senate>( tile.overlay() );
  std::string title = MetaDataHolder::instance().getData( building::senate ).prettyName();
  setTitle( _(title) );

  // number of workers
  _updateWorkersLabel( Point( 32, 136), 542, senate->maximumWorkers(), senate->numberWorkers() );

  std::string denariesStr = StringHelper::format( 0xff, "%s %d", _("##senate_save##"), senate->funds() );

  Label* lb = new Label( this, Rect( 60, 35, width() - 16, 35 + 30 ), denariesStr );
  lb->setIcon( GoodHelper::picture( Good::denaries ) );
  lb->setText( denariesStr );
  lb->setTextOffset( Point( 30, 0 ));

  new Label( this, Rect( 60, 215, 60 + 300, 215 + 24 ), _("##visit_rating_advisor##") );
  TexturedButton* btnAdvisor = new TexturedButton( this, Point( 350, 215 ), Size(28), advisorBtnId, 289 );
  CONNECT( btnAdvisor, onClicked(), this, AboutSenate::_showRatingAdvisor );
  CONNECT( btnAdvisor, onClicked(), this, AboutSenate::deleteLater );
}
Ejemplo n.º 4
0
AboutGranary::AboutGranary(Widget* parent, PlayerCityPtr city, const Tile& tile )
  : AboutConstruction( parent, Rect( 0, 0, 510, 280 ), Rect( 16, 130, 510 - 16, 130 + 62) )
{
  setupUI( ":/gui/granaryinfo.gui" );

  _granary = ptr_cast<Granary>( tile.overlay() );

  setBase( ptr_cast<Construction>( _granary ) );
  _setWorkingVisible( true );

  PushButton* btnOrders;
  Label* lbUnits;
  GET_WIDGET_FROM_UI( btnOrders )
  GET_WIDGET_FROM_UI( lbUnits )

  CONNECT( btnOrders, onClicked(), this, AboutGranary::showSpecialOrdersWindow );

  std::string title = MetaDataHolder::findPrettyName( _granary->type() );
  setTitle( _(title) ); 

  if( lbUnits )
  {
    // summary: total stock, free capacity
    std::string desc = utils::format( 0xff, "%d %s, %s %d",
                                             _granary->store().qty(),
                                             _("##units_in_stock##"), _("##freespace_for##"),
                                             _granary->store().freeQty() );
    lbUnits->setPosition( _lbTitleRef()->leftbottom() + Point( 0, 5 ) );
    lbUnits->setText( desc );

    drawGood(good::wheat, 0, lbUnits->bottom() );
    drawGood(good::meat, 0, lbUnits->bottom() + 25);
    drawGood(good::fruit, 1, lbUnits->bottom() );
    drawGood(good::vegetable, 1, lbUnits->bottom() + 25);
  }

  _updateWorkersLabel( Point( 32, lbUnits->bottom() + 60 ), 542, _granary->maximumWorkers(), _granary->numberWorkers() );
}