mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Added temporary UI for simturns testing
This commit is contained in:
parent
5b21a5ffbc
commit
54adeef29f
@ -58,6 +58,12 @@ OptionsTab::OptionsTab() : humanPlayers(0)
|
|||||||
CSH->setTurnTimerInfo(tinfo);
|
CSH->setTurnTimerInfo(tinfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addCallback("setSimturnDuration", [&](int index){
|
||||||
|
SimturnsInfo info;
|
||||||
|
info.optionalTurns = index;
|
||||||
|
CSH->setSimturnsInfo(info);
|
||||||
|
});
|
||||||
|
|
||||||
//helper function to parse string containing time to integer reflecting time in seconds
|
//helper function to parse string containing time to integer reflecting time in seconds
|
||||||
//assumed that input string can be modified by user, function shall support user's intention
|
//assumed that input string can be modified by user, function shall support user's intention
|
||||||
@ -214,6 +220,18 @@ void OptionsTab::recreate()
|
|||||||
|
|
||||||
entries.insert(std::make_pair(pInfo.first, std::make_shared<PlayerOptionsEntry>(pInfo.second, * this)));
|
entries.insert(std::make_pair(pInfo.first, std::make_shared<PlayerOptionsEntry>(pInfo.second, * this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Simultaneous turns
|
||||||
|
if(auto turnSlider = widget<CSlider>("labelSimturnsDurationValue"))
|
||||||
|
turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.optionalTurns);
|
||||||
|
|
||||||
|
if(auto w = widget<CLabel>("labelSimturnsDurationValue"))
|
||||||
|
{
|
||||||
|
MetaString message;
|
||||||
|
message.appendRawString("Simturns: up to %d days");
|
||||||
|
message.replaceNumber(SEL->getStartInfo()->simturnsInfo.optionalTurns);
|
||||||
|
w->setText(message.toString());
|
||||||
|
}
|
||||||
|
|
||||||
const auto & turnTimerRemote = SEL->getStartInfo()->turnTimerInfo;
|
const auto & turnTimerRemote = SEL->getStartInfo()->turnTimerInfo;
|
||||||
|
|
||||||
|
@ -73,16 +73,41 @@
|
|||||||
"adoptHeight": true
|
"adoptHeight": true
|
||||||
},
|
},
|
||||||
|
|
||||||
// timer
|
|
||||||
{
|
{
|
||||||
|
"name": "simturnsDuration",
|
||||||
|
"type": "slider",
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"position": {"x": 55, "y": 537},
|
||||||
|
"size": 194,
|
||||||
|
"callback": "setSimturnDuration",
|
||||||
|
"itemsVisible": 1,
|
||||||
|
"itemsTotal": 28,
|
||||||
|
"selected": 0,
|
||||||
|
"style": "blue",
|
||||||
|
"scrollBounds": {"x": 0, "y": 0, "w": 194, "h": 32},
|
||||||
|
"panningStep": 20
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "labelSimturnsDurationValue",
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"font": "small",
|
"font": "small",
|
||||||
"alignment": "center",
|
"alignment": "center",
|
||||||
"color": "yellow",
|
"color": "white",
|
||||||
"text": "core.genrltxt.521",
|
"text": "",
|
||||||
"position": {"x": 222, "y": 544}
|
"position": {"x": 319, "y": 545}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// timer
|
||||||
|
//{
|
||||||
|
// "type": "label",
|
||||||
|
// "font": "small",
|
||||||
|
// "alignment": "center",
|
||||||
|
// "color": "yellow",
|
||||||
|
// "text": "core.genrltxt.521",
|
||||||
|
// "position": {"x": 222, "y": 544}
|
||||||
|
//},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "labelTurnDurationValue",
|
"name": "labelTurnDurationValue",
|
||||||
"type": "label",
|
"type": "label",
|
||||||
@ -104,7 +129,8 @@
|
|||||||
"itemsTotal": 11,
|
"itemsTotal": 11,
|
||||||
"selected": 11,
|
"selected": 11,
|
||||||
"style": "blue",
|
"style": "blue",
|
||||||
"scrollBounds": {"x": -3, "y": -25, "w": 337, "h": 43},
|
"scrollBounds": {"x": 0, "y": 0, "w": 194, "h": 32},
|
||||||
|
//"scrollBounds": {"x": -3, "y": -25, "w": 337, "h": 43},
|
||||||
"panningStep": 20
|
"panningStep": 20
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -30,7 +30,7 @@ struct DLL_LINKAGE SimturnsInfo
|
|||||||
/// Maximum number of turns that might be played simultaneously unless contact is detected
|
/// Maximum number of turns that might be played simultaneously unless contact is detected
|
||||||
int optionalTurns = 0;
|
int optionalTurns = 0;
|
||||||
/// If set to true, human and 1 AI can act at the same time
|
/// If set to true, human and 1 AI can act at the same time
|
||||||
bool allowHumanWithAI = false;
|
bool allowHumanWithAI = true;
|
||||||
|
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
void serialize(Handler &h, const int version)
|
void serialize(Handler &h, const int version)
|
||||||
|
Loading…
Reference in New Issue
Block a user