
-- 网页活动数据
-- 按照配置顺序显示
-- OpenDlgId:点击时是否打开Dlg.有配置则会打开
-- OpenDlgId没配置时，默认会打开WebIndex配置的地址
--WebIndex -对应Cn_Res.ini里面STR_PROPAGATE_WEB_URL100配置的地址。Index范围[100-999]
--BtnId:配置该项等同于点击了MinimapAreaPanel.lua中对应图标Key值的按钮，需要OpenDlgId和WebIndex没有配置才可使用

-- ["FgEffAlways"] = true,要永久显示前景光效请配置
-- ["AniEffAlways"] = true,要永久显示背景光效请配置
-- ["FgImgAlways"] = true,要永久显示前景图片请配置
-- ["TipAlways"] = true,要永久显示tips请配置
local WebActivityData = {
	count = 5,
	--网页1
	[0] = {
		-- 按钮Ani
		["BtnId"] = -1,
		["ImgAni"] = "Main_ninjaBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		["Start"] = 20220308000000,
		["End"] = 20220321235959,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,",
		["WebIndex"] = 100,--对应Cn_Res.ini里面STR_PROPAGATE_WEB_URL100配置的地址。
		["FgEffAlways"] = true,
		["AniEffAlways"] = true,
		["FgImgAlways"] = true,
		["TipAlways"] = true,
	},
	--网页2
	[1] = {
		-- 按钮Ani
		["BtnId"] = -1,
		["ImgAni"] = "Main_ChunJieBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 4,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮持续特效（自始至终显示）
		["FGEffectAlways"] = "sl_chaozhi",
		["FGEffectAlwaysOffsetX"] = 7,
		["FGEffectAlwaysOffsetY"] = 3,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		["Start"] = 20220329000000,
		["End"] = 20220411235959,
		-- 是否允许跨服使用
		["CrossServer"] = 1,
		["WebIndex"] = 101,
		["FgEffAlways"] = true,
		["AniEffAlways"] = true,
		["FgImgAlways"] = true,
		["TipAlways"] = true,
	},
	--网页3
	[2] = {
		-- 按钮Ani
		["BtnId"] = -1,
		["ImgAni"] = "Nqianxin_Nqianxin",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		["Start"] = 20220426000000,
		["End"] = 20300426235959,
		-- 是否允许跨服使用
		["CrossServer"] = 1,
		["WebIndex"] = 102,
		["FgEffAlways"] = true,
		["AniEffAlways"] = true,
		["FgImgAlways"] = true,
		["TipAlways"] = true,
	},
	--网页4
	[3] = {
		-- 按钮Ani
		["BtnId"] = -1,
		["ImgAni"] = "Main_zbbbBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		["Start"] = 20211012000000,
		["End"] = 20211111235959,
		["WebIndex"] = 103,
		["FgEffAlways"] = true,
		["AniEffAlways"] = true,
		["FgImgAlways"] = true,
		["TipAlways"] = true,
	},
	--网页4
	[4] = {
		-- 按钮Ani
		["BtnId"] = 17,
		["ImgAni"] = "main_JbaogeBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		-- ["WebIndex"] = 103,
		["FgEffAlways"] = true,
		["AniEffAlways"] = true,
		["FgImgAlways"] = true,
		["TipAlways"] = true,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
}


-- 开服活动数据
-- 按照配置顺序显示
-- OpenDlgId:点击时是否打开Dlg.有配置则会打开
-- OpenDlgId没配置时，默认会打开WebIndex配置的地址
--0-2序号对应的活动不能变，程序有用到
local ServerActivityData = {
    count = 0,
--七日登录
    [0] = {
        -- 按钮Ani
        ["BtnId"] = -1,
        ["ImgAni"] = "7RHLBtn",
        ["ImgAniOffsetX"] = 0,
        ["ImgAniOffsetY"] = 0,
        -- 按钮FgAni(红点等覆盖图片)
        ["FGAni"] = "Operating_PromptPic",
        ["FGAniOffsetX"] = 35,
        ["FGAniOffsetY"] = 0,
        -- 按钮覆盖特效
        ["FGEffect"] = "",
        ["FGEffectOffsetX"] = 0,
        ["FGEffectOffsetY"] = 0,
        ["OpenDlgId"] = 1012,
        ["FgEffAlways"] = true,
        ["AniEffAlways"] = true,
        ["FgImgAlways"] = true,
        ["TipAlways"] = true,
    },
--开服目标
    [1] = {
        -- 按钮Ani
        ["BtnId"] = -1,
        ["ImgAni"] = "KFMBBtn",
        ["ImgAniOffsetX"] = 0,
        ["ImgAniOffsetY"] = 0,
        -- 按钮FgAni(红点等覆盖图片)
        ["FGAni"] = "Jabali_RedtipsPic",
        ["FGAniOffsetX"] = 35,
        ["FGAniOffsetY"] = 0,
        -- 按钮覆盖特效
        ["FGEffect"] = "",
        ["FGEffectOffsetX"] = 0,
        ["FGEffectOffsetY"] = 0,
        ["OpenDlgId"] = 1009,
        ["FgEffAlways"] = true,
        ["AniEffAlways"] = true,
        ["FgImgAlways"] = true,
        ["TipAlways"] = true,
    },
--开服争霸
    [2] = {
        -- 按钮Ani
        ["BtnId"] = -1,
        ["ImgAni"] = "FFhegemonyBtn",
        ["ImgAniOffsetX"] = 0,
        ["ImgAniOffsetY"] = 0,
        -- 按钮FgAni(红点等覆盖图片)
        ["FGAni"] = "Jabali_RedtipsPic",
        ["FGAniOffsetX"] = 35,
        ["FGAniOffsetY"] = 0,
        -- 按钮覆盖特效
        ["FGEffect"] = "",
        ["FGEffectOffsetX"] = 0,
        ["FGEffectOffsetY"] = 0,
        ["OpenDlgId"] = 1024,
        ["FgEffAlways"] = true,
        ["AniEffAlways"] = true,
        ["FgImgAlways"] = true,
        ["TipAlways"] = true,
    },

}

--英文日常图标
local EnDailyIconInfo = {
	count = 0,
	
}
--英文活动图标
local EnActivityInfo = {
	count = 6,
	
	--大侠传:4
	[0] = {
		["BtnId"] = 4,
		-- 按钮Ani
		["ImgAni"] = "Stage_HerosBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		["AniEffectExr"] = 0,
		-- 按钮Tip
		["Tip"] = "STR_COMPLETE_STAGE_GOAL_TIP",
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	[1] = {
			["BtnId"] = 27,
			-- 按钮Ani
			["ImgAni"] = "Main_MissionBtn",
			["ImgAniOffsetX"] = 0,
			["ImgAniOffsetY"] = 0,
			-- 按钮FgAni(红点等覆盖图片)
			["FGAni"] = "Operating_PromptPic",
			["FGAniOffsetX"] = 35,
			["FGAniOffsetY"] = 0,
			-- 按钮覆盖特效
			["FGEffect"] = "",
			["FGEffectOffsetX"] = 0,
			["FGEffectOffsetY"] = 0,
			-- 在某些地图隐藏
			["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	
	--外敌入侵
	[2] = {
		["BtnId"] = 29,
		-- 是否默认开启
		["DefaultShow"] = 1,
		-- 按钮Ani
		["ImgAni"] = "Main_WaiDiRuQinBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		["FGEffect"] = "gantanhao",
		["FGEffectLoop"] = 1,
		["FGEffectOffsetX"] = 48,
		["FGEffectOffsetY"] = 12,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		-- 是否允许跨服使用
		["CrossServer"] = 0,
		-- 跨服禁止的Tip
		["CrossServerTip"] = "STR_INVADE_CROSS_SERVER_FORBID",
	},
	[3] = {
		["BtnId"] = 9,
		-- 按钮Ani
		["ImgAni"] = "IWTBstrongBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	--挑战副本:26
	[4] = {
		["BtnId"] = 26,
		-- 按钮Ani
		["ImgAni"] = "Main_TiaoZhanBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	--挂机:5
	[5] = {
		["BtnId"] = 5,
		-- 按钮Ani
		["ImgAni"] = "AM_Automatic",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,11591,11592,11593,11594,11595,11596,11597,11598,11599,11600,"
	},
}

--英文活动图标 - 老兵服
local EnActivityInfoOldsoldier = {
	count = 4,
	--大侠传:4
	[0] = {
		["BtnId"] = 4,
		-- 按钮Ani
		["ImgAni"] = "Stage_HerosBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 按钮Ani特效
		["AniEffect"] = "",
		["AniEffectExr"] = 0,
		-- 按钮Tip
		["Tip"] = "STR_COMPLETE_STAGE_GOAL_TIP",
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	--外敌入侵
	[1] = {
		["BtnId"] = 29,
		-- 是否默认开启
		["DefaultShow"] = 1,
		-- 按钮Ani
		["ImgAni"] = "Main_WaiDiRuQinBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "Operating_PromptPic",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		["FGEffect"] = "gantanhao",
		["FGEffectLoop"] = 1,
		["FGEffectOffsetX"] = 48,
		["FGEffectOffsetY"] = 12,
		-- 按钮Ani特效
		["AniEffect"] = "",
		-- 按钮Tip
		["Tip"] = "",
		-- 是否允许跨服使用
		["CrossServer"] = 0,
		-- 跨服禁止的Tip
		["CrossServerTip"] = "STR_INVADE_CROSS_SERVER_FORBID",
	},
	[2] = {
		["BtnId"] = 9,
		-- 按钮Ani
		["ImgAni"] = "IWTBstrongBtn",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,"
	},
	--挂机:5
	[3] = {
		["BtnId"] = 5,
		-- 按钮Ani
		["ImgAni"] = "AM_Automatic",
		["ImgAniOffsetX"] = 0,
		["ImgAniOffsetY"] = 0,
		-- 按钮FgAni(红点等覆盖图片)
		["FGAni"] = "",
		["FGAniOffsetX"] = 35,
		["FGAniOffsetY"] = 0,
		-- 按钮覆盖特效
		["FGEffect"] = "",
		["FGEffectOffsetX"] = 0,
		["FGEffectOffsetY"] = 0,
		-- 在某些地图隐藏
		["HideInMap"] = "4027,4028,4029,4030,4032,4038,4039,4040,3053,11591,11592,11593,11594,11595,11596,11597,11598,11599,11600,"
	},
}

--英文交易图标
local EnTradeInfo = {
	count = 0,
}


local DlgInfo = {
	["ActivityNum1"] = WebActivityData.count,
	["ActivityNum2"] = ServerActivityData.count,
	["ActivityNum3"] = EnDailyIconInfo.count,
	["ActivityNum4"] = EnActivityInfo.count,
	["ActivityNum5"] = EnTradeInfo.count,
	
	["Set1"] = WebActivityData,
	["Set2"] = ServerActivityData,
	["Set3"] = EnDailyIconInfo,
	["Set4"] = EnActivityInfo,
	["Set5"] = EnTradeInfo,
	["PerWidth"] = 63,
	["DlgOffsetX"] = 30,
	["DlgOffsetY"] = 52,
}

local DlgInfoOldsoldier = {
	["ActivityNum1"] = WebActivityData.count,
	["ActivityNum2"] = ServerActivityData.count,
	["ActivityNum3"] = EnDailyIconInfo.count,
	["ActivityNum4"] = EnActivityInfoOldsoldier.count,
	["ActivityNum5"] = EnTradeInfo.count,
	
	["Set1"] = WebActivityData,
	["Set2"] = ServerActivityData,
	["Set3"] = EnDailyIconInfo,
	["Set4"] = EnActivityInfoOldsoldier,
	["Set5"] = EnTradeInfo,
	["PerWidth"] = 63,
	["DlgOffsetX"] = 30,
	["DlgOffsetY"] = 52,
}



local function GetDlgInfo(nType)
	-- 老兵服
	if UserData_IsOldSoldierServer() or UserData_IsCoinsServer() then
		return DlgInfoOldsoldier[nType]
	end
	return DlgInfo[nType]
end

-- 个数
-- nType: 1 网页活动数据; 2:开服活动数
local function GetActivityCount(nType)
	local str = "ActivityNum"..math.ceil(nType)
	local num = GetDlgInfo(str)
	return num
end

-- nType: 1 网页活动数据; 2:开服活动数
local function GetActivityData(nType, index, key)
	local str = "Set"..math.ceil(nType)
	local set = GetDlgInfo(str)
	if set ~= nil then
		if set.count <= index then
			return nil
		end

		keyValue = set[index][key]
	end

	if keyValue ~= nil then
		return keyValue
	end
	
	return 0
end


--通过BtnId去获取到在对应集合内的索引
local function GetBtnIdByIndex(nType, nId)
	local str = "Set"..math.ceil(nType)
	local set = GetDlgInfo(str)

	if set ~= nil then
		for i = 0, set.count do
			if set[i]["BtnId"] ~= nil  and set[i]["BtnId"] == nId then
				return i
			end
		end
	end

	return -1
end

-- 获取精彩活动图标
local function GetWonderfulItemAni(index, awardCount)
    -- 精彩活动父节点有奖励待领取的图标
    if index == 1 then
        return "Operating_PromptPic"

    -- 精彩活动子节点有奖励待领取的图标.awardCount奖励个数
    elseif index == 2 then
        return "Operating_PromptPic"

    end

    return ""
end

local ActivityCenter = {
    GetActivityCount = GetActivityCount,
    GetActivityData = GetActivityData,
    Unload = Unload,
	GetWonderfulItemAni = GetWonderfulItemAni,
	GetDlgInfo = GetDlgInfo,
	GetBtnIdByIndex = GetBtnIdByIndex,
}

-- global
ActivityCenter_GetActivityCount = ActivityCenter.GetActivityCount
ActivityCenter_GetActivityData = ActivityCenter.GetActivityData
ActivityCenter_Unload = ActivityCenter.Unload
ActivityCenter_GetWonderfulItemAni = ActivityCenter.GetWonderfulItemAni
ActivityCenter_GetDlgInfo = ActivityCenter.GetDlgInfo
ActivityCenter_GetBtnIdByIndex = ActivityCenter.GetBtnIdByIndex

return ActivityCenter
