Blame view

ios/Runner/Wowgame/Classes/game_animal/AniEndScene.h 1.5 KB
5daad4bc   xiaoyu   游戏源码添加编译(现存问题:游戏内...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  //
  //  AniEndScene.h
  //  SteveMaggieCpp
  //
  //  Created by Katarzyna Kalinowska-Górska on 16.05.2017.
  //
  //
  
  #ifndef AniEndScene_h
  #define AniEndScene_h
  
  #include  "AniAlertUtils.h"
  #include "AniParentScene.h"
  #include "AniGameStaticCreator.h"
  
  class AniEndScene : public AniParentScene
  {
      public:
      
          // create
          static AniEndScene* create(std::string layoutFilePath, int score);
      bool init(std::string layoutFilePath, int score);
      
      virtual void onEnter() override;
      virtual void onEnterTransitionDidFinish() override;
      
  protected:
      int m_score;
      AniGameStaticCreator AniGameStaticCreator;
      
      virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override;
  //    virtual void hideSettingsMenuWithLevelReset() override;
      void replayGame();
  
  #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
  
      cocos2d::EventListenerKeyboard* _keyboardListener;
  
      void addBackButtonListener(){
          _keyboardListener = cocos2d::EventListenerKeyboard::create();
          _keyboardListener->onKeyReleased = [&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event){
              if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK){
                      AniAlertUtils::showAppCloseConfirmDialog([&](){
                      });
                  }
          };
          cocos2d::Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(_keyboardListener, this);
      }
  #endif
  };
  
  #endif /* AniEndScene_h */