Exemplo n.º 1
0
    public void DidRequestAction(TapjoyEvent tapjoyEvent, TapjoyEventRequest request)
    {
        Debug.Log("C#: DidRequestAction type:" + request.type + ", identifier:" + request.identifier + ", quantity:" + request.quantity);

        /*
         * // Your app should perform an action based on the value of the request.type property
         * switch(request.type){
         *      case TapjoyEventRequest.TYPE_IN_APP_PURCHASE:
         *              // Your app should initiate an in-app purchase of the product identified by request.identifier
         *              break;
         *      case TapjoyEventRequest.TYPE_VIRTUAL_GOOD:
         *              // Your app should award the user the item specified by request.identifier with the amount specified by request.quantity
         *              break;
         *      case TapjoyEventRequest.TYPE_CURRENCY:
         *              // The user has been awarded the currency specified with request.identifier, with the amount specified by request.quantity
         *              break;
         *      case TapjoyEventRequest.TYPE_NAVIGATION:
         *              // Your app should attempt to navigate to the location specified by request.identifier
         *              break;
         * }
         */

        // Your app must call either EventRequestCompleted() or EventRequestCancelled() to complete the lifecycle of the request
        request.EventRequestCompleted();
    }
Exemplo n.º 2
0
    // CONNECT
    public void HandleTapjoyConnectSuccess()
    {
        Debug.Log("C#: HandleTapjoyConnectSuccess");


        // Get the user virtual currency
        TapjoyPlugin.GetTapPoints();

        // Preload direct play event
        diectPlayEvent = new TapjoyEvent("video_unit", this);
        diectPlayEvent.EnablePreload(true);
        diectPlayEvent.Send();
    }
Exemplo n.º 3
0
    public void ContentDidDisappear(TapjoyEvent tapjoyEvent)
    {
        Debug.Log("C#: ContentDidDisappear for event: " + tapjoyEvent.GetName());

        // Pre-load next event if direct play event
        if (tapjoyEvent.GetName() == diectPlayEvent.GetName())
        {
            diectPlayEvent = new TapjoyEvent("video_unit", this);
            diectPlayEvent.EnablePreload(true);
            diectPlayEvent.Send();
            tapPointsLabel = "Loading next direct play event.";
        }
    }
Exemplo n.º 4
0
    public void ContentIsReady(TapjoyEvent tapjoyEvent, int status)
    {
        Debug.Log("C#: ContentIsReady for event: " + tapjoyEvent.GetName() + " with status: " + status);

        /*
         * switch(status) {
         *      case TJCEventPreloadPartial:
         *              // handle partial load of cache
         *              break;
         *      case TJCEventPreloadComplete:
         *              // handle complete load of cache
         *              break;
         * }
         */
    }
Exemplo n.º 5
0
    public static string CreateEvent(TapjoyEvent eventRef, string eventName, string eventParameter)
    {
        if (Application.isEditor)
        {
            return(null);
        }
        string text = Guid.NewGuid().ToString();

        while (TapjoyPlugin.eventDictionary.ContainsKey(text))
        {
            text = Guid.NewGuid().ToString();
        }
        TapjoyPlugin.eventDictionary.Add(text, eventRef);
        TapjoyPluginDefault.CreateEvent(text, eventName, eventParameter);
        return(text);
    }
Exemplo n.º 6
0
    /// <summary>
    /// Creates a Tapjoy event with the specified parameters.
    /// </summary>
    /// <param name='eventName'>
    /// Event name.
    /// </param>
    /// <param name='eventParameters'>
    /// Event parameters.
    /// </param>
    public static string CreateEvent(TapjoyEvent eventRef, string eventName, string eventParameter)
    {
        if (Application.isEditor)
        {
            return(null);
        }

        Guid   guid      = Guid.NewGuid();
        string eventGuid = guid.ToString();

        while (eventDictionary.ContainsKey(eventGuid))
        {
            guid      = Guid.NewGuid();
            eventGuid = guid.ToString();
        }

        eventDictionary.Add(eventGuid, eventRef);

        TapjoyPlatformPlugin.CreateEvent(eventGuid, eventName, eventParameter);

        return(eventGuid);
    }
Exemplo n.º 7
0
    /// <summary>
    /// Creates a Tapjoy event with the specified parameters.
    /// </summary>
    /// <param name='eventName'>
    /// Event name.
    /// </param>
    /// <param name='eventParameters'>
    /// Event parameters.
    /// </param>
    public static string CreateEvent(TapjoyEvent eventRef, string eventName, string eventParameter)
    {
        if (Application.isEditor)
            return null;

        Guid guid = Guid.NewGuid();
        string eventGuid = guid.ToString();
        while (eventDictionary.ContainsKey(eventGuid))
        {
            guid = Guid.NewGuid();
            eventGuid = guid.ToString();
        }

        eventDictionary.Add(eventGuid, eventRef);

        TapjoyPlatformPlugin.CreateEvent(eventGuid, eventName, eventParameter);

        return eventGuid;
    }
