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(); }
// 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(); }
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."; } }
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; * } */ }
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); }
/// <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); }
/// <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; }
public void ContentDidAppear(TapjoyEvent tapjoyEvent) { Debug.Log("C#: ContentDidAppear for event: " + tapjoyEvent.GetName()); }
public void SendEventFailed(TapjoyEvent tapjoyEvent, string error) { Debug.Log("C#: SendEventFailed for event: " + tapjoyEvent.GetName() + " with error: " + error); }
public void SendEventSucceeded(TapjoyEvent tapjoyEvent, bool contentIsAvailable) { Debug.Log("C#: SendEventSucceeded, contentIsAvailable: " + contentIsAvailable + " for event: " + tapjoyEvent.GetName()); }
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); }
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(); }
public void ContentDidDisappear(TapjoyEvent tapjoyEvent) { Debug.Log("C#: ContentDidDisappear"); }
public void SendEventFailed(TapjoyEvent tapjoyEvent, string error) { Debug.Log("C#: SendEventFailed"); }
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"); }