contentdlc.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Binded values from engine
  2. enum EDLCId
  3. {
  4. DLC_UNKNOWN,
  5. DLC_FROSTLINE,
  6. };
  7. //! ContentDLC is for query installed DLC (only as entitlement keys, not content)
  8. class ContentDLC
  9. {
  10. //! void(EDLCId dlcId)
  11. ref ScriptInvoker m_OnChange = new ScriptInvoker();
  12. /*!
  13. For getting current entitlements on device (console). Could be called
  14. after any entitlement change or before accessing locked content.
  15. \param dlcIdList through this list is returned all installed DLC with valid license for current user
  16. \return count of installed and valid DLCs.
  17. */
  18. proto native int GetEntitlements(out TIntArray dlcIdList);
  19. /*!
  20. \param dlcId ID of DLC
  21. \return current state of availability of unlocking' dlc. Only DLC with valid license return true.
  22. */
  23. proto native bool IsDLCInstalled(EDLCId dlcId);
  24. bool OwnsAllDLC()
  25. {
  26. const int length = EnumTools.GetEnumSize(EDLCId);
  27. // Start at 1, because 0 is DLC_UNKNOWN
  28. for (int i = 1; i < length; ++i)
  29. {
  30. if (!IsDLCInstalled(EnumTools.GetEnumValue(EDLCId, i)))
  31. return false;
  32. }
  33. return true;
  34. }
  35. /*!
  36. Called from engine for notifing script after any change in additional
  37. content (installed, lost license). There should be check for current state of entitlements.
  38. On Xbox should be problem with event lost license! (system bug)
  39. \param dlcId ID of DLC that was changed. Could be empty string if console does not report concrete DLC ID.
  40. */
  41. void OnChange(EDLCId dlcId)
  42. {
  43. m_OnChange.Invoke(dlcId);
  44. }
  45. };