print("Init Mission Ogorod")

local vault = resourceManager:getVault(ResourceManager.COMMON)

local loadingLabel = KrTextBox(game:getFontResource("occ24"), 150, 35, 1, KrTextBox.LEFT)
-- loadingLabel:SetPos(10, 10, -1)
loadingLabel:SetPos(10, -500, -1)
setNodeScale(loadingLabel, 9)

mission:setLoadingLabel(loadingLabel)


resourceManager:initBoxVault("box1")
local boxVault = resourceManager:getBoxVault()

local spr = KrSprite(boxVault:GetSpriteResource("bg"))

createNameBox1(boxVault, spr, game, mission)

local coreRoot = mission:getCoreRoot();


local startBorderX = 259;
local startBorderY = 218;

local standB = KrSprite(boxVault:GetSpriteResource("o-lu"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-lu"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-lu"))
standB:SetPos(startBorderX + 64 * 3, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-lu"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ru"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ru"))
standB:SetPos(startBorderX + 64 * 5, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ru"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ru"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ld"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ld"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ld"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-ld"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("o-rd"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-rd"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-rd"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("o-rd"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("i-ru"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ru"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ru"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ru"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 3, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("i-lu"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-lu"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-lu"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-lu"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 3, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("i-ld"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ld"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ld"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-ld"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-rd"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-rd"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-rd"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("i-rd"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)



standB = KrSprite(boxVault:GetSpriteResource("hu-dd-l"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-dd-r"))
standB:SetPos(startBorderX + 64 * 0 + 32, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-dd-l"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-dd-r"))
standB:SetPos(startBorderX + 64 * 7 + 32, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hu-dd-l"))
standB:SetPos(startBorderX + 64 * 3, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-u"))
standB:SetPos(startBorderX + 64 * 3 + 32, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-dd-r"))
standB:SetPos(startBorderX + 64 * 4 + 32, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hu-du-l"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-du-r"))
standB:SetPos(startBorderX + 64 * 2 + 31, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-ud-l"))
standB:SetPos(startBorderX + 64 * 5 + 29, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-ud-r"))
standB:SetPos(startBorderX + 64 * 5 + 29 + 4, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hu-uu"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-uu"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hd-dd"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-dd"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-ud"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-du"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-uu"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-uu"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hd-dd"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-uu"))
standB:SetPos(startBorderX + 64 * 3 + 7 + 29, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-uu"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 3, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hu-long"))
standB:SetPos(startBorderX + 64 * 3 + 7 + 29, startBorderY + 64 * 3, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("hd-uu-half"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-d"))
standB:SetPos(startBorderX + 64 * 3 + 32, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("hd-uu-half"))
standB:SetPos(startBorderX + 64 * 4 + 32, startBorderY + 64 * 5, -1);
addNodeAdopt(standB, spr)



standB = KrSprite(boxVault:GetSpriteResource("vr-lr"))
standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-lr"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-lr"))
standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-lr"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-lr"))
standB:SetPos(startBorderX + 64 * 3, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-lr"))
standB:SetPos(startBorderX + 64 * 5, startBorderY - 64 * 1, -1);
addNodeAdopt(standB, spr)

placeStandBorderEx(boxVault, spr, "vl-lr", startBorderX, startBorderY, 1, 4, 0, 25)
-- standB = KrSprite(boxVault:GetSpriteResource("vr-rl"))
-- standB:SetPos(startBorderX + 64 * 1, startBorderY + 64 * 4, -1);
-- addNodeAdopt(standB, spr)

placeStandBorderEx(boxVault, spr, "vl-lr", startBorderX, startBorderY, 3, 4, 0, 25)
-- standB = KrSprite(boxVault:GetSpriteResource("vr-rl"))
-- standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 4, -1);
-- addNodeAdopt(standB, spr)

placeStandBorderEx(boxVault, spr, "vl-lr", startBorderX, startBorderY, 6, 4, 0, 25)
-- standB = KrSprite(boxVault:GetSpriteResource("vr-rl"))
-- standB:SetPos(startBorderX + 64 * 6, startBorderY + 64 * 4, -1);
-- addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("vl-rl"))
standB:SetPos(startBorderX + 64 * 2, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rl"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rl"))
standB:SetPos(startBorderX + 64 * 7, startBorderY + 64 * 4, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rr-half"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rr"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 0 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-l"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 1 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rr"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 2 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rr-half"))
standB:SetPos(startBorderX + 64 * 0, startBorderY + 64 * 3 + 32, -1);
addNodeAdopt(standB, spr)



standB = KrSprite(boxVault:GetSpriteResource("vr-ll-half"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 0, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-ll"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 0 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-r"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 1 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-ll"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 2 + 32, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-ll-half"))
standB:SetPos(startBorderX + 64 * 8, startBorderY + 64 * 3 + 32, -1);
addNodeAdopt(standB, spr)



standB = KrSprite(boxVault:GetSpriteResource("vl-ll"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vl-rr"))
standB:SetPos(startBorderX + 64 * 5, startBorderY + 64 * 1 + 39, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-rr"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("vr-ll"))
standB:SetPos(startBorderX + 64 * 3, startBorderY + 64 * 1 + 39, -1);
addNodeAdopt(standB, spr)


standB = KrSprite(boxVault:GetSpriteResource("rmk_pup"))
standB:SetPos(startBorderX + 64 * 0 - 25, startBorderY + 64 * 1 - 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("rmk_pup"))
standB:SetPos(startBorderX + 64 * 0 - 25, startBorderY + 64 * 3 - 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("rmk_pup"))
standB:SetPos(startBorderX + 64 * 8 + 24, startBorderY + 64 * 1 - 1, -1);
addNodeAdopt(standB, spr)

standB = KrSprite(boxVault:GetSpriteResource("rmk_pup"))
standB:SetPos(startBorderX + 64 * 8 + 24, startBorderY + 64 * 3 - 1, -1);
addNodeAdopt(standB, spr)


local stand = KrSprite(boxVault:GetSpriteResource("pupitr_bg"))
stand:SetPos(194, 104 - 64 * 3, -1);
-- setNodeScale(stand, 0.83, 0.80);
stand:SetZDepth(-18);
addNodeAdopt(stand, coreRoot)

stand = KrSprite(boxVault:GetSpriteResource("setka0"))
stand:SetPos(211 - 25 + 3 + 6, 110 - 25 + 2 - 64 * 3 + 3 , -1);
stand:SetZDepth(-18);
addNodeAdopt(stand, coreRoot)


--[[
local stand = KrSprite(boxVault:GetSpriteResource("pupitrtile"))
stand:SetPos(451, 90+64+64+64, -1);
setNodeScale(stand, 0.83, 0.80);
stand:SetZDepth(-100);
addNodeAdopt(stand, coreRoot)

local standB = KrSprite(boxVault:GetSpriteResource("standborder"))
standB:SetPos(451+64+1, 90+64+64+64+64, -1);
addNodeAdopt(standB, spr)
]]--

mission:setGroupCounts(4, 8);

local luIdx = 2;
local ruIdx = 0;
local ldIdx = 1;
local rdIdx = 3;

addMusicianPianBox1(boxVault, 2, "lu", coreRoot, mission, luIdx)
addMusicianTrubBox1(boxVault, 2, "ru", coreRoot, mission, ruIdx)
addMusicianManBox1(boxVault, 1, "ld", coreRoot, mission, ldIdx)
addMusicianBarBox1(boxVault, 2, "rd", coreRoot, mission, rdIdx)

-- бэки окон

local wndbg = KrSprite(boxVault:GetSpriteResource("wnd_bg"))
wndbg:SetPos(100, 88, -1);
wndbg:SetZDepth(-6);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_bg"))
wndbg:SetPos(102, 573, -1);
wndbg:SetZDepth(-6);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_bg"))
wndbg:SetPos(832, 88, -1);
wndbg:SetZDepth(-6);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_bg"))
wndbg:SetPos(831, 574, -1);
wndbg:SetZDepth(-6);
addNodeAdopt(wndbg, coreRoot)


-- тени окон

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_shadow"))
wndbg:SetPos(104, 579, -1);
wndbg:SetZDepth(-4);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_shadow"))
wndbg:SetPos(833, 579, -1);
wndbg:SetZDepth(-4);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_shadow"))
wndbg:SetPos(833, 94, -1);
wndbg:SetZDepth(-4);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("wnd_shadow"))
wndbg:SetPos(104, 94, -1);
wndbg:SetZDepth(-4);
addNodeAdopt(wndbg, coreRoot)

-- бэки дырок под шестерни

wndbg = KrSprite(boxVault:GetSpriteResource("shest_bg"))
wndbg:SetPos(147, 234, -1);
wndbg:SetZDepth(-9);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("shest_bg"))
wndbg:SetPos(877, 233, -1);
wndbg:SetZDepth(-9);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("shest_bg"))
wndbg:SetPos(880, 534, -1);
wndbg:SetZDepth(-9);
addNodeAdopt(wndbg, coreRoot)

wndbg = KrSprite(boxVault:GetSpriteResource("shest_bg"))
wndbg:SetPos(150, 534, -1);
wndbg:SetZDepth(-9);
addNodeAdopt(wndbg, coreRoot)


-- шестерни

local wheel = Wheel(coreRoot, true, 3.14)
local shest = KrSprite(boxVault:GetSpriteResource("shest"))
wheel:getRoot():SetPos(147 - 2, 234 - 24, -1);
wheel:getRoot():SetZDepth(-7);
wheel:setWheel(shest);
mission:addAnimationNode(wheel, luIdx)


wheel = Wheel(coreRoot, false, 3.14)
shest = KrSprite(boxVault:GetSpriteResource("shest"))
wheel:getRoot():SetPos(877 + 2, 233 - 24, -1);
wheel:getRoot():SetZDepth(-7);
wheel:setWheel(shest);
mission:addAnimationNode(wheel, ruIdx)

wheel = Wheel(coreRoot, false, 3.14)
shest = KrSprite(boxVault:GetSpriteResource("shest"))
wheel:getRoot():SetPos(880 + 2, 534 + 24, -1);
wheel:getRoot():SetZDepth(-7);
wheel:setWheel(shest);
mission:addAnimationNode(wheel, rdIdx)

wheel = Wheel(coreRoot, true, 3.14)
shest = KrSprite(boxVault:GetSpriteResource("shest"))
wheel:getRoot():SetPos(150 - 2, 534 + 24, -1);
wheel:getRoot():SetZDepth(-7);
wheel:setWheel(shest);
mission:addAnimationNode(wheel, ldIdx)


-- створки окон

local openCloseTime = 0.3;

local wnd = MusWnd(coreRoot, openCloseTime, 48)
local leftLeafShadow = KrSprite(boxVault:GetSpriteResource("winL_shadow"))
local leftLeaf = KrSprite(boxVault:GetSpriteResource("winL"))
addNodeAdopt(leftLeaf, leftLeafShadow)
wnd:addLeaf(leftLeafShadow, true);
local rightLeaf = KrSprite(boxVault:GetSpriteResource("winR"))
wnd:addLeaf(rightLeaf, false);
wnd:getRoot():SetPos(149, 90, -1);
wnd:getRoot():SetZDepth(-3);
mission:addAnimationNode(wnd, luIdx)

wnd = MusWnd(coreRoot, openCloseTime, 48)
leftLeafShadow = KrSprite(boxVault:GetSpriteResource("winL_shadow"))
leftLeaf = KrSprite(boxVault:GetSpriteResource("winL"))
addNodeAdopt(leftLeaf, leftLeafShadow)
wnd:addLeaf(leftLeafShadow, true);
rightLeaf = KrSprite(boxVault:GetSpriteResource("winR"))
wnd:addLeaf(rightLeaf, false);
wnd:getRoot():SetPos(878, 92, -1);
wnd:getRoot():SetZDepth(-3);
mission:addAnimationNode(wnd, ruIdx)

wnd = MusWnd(coreRoot, openCloseTime, 48)
leftLeafShadow = KrSprite(boxVault:GetSpriteResource("winL_shadow"))
leftLeaf = KrSprite(boxVault:GetSpriteResource("winL"))
addNodeAdopt(leftLeaf, leftLeafShadow)
wnd:addLeaf(leftLeafShadow, true);
rightLeaf = KrSprite(boxVault:GetSpriteResource("winR"))
wnd:addLeaf(rightLeaf, false);
wnd:getRoot():SetPos(149, 577, -1);
wnd:getRoot():SetZDepth(-3);
mission:addAnimationNode(wnd, ldIdx)

wnd = MusWnd(coreRoot, openCloseTime, 48)
leftLeafShadow = KrSprite(boxVault:GetSpriteResource("winL_shadow"))
leftLeaf = KrSprite(boxVault:GetSpriteResource("winL"))
addNodeAdopt(leftLeaf, leftLeafShadow)
wnd:addLeaf(leftLeafShadow, true);
rightLeaf = KrSprite(boxVault:GetSpriteResource("winR"))
wnd:addLeaf(rightLeaf, false);
wnd:getRoot():SetPos(878, 578, -1);
wnd:getRoot():SetZDepth(-3);
mission:addAnimationNode(wnd, rdIdx)

-- Мастер вал

local border = KrImNode();
local masterStart = 285-28;
local inwidth = 41;
local pupwidth = 24;
local valwidth = 65;
local valY = 645;
local scaleBar = 0.84;


local val = KrSprite(boxVault:GetSpriteResource("bar-val-add"))
val:SetPos(masterStart - 5, valY, -1);
addNodeAdopt(val, spr)

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;

val = KrSprite(boxVault:GetSpriteResource("bar-val"))
setNodeScale(val, scaleBar, 1);
val:SetPos(masterStart, valY, -1);
addNodeAdopt(val, spr)
masterStart = masterStart + valwidth;




-- мастер баровские шпыньки

local barSpeed = 20
local shiftBarStart = 0;
local shiftBarP = 16;
local tileWidth = 65;
masterStart = 262;
valY = 645 - 30;


local scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("0")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4)


scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("1")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 1)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("2")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 2)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("3")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 3)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("4")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 4)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("5")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 5)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("6")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 6)

