local dialogwrongresolution = nil
function OnSceneLoad(screen)
	if not game_state then
		game_state = {}
	end
	LoadData(screen)    
	InitButtons(screen)	
	screen:SetLayer(102400)
	
	InitDialogWheelsMiniGames(screen)
	text = nil;	
	SetText();
	text:SetBorderSize(600, 180);
	text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_MIDDLE);
	text:AttachTo(screen:GetObject('BG'))
	text:SetScale(0.8)
	text:SetZ(90)
	text:SetXY(-250, -110)
	
	title = nil;	
	SetTitle();
	title:SetTextAlignment(HGETEXT_CENTER);
	title:AttachTo(screen:GetObject('BG'))
	title:SetZ(90)
	title:SetY(-170)
	screen:SetLayer(102400)
	dialogwrongresolution = screen
end

function InitButtons(screen)
    local up = screen:GetObject("buttonbigup"):GetAnimationPtr()
	local over = screen:GetObject("buttonbigover"):GetAnimationPtr()	
	local down = screen:GetObject("buttonbigdown"):GetAnimationPtr()	
	game_state.ok_button = CreateButton(up, over, down, "Resume", screen)
	game_state.ok_button:AttachTo(screen)
	game_state.ok_button:SetXY(523, 515)
	game_state.ok_button:SetZ(140)
end

function OnUpdate(dt)
end

function OnObjectMouseDown(object)
end

function OnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
end

function CanBeHinted(obj)
    if locked_object[obj] ~= true then
        return true
    else
        return false
    end
end

function OnObjectMouseEnter(obj)
end

function OnObjectMouseLeave(obj)
end

function OnLostFocus(obj)
end

function OnGainFocus(obj)
end

function OnButtonMouseEnter(title)
end

function OnButtonMouseLeave(title)
end

function OnObjectMouseUp(object)
end

function OnObjectMouseDown(object)
end



function InitDialogWheelsMiniGames(screen)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/01.png',0,0,88,88,1,0)
	anim:SetHotSpot(44,44)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('01',anim,548,586,105,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/02.png',0,0,72,71,1,0)
	anim:SetHotSpot(36,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('02',anim,516,608,102,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/02.png',0,0,72,71,1,0)
	anim:SetHotSpot(36,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('022',anim,467,570,106,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/03.png',0,0,42,42,1,0)
	anim:SetHotSpot(21,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('03',anim,484,531,104,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/04.png',0,0,34,34,1,0)
	anim:SetHotSpot(17,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('04',anim,483,569,112,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/05.png',0,0,67,67,1,0)
	anim:SetHotSpot(33,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('05',anim,559,548,103,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/06.png',0,0,110,110,1,0)
	anim:SetHotSpot(55,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('06',anim,520,574,101,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/07.png',0,0,62,61,1,0)
	anim:SetHotSpot(31,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('07',anim,531,538,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/07.png',0,0,62,61,1,0)
	anim:SetHotSpot(31,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('072',anim,491,556,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/03.png',0,0,42,42,1,0)
	anim:SetHotSpot(21,21)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('032',anim,560,599,102,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/04.png',0,0,34,34,1,0)
	anim:SetHotSpot(17,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('042',anim,499,583,127,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/shesterni/04.png',0,0,34,34,1,0)
	anim:SetHotSpot(17,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('043',anim,478,548,120,0,1,1)
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('02')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0);
	af:SetKey(_TRACK_A, 3.95833333333333, -6.2657320075);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('022')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0);
	af:SetKey(_TRACK_A, 3.95833333333333, 6.2831853);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('03')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, -6.2657320075);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('04')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, -6.2657320075);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('05')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, -12.5489173075);
	af:Play()
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('06')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, 6.2657320075)
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('07')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, -12.5663706);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('072')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, 12.5663706);
	af:Play()
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('032')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, -18.8321026075);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('042')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, 6.2657320075);
	af:Play()	
	
	local af = CreateAnimationEffector()
	local object = screen:GetObject('043')
	af:AttachTo(object)
	af:SetMode(_ANIM_FWD + _ANIM_LOOP)
	af:SetKey(_TRACK_A, 0, 0)
	af:SetKey(_TRACK_A, 3.95833333333333, 6.2657320075);
	af:Play()	
end

function SetText()	
	text = CreateTextEntity("SchoolbookBI31", GetString('WRONG_RESOLUTION_TEXT_SHORT'))
end

function OnButtonPress(title)      
    if title == "Resume" then	
        Log('DialogWrongResolution OK')
		dialogwrongresolution:ScreenDestroy()		
	    TimerDo(GetGameManager():GetTimer(), 1, function() GetGameManager():GetCurrentScreen():Go() end)
	    TimerDo(GetGameManager():GetTimer(), 0.9, function() GetGameApp():OnMessageHide() end)
	end
end

function SetTitle()
	title = CreateTextEntity("Calisto_MT_31", GetString("WARNING"));
end

function OnScreenShown()
end


-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/GUI/Options/front.png',0,0,597,186,1,0)
	anim:SetHotSpot(298,93)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('front',anim,524,572,136,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x88FFFFFF')
	screen:CreateObject('bg',anim,512,384,88,0,128,96)
	local anim = CreateAnimation('data/Texture/GUI/Options/buttonbig.png',0,0,166,70,1,0)
	anim:SetHotSpot(83,35)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonbigup',anim,870,213,140,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/buttonbig.png',0,71,166,70,1,0)
	anim:SetHotSpot(83,35)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonbigover',anim,864,259,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/buttonbig.png',0,144,166,70,1,0)
	anim:SetHotSpot(83,35)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonbigdown',anim,858,321,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/yes.png',0,0,88,72,1,0)
	anim:SetHotSpot(44,36)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonleftup',anim,522,148,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/yes.png',0,72,88,72,1,0)
	anim:SetHotSpot(44,36)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonleftover',anim,530,188,101,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/yes.png',0,144,88,72,1,0)
	anim:SetHotSpot(44,36)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonleftdown',anim,529,239,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/no.png',0,0,86,68,1,0)
	anim:SetHotSpot(43,34)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonrightup',anim,866,151,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/no.png',0,68,86,68,1,0)
	anim:SetHotSpot(43,34)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonrightover',anim,860,209,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Dialog/no.png',0,136,86,68,1,0)
	anim:SetHotSpot(43,34)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('buttonrightdown',anim,856,267,100,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Options/strelka.png',0,0,62,153,1,0)
	anim:SetHotSpot(26,116)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('strelka',anim,521,566,134,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Window/BigWindow.png',0,0,582,516,1,0)
	anim:SetHotSpot(291,258)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('BG',anim,525,391,100,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END