local WorldNewsTip = BaseClass("WorldNewsTip")
local UIEventTrigger = CS.UIEventTrigger
local collider_path = "Img/Collider"
local OnCreate = function(self, request)
  self.request = request
  self.gameObject = request.gameObject
  self.transform = request.gameObject.transform
  self.collider = self.transform:Find(collider_path):GetComponent(typeof(UIEventTrigger))
  
  function self.collider.onPointerClick()
    self:OnClick()
  end
end
local OnDestroy = function(self)
  self.request = nil
  self.data = nil
  if self.collider ~= nil and IsNull(self.collider) == false then
    self.collider.onPointerClick = nil
  end
  self.collider = nil
end
local OnClick = function(self)
  CS.SceneManager.World:SetUseInput(false)
  GoToUtil.GotoOpenView(UIWindowNames.UIWorldNewsTips, {anim = true}, self.data.id)
end
local SetData = function(self, data)
  self.data = data
  local pos = SceneUtils.TileIndexToWorld(self.data.id)
  self:SetPos(pos)
end
local SetPos = function(self, pos)
  local t = pos
  self.transform:Set_position(t.x, t.y, t.z)
end
WorldNewsTip.OnCreate = OnCreate
WorldNewsTip.OnDestroy = OnDestroy
WorldNewsTip.OnClick = OnClick
WorldNewsTip.SetData = SetData
WorldNewsTip.SetPos = SetPos
return WorldNewsTip
