print("init Tooltip Window begin");


local menu = game:getSceneManager():getTooltipWindow()
local vault = resourceManager:getVault(ResourceManager.COMMON)

local sprite = KrSprite(vault:GetSpriteResource("fake_hatch"))
-- aniFadeInFadeOut(sprite,0,.3,.3,127)
aniFadeInFadeOut(sprite,0,.3,.3,255)
menu:setBackground(sprite)

local bg = KrSprite(vault:GetSpriteResource("fake_hatch"))

bg:SetPos(0, 0, -1)
aniFadeInFadeOut(bg,0,1,1)
menu:setImageFrame(bg)


sprite = KrSprite(vault:GetSpriteResource("half_black_hatch"))
setNodeScale(sprite, 256, 192);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("MASTER"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("CLICK_PIECE"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("STAND"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("UNI_DRAG1"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("UNI_DRAG2"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("MASTER_WND"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("RED_PIECE_WND"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("BLUE_PIECE_WND"))
setNodeScale(sprite, 8, 8);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("fake_hatch"))
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("HINT_FADER"))
setNodeScale(sprite, 10.14, 10.14);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("ROOM_CHAIR"))
setNodeScale(sprite, 16, 16);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("ROOM_BOOK"))
setNodeScale(sprite, 16, 16);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("ROOM_MAP"))
setNodeScale(sprite, 16, 16);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("BOOK_SONG"))
setNodeScale(sprite, 16.25, 16.25);
sprite:SetPos(0, -272, -1);
menu:addBGFader(sprite);

sprite = KrSprite(vault:GetSpriteResource("BOOK_SONG"))
setNodeScale(sprite, 16.25, 16.25);
sprite:SetPos(0, 0, -1);
menu:addBGFader(sprite);


local window1Left = 1024 / 2 - 598 / 2
local window1Top = 768 / 2 - 150 / 2;

