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
/********************************************************************
*
*	Created:	8/4/2014   17:26
*
*	File:		fsIPickListEntryGui.h
*
*	Author:		Mick Waites
*	
*	Purpose:	Base for the different pick list gui entry types.
*
*********************************************************************/

#ifndef fsIPickListEntryGuihdr
#define fsIPickListEntryGuihdr

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

class fsITextSpriteComponent;


class gfIPickListEntryGui : public fsIMessageListenerGuiComponent
{
public:

	static const fsCUniqueId mAddedEntryToPickListdMsg;

	fsCEntity* const firstEntityGet() const;


	void postLoadRelink(const std::vector<fsCEntity*>& pMyEntities);
	fsBool entityNameMatchGet(const fsStr& pMatch) const;
	fsStr entityLocalisedNameGet() const;

	void uncollectedEntitiesInSubSceneAddToVec(std::vector<fsCEntity*>& pVec, fsS32 pSubSceneIndex) const;

	void deactivate();
	void activate(const std::vector<fsCEntity*>& pMyEntities, fsS32 pTotalEntitiesToCollect);
	fsBool isActiveGet() const;
	fsBool collectionCompleteGetAndReset();

protected:

	const std::vector<fsCEntity*>& myEntitiesGet() const { return mMyEntities; }

	enum
	{
		eSTATE_INACTIVE = 0,
		eSTATE_TRANSITION_ON,
		eSTATE_WAITING_FOR_COLLECTION,
		eSTATE_COLLECTED_TRANSITION_OFF,
		eSTATE_COLLECTION_COMPLETE
	};

	std::vector<fsCEntity*> entitiesGet() const;<--- Function 'entitiesGet()' should return member 'mMyEntities' by const reference.
	void stateSet(fsS32);
	fsS32 stateGet() const;
	void numberToCollectSet(fsS32 pNumToCollect);
	fsS32 numberToCollectGet() const;

	void updateDo(fsS32 pDeltaMs) override;
	void serialiseDo() override;
	void deserialiseDo() override;
	void resetDo() override;

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

	gfIPickListEntryGui(fsCEntity* pParent);
	virtual ~gfIPickListEntryGui();


private:

	virtual void uncollectedEntitiesInSubSceneAddToVecDo(std::vector<fsCEntity*>& pVec, fsS32 pSubSceneIndex) const
	{
	};

	virtual void activateDo(std::vector<fsCEntity*> pMyEntities) = 0;
	// After a load has linked the entities back up.
	virtual void relinkedDo() {}
	virtual void deactivateDo() = 0;
	virtual fsBool transitionOnUpdate(fsS32 pDeltaMs) = 0;
	virtual fsBool transitionOffUpdate(fsS32 pDeltaMs) = 0;
	virtual fsBool entityCollectedHandle() = 0;

	virtual void entitiesMakeCollectableDo(fsS32 pTotalEntitiesToCollect)
	{
	}

	void entitiesMakeCollectable(fsS32 pTotalEntitiesToCollect);

	std::vector<fsCEntity*> mMyEntities;

	fsS32 mNumToCollect;
	fsStr mEntityLocalisedName;
	// What gets saved; a found word's entry has no entities after a load, so it can't be read back from them.
	fsStr mEntitySaveName;

	fsS32 mState;
};

#endif