dofile('data/Scripts/Screens/DialogScreen.lua');

function OnCreateContent()
--	dialogScreen
	
	CreateGraphics();
    CreateButtons();
    CreateAdditionalControls();
end

function OnFreeContent()
--	dialogScreen = nil;
--	questionText = nil;
end

function OnSetValue(value)
    assert(dialogScreen.inputText ~= nil and dialogScreen.questionText ~= nil);
    dialogScreen.inputText:SetText(value);
end

------------------------------------------------------------------------------
--// auxiliary functions
function CreateAdditionalControls()
   assert(dialogScreen.questionText ~= nil);
    local inputText = CreateTextEntity('GUITextFont', '');
	inputText:SetName('InputedText');
    inputText:AttachTo(dialogScreen.questionText);
	inputText:SetXY(0.0, 60.0);
	inputText:SetZ(1.0);
	
    dialogScreen.inputText = inputText;
end

function CreateButtons()
	do
		local button = CreateButton('ButtonUp','ButtonOver','ButtonDown', 'YES', dialogScreen);
		button:AttachTo(dialogScreen);
		button:SetXY(SCREEN_WIDTH/2.0 - 83.0, 530.0);
		button:SetZ(1);
		button:SetVisible(true);

		local caption = CreateTextEntity('GUICaptionFont', 'ENTER');
		caption:SetName('YesButtonCaption');
	    caption:AttachTo(button);
		caption:SetXY(0,0);
		caption:SetZ(1.0);
	end
	do
		local button = CreateButton('ButtonUp','ButtonOver','ButtonDown', 'NO', dialogScreen);
		button:AttachTo(dialogScreen);
		button:SetXY(SCREEN_WIDTH/2.0 + 83.0, 530.0);
		button:SetZ(1);
		button:SetVisible(true);

		local caption = CreateTextEntity('GUICaptionFont', 'CANCEL');
		caption:SetName('NoButtonCaption');
	    caption:AttachTo(button);
		caption:SetXY(0,0);
		caption:SetZ(1.0);
	end
end
