mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
button for campaignsets
This commit is contained in:
@@ -425,6 +425,7 @@
|
|||||||
"vcmi.keyBindings.keyBinding.lobbySelectScenario": "Lobby select scenario",
|
"vcmi.keyBindings.keyBinding.lobbySelectScenario": "Lobby select scenario",
|
||||||
"vcmi.keyBindings.keyBinding.lobbyToggleChat": "Lobby toggle chat",
|
"vcmi.keyBindings.keyBinding.lobbyToggleChat": "Lobby toggle chat",
|
||||||
"vcmi.keyBindings.keyBinding.lobbyTurnOptions": "Lobby turn options",
|
"vcmi.keyBindings.keyBinding.lobbyTurnOptions": "Lobby turn options",
|
||||||
|
"vcmi.keyBindings.keyBinding.lobbyCampaignSets": "Lobby campaign sets",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuBack": "Main menu back",
|
"vcmi.keyBindings.keyBinding.mainMenuBack": "Main menu back",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuCampaign": "Main menu campaign",
|
"vcmi.keyBindings.keyBinding.mainMenuCampaign": "Main menu campaign",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuCampaignAb": "Main menu campaign ab",
|
"vcmi.keyBindings.keyBinding.mainMenuCampaignAb": "Main menu campaign ab",
|
||||||
@@ -848,6 +849,9 @@
|
|||||||
"vcmi.optionsTab.simturns.months.1" : " %d month",
|
"vcmi.optionsTab.simturns.months.1" : " %d month",
|
||||||
"vcmi.optionsTab.simturns.months.2" : " %d months",
|
"vcmi.optionsTab.simturns.months.2" : " %d months",
|
||||||
|
|
||||||
|
"vcmi.selectionTab.campaignSets.hover" : "Campaign sets",
|
||||||
|
"vcmi.selectionTab.campaignSets.help" : "Multiple campaigns bundeled as set",
|
||||||
|
|
||||||
"vcmi.optionsTab.extraOptions.hover" : "Extra Options",
|
"vcmi.optionsTab.extraOptions.hover" : "Extra Options",
|
||||||
"vcmi.optionsTab.extraOptions.help" : "Additional settings for the game",
|
"vcmi.optionsTab.extraOptions.help" : "Additional settings for the game",
|
||||||
|
|
||||||
|
|||||||
@@ -434,6 +434,7 @@
|
|||||||
"vcmi.keyBindings.keyBinding.lobbySelectScenario": "Lobby Szenario wählen",
|
"vcmi.keyBindings.keyBinding.lobbySelectScenario": "Lobby Szenario wählen",
|
||||||
"vcmi.keyBindings.keyBinding.lobbyToggleChat": "Lobby Chat umschalten",
|
"vcmi.keyBindings.keyBinding.lobbyToggleChat": "Lobby Chat umschalten",
|
||||||
"vcmi.keyBindings.keyBinding.lobbyTurnOptions": "Lobby Zugoptionen",
|
"vcmi.keyBindings.keyBinding.lobbyTurnOptions": "Lobby Zugoptionen",
|
||||||
|
"vcmi.keyBindings.keyBinding.lobbyCampaignSets": "Lobby Kampagnensätze",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuBack": "Hauptmenü zurück",
|
"vcmi.keyBindings.keyBinding.mainMenuBack": "Hauptmenü zurück",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuCampaign": "Hauptmenü Kampagne",
|
"vcmi.keyBindings.keyBinding.mainMenuCampaign": "Hauptmenü Kampagne",
|
||||||
"vcmi.keyBindings.keyBinding.mainMenuCampaignAb": "Hauptmenü Kampagne Ab",
|
"vcmi.keyBindings.keyBinding.mainMenuCampaignAb": "Hauptmenü Kampagne Ab",
|
||||||
@@ -847,6 +848,9 @@
|
|||||||
"vcmi.optionsTab.simturns.months.1" : "%d Monat",
|
"vcmi.optionsTab.simturns.months.1" : "%d Monat",
|
||||||
"vcmi.optionsTab.simturns.months.2" : "%d Monate",
|
"vcmi.optionsTab.simturns.months.2" : "%d Monate",
|
||||||
|
|
||||||
|
"vcmi.selectionTab.campaignSets.hover" : "Kampagnensätze",
|
||||||
|
"vcmi.selectionTab.campaignSets.help" : "Mehrere Kampagnen gebündelt als Satz",
|
||||||
|
|
||||||
"vcmi.optionsTab.extraOptions.hover" : "Extra Optionen",
|
"vcmi.optionsTab.extraOptions.hover" : "Extra Optionen",
|
||||||
"vcmi.optionsTab.extraOptions.help" : "Zusätzliche Einstellungen für das Spiel",
|
"vcmi.optionsTab.extraOptions.help" : "Zusätzliche Einstellungen für das Spiel",
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ enum class EShortcut
|
|||||||
LOBBY_RANDOM_TOWN,
|
LOBBY_RANDOM_TOWN,
|
||||||
LOBBY_RANDOM_TOWN_VS,
|
LOBBY_RANDOM_TOWN_VS,
|
||||||
LOBBY_HANDICAP,
|
LOBBY_HANDICAP,
|
||||||
|
LOBBY_CAMPAIGN_SETS,
|
||||||
|
|
||||||
MAPS_SIZE_S,
|
MAPS_SIZE_S,
|
||||||
MAPS_SIZE_M,
|
MAPS_SIZE_M,
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
|
|||||||
{"lobbyRandomTown", EShortcut::LOBBY_RANDOM_TOWN },
|
{"lobbyRandomTown", EShortcut::LOBBY_RANDOM_TOWN },
|
||||||
{"lobbyRandomTownVs", EShortcut::LOBBY_RANDOM_TOWN_VS },
|
{"lobbyRandomTownVs", EShortcut::LOBBY_RANDOM_TOWN_VS },
|
||||||
{"lobbyHandicap", EShortcut::LOBBY_HANDICAP },
|
{"lobbyHandicap", EShortcut::LOBBY_HANDICAP },
|
||||||
|
{"lobbyCampaignSets", EShortcut::LOBBY_CAMPAIGN_SETS },
|
||||||
{"mapsSizeS", EShortcut::MAPS_SIZE_S },
|
{"mapsSizeS", EShortcut::MAPS_SIZE_S },
|
||||||
{"mapsSizeM", EShortcut::MAPS_SIZE_M },
|
{"mapsSizeM", EShortcut::MAPS_SIZE_M },
|
||||||
{"mapsSizeL", EShortcut::MAPS_SIZE_L },
|
{"mapsSizeL", EShortcut::MAPS_SIZE_L },
|
||||||
|
|||||||
@@ -154,15 +154,24 @@ static ESortBy getSortBySelectionScreen(ESelectionScreen Type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SelectionTab::SelectionTab(ESelectionScreen Type)
|
SelectionTab::SelectionTab(ESelectionScreen Type)
|
||||||
: CIntObject(LCLICK | SHOW_POPUP | KEYBOARD | DOUBLECLICK), callOnSelect(nullptr), tabType(Type), selectionPos(0), sortModeAscending(true), inputNameRect{32, 539, 350, 20}, curFolder(""), currentMapSizeFilter(0), showRandom(false), deleteMode(false)
|
: CIntObject(LCLICK | SHOW_POPUP | KEYBOARD | DOUBLECLICK)
|
||||||
|
, callOnSelect(nullptr)
|
||||||
|
, tabType(Type)
|
||||||
|
, selectionPos(0)
|
||||||
|
, sortModeAscending(true)
|
||||||
|
, inputNameRect{32, 539, 350, 20}
|
||||||
|
, curFolder("")
|
||||||
|
, currentMapSizeFilter(0)
|
||||||
|
, showRandom(false)
|
||||||
|
, deleteMode(false)
|
||||||
|
, enableUiEnhancements(settings["general"]["enableUiEnhancements"].Bool())
|
||||||
|
, campaignSets(JsonUtils::assembleFromFiles("config/campaignSets.json"))
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
|
|
||||||
generalSortingBy = getSortBySelectionScreen(tabType);
|
generalSortingBy = getSortBySelectionScreen(tabType);
|
||||||
sortingBy = _format;
|
sortingBy = _format;
|
||||||
|
|
||||||
bool enableUiEnhancements = settings["general"]["enableUiEnhancements"].Bool();
|
|
||||||
|
|
||||||
if(tabType != ESelectionScreen::campaignList)
|
if(tabType != ESelectionScreen::campaignList)
|
||||||
{
|
{
|
||||||
background = std::make_shared<CPicture>(ImagePath::builtin("SCSELBCK.bmp"), 0, 6);
|
background = std::make_shared<CPicture>(ImagePath::builtin("SCSELBCK.bmp"), 0, 6);
|
||||||
@@ -244,6 +253,14 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
|||||||
if(tabType == ESelectionScreen::newGame)
|
if(tabType == ESelectionScreen::newGame)
|
||||||
buttonDeleteMode->setEnabled(false);
|
buttonDeleteMode->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tabType == ESelectionScreen::campaignList)
|
||||||
|
{
|
||||||
|
buttonCampaignSet = std::make_shared<CButton>(Point(262, 53), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("", LIBRARY->generaltexth->translate("vcmi.selectionTab.campaignSets.help")), [this]{
|
||||||
|
showCampaignSetWindow();
|
||||||
|
}, EShortcut::LOBBY_CAMPAIGN_SETS);
|
||||||
|
buttonCampaignSet->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.selectionTab.campaignSets.hover"), FONT_SMALL, Colors::WHITE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < positionsToShow; i++)
|
for(int i = 0; i < positionsToShow; i++)
|
||||||
@@ -961,9 +978,6 @@ void SelectionTab::handleUnsupportedSavegames(const std::vector<ResourcePath> &
|
|||||||
|
|
||||||
void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files)
|
void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files)
|
||||||
{
|
{
|
||||||
auto campaignSets = JsonUtils::assembleFromFiles("config/campaignSets.json");
|
|
||||||
auto mainmenu = JsonNode(JsonPath::builtin("config/mainmenu.json"));
|
|
||||||
|
|
||||||
allItems.reserve(files.size());
|
allItems.reserve(files.size());
|
||||||
for(auto & file : files)
|
for(auto & file : files)
|
||||||
{
|
{
|
||||||
@@ -977,22 +991,13 @@ void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files
|
|||||||
if(info->campaign)
|
if(info->campaign)
|
||||||
{
|
{
|
||||||
// skip campaigns organized in sets
|
// skip campaigns organized in sets
|
||||||
std::string foundInSet = "";
|
bool foundInSet = false;
|
||||||
for (auto const & set : campaignSets.Struct())
|
for (auto const & set : campaignSets.Struct())
|
||||||
for (auto const & item : set.second["items"].Vector())
|
for (auto const & item : set.second["items"].Vector())
|
||||||
if(file.getName() == ResourcePath(item["file"].String()).getName())
|
if(file.getName() == ResourcePath(item["file"].String()).getName())
|
||||||
foundInSet = set.first;
|
foundInSet = true;
|
||||||
|
|
||||||
// set has to be used in main menu
|
if(!foundInSet || !enableUiEnhancements)
|
||||||
bool setInMainmenu = false;
|
|
||||||
if(!foundInSet.empty())
|
|
||||||
for (auto const & item : mainmenu["window"]["items"].Vector())
|
|
||||||
if(item["name"].String() == "campaign")
|
|
||||||
for (auto const & button : item["buttons"].Vector())
|
|
||||||
if(boost::algorithm::ends_with(boost::algorithm::to_lower_copy(button["command"].String()), boost::algorithm::to_lower_copy(foundInSet)))
|
|
||||||
setInMainmenu = true;
|
|
||||||
|
|
||||||
if(!setInMainmenu)
|
|
||||||
allItems.push_back(info);
|
allItems.push_back(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1128,3 +1133,8 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<ElementInfo> info, bool
|
|||||||
labelName->setText(info->name);
|
labelName->setText(info->name);
|
||||||
labelName->setColor(color);
|
labelName->setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionTab::showCampaignSetWindow()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ class SelectionTab : public CIntObject
|
|||||||
std::shared_ptr<CAnimation> iconsLossCondition;
|
std::shared_ptr<CAnimation> iconsLossCondition;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ListItem>> unSupportedSaves;
|
std::vector<std::shared_ptr<ListItem>> unSupportedSaves;
|
||||||
|
|
||||||
|
JsonNode campaignSets;
|
||||||
public:
|
public:
|
||||||
std::vector<std::shared_ptr<ElementInfo>> allItems;
|
std::vector<std::shared_ptr<ElementInfo>> allItems;
|
||||||
std::vector<std::shared_ptr<ElementInfo>> curItems;
|
std::vector<std::shared_ptr<ElementInfo>> curItems;
|
||||||
@@ -125,6 +127,9 @@ private:
|
|||||||
std::shared_ptr<CButton> buttonDeleteMode;
|
std::shared_ptr<CButton> buttonDeleteMode;
|
||||||
bool deleteMode;
|
bool deleteMode;
|
||||||
|
|
||||||
|
bool enableUiEnhancements;
|
||||||
|
std::shared_ptr<CButton> buttonCampaignSet;
|
||||||
|
|
||||||
auto checkSubfolder(std::string path);
|
auto checkSubfolder(std::string path);
|
||||||
|
|
||||||
bool isMapSupported(const CMapInfo & info);
|
bool isMapSupported(const CMapInfo & info);
|
||||||
@@ -133,5 +138,7 @@ private:
|
|||||||
void parseCampaigns(const std::unordered_set<ResourcePath> & files);
|
void parseCampaigns(const std::unordered_set<ResourcePath> & files);
|
||||||
std::unordered_set<ResourcePath> getFiles(std::string dirURI, EResType resType);
|
std::unordered_set<ResourcePath> getFiles(std::string dirURI, EResType resType);
|
||||||
|
|
||||||
|
void showCampaignSetWindow();
|
||||||
|
|
||||||
void handleUnsupportedSavegames(const std::vector<ResourcePath> & files);
|
void handleUnsupportedSavegames(const std::vector<ResourcePath> & files);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,6 +154,7 @@
|
|||||||
"lobbySelectScenario": "S",
|
"lobbySelectScenario": "S",
|
||||||
"lobbyToggleChat": "C",
|
"lobbyToggleChat": "C",
|
||||||
"lobbyTurnOptions": "T",
|
"lobbyTurnOptions": "T",
|
||||||
|
"lobbyCampaignSets": "G",
|
||||||
"mainMenuBack": [ "B", "Escape" ],
|
"mainMenuBack": [ "B", "Escape" ],
|
||||||
"mainMenuCampaign": "C",
|
"mainMenuCampaign": "C",
|
||||||
"mainMenuCampaignAb": "A",
|
"mainMenuCampaignAb": "A",
|
||||||
|
|||||||
Reference in New Issue
Block a user