------------------------------------------------------------------
-- DoubleIncome.lua.lua
-- Author     : yeyq

-- Version    : 1.0
-- Date       :
-- Description: 
------------------------------------------------------------------

module("DoubleIncome", package.seeall)

-- õĳԱҪļͷӱҪ˵
-- Աͳһ»߿ʼӵĸҪСд

local g_scene = nil 		-- 
local g_layer = nil 
local g_activeTable = nil 


-------------------------˽нӿ------------------------
--
-- ʼԴԱ
function initResource()
end
-- ͷԴ
function releaseResource()
	if  g_layer  then
		g_layer:getParent():removeChild(g_layer,true)
		g_layer = nil 		
	end
end

-- 
function init(mScene,Flayer,table)
	g_scene = mScene
	initResource()
	g_activeTable = table
	-- ӱ
	g_layer = CCLayer:create()
	Flayer:addChild(g_layer, 0)
	-- עᴥ¼
	g_layer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHBEGAN, "DoubleIncome.touchBegan")
	g_layer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHMOVED, "DoubleIncome.touchMove")
	g_layer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHENDED, "DoubleIncome.touchEnd")

	-- ˴ӳʼ
	-- ˴ӳʼ
	
	
	local BgImgW  = pWinSize.width*0.92
	local BgImgH = pWinSize.height*0.69
	local  BgImg = CCSprite:create(P("activeBg/list_1159.jpg"))
	BgImg:setScaleX(BgImgW/BgImg:getContentSize().width)
	BgImg:setScaleY(BgImgH/BgImg:getContentSize().height)
	g_layer:addChild(BgImg,0)
	BgImg:setAnchorPoint(PT(0,0))
	BgImg:setPosition(PT(pWinSize.width*0.5-BgImgW/2,pWinSize.height*0.21))
	
	
	local strImg = CCSprite:create(P("title/list_1160.png"))
	g_layer:addChild(strImg,0)
	strImg:setAnchorPoint(PT(0,0))
	titleHeight = BgImg:getPosition().y+BgImgH-SY(50)	
	strImg:setPosition(PT((pWinSize.width-strImg:getContentSize().width)/2,titleHeight))

	
	local gotoButton  = ZyButton:new("button/list_1023.png",nil,nil,Language.RecruitScene_buttonStr,FONT_NAME,FONT_SM_SIZE)
	gotoButton:setAnchorPoint(PT(0.5,0.5))
	gotoButton:setPosition(PT(pWinSize.width*0.5,pWinSize.height*0.3))
	gotoButton:addto(g_layer,0)
	gotoButton:registerScriptHandler(gotoAction)

	showLayer()
	
	
end
function showLayer()
		local DoubleStr = string.format(Language.Active_Date,g_activeTable.StartDate,g_activeTable.EndDate)
		local activeStr= CCLabelTTF:create(DoubleStr,FONT_NAME,FONT_SM_SIZE)
		g_layer:addChild(activeStr,0)
		activeStr:setAnchorPoint(PT(0,0))
		activeStr:setPosition(PT(pWinSize.width*0.05,titleHeight-SY(20)))
		
		local cotentStr = string.format(Language.Active_ContentStr,g_activeTable.FestivalDesc)
		local str = string.format("<label>%s</label>",cotentStr)
		local activeStr1 = ZyMultiLabel:new(str,pWinSize.width*0.9,FONT_NAME,FONT_SM_SIZE)
		activeStr1:addto(g_layer,0)
		activeStr1:setAnchorPoint(PT(0,0))
		activeStr1:setPosition(PT(activeStr:getPosition().x,activeStr:getPosition().y-SY(20)))
		
		
		local doubleStirng = string.format(Language.DoubleIncome_str2,g_activeTable.RestrainNum)
		local activeStr2= CCLabelTTF:create(doubleStirng,FONT_NAME,FONT_SM_SIZE)
		g_layer:addChild(activeStr2,0)
		activeStr2:setAnchorPoint(PT(0,0))
		activeStr2:setPosition(PT(activeStr:getPosition().x,activeStr1:getPosition().y-SY(20)))
		
end
function gotoAction()
	MainMenuLayer.funcAction(true,51)
end
-- 
function touchBegan(e)
end
-- ƶ
function touchMove(e)
end
-- 
function touchEnd(e)
end
-- ص
function networkCallback(pScutScene, lpExternalData)
	local actionID = NdReader:getActionID()
	local userData = ScutRequestParam:getParamData(lpExternalData)
end