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 startBorderX = 259 - 3;
local startBorderY = 202 - 33;

placeStandBorder(boxVault, spr, "o-lu", startBorderX, startBorderY, 0, 0)
placeStandBorder(boxVault, spr, "o-ru", startBorderX, startBorderY, 4, 0)
placeStandBorder(boxVault, spr, "o-ru", startBorderX, startBorderY, 6, 1)
placeStandBorder(boxVault, spr, "o-ru", startBorderX, startBorderY, 8, 2)
placeStandBorder(boxVault, spr, "o-ld", startBorderX, startBorderY, 0, 4)
placeStandBorder(boxVault, spr, "o-ld", startBorderX, startBorderY, 4, 5)
placeStandBorder(boxVault, spr, "o-ld", startBorderX, startBorderY, 6, 6)
placeStandBorder(boxVault, spr, "o-rd", startBorderX, startBorderY, 8, 6)

placeStandBorder(boxVault, spr, "i-ru", startBorderX, startBorderY, 4, 1)
placeStandBorder(boxVault, spr, "i-ru", startBorderX, startBorderY, 6, 2)
placeStandBorder(boxVault, spr, "i-ld", startBorderX, startBorderY, 4, 4)
placeStandBorder(boxVault, spr, "i-ld", startBorderX, startBorderY, 6, 5)


for i = 0, 1 do
	placeStandBorderEx(boxVault, spr, "hu-ud-l", startBorderX, startBorderY, 4 + i * 2, 1 + i, 29, 0)
	placeStandBorderEx(boxVault, spr, "hu-long", startBorderX, startBorderY, 4 + i * 2, 1 + i, 32, 0)
	placeStandBorderEx(boxVault, spr, "hu-dd-r", startBorderX, startBorderY, 5 + i * 2, 1 + i, 32, 0)
end

placeStandBorder(boxVault, spr, "hd-uu-half", startBorderX, startBorderY, 4, 5)
placeStandBorderEx(boxVault, spr, "hd-uu", startBorderX, startBorderY, 4, 5, 32, 0)
placeStandBorder(boxVault, spr, "hd-dd", startBorderX, startBorderY, 5, 5)

placeStandBorder(boxVault, spr, "hd-uu-half", startBorderX, startBorderY, 6, 6)
placeStandBorderEx(boxVault, spr, "hd-uu", startBorderX, startBorderY, 6, 6, 32, 0)
placeStandBorderEx(boxVault, spr, "hd-ud", startBorderX, startBorderY, 7, 6, 32, 0)

placeStandBorder(boxVault, spr, "vr-lr", startBorderX, startBorderY, 4, 0)
placeStandBorder(boxVault, spr, "vr-lr", startBorderX, startBorderY, 6, 1)
placeStandBorderEx(boxVault, spr, "vl-lr", startBorderX, startBorderY, 4, 4, 0, 28)
placeStandBorderEx(boxVault, spr, "vl-lr", startBorderX, startBorderY, 6, 5, 0, 28)

placeStandBorder(boxVault, spr, "vl-rr-half", startBorderX, startBorderY, 0, 0)
placeStandBorderEx(boxVault, spr, "vl-rr", startBorderX, startBorderY, 0, 0, 0, 32)
placeStandBorderEx(boxVault, spr, "vl-l", startBorderX, startBorderY, 0, 1, 0, 32)
placeStandBorderEx(boxVault, spr, "vl-rr", startBorderX, startBorderY, 0, 2, 0, 32)
placeStandBorderEx(boxVault, spr, "vl-rr-half", startBorderX, startBorderY, 0, 3, 0, 32)

placeStandBorder(boxVault, spr, "vr-ll-half", startBorderX, startBorderY, 8, 2)
placeStandBorderEx(boxVault, spr, "vr-ll", startBorderX, startBorderY, 8, 2, 0, 32)
placeStandBorderEx(boxVault, spr, "vr-r", startBorderX, startBorderY, 8, 3, 0, 32)
placeStandBorderEx(boxVault, spr, "vr-ll", startBorderX, startBorderY, 8, 4, 0, 32)
placeStandBorderEx(boxVault, spr, "vr-ll-half", startBorderX, startBorderY, 8, 5, 0, 32)

placeStandBorder(boxVault, spr, "hu-dd-l", startBorderX, startBorderY, 0, 0)
placeStandBorderEx(boxVault, spr, "hu-long", startBorderX, startBorderY, 0, 0, 32, 0)
placeStandBorderEx(boxVault, spr, "hu-u", startBorderX, startBorderY, 1, 0, 32, 0)
placeStandBorderEx(boxVault, spr, "hu-long", startBorderX, startBorderY, 2, 0, 32, 0)
placeStandBorderEx(boxVault, spr, "hu-dd-r", startBorderX, startBorderY, 3, 0, 32, 0)

placeStandBorder(boxVault, spr, "hd-uu-half", startBorderX, startBorderY, 0, 4)
placeStandBorderEx(boxVault, spr, "hd-uu", startBorderX, startBorderY, 0, 4, 32, 0)
placeStandBorderEx(boxVault, spr, "hd-d", startBorderX, startBorderY, 1, 4, 32, 0)
placeStandBorderEx(boxVault, spr, "hd-uu", startBorderX, startBorderY, 2, 4, 32, 0)
placeStandBorder(boxVault, spr, "hd-dd", startBorderX, startBorderY, 3, 4)


placeStandBorderEx(boxVault, spr, "rmk_pup", startBorderX, startBorderY, 0, 1, -25, -1)
placeStandBorderEx(boxVault, spr, "rmk_pup", startBorderX, startBorderY, 0, 3, -25, 1)

placeStandBorderEx(boxVault, spr, "rmk_pup", startBorderX, startBorderY, 8, 3, 25, -1)
placeStandBorderEx(boxVault, spr, "rmk_pup", startBorderX, startBorderY, 8, 5, 25, 1)

local coreRoot = mission:getCoreRoot();

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

stand = KrSprite(boxVault:GetSpriteResource("setka0"))
stand:SetPos(211 - 21 + 20 - 18, 110 - 53 - 30 - 50, -1);
stand:SetZDepth(-99);
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)
]]--

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

mission:setGroupCounts(4, 8);

addMusicianTrubBox1(boxVault, 3.8296, "lu", coreRoot, mission, luIdx)
addMusicianTrubBox1(boxVault, 3.8296, "ru", coreRoot, mission, ruIdx)
addMusicianTrubBox1(boxVault, 3.8296, "ld", coreRoot, mission, ldIdx)
addMusicianBarBox1(boxVault, 3.8296, "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)
