Last active
September 12, 2016 17:30
-
-
Save revmob-sdk/3455480 to your computer and use it in GitHub Desktop.
RevMob Unity SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameObject : MonoBehaviour | |
{ | |
// Just replace the IDs below with your appIDs. | |
private static readonly Dictionary<String, String> appIds = new Dictionary<String, String>() { | |
{ "Android", "4f56aa6e3dc441000e005a20"}, | |
{ "IOS", "4fd619388d314b0008000213" } | |
}; | |
private RevMob revmob; | |
void Awake() { | |
Debug.Log("Creating RevMob Session"); | |
revmob = RevMob.Start(appIds); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Collections.Generic; | |
private var APP_IDS = new Dictionary.<String, String>(); | |
private var revmob:RevMob; | |
function Awake() { | |
// Just replace the ID below with your appID. | |
APP_IDS["Android"] = "4f56aa6e3dc441000e005a20"; | |
APP_IDS["IOS"] = "4fd619388d314b0008000213"; | |
Debug.Log("[RevMob Sample App - JavaScript] Starting Session"); | |
revmob = RevMob.Start(APP_IDS, "GameObject"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameObject : MonoBehaviour | |
{ | |
// ... | |
void OnGUI() { | |
if( GUI.Button(new Rect(X_POSITION, Y_POSITION, WIDTH, HEIGHT), "Download a Free Game") ) { | |
revmob.OpenAdLink(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameObject : MonoBehaviour | |
{ | |
// ... | |
void Start() { | |
revmob.ShowPopup(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class RevMobGameObject : MonoBehaviour, IRevMobListener | |
{ | |
// Just replace the IDs below with your appIDs. | |
private static readonly Dictionary<String, String> appIds = new Dictionary<String, String>() { | |
{ "Android", "4f56aa6e3dc441000e005a20"}, | |
{ "IOS", "4fd619388d314b0008000213" } | |
}; | |
private RevMob revmob; | |
public void Awake() { | |
revmob = RevMob.Start(appIds, "RevMobGameObject"); | |
} | |
public void Update() { | |
// ... | |
} | |
#region IRevMobListener implementation | |
public void AdDidReceive (string revMobAdType) | |
{ | |
Debug.Log("Ad did receive."); | |
} | |
public void AdDidFail (string revMobAdType) | |
{ | |
Debug.Log("Ad did fail."); | |
} | |
public void AdDisplayed (string revMobAdType) | |
{ | |
Debug.Log("Ad displayed."); | |
} | |
public void UserClickedInTheAd (string revMobAdType) | |
{ | |
Debug.Log("Ad clicked."); | |
} | |
public void UserClosedTheAd (string revMobAdType) | |
{ | |
Debug.Log("Ad closed."); | |
} | |
public void InstallDidReceive (string revMobAdType) | |
{ | |
// Do not implement. | |
} | |
public void InstallDidFail (string revMobAdType) | |
{ | |
// Do not implement. | |
} | |
#endregion | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Collections.Generic; | |
private var APP_IDS = new Dictionary.<String, String>(); | |
private var revmob:RevMob; | |
function Awake() { | |
// Just replace the ID below with your appID. | |
APP_IDS["Android"] = "4f56aa6e3dc441000e005a20"; | |
APP_IDS["IOS"] = "4fd619388d314b0008000213"; | |
Debug.Log("[RevMob Sample App - JavaScript] Starting Session"); | |
revmob = RevMob.Start(APP_IDS, "GameObject"); | |
} | |
function Start() { | |
if ( revmob.IsDevice() ) { | |
Debug.Log("[RevMob Sample App - JavaScript] Show Fullscreen"); | |
revmob.ShowFullscreen(); | |
} | |
} | |
function AdDidReceive(adUnitType) { | |
Debug.Log("[RevMob Sample App - JavaScript] Ad did received"); | |
} | |
function AdDidFail(adUnitType) { | |
Debug.Log("[RevMob Sample App - JavaScript] Ad did not received"); | |
} | |
function AdDisplayed(adUnitType) { | |
Debug.Log("[RevMob Sample App - JavaScript] Ad displayed"); | |
} | |
function UserClickedInTheAd(adUnitType) { | |
Debug.Log("[RevMob Sample App - JavaScript] Ad clicked"); | |
} | |
function UserClosedTheAd(adUnitType) { | |
Debug.Log("[RevMob Sample App - JavaScript] Ad closed"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameObject : MonoBehaviour | |
{ | |
// ... | |
void Start() { | |
revmob.ShowFullscreen(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameObject : MonoBehaviour | |
{ | |
private static readonly string PLACEMENT_ID = "5058bc5f5d9fb60800000001"; | |
// ... | |
void Start() { | |
revmob.ShowFullscreen(PLACEMENT_ID); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scenario of success: with ads | |
revmob = RevMob.SetTestingMode(RevMob.Test.WITH_ADS); | |
// scenario of failure: without ads | |
revmob = RevMob.SetTestingMode(RevMob.Test.WITHOUT_ADS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So do i attach all these in the same gameobject?