File size: 1,477 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

// Binded values from engine
enum EDLCId
{
	DLC_UNKNOWN,
	DLC_BLISS,
};

//! ContentDLC is for query installed DLC (only as entitlement keys, not content)
class ContentDLC
{
	//! void(EDLCId dlcId)
	ref ScriptInvoker m_OnChange = new ScriptInvoker();
	
	/*!
		For getting current entitlements on device (console). Could be called 
		after any entitlement change or before accessing locked content.
		\param dlcIdList through this list is returned all installed DLC with valid license for current user
		\return count of installed and valid DLCs.
	*/
	proto native int GetEntitlements(out TIntArray dlcIdList);
	
	/*!
		\param dlcId ID of DLC
		\return current state of availability of unlocking' dlc. Only DLC with valid license return true.
	*/
	proto native bool IsDLCInstalled(EDLCId dlcId);
	
	bool OwnsAllDLC()
	{
		const int length = EnumTools.GetEnumSize(EDLCId);
		
		// Start at 1, because 0 is DLC_UNKNOWN
		for (int i = 1; i < length; ++i)
		{
			if (!IsDLCInstalled(EnumTools.GetEnumValue(EDLCId, i)))
				return false;
		}
		
		return true;
	}
	
	/*!
		Called from engine for notifing script after any change in additional 
		content (installed, lost license). There should be check for current state of entitlements.
		On Xbox should be problem with event lost license! (system bug)
		\param dlcId ID of DLC that was changed. Could be empty string if console does not report concrete DLC ID.
	*/
	void OnChange(EDLCId dlcId)
	{
		m_OnChange.Invoke(dlcId);
	}
};