local this = L_BevTree:registClass("guide.showGuideTips", L_BevTree.action)

function this:param()
  self.tipsKey = ""
  self.showKeys = ""
  self.specialIcons = ""
end

function this:parse()
  self.tipsKey = self:getParam("tipsKey")
  self.showKeys = self:getParam("showKeys")
  self.specialIcons = self:getParam("specialIcons")
end

function this:onEnter()
  local tips = L_WordsTpl:getValue(self.tipsKey)
  self.showTipData = {
    showTips = tips,
    showKeys = string.split(self.showKeys, "|"),
    specialIcons = string.split(self.specialIcons, "|")
  }
  local status = L_UI:getPageStatus("pageGuideTipsPanel")
  if not status or status == L_UI.pageEvent.closed then
    L_UI:open("pageGuideTipsPanel", self.showTipData)
  end
  self.result = L_BevTree.taskResult.Running
end

function this:execute()
  if self.result == L_BevTree.taskResult.Running and L_UI:checkPageOpen("pageGuideTipsPanel") then
    return L_BevTree.taskResult.Success
  end
  return L_BevTree.taskResult.Running
end

function this:onReset()
  if self.lastResult == L_BevTree.taskResult.Success and L_UI:checkPageOpen("pageGuideTipsPanel") then
    L_UI:close("pageGuideTipsPanel")
  end
end

return this
