StartUpCommand.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. local StartUpCommand = class('StartUpCommand', framework.SimpleCommand)
  2. function StartUpCommand:ctor()
  3. end
  4. function StartUpCommand:execute(note)
  5. -- remove self command
  6. local facade = global.Facade
  7. local noticeTable = global.NoticeTable
  8. facade:removeCommand(noticeTable.StartUp)
  9. -- init some command
  10. local gameResumedCommand = requireCommand("gamestates/GameResumedCommand")
  11. local gameSuspendCommand = requireCommand("gamestates/GameSuspendCommand")
  12. facade:registerCommand(noticeTable.GameResumed, gameResumedCommand)
  13. facade:registerCommand(noticeTable.GameSuspend, gameSuspendCommand)
  14. self:GameInit()
  15. end
  16. function StartUpCommand:GameInit()
  17. -- init game fsm
  18. local GameStateController = requireMediator("gamestates/GameStateController")
  19. local gameFSMController = GameStateController.new()
  20. global.Facade:registerMediator(gameFSMController)
  21. global.GameStateController = gameFSMController
  22. -- goto active
  23. global.Facade:sendNotification(global.NoticeTable.ChangeGameState, global.MMO.GAME_STATE_ACTIVE)
  24. end
  25. return StartUpCommand