B. EventHandler

EventHandler is for getting return values from async invocations or getting events related to interstitial popup view.

EventHandler Class

using UnityEngine;
using System.Collections;

namespace TnkAd {
    public class EventHandler : MonoBehaviour {
        // publishing state 
        public const int PUB_STAT_NO = 0// not publishing yet
        public const int PUB_STAT_YES = 1// publising state
        public const int PUB_STAT_TEST = 2// testing state

        // onClose(int type)
        public const int CLOSE_SIMPLE = 0// users simply closed ad view.
        public const int CLOSE_CLICK = 1// users clicked ad view.
        public const int CLOSE_EXIT = 2// users clicked exit app button.

        // onFailure(int errCode)
        public const int FAIL_NO_AD = -1;  // no ad available
        public const int FAIL_NO_IMAGE = -2// ad image not available
        public const int FAIL_TIMEOUT = -3;  // ad not arrived in 5 secs.
        public const int FAIL_CANCELED = -4// ad frequency setting
        public const int FAIL_SYSTEM = -9;

        // Set 'Handler Namein Unity Inspector
        public string handlerName;
        // ... 

        // TnkAdListener methods
        public virtual void onClose (int type) {}
        public virtual void onFailure (int errCode) {}
        public virtual void onLoad() {}
        public virtual void onShow() {}

        // ServiceCallback method
        public virtual void onReturnQueryPoint (int point) {}
        public virtual void onReturnPurchaseItem(long curPoint, long seqId) {}
        public virtual void onReturnQueryPublishState(int state) {}

Follow steps below to use EventHandler.
  1. Create a new script and change the superclass to EventHandler.
  2. Override methods relevant your logic. (You don't have to write down every method in EventHandler. Just write methods in your interest.)
  3. Add the class to GameObject in Scene screen of Unity. (Add to existing GameObject or make a new GameObject for this.)
  4. In Unity Inspector screen, set a name in Handler Name. This name is used to distinguish your callbacks or events.
1) Create EventHandler script and write your logic

Sample code for EventHandler

using UnityEngine;
using System.Collections;

public class MyTnkHandler : TnkAd.EventHandler {

    public override void onReturnQueryPoint(int point) {
        Debug.Log("##### onReturnQueryPoint " + point.ToString());
    public override void onReturnPurchaseItem(long curPoint, long seqId) {
        Debug.Log("##### onReturnPurchaseItem point = " + curPoint.ToString());
        Debug.Log("##### onReturnPurchaseItem seqId = " + seqId.ToString());

2) Add to GameObject and give a name to Handler Name 지정

3) Invoke Plugin API with the name given to Handler Name

Invoke a plugin method

if (GUI.Button (new Rect (10040015080), "Query point")) {
      Debug.Log("Query point");
      // be sure that put handler object named 'testhandlerin your scene. (It should be named in Unity Inspector)