local windowBack = KrImNode()
windowBack:SetPos( window1Left, window1Top, -1 )
local pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_1"))
setNodeScale(pageBG1, 597 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

local startBorderX = 0;
local startBorderY = 0;

local standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

standB = KrSprite(vault:GetSpriteResource("mbox_r"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY + 64;


standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 3 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

standB = KrSprite(vault:GetSpriteResource("mbox_l"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;


menu:addBG(windowBack);

-- bg2

window2Left = 1024 / 2 - 598 / 2
window2Top = 768 / 2 - 220 / 2;

windowBack = KrImNode()
windowBack:SetPos( window2Left, window2Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_2"))
setNodeScale(pageBG1, 597 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 1 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 3 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 1 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);


-- bg3

window3Left = 1024 / 2 - 470 / 2
window3Top = 768 / 2 - 350 / 2;

windowBack = KrImNode()
windowBack:SetPos( window3Left, window3Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_1"))
setNodeScale(pageBG1, 470 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 3 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 3 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);

-- bg4

window4Left = 1024 / 2 - 342 / 2
window4Top = 768 / 2 - 158 / 2;

windowBack = KrImNode()
windowBack:SetPos( window4Left, window4Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_2"))
setNodeScale(pageBG1, 1, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 1 do
	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;
end


startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;

menu:addBG(windowBack);

-- bg5

window5Left = 1024 / 2 - 470 / 2
window5Top = 768 / 2 - 412 / 2;

windowBack = KrImNode()
windowBack:SetPos( window5Left, window5Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_3"))
setNodeScale(pageBG1, 470 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 4 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 4 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);

-- bg6

local window6Left = 1024 / 2 - 468 / 2
local window6Top = 768 / 2 - 92 / 2;

local windowBack = KrImNode()
windowBack:SetPos( window6Left, window6Top, -1 )
local pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_0"))
setNodeScale(pageBG1, 469 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

local startBorderX = 0;
local startBorderY = 0;

local standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

--[[
standB = KrSprite(vault:GetSpriteResource("mbox_r"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY + 64;
]]--

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

--[[
standB = KrSprite(vault:GetSpriteResource("mbox_l"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;
]]--

menu:addBG(windowBack);

-- bg7

window7Left = 1024 / 2 - 470 / 2
window7Top = 768 / 2 - 220 / 2;

windowBack = KrImNode()
windowBack:SetPos( window7Left, window7Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_2"))
setNodeScale(pageBG1, 470 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 1 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 1 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);


-- bg8

window8Left = 1024 / 2 - 598 / 2
window8Top = 768 / 2 - 284 / 2;

windowBack = KrImNode()
windowBack:SetPos( window8Left, window8Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_2"))
setNodeScale(pageBG1, 597 / 438, 284 / 220)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 2 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 3 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 2 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);

-- bg9

local window9Left = 1024 / 2 - 468 / 2
local window9Top = 768 / 2 - 92 / 2;

local windowBack = KrImNode()
windowBack:SetPos( window9Left, window9Top, -1 )
local pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_2"))
setNodeScale(pageBG1, 469 / 438, 92 / 220)
addNodeAdopt(pageBG1, windowBack)

local startBorderX = 0;
local startBorderY = 0;

local standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

--[[
standB = KrSprite(vault:GetSpriteResource("mbox_r"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY + 64;
]]--

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

--[[
standB = KrSprite(vault:GetSpriteResource("mbox_l"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;
]]--

menu:addBG(windowBack);

-- bg10

local window10Left = 1024 / 2 - 470 / 2
local window10Top = 768 / 2 - 150 / 2;

local windowBack = KrImNode()
windowBack:SetPos( window10Left, window10Top, -1 )
local pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_msg_1"))
setNodeScale(pageBG1, 470 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

local startBorderX = 0;
local startBorderY = 0;

local standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

standB = KrSprite(vault:GetSpriteResource("mbox_r"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY + 64;


standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

standB = KrSprite(vault:GetSpriteResource("mbox_l"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;


menu:addBG(windowBack);

-- bg11

window11Left = 1024 / 2 - 598 / 2
window11Top = 768 / 2 - 350 / 2;

windowBack = KrImNode()
windowBack:SetPos( window11Left, window11Top, -1 )
pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_1"))
setNodeScale(pageBG1, 598 / 438, 1)
addNodeAdopt(pageBG1, windowBack)

startBorderX = 0;
startBorderY = 0;

standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;

for i = 0, 3 do
	standB = KrSprite(vault:GetSpriteResource("mbox_r"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY + 64;
end

standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 3 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

for i = 0, 3 do
	standB = KrSprite(vault:GetSpriteResource("mbox_l"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderY = startBorderY - 64;
end

menu:addBG(windowBack);


-- bg12

local window12Left = 1024 / 2 - 468 / 2
local window12Top = 768 / 2 - 156 / 2;

local windowBack = KrImNode()
windowBack:SetPos( window12Left, window12Top, -1 )
local pageBG1 = KrSprite(vault:GetSpriteResource("Pergament_tut_2"))
setNodeScale(pageBG1, 469 / 342, 1)
addNodeAdopt(pageBG1, windowBack)

local startBorderX = 0;
local startBorderY = 0;

local standB = KrSprite(vault:GetSpriteResource("mbox_lu"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX + 44;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_u_gem"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 128;

for i = 0, 1 do

	standB = KrSprite(vault:GetSpriteResource("mbox_u"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)

	startBorderX = startBorderX + 64;

end

standB = KrSprite(vault:GetSpriteResource("mbox_ru"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)


startBorderX = startBorderX + 41;
startBorderY = startBorderY + 46;


standB = KrSprite(vault:GetSpriteResource("mbox_r"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY + 64;


standB = KrSprite(vault:GetSpriteResource("mbox_rd"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderX = startBorderX - 41 - 128;
startBorderY = startBorderY + 46;

for i = 0, 2 do

	standB = KrSprite(vault:GetSpriteResource("mbox_d"))
	standB:SetPos(startBorderX, startBorderY, -1);
	addNodeAdopt(standB, windowBack)


	startBorderX = startBorderX - 128;

end

startBorderX = startBorderX + 128 - 44;
startBorderY = startBorderY - 46;

standB = KrSprite(vault:GetSpriteResource("mbox_ld"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;

standB = KrSprite(vault:GetSpriteResource("mbox_l"))
standB:SetPos(startBorderX, startBorderY, -1);
addNodeAdopt(standB, windowBack)

startBorderY = startBorderY - 64;


menu:addBG(windowBack);


-- pages

local page = KrImNode()

local pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 116, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.1") );
pageTextBox:SetPos(window1Left + 15, window1Top + 20 + 54 - 40 - 13, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 0, 0, 0, 0);

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.2") );
pageTextBox:SetPos(window2Left + 20 + 12, window2Top + 20, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_chair"))
pageSpr:SetPos(window2Left + 508 - 12, window2Top + 108, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 1, 11, 0, -220);

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 116, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.3") );
pageTextBox:SetPos(window1Left + 10 + 20, window1Top + 34 - 12, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_book"))
pageSpr:SetPos(window1Left + 503 - 2, window1Top + 65, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 0, 12, 0, 0);

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.4") );
pageTextBox:SetPos(window2Left + 30, window2Top + 20, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 1, 14, 100 + 51, 100 + 122);

local page = KrImNode()
menu:addPage(page, 0, 0, 0, 0);


page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 284, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.5") );
pageTextBox:SetPos(window8Left + 23, window8Top + 20 + 32 - 24, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_map_cyfra"))
pageSpr:SetPos(window8Left + 516, window8Top + 132 + 50, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 7, 13, 0, 0);


page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.6_1") );
pageTextBox:SetPos(window1Left + 20, window1Top + 20, -1);

menu:setScenario6TextBox(pageTextBox);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 0, 0, 0, 0);



--- Tutorial ---

page = KrImNode()
local pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.CLICK_MASTER") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
-- menu:addPage(page, 11, 1, 2, -81 + 40);
-- menu:addPage(page, 11, 1, 0, -260 + 16);
menu:addPage(page, 11, 1, 0, -260 + 204 + 16);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.CLICK_PIECE") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
-- menu:addPage(page, 11, 2, 2 - 70, -81 + 40);
menu:addPage(page, 11, 2, 0, -260 + 16);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.STAND") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 3, 0, -260);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.DRAG1") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 4, 0, -260);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.DRAG2") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 5, 0, -260);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.CLICK_STAND") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 3, 0, -260);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.MASTER_WND") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 6, 0, -260 + 16);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.RED_PIECE_WND") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 7, 0, -260 + 16);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.MAIN_MELODY") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 9, 0, -260);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.BLUE_PIECE_WND") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 8, 0, -260 + 16);

page = KrImNode()
pageTextBox = KrTextBox(game:getFontResource("occ24b"), 428, 125, 4, KrTextBox.CENTER);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.COMPLETE") );
pageTextBox:SetPos(window12Left + 20, window12Top + 17, -1);
addNodeAdopt(pageTextBox, page)
menu:addPage(page, 11, 9, 0, -260);

--------------------------------------


--- Withour masterbar

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.WOMASTER") );
pageTextBox:SetPos(window12Left + 17, window12Top + 18 + 14, -1);

addNodeAdopt(pageTextBox, page)

menu:addPage(page, 11, 0, 0, 0);


--- Unlock workshop

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.UNLOCKWORKSHOP") );
pageTextBox:SetPos(window7Left + 23, window7Top + 45 + 16, -1);
addNodeAdopt(pageTextBox, page)


pageSpr = KrSprite(vault:GetSpriteResource("help_map_2"))
pageSpr:SetPos(window7Left + 516 - 128, window7Top + 100, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 6, 0, 0, 0);


--- Unlock museum

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.MUSEUM") );
pageTextBox:SetPos(window7Left + 23, window7Top + 45 + 24, -1);
addNodeAdopt(pageTextBox, page)


pageSpr = KrSprite(vault:GetSpriteResource("help_map_2"))
pageSpr:SetPos(window7Left + 516 - 128, window7Top + 100, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 6, 0, 0, 0);


--- Win! Unlock bonuses

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.UNLOCKBONUSES") );
pageTextBox:SetPos(window8Left + 23, window8Top + 20 - 10 + 13, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_crea"))
pageSpr:SetPos(window8Left + 331 - 260, window8Top + 155 + 27 + 67, -1);
addNodeAdopt(pageSpr, page)

pageSpr = KrSprite(vault:GetSpriteResource("amulet_final"))
pageSpr:SetPos(window8Left + 469 - 102 + 6, window8Top + 110 - 96 + 3, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 7, 0, 0, 0);


--- Locked

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.CREATIONS") );
pageTextBox:SetPos(window9Left + 15, window9Top + 20, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 8, 0, 0, 0);


--- Creative only

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.CREATIONS_NOWIN") );
pageTextBox:SetPos(window10Left + 17, window10Top + 18 + 17, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 9, 0, 0, 0);


-- Tutorial - Hint --

page = KrImNode()

page:SetPos(0, -5, -1);

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 116, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.HINT_BTN") );
pageTextBox:SetPos(window4Left + 15, window4Top + 24, -1);
addNodeAdopt(pageTextBox, page)

--[[
pageSpr = KrSprite(vault:GetSpriteResource("help_hint"))
pageSpr:SetPos(window3Left + 235 + 116 - 50 + 32 - 88, window3Top + 235 - 59 + 27 + 12, -1);
addNodeAdopt(pageSpr, page)
]]--

menu:addPage(page, 3, 10, 0, -45);


-- Tutorial - Darken -------

page = KrImNode()

page:SetPos(10, 0, -1);

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 176, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.DARKEN") );
pageTextBox:SetPos(window5Left + 20 - 13, window5Top + 20, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_column"))
pageSpr:SetPos(window5Left + 235 - 80 + 151 + 20 - 13 - 107, window5Top + 135 + 18 + 42 - 36 + 98, -1);
addNodeAdopt(pageSpr, page)

menu:addPage(page, 4, 0, 0, 0);


-- Tutorial - VERT ---------

page = KrImNode()

page:SetPos(10, 0, -1);

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 176, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("TUTORIAL.NEW.VERT") );
pageTextBox:SetPos(window5Left + 20 - 8, window5Top + 12, -1);
addNodeAdopt(pageTextBox, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_vert1"))
pageSpr:SetPos(window5Left + 133 - 8, window5Top + 295, -1);
addNodeAdopt(pageSpr, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_vert2"))
pageSpr:SetPos(window5Left + 325 - 8, window5Top + 294, -1);
addNodeAdopt(pageSpr, page)

pageSpr = KrSprite(vault:GetSpriteResource("help_equal"))
pageSpr:SetPos(window5Left + 223 - 8, window5Top + 296, -1);
addNodeAdopt(pageSpr, page)


menu:addPage(page, 4, 0, 0, 0);

--------------------------------------

-- scenario piece ---------

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.7_only_piece") );
pageTextBox:SetPos(window10Left + 30, window10Top + 20, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 9, 15, 100 + 51 + 95, 100 + 122 - 443 + 50 + 167);


-- scenario ready ---------

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.8_outline_ready") );
pageTextBox:SetPos(window10Left + 30 + 20, window10Top + 20 + 16, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 9, 15, 100 + 51 + 95, 100 + 122 - 443 + 50 + 167);

--------------------------------------

-- scenario goal ---------

page = KrImNode()

page:SetPos(10, 0, -1);

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 176, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.GOAL") );
pageTextBox:SetPos(window2Left + 20 - 8, window2Top + 12, -1);
addNodeAdopt(pageTextBox, page)

menu:addPage(page, 1, 0, 0, 0);

--------------------------------------

--- Withour masterbar 2

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.WOMASTER2") );
pageTextBox:SetPos(window6Left + 23, window6Top + 18, -1);

addNodeAdopt(pageTextBox, page)

menu:addPage(page, 5, 0, 0, 0);


--------------------------------------

--- Masterbar is green

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.MASTERGREEN") );
pageTextBox:SetPos(window6Left + 33, window6Top + 18, -1);

addNodeAdopt(pageTextBox, page)

menu:addPage(page, 5, 0, 0, 0);


--- Splitted

page = KrImNode()

pageTextBox = KrTextBox(game:getFontResource("occ24b"), 577, 220, 4, KrTextBox.LEFT);
pageTextBox:SetTextMultiLineColored( getText("SCENARIO.SPLITTED") );
-- pageTextBox:SetPos(window6Left + 15, window6Top + 18, -1);
pageTextBox:SetPos(window12Left + 15, window12Top + 18, -1);

addNodeAdopt(pageTextBox, page)

-- menu:addPage(page, 5, 0, 0, 0);
menu:addPage(page, 11, 0, 0, 0);


-- end crate text box

-- кнопка скрытия тултипа

	local button = XButton();

	local x = 170
	local y = 220

	local width = 94
	local height = 30
	local sensX = -47
	local sensY = -15
	local textY = sensY + 3;

	local rText = 245;
	local gText = 203;
	local bText = 99;
	local aText = 216;

	local rHText = 255;
	local gHText = 255;
	local bHText = 255;
	local aHText = 216;

	initXBtn(button, "Btn_game", x, y, sensX, sensY, width, height, vault)
	initXButtonText(button, "HIDE",
					sensX, textY, 
					width, height, 
					"occ24bg", KrTextBox.CENTER)

	button:setTextColor(rText, gText, bText, aText);
	button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, rHText, gHText, bHText, aHText);
	button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);

	aniFadeInFadeOut(button:getRoot(),0,1,1)
	menu:setHideButton(button);

-- кнопка "Дальше"

	local button = XButton();

	x = 680

	initXBtn(button, "Btn_game", x, y, sensX, sensY, width, height, vault)
	initXButtonText(button, "Next",
					sensX, textY, 
					width, height, 
					"occ24bg", KrTextBox.CENTER)

	button:setTextColor(rText, gText, bText, aText);
	button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, rHText, gHText, bHText, aHText);
	button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);

	aniFadeInFadeOut(button:getRoot(),0,1,1)
	menu:setNextButton(button);


-- create and init textBox


local width = 250;
local height= 150;

local textBox = KrTextBox(game:getFontResource("occ24"), width, height, 2, KrTextBox.CENTER);

textBox:SetPos(300, 300, -1);

aniFadeInFadeOut(textBox,0,1,1)
menu:setTextBox(textBox);

----

print("init Tooltip Window end");


