--модуль для обработки кликов по ресурсам игрока
click_widget = {}

__inherite(click_widget, null_lua_widget_handler())

click_widget._areas =
{
	money = {pos = sf.misc.FloatVector(40,30), size = sf.misc.FloatVector(180,55), tutorial_event="money_tutorial"},
}

function click_widget.__CreateInstance()
    return "click_widget"
end

function click_widget.Load(_this, _info, _templates)
	return true
end

function click_widget.OnMouseMove(_this, _pos, _state, _broadcast)
	
	for _, area_info in pairs(click_widget._areas) do
		if __IsPointInRect(_pos, area_info.pos, area_info.size) then
			sf.gui.g_Cursor.Instance().SetCursor( sf.gui.CCursor.CursorHand )   	
			break
		end
	end
    return false
end

function click_widget.OnMouseUp(_this, _pos, _button, _state, _broadcast)
    return false
end

function click_widget.OnMouseDown(_this, _pos, _button, _state, _broadcast)
	for _, area_info in pairs(click_widget._areas) do
		if __IsPointInRect(_pos, area_info.pos, area_info.size) then
			tutorial_window.Show(town_window._self, area_info.tutorial_event)	
			break
		end
	end
    return false
end

function click_widget.OnDoubleClick(_this, _pos, _state, _broadcast)
    return true
end
