local Config = {}

local gameID = "daer"

Config.animType = 
{
	_in = 1,
	_out = 2,
}

function Config:saveOption(desk,skin)
	cc.UserDefault:getInstance():setIntegerForKey(tostring(gameID) .. 'desk',tonumber(desk))
	cc.UserDefault:getInstance():setIntegerForKey(tostring(gameID) .. 'skin',tonumber(skin))
end

function Config:loadOption()
	return self:loadDesk(),self:loadSkin()
end

function Config:loadDesk()
	return cc.UserDefault:getInstance():getIntegerForKey(tostring(gameID) .. 'desk',1)
end

function Config:loadSkin()
	return cc.UserDefault:getInstance():getIntegerForKey(tostring(gameID) .. 'skin',1)
end

function Config:uiAnim(parent,anim,callback)
	if not parent then
		return false
	end
	parent:setScale(UIHelper:AorBorC(anim == Config.animType._out,0,1))
	local array = {}
	if anim == Config.animType._out then
		table.insert(array,cc.ScaleTo:create(0.07,1.1))
		table.insert(array,cc.ScaleTo:create(0.15,1))
	else
		table.insert(array,cc.EaseBackIn:create(cc.ScaleTo:create(0.3,0.3)))
	end
	table.insert(array,cc.CallFunc:create(function()
		if callback then
			callback()
		end
	end))
	parent:runAction(cc.Sequence:create(array))
	return true
end

return Config