License Manager is an add-on for Combu that allows you to easily manage your awesome game/app with subscription plans. You can set the licenses of your players directly in the interface of the administration console and set a default type of license for new registrations (usually X-days or X-launches trial).
In Unity you can check if the license of the local user is still valid or expired, there’s also a check for off-line mode but this system is mainly implemented for online games/apps so it is not meant to replace or work as a full featured DRM manager but it adds a similar functionality to your Combu applications.
This product does not handle online payments at this moment, but it’s very easy to change licenses through a web script: just include lib/api.php from Combu in your PHP file and call LicenseManager::SaveLicense($idAccount, $licenseType, $licenseValue, $licenseNumber), where:
- $idAccount is the account Id
- $licenseType can be: LICENSE_TYPE_TIME (1), LICENSE_TYPE_LAUNCH (2), LICENSE_TYPE_MONTHLY (3), LICENSE_TYPE_YEARLY (4), LICENSE_TYPE_PERPETUAL (5)
- $licenseValue can be:
- if $licenseType is LICENSE_TYPE_TIME: expiration date as YYYY-MM-DD (e.g.: 2015-09-23)
- if $licenseType is LICENSE_TYPE_LAUNCH: remaining launches count (e.g.: 5)
- if $licenseType is LICENSE_TYPE_MONTHLY: expire period as MM-YYYY (e.g.: 09-2015)
- if $licenseType is LICENSE_TYPE_YEARLY: expiration year (e.g.: 2015)
- if $licenseType is LICENSE_TYPE_PERPETUAL: NULL or empty string
- $licenseNumber is the license serial number (you can set it to what ever you want, if you don’t want to change then pass NULL)
Purchase
Install the add-on
To install this add-on, just uncompress the file license-manager_web.zip in the folder /addons of your Combu server installation (you will have a new folder called license-manager).
In the expanded folder license-manager you will find the file config.php that you should edit to assign the following values to the constants:
- LICENSE_KEY: a 32-length string that will be used in the encryption/decryption of data
- LICENSE_IV: a 32-length string that will be used in the encryption/decryption of data
- LICENSE_AUTOGENERATE: if TRUE then it will auto-generate license numbers on user creation (and it’ll be denied to update the number from clients)
- LICENSE_DEFAULT_TYPE: the default license that is granted to any new account registered, it can be one of the constants defined in addon.php (LICENSE_TYPE_* after the comment “Valid License types“)
- LICENSE_DEFAULT_TIME: if LICENSE_DEFAULT_TYPE is set as LICENSE_TYPE_TIME then this constant is the number of days available to try your software
- LICENSE_DEFAULT_LAUNCHES: if LICENSE_DEFAULT_TYPE is set as LICENSE_TYPE_LAUNCH then this constant is the number of launches to try your software
If LICENSE_DEFAULT_TYPE is set as LICENSE_TYPE_MONTHLY then the default expiration for new accounts is next month from account registration.
If LICENSE_DEFAULT_TYPE is set as LICENSE_TYPE_YEARLY then the default expiration for new accounts is next year from account registration.
Once you’ve done, in your Combu Administration you will find a new section License Manager (see screenshots at the bottom of this page).
How to use
To add the functionality in your game/app on Unity, just create a new empty object and attach the script LicenseManager (or use the prefab that is in the folder Prefabs).
You can set the following properties in the inspector:
- License Key: it must be equal to the above constant LICENSE_KEY
- License Iv: it must be equal to the above constant LICENSE_IV
- Addon Relative Url: it should be fine addons/license-manager for everyone, it’s the relative path to the add-on folder and you have to change this only if you renamed it (in the next releases this will be turned into a const)