HalloweenParentScene.h
3.19 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// HalloweenParentScene.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 16.05.2017.
//
//
#ifndef HalloweenParentScene_h
#define HalloweenParentScene_h
#include "cocos2d.h"
#include "HSceneWithUtils.h"
#include "ui/CocosGUI.h"
#include "TouchHandlerTypes.h"
#include "HLayoutParser.h"
class HalloweenParentScene : public HSceneWithUtils, public HLayoutViewInterface
{
public:
// create
static HalloweenParentScene* create(std::string layoutFilePath = "");
virtual bool initWithConfigurationFiles(std::string layoutFilePath = "");
// overrides
virtual void onEnter() override;
virtual void onExit() override;
// HLayoutViewInterface
virtual void addLayer(cocos2d::Layer* layer) override;
virtual void addObject(std::string objectName, cocos2d::Node* object) override;
virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override;
// other
virtual void disableButton(std::string buttonName);
virtual void enableButton(std::string buttonName);
// virtual void disableFastForwardButton();
// virtual void enableFastForwardButton();
virtual long long getLastScreenTouchTime();
// virtual void presentEndscene();
virtual void addTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType);
virtual void removeTouchHandler(std::string touchHandlerKey, TouchHandlerType touchHandlerType);
virtual void setLoadFromAssets(bool loadFromAssets);
protected:
// configuration file paths
std::string _layoutFilePath;
bool _loadFromAssets;
// layout objects
std::vector<cocos2d::Layer*> _layers;
std::map<std::string, cocos2d::Node*> _objects;
// state vars
bool _layoutLoaded;
// touch handling
std::map<std::string, TouchHandlerFunction> _touchBeganHandlers;
std::map<std::string, TouchHandlerFunction> _touchMovedHandlers;
std::map<std::string, TouchHandlerFunction> _touchEndedHandlers;
std::map<std::string, TouchHandlerType> _touchHandlersToRemove;
bool _isHandlingTouches;
long long _lastUserTouchEndedTime;
long long _lastUserTouchMovedTime;
// methods
// virtual void adjustBgMusicButton(bool bgMusicPlaying);
virtual void reloadLayoutClean();
virtual void loadLayout(bool forceLoad);
// virtual void configureTransitionListeners();
// virtual void onGameHide(cocos2d::EventCustom* event);
// virtual void onGameShow(cocos2d::EventCustom* event);
virtual void resetLastUserTouchTimes();
virtual void configureTouchHandlers();
virtual void filterTouchHandlers();
virtual void clearTouchHandlers();
virtual std::map<std::string, TouchHandlerFunction>* pickTouchHandlersContainer(TouchHandlerType touchHandlerType);
virtual void addNewNodeToObjectLayer(cocos2d::Node* newNode);
};
#endif /* HalloweenParentScene_h */