aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_Intro.cpp
blob: 997abe5d52d0d5e44cde381168bec860887e4ebe (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
146
147
148
149
150
151
152
153
// Minecraft.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

#include <assert.h>
#include "..\XUI\XUI_Intro.h"

#define TIMELINE_NORMAL		0
#define TIMELINE_ESRBFADE	1
#define TIMELINE_LOGOSFADE	2

//----------------------------------------------------------------------------------
// Performs initialization tasks - retrieves controls.
//----------------------------------------------------------------------------------
HRESULT CScene_Intro::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
	MapChildControls();

	// We may need to display a ratings image for a while at the start...
	m_bWantsToSkip=false;
	m_iTimeline=TIMELINE_NORMAL;

	// 4J-PB - We can't check to see if the version is a trial or full game until after 5 seconds...
	// The reason that this is a requirement is that there is a problem that occasionally happens *only* in the production 
	// environment (not partnernet or cert), where if you don�t wait 5 seconds, you can run into an issue where the timing 
	// of the call fails and the game is always identified as being the trial version even if you have upgraded to the full version.
	// -Joe Dunavant

	// start a timer for the required 5 seconds, plus an extra bit to allow the lib timer to enable the xcontent license check call
#ifdef _CONTENT_PACKAGE
	m_bSkippable=false;
	XuiSetTimer( m_hObj,0,5200);
#else
	m_bSkippable=true;
#endif
	
	return S_OK;
}

//----------------------------------------------------------------------------------
// Handler for the button press message.
//----------------------------------------------------------------------------------
HRESULT CScene_Intro::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
{
	// This assumes all buttons can only be pressed with the A button
	ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);


	return S_OK;
}

HRESULT CScene_Intro::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
{
	ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);

	static bool bPressed=false;

	if(bPressed==false)
	{
		if(m_bSkippable)
		{
			// stop the animation
			XuiElementStopTimeline(m_hObj,TRUE);
			app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
			app.SetIntroRunning(false);		
		}
		else
		{
			m_bWantsToSkip=true;
		}
		
		bPressed=true;
	}

	return S_OK;
}

HRESULT CScene_Intro::OnTimelineEnd(HXUIOBJ hObjSource, BOOL& bHandled)
{
	int nStart, nEnd;

	if(m_bSkippable && m_bWantsToSkip)
	{
		// straight to the game
		app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
		app.SetIntroRunning(false);
	}
	else
	{
		switch(m_iTimeline)
		{
		case TIMELINE_NORMAL:
			{	
				// 4J-PB - lots of discussions over this because Brazil is in the NA region. This is what I have been advised to do...
				//if(ProfileManager.RegionIsNorthAmerica())
				if(ProfileManager.LocaleIsUSorCanada())
				{
					m_iTimeline=TIMELINE_ESRBFADE;
					XuiElementFindNamedFrame( m_hObj, L"ESRBFade", &nStart );
					XuiElementFindNamedFrame( m_hObj, L"ESRBFadeEnd", &nEnd );
					XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE ); 
				}
				else
				{
					m_iTimeline=TIMELINE_LOGOSFADE;
					XuiElementFindNamedFrame( m_hObj, L"StartFade", &nStart );
					XuiElementFindNamedFrame( m_hObj, L"EndFade", &nEnd );
					XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE ); 
				}			
			}
			break;

		case TIMELINE_ESRBFADE:
			if(m_bWantsToSkip && m_bSkippable)
			{
				app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
				app.SetIntroRunning(false);	
			}
			else
			{			
				m_iTimeline=TIMELINE_LOGOSFADE;				
				XuiElementFindNamedFrame( m_hObj, L"StartFade", &nStart );
				XuiElementFindNamedFrame( m_hObj, L"EndFade", &nEnd );
				XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE ); 
			}
			break;
		case TIMELINE_LOGOSFADE:
			app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
			app.SetIntroRunning(false);		
			break;
		}
	}

	return S_OK;
}


HRESULT CScene_Intro::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
{
	HRESULT hr=XuiKillTimer(m_hObj,0);
	m_bSkippable=true;

	if(m_bWantsToSkip)
	{
		// stop the animation
		XuiElementStopTimeline(m_hObj,TRUE);
		app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
		app.SetIntroRunning(false);		
	}

	return hr;
}