ActorReviveCommand.lua 795 B

123456789101112131415161718192021
  1. local ActorReviveCommand = class('ActorReviveCommand', framework.SimpleCommand)
  2. local optionsUtils = requireProxy("optionsUtils")
  3. function ActorReviveCommand:ctor()
  4. end
  5. function ActorReviveCommand:execute(notification)
  6. local data = notification:getBody()
  7. local actor = data.actor
  8. if not actor then
  9. return false
  10. end
  11. local HeroPropertyProxy = global.Facade:retrieveProxy(global.ProxyTable.HeroPropertyProxy)
  12. if HeroPropertyProxy:IsHeroOpen() and HeroPropertyProxy:HeroIsLogin() and HeroPropertyProxy:getAlive() == false and data.actorID == HeroPropertyProxy:GetRoleUID() then
  13. HeroPropertyProxy:setAlive(true)
  14. end
  15. global.Facade:sendNotification(global.NoticeTable.RefreshActorSceneOptions, actor)
  16. end
  17. return ActorReviveCommand