scroll = UVScroll(spr, barSpeed)
local dots = KrSprite(boxVault:GetSpriteResource("dots"))
setNodeScale(dots, scaleBar, 1);
dots:SetAction("7")
local colorTr = KrColorTransform()
colorTr:SetAlpha(127);
dots:SetColor(colorTr, -1);
scroll:getRoot():SetPos(masterStart, valY, -1);
masterStart = masterStart + tileWidth;
scroll:setSprite(dots, shiftBarStart);
shiftBarStart = shiftBarStart + shiftBarP;
mission:addAnimationNode(scroll, 4 + 7)





masterStart = 0;

local barSpr = KrSprite(boxVault:GetSpriteResource("bar-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)

barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-pup-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + pupwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-pup-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + pupwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-center"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + 156;


barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;


barSpr = KrSprite(boxVault:GetSpriteResource("bar-pup-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + pupwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-pup-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + pupwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-in-left"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)
masterStart = masterStart + inwidth;

barSpr = KrSprite(boxVault:GetSpriteResource("bar-right"))
setNodeScale(barSpr, scaleBar, 1);
barSpr:SetPos(masterStart, 0, -1);
addNodeAdopt(barSpr, border)


border:SetPos(285 - 18, 645, -1);
addNodeAdopt(border, spr)

mission:setBG(spr)

	local button = XButton();


	local x = 68
	local y = 18

	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, "GAME_SCREEN.HINT",
						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);

	mission:setHelpButton(button)

	button = XButton();

	x = x + 1024 - 68 - 68

	initXBtn(button, "Btn_game", x, y, sensX, sensY, width, height, vault)
	initXButtonText(button, "GAME_SCREEN.MENU",
						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);

	mission:setExitButton(button)

fadingPlane = KrSprite(vault:GetSpriteResource("fadingPlane"))
fadingPlane:SetPos(0, 0, -1)
mission:setFadingPlaneSprite(fadingPlane)
