Unity 3D – Custom Rewards Menu

ctalyst® – Using your own Rewards Menu

This article will show how to integrate your custom Rewards/Coupon Menu with ctalyst®. This article with provide with some helper functions as well that can be used or modify in order to fit your applications need. In this article the words Coupon and Rewards are used interchangeably

Prerequisites:

Creating Rewards Menu:

Initializing Plugin:

Create Empty GameObject and name it ctalystRewardsHandler. Drag and drop the ctalyst_Game_Registration Component from ctalyst.dll file under Assets/DLI/plugins folder onto onto ctalystRewardsHandler GameObject. Fill up the your Publisher Token in “Token” field and Game ID in “Content ID” field in Inspector Window of ctalystRewardsHandler.

Next step is to get all the Coupon Images as Texture2D. Following code will do that.

private Hashtable couponHashtable;
void Awake()
{
couponHashtable = new Hashtable();
// Get all the Coupons, if any.
// This method will return the Hashtable (Key, Value pair) list, which has Coupon Texture and filename of the Coupon as Stored on Disk
couponHashtable = ctalystSdk.GetCouponHashTable();
}
public void CouponFeedBackEventListener()
{
// This method will execute if Coupon Feedback is sent successful
// You can put custom code here ...
}

Coupon Hashtable will be list of “Key, Value pairs”, with Keys representing coupon’s filename as stored on the disk and value represent the Texture2D for the same coupon. You can display the images as you want. There are three action that need to be implemented.

Coupon/Reward Liked – If user liked the coupon.

Coupon/Reward Disliked – If user disliked the coupon.

Coupon/Reward Clicked – If user clicked the coupon that will navigate the user to URL provided by ctalyst®.

Implementing Like a Coupon:

Following code will implement this:

ctalystSdk.CouponFeedBack(1, coupon_filename);

The above must be called when a user liked a coupon. “1” represents the code that define coupon is liked and “coupon_filename” is the “Key” in couponHastable. Make sure you supply the filename corresponding to coupon itself.

Implementing Dislike a Coupon:

Following code will implement this:

ctalystSdk.CouponFeedBack(2, coupon_filename);

The above must be called when a user disliked a coupon. “2” represents the code that define coupon is liked and “coupon_filename” is the “Key” in couponHastable. Make sure you supply the filename corresponding to coupon itself.

Implementing Dislike a Coupon:

Following code will implement this:

ctalystSdk.CouponFeedBack(3, coupon_filename);

The above must be called when a user clicked a coupon. “3” represents the code that define coupon is liked and “coupon_filename” is the “Key” in couponHastable. Make sure you supply the filename corresponding to coupon itself. This will be end up navigating the user to the Coupons Website.