1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

extra option tab

This commit is contained in:
Laserlicht 2023-12-28 19:41:01 +01:00
parent 207b5a2ed0
commit a3e27b859e
11 changed files with 149 additions and 24 deletions

View File

@ -264,11 +264,9 @@
"vcmi.optionsTab.simturnsMin.hover" : "At least for",
"vcmi.optionsTab.simturnsMax.hover" : "At most for",
"vcmi.optionsTab.simturnsAI.hover" : "(Experimental) Simultaneous AI Turns",
"vcmi.optionsTab.cheatAllowed.hover" : "Allow cheats",
"vcmi.optionsTab.simturnsMin.help" : "Play simultaneously for specified number of days. Contacts between players during this period are blocked",
"vcmi.optionsTab.simturnsMax.help" : "Play simultaneously for specified number of days or until contact with another player",
"vcmi.optionsTab.simturnsAI.help" : "{Simultaneous AI Turns}\nExperimental option. Allows AI players to act at the same time as human player when simultaneous turns are enabled.",
"vcmi.optionsTab.cheatAllowed.help" : "{Allow cheats}\nAllows the inputs of cheats during the game.",
"vcmi.optionsTab.turnTime.select" : "Select turn timer preset",
"vcmi.optionsTab.turnTime.unlimited" : "Unlimited turn time",
@ -307,6 +305,12 @@
"vcmi.optionsTab.simturns.months.1" : " %d month",
"vcmi.optionsTab.simturns.months.2" : " %d months",
"vcmi.optionsTab.extraOptions.hover" : "Extra Options",
"vcmi.optionsTab.extraOptions.help" : "Additional settings for the game.",
"vcmi.optionsTab.cheatAllowed.hover" : "Allow cheats",
"vcmi.optionsTab.cheatAllowed.help" : "{Allow cheats}\nAllows the inputs of cheats during the game.",
// Custom victory conditions for H3 campaigns and HotA maps
"vcmi.map.victoryCondition.daysPassed.toOthers" : "The enemy has managed to survive till this day. Victory is theirs!",
"vcmi.map.victoryCondition.daysPassed.toSelf" : "Congratulations! You have managed to survive. Victory is yours!",

View File

@ -283,11 +283,9 @@
"vcmi.optionsTab.simturnsMin.hover" : "Zumindest für",
"vcmi.optionsTab.simturnsMax.hover" : "Höchstens für",
"vcmi.optionsTab.simturnsAI.hover" : "(Experimentell) Simultane KI Züge",
"vcmi.optionsTab.cheatAllowed.hover" : "Cheats erlauben",
"vcmi.optionsTab.simturnsMin.help" : "Spielt gleichzeitig für eine bestimmte Anzahl von Tagen. Die Kontakte zwischen den Spielern sind während dieser Zeit blockiert",
"vcmi.optionsTab.simturnsMax.help" : "Spielt gleichzeitig für eine bestimmte Anzahl von Tagen oder bis zum Kontakt mit einem anderen Spieler",
"vcmi.optionsTab.simturnsAI.help" : "{Simultane KI Züge}\nExperimentelle Option. Ermöglicht es den KI-Spielern, gleichzeitig mit dem menschlichen Spieler zu agieren, wenn simultane Spielzüge aktiviert sind.",
"vcmi.optionsTab.cheatAllowed.help" : "{Cheats erlauben}\nErlaubt die Eingabe von Cheats während des Spiels.",
// Translation note: translate strings below using form that is correct for "0 days", "1 day" and "2 days" in your language
// Using this information, VCMI will automatically select correct plural form for every possible amount
@ -301,6 +299,12 @@
"vcmi.optionsTab.simturns.months.1" : "%d Monat",
"vcmi.optionsTab.simturns.months.2" : "%d Monate",
"vcmi.optionsTab.extraOptions.hover" : "Extra Optionen",
"vcmi.optionsTab.extraOptions.help" : "Zusätzliche Einstellungen für das Spiel.",
"vcmi.optionsTab.cheatAllowed.hover" : "Cheats erlauben",
"vcmi.optionsTab.cheatAllowed.help" : "{Cheats erlauben}\nErlaubt die Eingabe von Cheats während des Spiels.",
// Custom victory conditions for H3 campaigns and HotA maps
"vcmi.map.victoryCondition.daysPassed.toOthers" : "Der Feind hat es geschafft, bis zum heutigen Tag zu überleben. Der Sieg gehört ihm!",
"vcmi.map.victoryCondition.daysPassed.toSelf" : "Herzlichen Glückwunsch! Ihr habt es geschafft, zu überleben. Der Sieg ist euer!",

