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
/********************************************************************
*
*	File:		gfCInGameShopGui.h
*
*	Purpose:	Marketplace for virtual items
*
*********************************************************************/

#ifndef gfCInGameShopGuihdr
#define gfCInGameShopGuihdr

#include <vector>

#include <fsCore/fsPoint.h>

#include "../gfICatalogueGui.h"

class gfICatalogueEntry;
class gfCCatalogueCatalogue;
class gfCCatalogueItem;


class gfCInGameShopGui : public gfICatalogueGui
{
	friend class fsCComponentFactory;

public:

	static const fsCUniqueId mItemPurchasedMsg;

	static const fsCUniqueId mTypeId;

	static fsBool itemPurchased(const gfCCatalogueItem* pShopItem);
	fsStr currencyStringGet(fsS32 pCurrencyAmount) const;
	fsStr postPurchaseActionGet() const;

	virtual void currencyDisplayRefresh();

protected:

	void catalogueLoadDo() override;
	void itemInfoSetDo(fsS32 pEntIndex, fsS32 pChildIndex) const override;

	fsBool onButtonClicked(fsCButtonComponent* pButtonComp) override;
	void itemSelect(const gfICatalogueEntry* pShopItem) override;
	virtual void onBackSelection();

	void initialiseFromVariableTableDo(const fsCVariableTable& pVars) override;

	static fsIComponent* const create(fsCEntity* pParent);

	gfCInGameShopGui(fsCEntity* pParent);
	virtual ~gfCInGameShopGui();<--- Destructor in derived class

private:

	fsStr mPostPurchaseAction;
	fsStr mCurrencyKey;
	fsStr mConfirmPurchaseFileName;

	static fsBool notEnoughFunds(const gfCCatalogueItem* pItem);

	static void disablePurchase(fsCEntity* pEnt, fsBool pDisable);
	static fsBool purchasedSet(fsCEntity* pEnt, fsBool pDisable);
};

#endif