ActiveUI* State::getActiveUI(std::string name) { return dynamic_cast<ActiveUI*>(getUI(name)); }
TextArea* State::getTextArea(std::string name) { return dynamic_cast<TextArea*>(getUI(name)); }
void SettingsMenu::doSave() { auto settings = Game::getInstance()->settings(); settings->setCombatDifficulty(((UI::MultistateImageButton*)getUI("combat_difficulty"))->state()); settings->setGameDifficulty(((UI::MultistateImageButton*)getUI("game_difficulty"))->state()); settings->setViolenceLevel(((UI::MultistateImageButton*)getUI("violence_level"))->state()); settings->setTargetHighlight(((UI::MultistateImageButton*)getUI("target_highlight"))->state()); settings->setCombatLooks(((UI::MultistateImageButton*)getUI("combat_looks"))->state()); settings->setCombatMessages(((UI::MultistateImageButton*)getUI("combat_messages"))->state()); settings->setCombatTaunts(((UI::MultistateImageButton*)getUI("combat_taunts"))->state()); settings->setLanguageFilter(((UI::MultistateImageButton*)getUI("language_filter"))->state()); settings->setRunning(((UI::MultistateImageButton*)getUI("running"))->state()); settings->setSubtitles(((UI::MultistateImageButton*)getUI("subtitles"))->state()); settings->setItemHighlight(((UI::MultistateImageButton*)getUI("item_highlight"))->state()); settings->setMasterVolume(((UI::Slider*)getUI("master_volume"))->value()); settings->setMusicVolume(((UI::Slider*)getUI("music_volume"))->value()); settings->setVoiceVolume(((UI::Slider*)getUI("voice_volume"))->value()); settings->setSfxVolume(((UI::Slider*)getUI("sfx_volume"))->value()); settings->setTextDelay(((UI::Slider*)getUI("text_delay"))->value()); settings->setCombatSpeed(((UI::Slider*)getUI("combat_speed"))->value()); settings->setBrightness(((UI::Slider*)getUI("brightness"))->value()); settings->setMouseSensitivity(((UI::Slider*)getUI("mouse_sensitivity"))->value()); settings->setPlayerSpeedup(((UI::ImageButton*)getUI("player_speedup"))->checked()); settings->save(); Game::getInstance()->popState(); }
void InventoryState::_screenShow (unsigned int PID) { auto player = Game::getInstance()->player(); auto playerNameLabel = getTextArea("player_name"); auto statsLabel = getTextArea("label_stats"); auto statsValuesLabel = getTextArea("label_stats_values"); auto textLabel = getTextArea("textLabel"); auto hitPointsLabel = getTextArea("hitPointsLabel"); auto armorClassLabel = getTextArea("armorClassLabel"); auto damageThresholdLabel = getTextArea("damageThresholdLabel"); auto damageResistanceLabel = getTextArea("damageResistanceLabel"); auto line2 = dynamic_cast<Image*>(getUI("line2")); auto line3 = dynamic_cast<Image*>(getUI("line3")); auto totalWtLabel = getTextArea("totalWtLabel"); auto weightLabel = getTextArea("weightLabel"); auto weightMaxLabel = getTextArea("weightMaxLabel"); auto leftHandLabel = getTextArea("leftHandLabel"); auto rightHandLabel = getTextArea("rightHandLabel"); auto screenLabel = getTextArea("screenLabel"); if (PID == 0) { playerNameLabel->setText(player->name()); screenLabel->setVisible(false); statsLabel->setVisible(true); statsValuesLabel->setVisible(true); textLabel->setVisible(true); hitPointsLabel->setVisible(true); armorClassLabel->setVisible(true); damageThresholdLabel->setVisible(true); damageResistanceLabel->setVisible(true); line2->setVisible(true); line3->setVisible(true); totalWtLabel->setVisible(true); weightLabel->setVisible(true); weightMaxLabel->setVisible(true); leftHandLabel->setVisible(true); rightHandLabel->setVisible(true); } else { auto msg = ResourceManager::msgFileType("text/english/game/pro_item.msg"); playerNameLabel->setText(msg->message(PID*100)->text()); // item name screenLabel->setText(msg->message(PID*100+1)->text()); // item dedcription screenLabel->setVisible(true); statsLabel->setVisible(false); statsValuesLabel->setVisible(false); textLabel->setVisible(false); hitPointsLabel->setVisible(false); armorClassLabel->setVisible(false); damageThresholdLabel->setVisible(false); damageResistanceLabel->setVisible(false); line2->setVisible(false); line3->setVisible(false); totalWtLabel->setVisible(false); weightLabel->setVisible(false); weightMaxLabel->setVisible(false); leftHandLabel->setVisible(false); rightHandLabel->setVisible(false); } }
UI::SmallCounter* State::getSmallCounter(const std::string& name) { return dynamic_cast<UI::SmallCounter*>(getUI(name)); }
UI::ImageList* State::getImageList(const std::string& name) { return dynamic_cast<UI::ImageList*>(getUI(name)); }
UI::TextArea* State::getTextArea(const std::string& name) { return dynamic_cast<UI::TextArea*>(getUI(name)); }