View File

@ -52,6 +52,7 @@ set(client_SRCS
lobby/CScenarioInfoScreen.cpp
lobby/CSelectionBase.cpp
lobby/TurnOptionsTab.cpp
lobby/ExtraOptionsTab.cpp
lobby/OptionsTab.cpp
lobby/OptionsTabBase.cpp
lobby/RandomMapTab.cpp
@ -215,6 +216,7 @@ set(client_HEADERS
lobby/CScenarioInfoScreen.h
lobby/CSelectionBase.h
lobby/TurnOptionsTab.h
lobby/ExtraOptionsTab.h
lobby/OptionsTab.h
lobby/OptionsTabBase.h
lobby/RandomMapTab.h

View File

@ -16,6 +16,7 @@
#include "lobby/OptionsTab.h"
#include "lobby/RandomMapTab.h"
#include "lobby/TurnOptionsTab.h"
#include "lobby/ExtraOptionsTab.h"
#include "lobby/SelectionTab.h"
#include "lobby/CBonusSelection.h"
@ -99,6 +100,9 @@ void ApplyOnLobbyScreenNetPackVisitor::visitLobbyGuiAction(LobbyGuiAction & pack
case LobbyGuiAction::OPEN_TURN_OPTIONS:
lobby->toggleTab(lobby->tabTurnOptions);
break;
case LobbyGuiAction::OPEN_EXTRA_OPTIONS:
lobby->toggleTab(lobby->tabExtraOptions);
break;
}
}

View File

@ -12,6 +12,7 @@
#include "CBonusSelection.h"
#include "TurnOptionsTab.h"
#include "ExtraOptionsTab.h"
#include "OptionsTab.h"
#include "RandomMapTab.h"
#include "SelectionTab.h"
@ -53,7 +54,10 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
buttonOptions = std::make_shared<CButton>(Point(411, 510), AnimationPath::builtin("GSPBUTT.DEF"), CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabOpt), EShortcut::LOBBY_ADDITIONAL_OPTIONS);
if(settings["general"]["enableUiEnhancements"].Bool())
buttonTurnOptions = std::make_shared<CButton>(Point(619, 510), AnimationPath::builtin("GSPBUT2.DEF"), CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabTurnOptions), EShortcut::NONE);
{
buttonTurnOptions = std::make_shared<CButton>(Point(619, 105), AnimationPath::builtin("GSPBUT2.DEF"), CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabTurnOptions), EShortcut::NONE);
buttonExtraOptions = std::make_shared<CButton>(Point(619, 510), AnimationPath::builtin("GSPBUT2.DEF"), CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabExtraOptions), EShortcut::NONE);
}
};
buttonChat = std::make_shared<CButton>(Point(619, 80), AnimationPath::builtin("GSPBUT2.DEF"), CGI->generaltexth->zelp[48], std::bind(&CLobbyScreen::toggleChat, this), EShortcut::LOBBY_HIDE_CHAT);
@ -65,6 +69,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
{
tabOpt = std::make_shared<OptionsTab>();
tabTurnOptions = std::make_shared<TurnOptionsTab>();
tabExtraOptions = std::make_shared<ExtraOptionsTab>();
tabRand = std::make_shared<RandomMapTab>();
tabRand->mapInfoChanged += std::bind(&IServerAPI::setMapInfo, CSH, _1, _2);
buttonRMG = std::make_shared<CButton>(Point(411, 105), AnimationPath::builtin("GSPBUTT.DEF"), CGI->generaltexth->zelp[47], 0, EShortcut::LOBBY_RANDOM_MAP);
@ -84,6 +89,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
{
tabOpt = std::make_shared<OptionsTab>();
tabTurnOptions = std::make_shared<TurnOptionsTab>();
tabExtraOptions = std::make_shared<ExtraOptionsTab>();
buttonStart = std::make_shared<CButton>(Point(411, 535), AnimationPath::builtin("SCNRLOD.DEF"), CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, false), EShortcut::LOBBY_LOAD_GAME);
initLobby();
break;
@ -122,6 +128,8 @@ void CLobbyScreen::toggleTab(std::shared_ptr<CIntObject> tab)
CSH->sendGuiAction(LobbyGuiAction::OPEN_RANDOM_MAP_OPTIONS);
else if(tab == tabTurnOptions)
CSH->sendGuiAction(LobbyGuiAction::OPEN_TURN_OPTIONS);
else if(tab == tabExtraOptions)
CSH->sendGuiAction(LobbyGuiAction::OPEN_EXTRA_OPTIONS);
CSelectionBase::toggleTab(tab);
}
@ -157,6 +165,9 @@ void CLobbyScreen::toggleMode(bool host)
if (buttonTurnOptions)
buttonTurnOptions->addTextOverlay(CGI->generaltexth->translate("vcmi.optionsTab.turnOptions.hover"), FONT_SMALL, buttonColor);
if (buttonExtraOptions)
buttonExtraOptions->addTextOverlay(CGI->generaltexth->translate("vcmi.optionsTab.extraOptions.hover"), FONT_SMALL, buttonColor);
if(buttonRMG)
{
buttonRMG->addTextOverlay(CGI->generaltexth->allTexts[740], FONT_SMALL, buttonColor);
@ -168,10 +179,14 @@ void CLobbyScreen::toggleMode(bool host)
if (buttonTurnOptions)
buttonTurnOptions->block(!host);
if (buttonExtraOptions)
buttonExtraOptions->block(!host);
if(CSH->mi)
{
tabOpt->recreate();
tabTurnOptions->recreate();
tabExtraOptions->recreate();
}
}
@ -191,7 +206,9 @@ void CLobbyScreen::updateAfterStateChange()
if (tabOpt)
tabOpt->recreate();
if (tabTurnOptions)
tabTurnOptions->recreate();
tabTurnOptions->recreate();
if (tabExtraOptions)
tabExtraOptions->recreate();
}
buttonStart->block(CSH->mi == nullptr || CSH->isGuest());

