local this = class("flyMsgManager", G_EventManagerBase)
this.event = {
  flyMsgPopup = "flyMsgPopup",
  flyMsgPopupEnd = "flyMsgPopupEnd"
}
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_achievement"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_activity"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_normalMsg"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_rewardMsg"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_touch"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_favorability"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_areaMsg"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_homeContentUnlock"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_mountRidingUnlock"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_homeScienceExp"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_longPress"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_battle"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_task"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_multiDungeonInvite"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_petEatFinishMsg"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_exploreLvUp"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_exploreComplete"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_getPet"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_petCatalog"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_petGeneMutation"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_petDuelResult"))
table.merge(this, require("ui.manager.flyMsg.flyMsgManager_petFavorable"))

function this:ctor()
  this.super.ctor(self)
  self.root = nil
  self.canvas = nil
  self.pool = nil
end

function this:getNextUniqueId()
  return L_PriorityShowQueueManager:getUniqueId()
end

function this:initialize()
  local go = L_ResPool:syncGameObject("Program/FlyMsg/pre_flyMsgNode.prefab", L_UI:getRoot())
  go.name = "[FlyMsgNode]"
  self.root = go.transform
  local typeRect = typeof(C_RectTransform)
  self.despawnRoot = self.root:Find("despawnRoot"):GetComponent(typeRect)
  self.normalRoot = self.root:Find("normalRoot"):GetComponent(typeRect)
  self.rewardRoot = self.root:Find("rewardRoot"):GetComponent(typeRect)
  self.petEatFinishRoot = self.root:Find("petEatFinishRoot"):GetComponent(typeRect)
  self.touchRoot = self.root:Find("touchRoot"):GetComponent(typeRect)
  self.favorabilityRoot = self.root:Find("favorabilityRoot"):GetComponent(typeRect)
  self.favorabilityMoveRoot = self.root:Find("favorabilityMoveRoot"):GetComponent(typeRect)
  self.longPressRoot = self.root:Find("longPressRoot"):GetComponent(typeRect)
  self.leftRoot = self.root:Find("LeftRoot"):GetComponent(typeRect)
  self.multiDungeonInviteRoot = self.root:Find("multiDungeonInvite"):GetComponent(typeRect)
  self.petDuelResultRoot = self.root:Find("petDuelResultRoot"):GetComponent(typeRect)
  self.canvas = self.root:GetComponent(typeof(Unity.Canvas))
  self.canvas.sortingOrder = 20000
  self.pool = L_PoolManager:getSpawnPool(self.despawnRoot, 50)
  self:initTouch()
  self:initNormalMsg()
  self:initRewardMsg()
  self:initPetEatFinishMsg()
  self:initAchievement()
  self:initActivity()
  self:initFavorabilityMsg()
  self:initAreaMsg()
  self:initHomeContentUnlock()
  self:initMountRidingUnlock()
  self:initHomeScienceExpTip()
  self:initLongPress()
  self:initBattleFlyEffect()
  self:initMultiDungeonInvite()
  self:initMapExploreComplete()
  self:initMapExploreLvUp()
  self:initPetDuelResultMsg()
  self:initPetFavorableTip()
end

function this:dispose()
  if not self.root then
    return
  end
  self:disposeTouch()
  self:disposeNormalMsg()
  self:disposeRewardMsg()
  self:disposePetEatFinishMsg()
  self:disposeAchievement()
  self:disposeActivity()
  self:disposeFavorabilityMsg()
  self:disposeAreaMsg()
  self:disposeHomeContentUnlock()
  self:disposeMountRidingUnlock()
  self:disposeHomeScienceExpTip()
  self:disposeLongPress()
  self:disposeBattleFlyEffect()
  self:disposeTaskTip()
  self:disposeMultiDungeonInvite()
  self:disposeMapExploreLvUp()
  self:disposeMapExploreComplete()
  self:disposeGetPetTip()
  self:disposePetCatalogTip()
  self:disposePetGeneMutationTip()
  self:disposePetDuelResultMsg()
  self:disposeHomePetFavorableTip()
  self.pool:dispose()
  if L_CommonUtil.isValid(self.root.gameObject) then
    C_GameObject.Destroy(self.root.gameObject)
  end
  self.root = nil
  self.despawnRoot = nil
  self.normalRoot = nil
  self.rewardRoot = nil
  self.petEatFinishRoot = nil
  self.touchRoot = nil
  self.favorabilityRoot = nil
  self.favorabilityMoveRoot = nil
  self.longPressRoot = nil
  self.canvas = nil
  self.multiDungeonInviteRoot = nil
  self.petDuelResultRoot = nil
end

function this:formatImageStr(icon, name)
  local describe
  if string.isEmpty(icon) then
    describe = name
  else
    describe = string.format("<p=%s w=40 h=40/>%s", icon, name)
  end
  return describe
end

return this
