Blame view

ios/Runner/Wowgame/Classes/game_toy/ToyLevelPickerView.h 1.28 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
  //
  //  ToyLevelPickerView.h
  //  HalloweenSpaceInvaders
  //
  //  Created by Katarzyna Kalinowska-Górska on 29/09/2019.
  //
  
  #ifndef ToyLevelPickerView_h
  #define ToyLevelPickerView_h
  
  #include "cocos2d.h"
  #include "ToyLevelView.h"
  #include <vector>
  #include <string>
  #include "ToyLayoutObject.h"
  
  class ToyLevelPickerView : public cocos2d::Node, public ToyLayoutObject {
    
  public:
      static ToyLevelPickerView* create(const std::vector<std::string>& levelImagePaths, const std::vector<std::string>& levelNames);
      void selectLevelIndex(int index, bool animated = true);
      int getPickedLevelIndex();
      void addOnLevelChangedCallback(std::function<void(int)> onLevelChanged);
      void reloadLevels(const std::vector<std::string>& levelImagePaths, const std::vector<std::string>& levelNames);
      
      virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, ToyLayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override;
      
  protected:
      int _selectedLevelIndex;
      std::vector<ToyLevelView*> levelViews;
      std::function<void(int)> _onLevelChanged;
      bool init(const std::vector<std::string>& levelImagePaths, const std::vector<std::string>& levelNames);
      void prepareTouchHandlers();
  };
  
  #endif /* ToyLevelPickerView_h */