Пример #1
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();
    }
Пример #2
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.";
        }
    }
Пример #3
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);
	}