模块:NavboxV2/EvenoddContext

-- evenodd swap Context start
local EvenoddContext = {
	['_type'] = "eosContext",
	['evenodd'] = "",
	["currentVal"] = {},
	["nextVal"] = {},
	--[[ ['oddstyle'] = "",
	['evenstyle'] = "",]]
}
EvenoddContext.__index = EvenoddContext
function EvenoddContext.new(context,getArgFunc)
	local prefix = context.prefix
	local evenodd = getArgFunc(prefix, "evenodd", nil ,context)
	local a,b = "odd", "even"
	local noStyle = false	
	if evenodd == "odd" or evenodd == "even" then -- 奇偶锁定
		a , b = evenodd , evenodd
	elseif evenodd == "off" then --
		a , b ,noStyle = "off" , "off" , true
	elseif evenodd == "swap" then -- 对调
		a , b = b , a
	end
	
	local newObj = {}
	setmetatable(newObj, EvenoddContext)
	newObj.evenodd = evenodd
	newObj.currentVal = {a, 'navbox-' .. a }
	newObj.nextVal    = {b, 'navbox-' .. b }
	--[[newObj.oddstyle , newObj.evenstyle = 
		getArgFunc(prefix, "oddstyle", "") , getArgFunc(prefix, "evenstyle", "")]]
	return newObj
end

function EvenoddContext:current(isNext)
	local returnArr = self.currentVal
	if isNext == true then self.currentVal, self.nextVal = self.nextVal, self.currentVal end
	return unpack(returnArr)
end

function EvenoddContext:currentOddEven()
	return self:current()
end

function EvenoddContext:next()
	return self:current(true)
end

function EvenoddContext:evenoddArgValue()
	return self.evenodd
end

---------------------

return EvenoddContext