HeroTakeOffEquipCommand.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. local HeroTakeOffEquipCommand = class('HeroTakeOffEquipCommand', framework.SimpleCommand)
  2. function HeroTakeOffEquipCommand:ctor()
  3. end
  4. function HeroTakeOffEquipCommand:execute(notification) ---脱装备
  5. local HeroEquipProxy = global.Facade:retrieveProxy(global.ProxyTable.HeroEquipProxy)
  6. local data = notification:getBody()
  7. local HeroBagProxy = global.Facade:retrieveProxy(global.ProxyTable.HeroBagProxy)
  8. -- if HeroBagProxy:GetBagCollimator() then --有准星操作
  9. -- return
  10. -- end
  11. -- is bag full?
  12. if HeroBagProxy:isToBeFull() then
  13. global.Facade:sendNotification(global.NoticeTable.SystemTips, GET_STRING(800050))
  14. local data = {
  15. MakeIndex = data.MakeIndex,
  16. state = 1
  17. }
  18. global.Facade:sendNotification(global.NoticeTable.Layer_Player_Equip_State_Change_Hero, data)
  19. SLBridge:onLUAEvent(LUA_EVENT_HERO_EQUIP_STATE_CHANGE, data)
  20. return false
  21. end
  22. local name = data.Name
  23. local pos = data.Where
  24. local MakeIndex = data.MakeIndex
  25. local AutoUseItemProxy = global.Facade:retrieveProxy(global.ProxyTable.AutoUseItemProxy)
  26. AutoUseItemProxy:AddEquipOffMakeIndex(MakeIndex)
  27. LuaSendMsg(global.MsgType.MSG_CS_PLAYER_EQUIP_OFF_REQUEST_HERO, MakeIndex, pos, 0, 0, name, string.len(name))
  28. end
  29. return HeroTakeOffEquipCommand