aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_EULA.cpp
blob: 41195621244bdbe54d15a9cd45aa6a0326ae522e (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
137
138
139
140
141
142
143
144
145
#include "stdafx.h"
#include "UI.h"
#include "UIScene_EULA.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"

UIScene_EULA::UIScene_EULA(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
	// Setup all the Iggy references we need for this scene
	initialiseMovie();

	parentLayer->addComponent(iPad,eUIComponent_Panorama);
	parentLayer->addComponent(iPad,eUIComponent_Logo);

	m_buttonConfirm.init(app.GetString(IDS_TOOLTIPS_ACCEPT),eControl_Confirm);

#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
	wstring EULA = app.GetString(IDS_EULA);
	EULA.append(L"\r\n");

#if defined(__PS3__)
	if(app.IsEuropeanSKU())
	{
		EULA.append(app.GetString(IDS_EULA_SCEE));
		// if it's the BD build
		if(StorageManager.GetBootTypeDisc())
		{
			EULA.append(app.GetString(IDS_EULA_SCEE_BD));
		}
	}
	else if(app.IsAmericanSKU())
	{
		EULA.append(app.GetString(IDS_EULA_SCEA));
	}
#elif defined __ORBIS__
	if(app.IsEuropeanSKU())
	{
		EULA.append(app.GetString(IDS_EULA_SCEE));
		// 4J-PB - we can't tell if it's a disc or digital version, so let's show this anyway
		EULA.append(app.GetString(IDS_EULA_SCEE_BD));		
	}
	else if(app.IsAmericanSKU())
	{
		EULA.append(app.GetString(IDS_EULA_SCEA));
	}
#endif
#else
	wstring EULA = L"";
#endif

	vector<wstring> paragraphs;
	size_t lastIndex = 0;
	for (	size_t index = EULA.find(L"\r\n", lastIndex, 2);
			index != wstring::npos; 
			index = EULA.find(L"\r\n", lastIndex, 2)
		)
	{
		paragraphs.push_back( EULA.substr(lastIndex, index-lastIndex) + L" " );
		lastIndex = index + 2;
	}
	paragraphs.push_back( EULA.substr( lastIndex, EULA.length() - lastIndex ) );

	for(unsigned int i = 0; i < paragraphs.size(); ++i)
	{
		m_labelDescription.addText(paragraphs[i],i == (paragraphs.size() - 1) );
	}

	// 4J-PB - If we have a signed in user connected, let's get the DLC now
	for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
	{
		if( (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ) 
		{
			if(!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) 
			{
				app.StartInstallDLCProcess(i);
				break;
			}
		}
	}

	m_bIgnoreInput=false;

	//ui.setFontCachingCalculationBuffer(20000);

#ifdef __PSVITA__
	ui.TouchBoxRebuild(this);
#endif
}

UIScene_EULA::~UIScene_EULA()
{
	m_parentLayer->removeComponent(eUIComponent_Panorama);
	m_parentLayer->removeComponent(eUIComponent_Logo);
}

wstring UIScene_EULA::getMoviePath()
{
	return L"EULA";
}

void UIScene_EULA::updateTooltips()
{
	ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT );
}

void UIScene_EULA::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
	if(m_bIgnoreInput) return;

#ifdef __ORBIS__
	// ignore all players except player 0 - it's their profile that is currently being used
	if(iPad!=0) return;
#endif
	
	ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);

	switch(key)
	{
#ifdef __ORBIS__
	case ACTION_MENU_TOUCHPAD_PRESS:
#endif
	case ACTION_MENU_OK:
	case ACTION_MENU_DOWN:
	case ACTION_MENU_UP:
	case ACTION_MENU_PAGEUP:
	case ACTION_MENU_PAGEDOWN:
	case ACTION_MENU_OTHER_STICK_DOWN:
	case ACTION_MENU_OTHER_STICK_UP:
		sendInputToMovie(key, repeat, pressed, released);
		break;
	}
}

void UIScene_EULA::handlePress(F64 controlId, F64 childId)
{
	switch(static_cast<int>(controlId))
	{
	case eControl_Confirm:
		//CD - Added for audio
		ui.PlayUISFX(eSFX_Press);
		app.SetGameSettings(0,eGameSetting_PS3_EULA_Read,1);
		ui.NavigateToScene(0,eUIScene_SaveMessage);
		ui.setFontCachingCalculationBuffer(-1);
		break;
	};
}