local CityDomeProtectEffect = BaseClass("CityDomeProtectEffect")
local OnCreate = function(self, go)
  if go ~= nil then
    self.request = go
    self.gameObject = go.gameObject
    self.transform = go.gameObject.transform
  end
  self:ComponentDefine()
  self:DataDefine()
end
local OnDestroy = function(self)
  self:ComponentDestroy()
  self:DataDestroy()
end
local ComponentDefine = function(self)
end
local ComponentDestroy = function(self)
  self.gameObject = nil
  self.transform = nil
end
local DataDefine = function(self)
  self.isUpdate = false
  self.param = nil
  self.curPosition = nil
end
local DataDestroy = function(self)
  self.param = nil
  self.curPosition = nil
  self.timer_action = nil
  self:DeleteTimer()
end
local DeleteTimer = function(self)
  self.isUpdate = false
  if self.timer ~= nil then
    self.timer:Stop()
    self.timer = nil
  end
end
local AddTimer = function(self)
  self.isUpdate = true
  if self.timer == nil then
    self.timer = TimerManager:GetInstance():GetTimer(1, self.timer_action, self, false, false, false)
  end
  self.timer:Start()
end
local CheckIsFinish = function(self)
  if self.isUpdate == true and self.param ~= nil then
    local curTime = UITimeManager:GetInstance():GetServerSeconds()
    if curTime > self.param.endTime then
      self.isUpdate = false
      CityMovingEffectManager:GetInstance():RemoveCityDomeHideEffect(self.param.bUuid)
    end
  end
end
local ReInit = function(self, param)
  self.timer = nil
  
  function self.timer_action(temp)
    self:CheckIsFinish()
  end
  
  self:AddTimer()
  self.param = param
  self:ShowPanel()
end
local ShowPanel = function(self)
  local serverId = self.param.serverId or LuaEntry.Player:GetCurServerId()
  self.gameObject.transform.position = SceneUtils.TileIndexToWorld(self.param.posIndex, ForceChangeScene.World, serverId)
end
CityDomeProtectEffect.OnCreate = OnCreate
CityDomeProtectEffect.OnDestroy = OnDestroy
CityDomeProtectEffect.ComponentDefine = ComponentDefine
CityDomeProtectEffect.ComponentDestroy = ComponentDestroy
CityDomeProtectEffect.DataDefine = DataDefine
CityDomeProtectEffect.DataDestroy = DataDestroy
CityDomeProtectEffect.ReInit = ReInit
CityDomeProtectEffect.ShowPanel = ShowPanel
CityDomeProtectEffect.CheckIsFinish = CheckIsFinish
CityDomeProtectEffect.AddTimer = AddTimer
CityDomeProtectEffect.DeleteTimer = DeleteTimer
return CityDomeProtectEffect
