local SplinterExchangeManager = BaseClass("SplinterExchangeManager")
local __init = function(self)
  self.exchangeInfoList = {}
  for key, value in pairs(SplinterExchangeType) do
    local exchangeInfo = SplinterExchangeInfo.New()
    exchangeInfo:InitByCfg(value)
    self.exchangeInfoList[value.Id] = exchangeInfo
  end
  self:AddListener()
end
local __delete = function(self)
  self.exchangeInfoList = nil
  self:RemoveListener()
end
local AddListener = function(self)
end
local RemoveListener = function(self)
end
local RefreshSelfInfo = function(self, message)
  if message and message.type then
    self.exchangeInfoList[message.type]:RefreshSelfInfo(message)
  end
end
local RefreshALInfoList = function(self, message)
  if message and message.type then
    self.exchangeInfoList[message.type]:RefreshALInfoList(message)
  end
end
local CancelExchange = function(self, type)
  self.exchangeInfoList[type]:CancelExchange()
end
local RefreshRecordDataList = function(self, message)
  self.exchangeInfoList[message.type]:RefreshRecordDataList(message)
end
local RefreshOneRecordData = function(self, message)
  self.exchangeInfoList[message.type]:RefreshOneRecordData(message)
end
local RefreshSelfRecordShowData = function(self, message)
  self.exchangeInfoList[message.type]:RefreshSelfRecordShowData(message)
end
local GetRecordDataByUuid = function(self, type, uuid)
  return self.exchangeInfoList[type]:GetRecordDataByUuid(uuid)
end
local GetAlExchangeDataList = function(self, type)
  return self.exchangeInfoList[type]:GetAlExchangeDataList()
end
local GetSelfExchangeData = function(self, type)
  return self.exchangeInfoList[type]:GetSelfExchangeData()
end
local GetRecordDataList = function(self, type)
  return self.exchangeInfoList[type]:GetRecordDataList()
end
local GetAllFragNum = function(self, type)
  return self.exchangeInfoList[type]:GetAllFragNum()
end
local SetShowExchangeRedPoint = function(self, message)
  if message and message.TREASURE_FRAGMENT then
    self.exchangeInfoList[SplinterExchangeType.DispatchTreasure.Id]:SetShowExchangeRedPoint(message)
  end
end
local GetExchangeLogRedPoint = function(self, type)
  return self.exchangeInfoList[type]:GetExchangeLogRedPoint()
end
local GetFragGoodsIdList = function(self, type)
  return self.exchangeInfoList[type].fragGoodsIdList
end
local GetExchangeInfo = function(self, type)
  return self.exchangeInfoList[type]
end
local GetIndexByGoodsId = function(self, type, goodsId)
  if type == nil then
    return 0
  end
  return self.exchangeInfoList[type]:GetIndexByGoodsId(goodsId)
end
local GetIndexStrByIndex = function(self, type, index)
  if (type == SplinterExchangeType.DispatchTreasure.Id or type == SplinterExchangeType.DigTreasure.Id) and index and 0 < index then
    return "M" .. index
  else
    return ""
  end
end
local GetIndexStrByGoodsId = function(self, type, goodsId)
  return self:GetIndexStrByIndex(type, self:GetIndexByGoodsId(type, goodsId))
end
local GetLogRedPointStrByType = function(self, type)
  return self.exchangeInfoList[type]:GetCfgData().LogRedPoint
end
local GetSplinterTypeByLogRedPointStr = function(self, str)
  for key, value in pairs(SplinterExchangeType) do
    if value.LogRedPoint == str then
      return value.Id
    end
  end
  return nil
end
SplinterExchangeManager.__init = __init
SplinterExchangeManager.__delete = __delete
SplinterExchangeManager.AddListener = AddListener
SplinterExchangeManager.RemoveListener = RemoveListener
SplinterExchangeManager.RefreshSelfInfo = RefreshSelfInfo
SplinterExchangeManager.RefreshALInfoList = RefreshALInfoList
SplinterExchangeManager.CancelExchange = CancelExchange
SplinterExchangeManager.RefreshRecordDataList = RefreshRecordDataList
SplinterExchangeManager.RefreshSelfRecordShowData = RefreshSelfRecordShowData
SplinterExchangeManager.RefreshOneRecordData = RefreshOneRecordData
SplinterExchangeManager.GetAlExchangeDataList = GetAlExchangeDataList
SplinterExchangeManager.GetSelfExchangeData = GetSelfExchangeData
SplinterExchangeManager.GetRecordDataList = GetRecordDataList
SplinterExchangeManager.GetRecordDataByUuid = GetRecordDataByUuid
SplinterExchangeManager.GetAllFragNum = GetAllFragNum
SplinterExchangeManager.GetExchangeLogRedPoint = GetExchangeLogRedPoint
SplinterExchangeManager.SetShowExchangeRedPoint = SetShowExchangeRedPoint
SplinterExchangeManager.GetFragGoodsIdList = GetFragGoodsIdList
SplinterExchangeManager.GetExchangeInfo = GetExchangeInfo
SplinterExchangeManager.GetIndexByGoodsId = GetIndexByGoodsId
SplinterExchangeManager.GetIndexStrByIndex = GetIndexStrByIndex
SplinterExchangeManager.GetIndexStrByGoodsId = GetIndexStrByGoodsId
SplinterExchangeManager.GetLogRedPointStrByType = GetLogRedPointStrByType
SplinterExchangeManager.GetSplinterTypeByLogRedPointStr = GetSplinterTypeByLogRedPointStr
return SplinterExchangeManager
