local this = class("modulePhotoGroup_petAction", require("ui.pages.photo.group.modulePhotoGroup_action"))

function this:initDefaultId()
  self.defaultId = L_Const.photoParam.petDefAction
end

function this:getTargetEntity()
end

function this:setActionId(id)
  self.actionId = id
end

function this:onEvent_selectPhotoHeroChange()
end

function this:open()
  self:initDefaultId()
  self:updateTargetEntity()
  self:initGroupList(L_Const.photoGroup.petAction)
  self.speedIdx = 2
end

function this:animEvaluate(value)
  local state = self.animator:getState(self.animName)
  local dt = (value - math.min(state.normalizedTime, 1)) * self.animLen
  self:setEntitySpeed(1, false)
  self.animator:Evaluate(dt)
end

function this:updateTargetEntity(target)
  this.super.updateTargetEntity(self, target)
  if self.parent.curSelectEntityInfo then
    self.actionId = self.parent.curSelectEntityInfo.actionId
    self.bind.selectedId = self.actionId
  end
end

function this:setActionId(id)
  self.actionId = id
  local tpl = self.paramTpl:getTplById(self.actionId)
  self.animName = self.paramTpl:getParam(tpl)
  if self.parent.curSelectEntityInfo then
    self.parent.curSelectEntityInfo.actionId = id
  end
  self.speedIdx = 2
  self.bind.goSlider = self.actionId ~= self.defaultId
  self.bind.active_collect = false
end

function this:playAction(actionId)
  self.target.animator.lockState = true
  self.super.playAction(self, actionId)
end

return this
