print("init Room0 begin");


local vault = resourceManager:getVault(ResourceManager.COMMON)
local scene = game:getSceneManager():getCurrentRoomScene()

buttDelay = 0
buttFadeTime = 0.5

-- Тултип

local ttLeft = 150;
local ttTop = 650;

local shiftGuiY = 0;

local tooltipBG = KrSprite(vault:GetSpriteResource("rmk"))
-- tooltipBG:SetPos(172, 662, -1)
tooltipBG:SetPos(174, 28 - 10 + shiftGuiY, -1)

aniFadeInFadeOut(tooltipBG, buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setTooltipSprite(tooltipBG)

local textBox = KrTextBox(game:getFontResource("occ24"), 646, 104, 2, KrTextBox.LEFT);
textBox:SetPos(184, 38 - 10 + shiftGuiY, -1);

aniFadeInFadeOut(textBox, buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setTooltipTextBox(textBox)

-- Кнопка возврата в меню

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;
		

-- Книга

x = 930
y = 700

width = 141
height = 104
sensX = -65
sensY = -35

-- initXBtn(button, "room_book_btn", 937, 692, sensX, sensY, width, height, vault)
initXBtn(button, "room_book_btn", 937, 61 + shiftGuiY, sensX, sensY, width, height, vault)

aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setBookButton(button);

-- Схема дома

-- local x = 933;
-- local y = 78;

local x = 86;
local y = 76 + shiftGuiY;


local schemeBG = KrSprite(vault:GetSpriteResource("map_rulon_h"))
schemeBG:SetPos(x, y, -1)

aniFadeInFadeOut(schemeBG, buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setHouseSchemeSpriteBG(schemeBG)

schemeBG = KrSprite(vault:GetSpriteResource("map_plan"))
schemeBG:SetPos(x, y, -1)

aniFadeInFadeOut(schemeBG, buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setHouseSchemeSprite(schemeBG)




-- Кнопки схемы

shftNmbrX = -8-5
shftNmbrY = -4-2

-- кнопка 0

button = XButton();

width = 30
height = 28
sensX = -35
sensY = -6

initXBtn(button, "map_room1_btn", x, y, sensX, sensY, width, height, vault)

initXButtonTextUnshifted(button, "_0",
					-21 + shftNmbrX, 3 + shftNmbrY, 
					width - 2, height, 
					"occ24b", KrTextBox.CENTER)

button:setTextColor(163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, 163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
button:setTextColorBType(XButton.SELECTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_HIGHLIGHTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_PRESSED, 251, 247, 156, 255);

aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setRoomSchemeButton(button, 0);


-- кнопка 1

width = 29
height = 25
sensX = -35
sensY = 36

button = XButton();

initXBtn(button, "map_room4_btn", x, y, sensX, sensY, width, height, vault)

initXButtonTextUnshifted(button, "_1",
					-19 + shftNmbrX, 43 + shftNmbrY, 
					width - 7, height + 6, 
					"occ24b", KrTextBox.CENTER)

button:setTextColor(163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, 163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
button:setTextColorBType(XButton.SELECTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_HIGHLIGHTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_PRESSED, 251, 247, 156, 255);


aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setRoomSchemeButton(button, 3);

-- кнопка 2

width = 32
height = 24
sensX = 2
sensY = -38

button = XButton();

initXBtn(button, "map_room2_btn", x, y, sensX, sensY, width, height, vault)

initXButtonTextUnshifted(button, "_2",
					18 + shftNmbrX, -31 + shftNmbrY, 
					width - 7, height + 3, 
					"occ24b", KrTextBox.CENTER)

button:setTextColor(163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, 163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
button:setTextColorBType(XButton.SELECTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_HIGHLIGHTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_PRESSED, 251, 247, 156, 255);


aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setRoomSchemeButton(button, 1);




-- кнопка 3

width = 32
height = 28
sensX = 2
sensY = -6

button = XButton();

initXBtn(button, "map_room5_btn", x, y, sensX, sensY, width, height, vault)

initXButtonTextUnshifted(button, "_2",
					18 + shftNmbrX, 3 + shftNmbrY, 
					width - 7, height, 
					"occ24b", KrTextBox.CENTER)

button:setTextColor(163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, 163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
button:setTextColorBType(XButton.SELECTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_HIGHLIGHTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_PRESSED, 251, 247, 156, 255);


aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setRoomSchemeButton(button, 4);



-- кнопкmа 4

width = 32
height = 29
sensX = 2
sensY = 23

button = XButton();

initXBtn(button, "map_room3_btn", x, y, sensX, sensY, width, height, vault)

initXButtonTextUnshifted(button, "_2",
					18 + shftNmbrX, 32 + shftNmbrY, 
					width - 7, height, 
					"occ24b", KrTextBox.CENTER)

button:setTextColor(163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, 163, 50, 9, 255);
button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
button:setTextColorBType(XButton.SELECTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_HIGHLIGHTED, 251, 247, 156, 255);
button:setTextColorBType(XButton.SELECTED_PRESSED, 251, 247, 156, 255);


aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
scene:setRoomSchemeButton(button, 2);


----- Кнопка выхода в меню

button = XButton();

	local x = 953;
	local y = 751;

	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_room_menu_down", x, y, sensX, sensY, width, height, vault)
	initXButtonText(button, "ROOM.MENU",
						sensX, textY, 
						width, height, 
						"occ24bg", KrTextBox.CENTER)

--	aniFadeInFadeOut(button:getRoot(),fadeInDelay, fadeInTime, fadeOutTime, 255)
aniFadeInFadeOut(button:getRoot(), buttDelay, buttFadeTime, buttFadeTime, 255)
	button:setTextColor(rText, gText, bText, aText);
	button:setTextColorBType(XButton.NORMAL_HIGHLIGHTED, rHText, gHText, bHText, aHText);
	button:setTextColorBType(XButton.NORMAL_PRESSED, rHText, gHText, bHText, aHText);
--	button:setAccelerator(XButton.ESCAPE);

scene:setExitButton(button)




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

aniFadeOutFadeIn(fadingPlane, 0, 0.5, 0, 0.5)
scene:setFadingPlaneSprite(fadingPlane)


print("init Room0 end");


