* Initializes all the elements in the EndResearch screen. * @param game Pointer to the core game. * @param research Pointer to the completed research. * @param bonus Pointer to bonus unlocked research. */
| 40 | * @param bonus Pointer to bonus unlocked research. |
| 41 | */ |
| 42 | ResearchCompleteState::ResearchCompleteState(Game * game, const RuleResearch * research, const RuleResearch * bonus): State (game), _research(research), _bonus(bonus) |
| 43 | { |
| 44 | _screen = false; |
| 45 | |
| 46 | // Create objects |
| 47 | _window = new Window(this, 230, 140, 45, 30, POPUP_BOTH); |
| 48 | _btnOk = new TextButton(80, 16, 64, 146); |
| 49 | _btnReport = new TextButton(80, 16, 176, 146); |
| 50 | _txtTitle = new Text(230, 17, 45, 70); |
| 51 | _txtResearch = new Text(230, 32, 45, 96); |
| 52 | |
| 53 | // Set palette |
| 54 | setPalette("PAL_GEOSCAPE", 0); |
| 55 | |
| 56 | add(_window); |
| 57 | add(_btnOk); |
| 58 | add(_btnReport); |
| 59 | add(_txtTitle); |
| 60 | add(_txtResearch); |
| 61 | |
| 62 | centerAllSurfaces(); |
| 63 | |
| 64 | // Set up objects |
| 65 | _window->setColor(Palette::blockOffset(15)-1); |
| 66 | _window->setBackground(_game->getResourcePack()->getSurface("BACK05.SCR")); |
| 67 | |
| 68 | _btnOk->setColor(Palette::blockOffset(8)+5); |
| 69 | _btnOk->setText(tr("STR_OK")); |
| 70 | _btnOk->onMouseClick((ActionHandler)&ResearchCompleteState::btnOkClick); |
| 71 | _btnOk->onKeyboardPress((ActionHandler)&ResearchCompleteState::btnOkClick, Options::keyCancel); |
| 72 | |
| 73 | _btnReport->setColor(Palette::blockOffset(8)+5); |
| 74 | _btnReport->setText(tr("STR_VIEW_REPORTS")); |
| 75 | _btnReport->onMouseClick((ActionHandler)&ResearchCompleteState::btnReportClick); |
| 76 | _btnReport->onKeyboardPress((ActionHandler)&ResearchCompleteState::btnReportClick, Options::keyOk); |
| 77 | |
| 78 | _txtTitle->setColor(Palette::blockOffset(15)-1); |
| 79 | _txtTitle->setBig(); |
| 80 | _txtTitle->setAlign(ALIGN_CENTER); |
| 81 | _txtTitle->setText(tr("STR_RESEARCH_COMPLETED")); |
| 82 | |
| 83 | _txtResearch->setColor(Palette::blockOffset(8)+10); |
| 84 | _txtResearch->setAlign(ALIGN_CENTER); |
| 85 | _txtResearch->setBig(); |
| 86 | _txtResearch->setWordWrap(true); |
| 87 | if (research) |
| 88 | { |
| 89 | _txtResearch->setText(tr(research->getName())); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * return to the previous screen |
nothing calls this directly
no test coverage detected