local this = {}
local _PrePetGeneMutationPath = "Program/FlyMsg/pre_petGeneMutation.prefab"
local _PetGeneMutationModulePath = "ui.manager.flyMsg.modulePetGeneMutation"

function this:showPetGeneMutationTip(info, callBack)
  local priorityShowData = require("ui.manager.priorityShowQueue.flyMsgPriorityShowData").new({
    flyMsgType = L_ShowQueueConst.flyMsgType.petGeneMutation,
    uuid = self:getNextUniqueId(),
    params = {
      {data = info, callBack = callBack}
    }
  })
  L_PriorityShowQueueManager:addPriorityShowData(priorityShowData)
end

function this:rawShowPetGeneMutationTip(uuid, popup)
  popup._uuid = uuid
  self:doShowPetGeneMutationTip(popup)
end

function this:doShowPetGeneMutationTip(popup)
  if not popup then
    return
  end
  if not self.petGeneMutationTipModule then
    self.goHandle = C_LuaUtility.InstantiateSync(_PrePetGeneMutationPath, self.root)
    self.petGeneMutationTipModule = require(_PetGeneMutationModulePath).new(G_UIModuleBase.ModuleType.Static)
    self.petGeneMutationTipModule:created()
    local go = self.goHandle.gameObject
    local trans = go.transform
    L_Vector3.setAnchored(trans, {x = 0, y = 0})
    self.petGeneMutationTipModule:toBind(go:GetComponent(typeof(C_UIBinding)))
    self.petGeneMutationTipModule:setCloseCB(handler(self, self.onPetGeneMutationClose))
  end
  self.petGeneMutationTipModule:initModule(popup)
end

function this:onPetGeneMutationClose(popup)
  if popup.callBack then
    popup.callBack()
  end
  self:sendEvent(self.event.flyMsgPopupEnd, L_ShowQueueConst.flyMsgType.petGeneMutation, popup._uuid)
end

function this:disposePetGeneMutationTip()
  if self.petGeneMutationTipModule then
    self.petGeneMutationTipModule:unBind()
    self.petGeneMutationTipModule = nil
  end
  if self.goHandle then
    C_LuaUtility.DestroyObject(self.goHandle)
  end
end

return this
