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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/********************************************************************
*
*	File:		gfCLevelSequencerMapComponent.h
*
*	Purpose:	Map to navigate to any level
*
*********************************************************************/

#ifndef gfCLevelSequencerMapComponenthdr
#define gfCLevelSequencerMapComponenthdr

#include <fsAppCore/src/components/gui/fsIMessageListenerGuiComponent.h>
#include <fsAppCore/src/components/gui/elements/fsCRollOverButtonComponent.h>

#include "../gfCLevelSequencerComponent.h"

class gfCTutorialSequencerComponent;


class gfCLevelSequencerMapComponent : public fsIMessageListenerGuiComponent, public gfCLevelSequencerComponent
{
	friend class fsCComponentFactory;
	friend class gfIAutoTestLevelUserInputComponent;

public:

	static const fsCUniqueId mTypeId;

	static fsStr const levelListNameGet();
	static fsStr const endLevelNameGet();
	static fsStr const demoEndNameGet();
	static fsBool lastLevel(fsStr pLevel);
	static fsStr pureLevelNameGet(fsStr const& pLevelName);

	void levelRollOverSet(fsCEntity* pEnt);

	virtual ~gfCLevelSequencerMapComponent();<--- Destructor in derived class

protected:

	void listenersRegisterDo() override;
	void listenersDeregisterDo() override;
	fsBool messageProcessDo(const fsCUniqueId& pMessageType,
	                        const fsIMessageDispatcher::sMessageParameters& pParam) override;

	void deserialiseDo() override;

	void updateDo(fsS32 pDeltaMs) override;
	void renderDo() override;

	gfCLevelSequencerLevelComponent* const levelSequencerLevelCreate(const fsStr& pPath, const fsStr& pName) override;

	static fsIComponent* create(fsCEntity* pParent);
	gfCLevelSequencerMapComponent(fsCEntity* pParent);

	void initialiseFromVariableTableDo(const fsCVariableTable& pVars) override;

private:

	struct fsCLevelSequenceMapButtonAction : public fsCRollOverButtonComponent::fsCRollOverAction
	{
		fsCLevelSequenceMapButtonAction(gfCLevelSequencerMapComponent* pParent, const fsPoint& pDrag) :
			mScale(1, 1),
			mDrag(pDrag),
			mParent(pParent)
		{
		}

		void update() override;
		void start(const fsPoint& pMousePos) override;
		void end(const fsPoint& pMousePos) override;
		void mouseDown(const fsPoint& pMousePos) override;
		void mouseUp(const fsPoint& pMousePos) override;

		fsPoint mScale;
		fsPoint mDrag;
		fsPoint mDragPos;
		gfCLevelSequencerMapComponent* mParent;
	};

	void init();

	static fsBool legacyMapLevelCheck();

	void clearMarkers();
	gfCTutorialSequencerComponent* const tutorialComponentGet() const;

	void typedCharacterHandle(fsS32 pTypedChar);
	fsStr targetLevelGet();

	fsBool scrollButtonsActive() const;

	void deferredTutorialsActivate();
	void scrollTutorialActivate();
	void fastScrollTutorialActivate();

	fsBool hitTest(fsCEntity* pParent, const fsPoint& pPos) const;

	void buttonsReInit();

	fsS32 scrollZoneWidth();

	void layoutParametersInitialise(const fsCVariableTable& pVars);

	void subSceneEntityCreate();
	void currentLeveleSet();
	void currentLeveleLocate();
	void currentLevelProgressShow();

	void levelsTrimToVisited();
	void levelsFilterMiniGamesOut();
	void levelIconsPageVisibletySet();
	void levelIconsCreate();
	void rollOverLevelEntityCreate();

	fsBool mapLevelIcon(const fsStr& pLevelName) const;

	static const fsStr mProgressLayerPrefix;
	static const fsStr mPositionLayerPrefix;

	fsPoint mFirstLevelIconPos;
	fsPoint mLevelIconPosIncrement;
	fsS32 mCurrLevelIcon;

	fsStr mLevelIconLayoutFileName;

	fsCEntity* mSubSceneEnt;

	fsS32 mElapsedTime;
	fsS32 mMaxLevels;

	fsCEntity* mRollOverLevelEntity;

	std::vector<fsStr> mRawSequence;
};

#endif