Last active
August 29, 2015 14:17
-
-
Save yasuyuki-kamata/b548ca37a4c917139a06 to your computer and use it in GitHub Desktop.
UnityAds コールバックテスト for UnityScript
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
#pragma strict | |
import UnityEngine.UI; | |
import UnityEngine.Advertisements; | |
var gameID : String = "26870"; // GAME ID | |
var isTestMode : boolean = false; // テストモード | |
var zoneID : String = "rewardedVideoZone"; // ZONE ID | |
var text : Text; // デバッグ用のUI.Text | |
var options : ShowOptions; // ShowOptions一時格納用 | |
function Awake () | |
{ | |
if (Advertisement.isSupported) { | |
// UnityAdsを初期化 | |
Advertisement.Initialize(gameID, isTestMode); | |
// ShowOptionsを初期化しておく | |
options = new ShowOptions(); | |
// resultCallbackに動画視聴完了時のアクションを登録 | |
options.resultCallback = function (result : ShowResult) { | |
// この中に動画視聴完了時の処理を書く | |
// 変数resultはFailed, Skipped, Finishedのいずれかが来る | |
text.text = "Get incentives!"; | |
}; | |
} | |
} | |
function ShowRewardedVideo () | |
{ | |
if (Advertisement.isReady(zoneID)) { | |
Advertisement.Show(zoneID, options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment