* Initializes all the elements in a Production Complete window. * @param game Pointer to the core game. * @param base Pointer to base the production belongs to. * @param item Item that finished producing. * @param state Pointer to the Geoscape state. * @param endType What ended the production. */
| 43 | * @param endType What ended the production. |
| 44 | */ |
| 45 | ProductionCompleteState::ProductionCompleteState(Game *game, Base *base, const std::wstring &item, GeoscapeState *state, productionProgress_e endType) : State(game), _base(base), _state(state), _endType(endType) |
| 46 | { |
| 47 | _screen = false; |
| 48 | |
| 49 | // Create objects |
| 50 | _window = new Window(this, 256, 160, 32, 20, POPUP_BOTH); |
| 51 | _btnOk = new TextButton(118, 18, 40, 154); |
| 52 | _btnGotoBase = new TextButton(118, 18, 162, 154); |
| 53 | _txtMessage = new Text(246, 110, 37, 35); |
| 54 | |
| 55 | // Set palette |
| 56 | setPalette("PAL_GEOSCAPE", 6); |
| 57 | |
| 58 | add(_window); |
| 59 | add(_btnOk); |
| 60 | add(_btnGotoBase); |
| 61 | add(_txtMessage); |
| 62 | |
| 63 | centerAllSurfaces(); |
| 64 | |
| 65 | // Set up objects |
| 66 | _window->setColor(Palette::blockOffset(15)-1); |
| 67 | _window->setBackground(_game->getResourcePack()->getSurface("BACK17.SCR")); |
| 68 | |
| 69 | _btnOk->setColor(Palette::blockOffset(8)+5); |
| 70 | _btnOk->setText(tr("STR_OK")); |
| 71 | _btnOk->onMouseClick((ActionHandler)&ProductionCompleteState::btnOkClick); |
| 72 | _btnOk->onKeyboardPress((ActionHandler)&ProductionCompleteState::btnOkClick, Options::keyCancel); |
| 73 | |
| 74 | _btnGotoBase->setColor(Palette::blockOffset(8)+5); |
| 75 | if (_endType != PROGRESS_CONSTRUCTION) |
| 76 | { |
| 77 | _btnGotoBase->setText(tr("STR_ALLOCATE_MANUFACTURE")); |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | _btnGotoBase->setText(tr("STR_GO_TO_BASE")); |
| 82 | } |
| 83 | _btnGotoBase->onMouseClick((ActionHandler)&ProductionCompleteState::btnGotoBaseClick); |
| 84 | |
| 85 | _txtMessage->setColor(Palette::blockOffset(15)-1); |
| 86 | _txtMessage->setAlign(ALIGN_CENTER); |
| 87 | _txtMessage->setVerticalAlign(ALIGN_MIDDLE); |
| 88 | _txtMessage->setBig(); |
| 89 | _txtMessage->setWordWrap(true); |
| 90 | std::wstring s; |
| 91 | switch(_endType) |
| 92 | { |
| 93 | case PROGRESS_CONSTRUCTION: |
| 94 | s = tr("STR_CONSTRUCTION_OF_FACILITY_AT_BASE_IS_COMPLETE").arg(item).arg(base->getName()); |
| 95 | break; |
| 96 | case PROGRESS_COMPLETE: |
| 97 | s = tr("STR_PRODUCTION_OF_ITEM_AT_BASE_IS_COMPLETE").arg(item).arg(base->getName()); |
| 98 | break; |
| 99 | case PROGRESS_NOT_ENOUGH_MONEY: |
| 100 | s = tr("STR_NOT_ENOUGH_MONEY_TO_PRODUCE_ITEM_AT_BASE").arg(item).arg(base->getName()); |
| 101 | break; |
| 102 | case PROGRESS_NOT_ENOUGH_MATERIALS: |
nothing calls this directly
no test coverage detected