aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_DLCOffers.h
blob: 412446d00ef54bea877bf7e2d646a5a9c5734aa6 (plain)
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
#pragma once

#include "../media\xuiscene_DLCOffers.h"
#include "../media\xuiscene_DLCMain.h"


#include "XUI_CustomMessages.h"
#include "XUI_Ctrl_4JList.h"
#include "XUI_Ctrl_4JIcon.h"
//#include "XUI_Ctrl_DLCPrice.h"

class CXuiCtrl4JList;
class CScene_DLCOffers;
class CXuiCtrlDLCPrice;

class CScene_DLCMain : public CXuiSceneImpl
{
	// Xui Elements
	CXuiList xList;
	CXuiCtrl4JList *list;
	CXuiControl m_Timer;

	// Misc
	int iPad, iOfferC;

	XUI_BEGIN_MSG_MAP()
		XUI_ON_XM_INIT( OnInit )
		XUI_ON_XM_DESTROY(OnDestroy)
		XUI_ON_XM_KEYDOWN( OnKeyDown )
		XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
		XUI_ON_XM_NAV_RETURN(OnNavReturn)
		XUI_ON_XM_TIMER( OnTimer )
	XUI_END_MSG_MAP()

	BEGIN_CONTROL_MAP()
		MAP_CONTROL(IDC_XuiOffersList, xList)
		MAP_CONTROL(IDC_Timer, m_Timer)	
	END_CONTROL_MAP()

	HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
	HRESULT OnDestroy();
	HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
	HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
	HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
	HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );

public:
	XUI_IMPLEMENT_CLASS( CScene_DLCMain, L"CScene_DLCMain", XUI_CLASS_SCENE )

private:
	bool m_bAllDLCContentRetrieved;
	bool m_bIgnoreInput;
};

class CScene_DLCOffers : public CXuiSceneImpl
{
protected:
	//static const wstring DEFAULT_BANNER;

	// Control and Element wrapper objects.
	CXuiList	m_List;
	CXuiCtrl4JList *m_pOffersList;
	CXuiImageElement m_Banner;
	CXuiCtrl4JIcon m_TMSImage;
	CXuiHtmlControl m_SellText;
	CXuiControl m_PriceTag;
	CXuiControl m_Timer;
	HXUIBRUSH m_hXuiBrush;

	// Message map. Here we tie messages to message handlers.
	XUI_BEGIN_MSG_MAP()
		XUI_ON_XM_INIT( OnInit )
		XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
		XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
		XUI_ON_XM_KEYDOWN(OnKeyDown)
		XUI_ON_XM_DESTROY(OnDestroy)
		XUI_ON_XM_NAV_RETURN(OnNavReturn)
		XUI_ON_XM_TIMER( OnTimer )
		XUI_ON_XM_DLCINSTALLED_MESSAGE(OnCustomMessage_DLCInstalled)
		XUI_ON_XM_GET_SOURCE_IMAGE( OnGetSourceDataImage )
	XUI_END_MSG_MAP()

	// Control mapping to objects
	BEGIN_CONTROL_MAP()
		MAP_CONTROL(IDC_XuiOffersList, m_List)
		MAP_CONTROL(IDC_XuiHTMLSellText, m_SellText)
		MAP_CONTROL(IDC_XuiDLCPriceTag, m_PriceTag)
		MAP_CONTROL(IDC_XuiDLCBanner, m_TMSImage)
		MAP_CONTROL(IDC_Timer, m_Timer)
	END_CONTROL_MAP()

	HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
	HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
	HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
	HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
	HRESULT OnDestroy();
	HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
	HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
	HRESULT OnCustomMessage_DLCInstalled();
	HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);

	HRESULT GetDLCInfo(  int iOfferC, bool bUpdateOnly=false );

	//static int EthernetDisconnectReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
	static int TMSReadCallback(void *pParam,int iPad,bool bResult);

	//void UpdateTooltips(XMARKETPLACE_CONTENTOFFER_INFO& xOffer);
	void UpdateTooltips(XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO& xOffer);
public:

	// Define the class. The class name must match the ClassOverride property
	// set for the scene in the UI Authoring tool.
	XUI_IMPLEMENT_CLASS( CScene_DLCOffers, L"CScene_DLCOffers", XUI_CLASS_SCENE )

	typedef struct _DLCOffer
	{
		int iOfferC;
	} 
	DLCOffer;

private:
	
	//vector<int> offerIndexes;
	CScene_DLCMain *pMain;
	bool m_bIgnorePress;
	int m_iPad;
	int m_iOfferC;
	int m_iType;
	bool m_bIsSD;
	bool m_bAllDLCContentRetrieved;
	bool m_bDLCRequiredIsRetrieved;
	bool m_bIsFemale; // to only show the correct gender type offers for avatars
	DLC_INFO *m_pNoImageFor_DLC;
	bool bNoDLCToDisplay; // to display a default "No DLC available at this time"

};