View File

@ -27,6 +27,7 @@ class CToggleGroup;
class RandomMapTab;
class OptionsTab;
class TurnOptionsTab;
class ExtraOptionsTab;
class SelectionTab;
class InfoCard;
class CChatBox;
@ -60,6 +61,7 @@ public:
std::shared_ptr<CButton> buttonRMG;
std::shared_ptr<CButton> buttonOptions;
std::shared_ptr<CButton> buttonTurnOptions;
std::shared_ptr<CButton> buttonExtraOptions;
std::shared_ptr<CButton> buttonStart;
std::shared_ptr<CButton> buttonBack;
std::shared_ptr<CButton> buttonSimturns;
@ -67,6 +69,7 @@ public:
std::shared_ptr<SelectionTab> tabSel;
std::shared_ptr<OptionsTab> tabOpt;
std::shared_ptr<TurnOptionsTab> tabTurnOptions;
std::shared_ptr<ExtraOptionsTab> tabExtraOptions;
std::shared_ptr<RandomMapTab> tabRand;
std::shared_ptr<CIntObject> curTab;

View File

@ -0,0 +1,18 @@
/*
* ExtraOptionsTab.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "ExtraOptionsTab.h"
ExtraOptionsTab::ExtraOptionsTab()
: OptionsTabBase(JsonPath::builtin("config/widgets/extraOptionsTab.json"))
{
}

View File

@ -0,0 +1,18 @@
/*
* ExtraOptionsTab.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "OptionsTabBase.h"
class ExtraOptionsTab : public OptionsTabBase
{
public:
ExtraOptionsTab();
};

View File

@ -0,0 +1,72 @@
{
"items":
[
{
"name": "background",
"type": "picture",
"image": "ADVOPTBK",
"position": {"x": 0, "y": 6}
},
{
"name": "labelTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "vcmi.optionsTab.extraOptions.hover",
"position": {"x": 222, "y": 36}
},
{
"name": "labelSubTitle",
"type": "multiLineLabel",
"font": "small",
"alignment": "center",
"color": "white",
"text": "vcmi.optionsTab.extraOptions.help",
"rect": {"x": 60, "y": 48, "w": 320, "h": 0},
"adoptHeight": true
},
{
"type": "transparentFilledRectangle",
"rect": {"x": 54, "y": 127, "w": 335, "h": 1},
"color": [24, 41, 90, 255]
},
{
"type": "transparentFilledRectangle",
"rect": {"x": 158, "y": 90, "w": 2, "h": 37},
"color": [24, 41, 90, 255]
},
{
"type": "transparentFilledRectangle",
"rect": {"x": 234, "y": 90, "w": 2, "h": 37},
"color": [24, 41, 90, 255]
},
{
"type": "transparentFilledRectangle",
"rect": {"x": 310, "y": 90, "w": 2, "h": 37},
"color": [24, 41, 90, 255]
},
{
"type": "transparentFilledRectangle",
"rect": {"x": 55, "y": 556, "w": 334, "h": 18},
"color": [24, 41, 90, 255]
},
{
"name": "buttonCheatAllowed",
"position": {"x": 70, "y": 100},
"type": "toggleButton",
"image": "lobby/checkbox",
"callback" : "setCheatAllowed",
"selected" : true
},
{
"name": "labelCheatAllowed",
"type": "label",
"font": "small",
"alignment": "left",
"color": "yellow",
"text": "vcmi.optionsTab.cheatAllowed.hover",
"position": {"x": 110, "y": 103}
}
]
}

View File

@ -329,23 +329,6 @@
"color": "yellow",
"text": "vcmi.optionsTab.simturnsAI.hover",
"position": {"x": 110, "y": 533}
},
{
"name": "buttonCheatAllowed",
"position": {"x": 70, "y": 555},
"type": "toggleButton",
"image": "lobby/checkbox",
"callback" : "setCheatAllowed",
"selected" : true
},
{
"name": "labelCheatAllowed",
"type": "label",
"font": "small",
"alignment": "left",
"color": "yellow",
"text": "vcmi.optionsTab.cheatAllowed.hover",
"position": {"x": 110, "y": 558}
}
],

View File

@ -86,7 +86,7 @@ struct DLL_LINKAGE LobbyChatMessage : public CLobbyPackToPropagate
struct DLL_LINKAGE LobbyGuiAction : public CLobbyPackToPropagate
{
enum EAction : ui8 {
NONE, NO_TAB, OPEN_OPTIONS, OPEN_SCENARIO_LIST, OPEN_RANDOM_MAP_OPTIONS, OPEN_TURN_OPTIONS
NONE, NO_TAB, OPEN_OPTIONS, OPEN_SCENARIO_LIST, OPEN_RANDOM_MAP_OPTIONS, OPEN_TURN_OPTIONS, OPEN_EXTRA_OPTIONS
} action = NONE;