local BFOrderMark = BaseClass("BFOrderMark")

function BFOrderMark:OnCreate(gameObject, orderData)
  self.gameObject = gameObject
  local arrow = gameObject.transform:Find("mark/Arrow")
  if arrow ~= nil then
    arrow.gameObject:SetActive(false)
  end
  self.uuid = orderData.uuid
  local cTime = UITimeManager:GetInstance():GetServerTime()
  local endTime = orderData:GetEndTime()
  local delay = (endTime - cTime) / 1000
  self.timer = TimerManager:GetInstance():GetTimer(delay, self.TimerCallback, self, false, false, false)
  self.timer:Start()
end

function BFOrderMark:Destroy()
  self:DelTimer()
  if IsNotNull(self.gameObject) then
    self.gameObject:SetActive(false)
  end
  self.gameObject = nil
end

function BFOrderMark:DelTimer()
  if self.timer ~= nil then
    self.timer:Stop()
    self.timer = nil
  end
end

function BFOrderMark:TimerCallback()
  self:DelTimer()
  DataCenter.ActEpidemicZoneManager:RemoveOrderData(self.uuid)
end

return BFOrderMark