Exemplo n.º 8
0
 public void ContentDidAppear(TapjoyEvent tapjoyEvent)
 {
     Debug.Log("C#: ContentDidAppear for event: " + tapjoyEvent.GetName());
 }
Exemplo n.º 9
0
 public void SendEventFailed(TapjoyEvent tapjoyEvent, string error)
 {
     Debug.Log("C#: SendEventFailed for event: " + tapjoyEvent.GetName() + " with error: " + error);
 }
Exemplo n.º 10
0
 public void SendEventSucceeded(TapjoyEvent tapjoyEvent, bool contentIsAvailable)
 {
     Debug.Log("C#: SendEventSucceeded, contentIsAvailable: " + contentIsAvailable + " for event: " + tapjoyEvent.GetName());
 }
Exemplo n.º 11
0
	void OnGUI()
	{
		if (viewIsShowing)
			return;
		
		GUIStyle labelStyle = new GUIStyle();
		labelStyle.alignment = TextAnchor.MiddleCenter;
		labelStyle.normal.textColor = Color.white;
		labelStyle.wordWrap = true;
		
		float centerx = Screen.width / 2;
		//float centery = Screen.height / 2;
		float spaceSize = 60;
		float buttonWidth = 300;
		float buttonHeight = 50;
		float fontSize = 20;
		float spacer = 100;
		
		// Quit app on BACK key.
		if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); }
		
		GUI.Label(new Rect(centerx - 200, spacer, 400, 25), "Tapjoy Connect Sample App", labelStyle);
		
		spacer += fontSize + 10;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Show Offers"))
		{
			TapjoyPlugin.ShowOffers();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Get Display Ad"))
		{
			TapjoyPlugin.GetDisplayAd();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Hide Display Ad"))
		{
			TapjoyPlugin.HideDisplayAd();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Toggle Display Ad Auto-Refresh"))
		{
			autoRefresh = !autoRefresh;
			TapjoyPlugin.EnableDisplayAdAutoRefresh(autoRefresh);
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Show Direct Play Video Ad"))
		{
			TapjoyPlugin.GetFullScreenAd();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Get Tap Points"))
		{
			TapjoyPlugin.GetTapPoints();
			ResetTapPointsLabel();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Spend Tap Points"))
		{
			TapjoyPlugin.SpendTapPoints(10);
			ResetTapPointsLabel();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Award Tap Points"))
		{
			TapjoyPlugin.AwardTapPoints(10);
			ResetTapPointsLabel();
		}
		
		spacer += spaceSize;
		
		if (GUI.Button(new Rect(centerx - (buttonWidth / 2), spacer, buttonWidth, buttonHeight), "Send Event"))
		{
			// Create a new sample event
			sampleEvent = new TapjoyEvent("test_unit", this);
			if (sampleEvent != null)
			{
				// By default, ad content will be shown automatically on a successful send. For finer control of when content should be shown, call:
				sampleEvent.EnableAutoPresent(false);

				sampleEvent.Send();
			}
		}

		spacer += fontSize;
		
		// Display status
		GUI.Label(new Rect(centerx - 200, spacer, 400, 150), tapPointsLabel, labelStyle);
	}
Exemplo n.º 12
0
	public void DidRequestAction(TapjoyEvent tapjoyEvent, TapjoyEventRequest request)
	{
		Debug.Log("C#: DidRequestAction type:" + request.type + ", identifier:" + request.identifier + ", quantity:" + request.quantity);

		/*
		// Your app should perform an action based on the value of the request.type property
		switch(request.type){
			case TapjoyEventRequest.TYPE_IN_APP_PURCHASE:
				// Your app should initiate an in-app purchase of the product identified by request.identifier
				break;
			case TapjoyEventRequest.TYPE_VIRTUAL_GOOD:
				// Your app should award the user the item specified by request.identifier with the amount specified by request.quantity
				break;
			case TapjoyEventRequest.TYPE_CURRENCY:
				// The user has been awarded the currency specified with request.identifier, with the amount specified by request.quantity
				break;
			case TapjoyEventRequest.TYPE_NAVIGATION:
				// Your app should attempt to navigate to the location specified by request.identifier
				break;
		}
		*/

		// Your app must call either EventRequestCompleted() or EventRequestCancelled() to complete the lifecycle of the request
		request.EventRequestCompleted();
	}
Exemplo n.º 13
0
	public void ContentDidDisappear(TapjoyEvent tapjoyEvent)
	{
		Debug.Log("C#: ContentDidDisappear");
	}
Exemplo n.º 14
0
	public void SendEventFailed(TapjoyEvent tapjoyEvent, string error)
	{
		Debug.Log("C#: SendEventFailed");
	}
Exemplo n.º 15
0
	public void SendEventSucceeded(TapjoyEvent tapjoyEvent, bool contentIsAvailable)
	{
		// Make sure we recieved content from the event call
		if(contentIsAvailable)
		{
			// If enableAutoPresent is set to false for the event, we need to present the event's content ourselves
			tapjoyEvent.Show();
		}
		Debug.Log("C#: SendEventSucceeded");
	}