- added option to toggle lua sandbox
This commit is contained in:
parent
9634ba58d4
commit
e295ccc5a1
|
@ -453,8 +453,23 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
||||||
checkBoxTimeDisplay.setValue(config.getBool("TimeDisplay","true"));
|
checkBoxTimeDisplay.setValue(config.getBool("TimeDisplay","true"));
|
||||||
|
|
||||||
currentLine-=lineOffset;
|
currentLine-=lineOffset;
|
||||||
|
|
||||||
|
labelLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"labelLuaDisableSecuritySandbox");
|
||||||
|
labelLuaDisableSecuritySandbox.init(currentLabelStart ,currentLine);
|
||||||
|
labelLuaDisableSecuritySandbox.setText(lang.get("LuaDisableSecuritySandbox"));
|
||||||
|
|
||||||
|
checkBoxLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"checkBoxLuaDisableSecuritySandbox");
|
||||||
|
checkBoxLuaDisableSecuritySandbox.init(currentColumnStart ,currentLine );
|
||||||
|
checkBoxLuaDisableSecuritySandbox.setValue(config.getBool("DisableLuaSandbox","false"));
|
||||||
|
|
||||||
|
luaMessageBox.registerGraphicComponent(containerName,"luaMessageBox");
|
||||||
|
luaMessageBox.init(lang.get("Yes"),lang.get("No"));
|
||||||
|
luaMessageBox.setEnabled(false);
|
||||||
|
luaMessageBoxState=0;
|
||||||
|
|
||||||
currentLine-=lineOffset;
|
currentLine-=lineOffset;
|
||||||
|
|
||||||
|
|
||||||
labelNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
labelNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||||
labelNetworkSettings.init(currentLabelStart+captionOffset, currentLine);
|
labelNetworkSettings.init(currentLabelStart+captionOffset, currentLine);
|
||||||
labelNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
labelNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||||
|
@ -610,6 +625,7 @@ void MenuStateOptions::reloadUI() {
|
||||||
|
|
||||||
console.resetFonts();
|
console.resetFonts();
|
||||||
mainMessageBox.init(lang.get("Ok"));
|
mainMessageBox.init(lang.get("Ok"));
|
||||||
|
luaMessageBox.init(lang.get("Yes"),lang.get("No"));
|
||||||
|
|
||||||
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||||
labelAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
labelAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||||
|
@ -678,6 +694,8 @@ void MenuStateOptions::reloadUI() {
|
||||||
labelChatStaysActive.setText(lang.get("ChatStaysActive"));
|
labelChatStaysActive.setText(lang.get("ChatStaysActive"));
|
||||||
labelTimeDisplay.setText(lang.get("TimeDisplay"));
|
labelTimeDisplay.setText(lang.get("TimeDisplay"));
|
||||||
|
|
||||||
|
labelLuaDisableSecuritySandbox.setText(lang.get("LuaDisableSecuritySandbox"));
|
||||||
|
|
||||||
labelRainEffect.setText(lang.get("RainEffect"));
|
labelRainEffect.setText(lang.get("RainEffect"));
|
||||||
|
|
||||||
labelVideos.setText(lang.get("EnableVideos"));
|
labelVideos.setText(lang.get("EnableVideos"));
|
||||||
|
@ -751,7 +769,20 @@ void MenuStateOptions::showMessageBox(const string &text, const string &header,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuStateOptions::showLuaMessageBox(const string &text, const string &header, bool toggle) {
|
||||||
|
if(!toggle) {
|
||||||
|
luaMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!luaMessageBox.getEnabled()){
|
||||||
|
luaMessageBox.setText(text);
|
||||||
|
luaMessageBox.setHeader(header);
|
||||||
|
luaMessageBox.setEnabled(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
luaMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
|
|
||||||
|
@ -777,6 +808,28 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(luaMessageBox.getEnabled()){
|
||||||
|
int button= 0;
|
||||||
|
if(luaMessageBox.mouseClick(x, y, button)) {
|
||||||
|
checkBoxLuaDisableSecuritySandbox.setValue(false);
|
||||||
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
if(button == 0) {
|
||||||
|
if(luaMessageBoxState == 1) {
|
||||||
|
checkBoxLuaDisableSecuritySandbox.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
luaMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(checkBoxLuaDisableSecuritySandbox.mouseClick(x, y)) {
|
||||||
|
if(checkBoxLuaDisableSecuritySandbox.getValue() == true) {
|
||||||
|
checkBoxLuaDisableSecuritySandbox.setValue(false);
|
||||||
|
|
||||||
|
luaMessageBoxState=1;
|
||||||
|
Lang &lang= Lang::getInstance();
|
||||||
|
showLuaMessageBox(lang.get("LuaDisableSecuritySandboxWaring"), lang.get("Question"), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(buttonOk.mouseClick(x, y)){
|
else if(buttonOk.mouseClick(x, y)){
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
|
||||||
|
@ -904,6 +957,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
checkBoxChatStaysActive.mouseClick(x, y);
|
checkBoxChatStaysActive.mouseClick(x, y);
|
||||||
checkBoxTimeDisplay.mouseClick(x, y);
|
checkBoxTimeDisplay.mouseClick(x, y);
|
||||||
|
|
||||||
|
checkBoxLuaDisableSecuritySandbox.mouseClick(x, y);
|
||||||
|
|
||||||
checkBoxRainEffect.mouseClick(x,y);
|
checkBoxRainEffect.mouseClick(x,y);
|
||||||
checkBoxRainEffectMenu.mouseClick(x,y);
|
checkBoxRainEffectMenu.mouseClick(x,y);
|
||||||
|
|
||||||
|
@ -913,8 +968,12 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
|
|
||||||
void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
||||||
if (mainMessageBox.getEnabled()) {
|
if (mainMessageBox.getEnabled()) {
|
||||||
mainMessageBox.mouseMove(x, y);
|
mainMessageBox.mouseMove(x, y);
|
||||||
}
|
}
|
||||||
|
if (luaMessageBox.getEnabled()) {
|
||||||
|
luaMessageBox.mouseMove(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
buttonOk.mouseMove(x, y);
|
buttonOk.mouseMove(x, y);
|
||||||
buttonAbort.mouseMove(x, y);
|
buttonAbort.mouseMove(x, y);
|
||||||
buttonAutoConfig.mouseMove(x, y);
|
buttonAutoConfig.mouseMove(x, y);
|
||||||
|
@ -950,6 +1009,9 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
||||||
checkBoxVisibleHud.mouseMove(x, y);
|
checkBoxVisibleHud.mouseMove(x, y);
|
||||||
checkBoxChatStaysActive.mouseMove(x, y);
|
checkBoxChatStaysActive.mouseMove(x, y);
|
||||||
checkBoxTimeDisplay.mouseMove(x, y);
|
checkBoxTimeDisplay.mouseMove(x, y);
|
||||||
|
|
||||||
|
checkBoxLuaDisableSecuritySandbox.mouseMove(x, y);
|
||||||
|
|
||||||
checkBoxRainEffect.mouseMove(x, y);
|
checkBoxRainEffect.mouseMove(x, y);
|
||||||
checkBoxRainEffectMenu.mouseMove(x, y);
|
checkBoxRainEffectMenu.mouseMove(x, y);
|
||||||
|
|
||||||
|
@ -1030,6 +1092,9 @@ void MenuStateOptions::render(){
|
||||||
if(mainMessageBox.getEnabled()){
|
if(mainMessageBox.getEnabled()){
|
||||||
renderer.renderMessageBox(&mainMessageBox);
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
}
|
}
|
||||||
|
else if(luaMessageBox.getEnabled()){
|
||||||
|
renderer.renderMessageBox(&luaMessageBox);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer.renderButton(&buttonOk);
|
renderer.renderButton(&buttonOk);
|
||||||
|
@ -1115,6 +1180,10 @@ void MenuStateOptions::render(){
|
||||||
renderer.renderLabel(&labelVisibleHud);
|
renderer.renderLabel(&labelVisibleHud);
|
||||||
renderer.renderLabel(&labelChatStaysActive);
|
renderer.renderLabel(&labelChatStaysActive);
|
||||||
renderer.renderLabel(&labelTimeDisplay);
|
renderer.renderLabel(&labelTimeDisplay);
|
||||||
|
|
||||||
|
renderer.renderLabel(&labelLuaDisableSecuritySandbox);
|
||||||
|
renderer.renderCheckBox(&checkBoxLuaDisableSecuritySandbox);
|
||||||
|
|
||||||
renderer.renderCheckBox(&checkBoxVisibleHud);
|
renderer.renderCheckBox(&checkBoxVisibleHud);
|
||||||
renderer.renderCheckBox(&checkBoxChatStaysActive);
|
renderer.renderCheckBox(&checkBoxChatStaysActive);
|
||||||
renderer.renderCheckBox(&checkBoxTimeDisplay);
|
renderer.renderCheckBox(&checkBoxTimeDisplay);
|
||||||
|
@ -1191,6 +1260,8 @@ void MenuStateOptions::saveConfig(){
|
||||||
config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue());
|
config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue());
|
||||||
config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue());
|
config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue());
|
||||||
|
|
||||||
|
config.setBool("DisableLuaSandbox", checkBoxLuaDisableSecuritySandbox.getValue());
|
||||||
|
|
||||||
config.setBool("RainEffect", checkBoxRainEffect.getValue());
|
config.setBool("RainEffect", checkBoxRainEffect.getValue());
|
||||||
config.setBool("RainEffectMenu", checkBoxRainEffectMenu.getValue());
|
config.setBool("RainEffectMenu", checkBoxRainEffectMenu.getValue());
|
||||||
|
|
||||||
|
@ -1211,6 +1282,10 @@ void MenuStateOptions::saveConfig(){
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
|
|
||||||
|
if(config.getBool("DisableLuaSandbox","false") == true) {
|
||||||
|
LuaScript::setDisableSandbox(true);
|
||||||
|
}
|
||||||
|
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
soundRenderer.stopAllSounds();
|
soundRenderer.stopAllSounds();
|
||||||
program->stopSoundSystem();
|
program->stopSoundSystem();
|
||||||
|
|
|
@ -138,6 +138,12 @@ private:
|
||||||
GraphicLabel labelVideos;
|
GraphicLabel labelVideos;
|
||||||
GraphicCheckBox checkBoxVideos;
|
GraphicCheckBox checkBoxVideos;
|
||||||
|
|
||||||
|
GraphicLabel labelLuaDisableSecuritySandbox;
|
||||||
|
GraphicCheckBox checkBoxLuaDisableSecuritySandbox;
|
||||||
|
|
||||||
|
GraphicMessageBox luaMessageBox;
|
||||||
|
int luaMessageBoxState;
|
||||||
|
|
||||||
map<string,string> languageList;
|
map<string,string> languageList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -157,6 +163,7 @@ private:
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
void setActiveInputLable(GraphicLabel* newLable);
|
void setActiveInputLable(GraphicLabel* newLable);
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
|
void showLuaMessageBox(const string &text, const string &header, bool toggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
Loading…
Reference in New Issue