mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Implement min/max simturns callbacks
This commit is contained in:
parent
1f045ab128
commit
e160b8557b
@ -236,8 +236,7 @@
|
||||
"vcmi.optionsTab.simturnsMin.hover" : "At least for",
|
||||
"vcmi.optionsTab.simturnsMax.hover" : "At most for",
|
||||
"vcmi.optionsTab.simturnsAI.hover" : "(Experimental) Simultaneous AI Turns",
|
||||
"vcmi.optionsTab.simturnsMin.help" : "Play simultaneously at least for specified number of days. Contacts between players during this period are blocked",
|
||||
"vcmi.optionsTab.simturnsMax.help" : "Play simultaneously at most for specified number of days or until they meet each other.",
|
||||
"vcmi.optionsTab.simturns.help" : "Play simultaneously at least for specified number of days, after which simultaneous turns will stay active until specified day or until players make contact. Contacts between players during this period are blocked",
|
||||
"vcmi.optionsTab.simturnsAI.help" : "",
|
||||
|
||||
// Custom victory conditions for H3 campaigns and HotA maps
|
||||
|
@ -38,8 +38,14 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
|
||||
}
|
||||
});
|
||||
|
||||
addCallback("setSimturnDuration", [&](int index){
|
||||
SimturnsInfo info;
|
||||
addCallback("setSimturnDurationMin", [&](int index){
|
||||
SimturnsInfo info = SEL->getStartInfo()->simturnsInfo;
|
||||
info.requiredTurns = index;
|
||||
CSH->setSimturnsInfo(info);
|
||||
});
|
||||
|
||||
addCallback("setSimturnDurationMax", [&](int index){
|
||||
SimturnsInfo info = SEL->getStartInfo()->simturnsInfo;
|
||||
info.optionalTurns = index;
|
||||
CSH->setSimturnsInfo(info);
|
||||
});
|
||||
@ -184,10 +190,21 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
|
||||
void OptionsTabBase::recreate()
|
||||
{
|
||||
//Simultaneous turns
|
||||
if(auto turnSlider = widget<CSlider>("labelSimturnsDurationValue"))
|
||||
if(auto turnSlider = widget<CSlider>("simturnsDurationMin"))
|
||||
turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.requiredTurns);
|
||||
|
||||
if(auto turnSlider = widget<CSlider>("simturnsDurationMax"))
|
||||
turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.optionalTurns);
|
||||
|
||||
if(auto w = widget<CLabel>("labelSimturnsDurationValue"))
|
||||
if(auto w = widget<CLabel>("labelSimturnsDurationValueMin"))
|
||||
{
|
||||
MetaString message;
|
||||
message.appendRawString("%d days");
|
||||
message.replaceNumber(SEL->getStartInfo()->simturnsInfo.requiredTurns);
|
||||
w->setText(message.toString());
|
||||
}
|
||||
|
||||
if(auto w = widget<CLabel>("labelSimturnsDurationValueMax"))
|
||||
{
|
||||
MetaString message;
|
||||
message.appendRawString("%d days");
|
||||
|
@ -78,7 +78,13 @@
|
||||
},
|
||||
{
|
||||
"type": "transparentFilledRectangle",
|
||||
"rect": {"x" : 64, "y" : 480, "w": 316, "h": 1},
|
||||
"rect": {"x" : 64, "y" : 465, "w": 316, "h": 1},
|
||||
"color": [0, 0, 0, 0],
|
||||
"colorLine": [80, 96, 160, 128]
|
||||
},
|
||||
{
|
||||
"type": "transparentFilledRectangle",
|
||||
"rect": {"x" : 64, "y" : 466, "w": 316, "h": 1},
|
||||
"color": [0, 0, 0, 0],
|
||||
"colorLine": [32, 40, 128, 128]
|
||||
},
|
||||
@ -123,16 +129,10 @@
|
||||
},
|
||||
{
|
||||
"text": "vcmi.optionsTab.chessFieldCreature.help"
|
||||
},
|
||||
{
|
||||
"text": ""
|
||||
},
|
||||
{
|
||||
"text": "vcmi.optionsTab.simturnsMin.help"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"type" : "verticalLayout66",
|
||||
"customType" : "timeInputBackground",
|
||||
@ -181,7 +181,7 @@
|
||||
"alignment": "left",
|
||||
"color": "white",
|
||||
"text": "vcmi.optionsTab.simturnsMin.hover",
|
||||
"position": {"x": 70, "y": 430}
|
||||
"position": {"x": 70, "y": 420}
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
@ -189,16 +189,16 @@
|
||||
"alignment": "left",
|
||||
"color": "white",
|
||||
"text": "vcmi.optionsTab.simturnsMax.hover",
|
||||
"position": {"x": 70, "y": 460}
|
||||
"position": {"x": 70, "y": 445}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "simturnsDurationMin",
|
||||
"type": "slider",
|
||||
"orientation": "horizontal",
|
||||
"position": {"x": 178, "y": 430},
|
||||
"position": {"x": 178, "y": 420},
|
||||
"size": 200,
|
||||
"callback": "setSimturnDuration",
|
||||
"callback": "setSimturnDurationMin",
|
||||
"itemsVisible": 1,
|
||||
"itemsTotal": 28,
|
||||
"selected": 0,
|
||||
@ -210,9 +210,9 @@
|
||||
"name": "simturnsDurationMax",
|
||||
"type": "slider",
|
||||
"orientation": "horizontal",
|
||||
"position": {"x": 178, "y": 460},
|
||||
"position": {"x": 178, "y": 445},
|
||||
"size": 200,
|
||||
"callback": "setSimturnDuration",
|
||||
"callback": "setSimturnDurationMax",
|
||||
"itemsVisible": 1,
|
||||
"itemsTotal": 28,
|
||||
"selected": 0,
|
||||
@ -227,7 +227,7 @@
|
||||
"alignment": "center",
|
||||
"color": "white",
|
||||
"text": "",
|
||||
"position": {"x": 320, "y": 438}
|
||||
"position": {"x": 320, "y": 428}
|
||||
},
|
||||
{
|
||||
"name": "labelSimturnsDurationValueMax",
|
||||
@ -236,9 +236,17 @@
|
||||
"alignment": "center",
|
||||
"color": "white",
|
||||
"text": "",
|
||||
"position": {"x": 320, "y": 468}
|
||||
"position": {"x": 320, "y": 453}
|
||||
},
|
||||
{
|
||||
"type" : "label",
|
||||
"text": "vcmi.optionsTab.simturns.help",
|
||||
"type": "multiLineLabel",
|
||||
"font": "tiny",
|
||||
"alignment": "center",
|
||||
"color": "white",
|
||||
"rect": {"x": 70, "y": 470, "w": 300, "h": 40}
|
||||
},
|
||||
|
||||
{
|
||||
"position": {"x": 70, "y": 535},
|
||||
"type": "toggleButton",
|
||||
|
Loading…
x
Reference in New Issue
Block a user