EnvChannel = {}

EnvChannel.ServerListTableName = nil

EnvChannel.ChannelConfig = {
	Develop = {Name = "Develop",ServerList = "Table_ServerList",ip={"192.168.1.166"},port=5005,NeedGM=true,initReporter = true},
	Alpha = {Name = "Alpha",ServerList = "Table_ServerList_Alpha",ip={"192.168.1.166","192.168.1.166"},port=5001},
	Studio = {Name = "Studio",ServerList = "Table_ServerList_Studio",ip={"192.168.1.166","192.168.1.166"},port=5001,initReporter = true},
	Gravity = {Name = "Gravity",ServerList = "Table_ServerList_Gravity",ip={"192.168.1.166"},port=5003},
	UWA = {Name = "UWA",ServerList = "Table_ServerList_UWA",ip={"192.168.1.166","192.168.1.166"},port=5001,NeedGM=true},
	Release = {Name = "Release",ServerList = "Table_ServerList_Alpha",ip={"192.168.1.166","192.168.1.166"},port=5000},
}

EnvChannel.BranchBitValue = {
	[EnvChannel.ChannelConfig.Develop.Name] = 1,
	[EnvChannel.ChannelConfig.Studio.Name] = 2,
	[EnvChannel.ChannelConfig.Alpha.Name] = 4,
	[EnvChannel.ChannelConfig.Release.Name] = 8,
}

EnvChannel.Channel = EnvChannel.ChannelConfig.Develop

if(AppEnvConfig.Instance) then
	EnvChannel.Channel = EnvChannel.ChannelConfig[AppEnvConfig.Instance.channelEnv]
	if(EnvChannel.Channel==nil) then
		EnvChannel.Channel = EnvChannel.ChannelConfig.Develop
	end
	EnvChannel.ServerListTableName = EnvChannel.Channel.ServerList
	if(ResourceID.CheckFileIsRecorded(EnvChannel.ServerListTableName)) then
		autoImport(EnvChannel.ServerListTableName)
		Table_ServerList = _G[EnvChannel.ServerListTableName]
	else
		autoImport("Table_ServerList")
	end
else
	autoImport("Table_ServerList")
end

function EnvChannel.GetPublicIP()
	local ipConfig = EnvChannel.Channel
	return ipConfig~=nil and ipConfig.ip or {NetConfig.PUBLIC_GAME_SERVER_IP}
end

function EnvChannel.GetPublicPort()
	local ipConfig = EnvChannel.Channel
	return ipConfig~=nil and ipConfig.port or NetConfig.PUBLIC_GAME_SERVER_PORT
end

function EnvChannel.GMButtonEnable()
	return EnvChannel.Channel.NeedGM == true;
end

function EnvChannel.SDKEnable()
	if(AppEnvConfig.Instance) then
		return AppEnvConfig.Instance.NeedSDK
	end
	return false
end

function EnvChannel.IsReleaseBranch()
	return EnvChannel.Channel.Name == EnvChannel.ChannelConfig.Release.Name
end

function EnvChannel.IsTFBranch()
	return EnvChannel.Channel.Name == EnvChannel.ChannelConfig.Alpha.Name
end

--urls;elements:{plat}
function EnvChannel.GetHttpOperationJson()
	local httpJson = HttpOperationJson.Instance
	if(httpJson) then
		local str = httpJson.rawString
		if(str) then
			EnvChannel.httpOptJson = StringUtil.Json2Lua(str)
		end
	end
	return EnvChannel.httpOptJson
end
