public void StartMovie() { PanelMovie.SetActive(false); SDKTest.SetTitleMovieObj(this); if (SDKTest.m_status == 1) { if (VAMPUnitySDK.show() == false) { SDKTest.m_status = 0; } else { AudioSource ad = GetComponent <AudioSource>(); ad.mute = true; } } if (SDKTest.m_status == 0) { VAMPUnitySDK.load(); PanelOK.SetActive(false); Panelerr.SetActive(true); } }
public void ActionMovie() { Moviepanel.SetActive(false); SDKTest.SetMenuObj(this); if (SDKTest.m_status == 1) { if (VAMPUnitySDK.show() == false) { SDKTest.m_status = 0; } else { flowchart.ExecuteBlock("mute"); } } if (SDKTest.m_status == 0) { VAMPUnitySDK.load(); DisplayMessage("動画の再生に失敗しました。\n\n" + "※インターネット接続を確認し、しばらくしてから再生してください。\n"); Messagepanel.SetActive(true); flowchart.ExecuteBlock("nonmute"); } }
void Start() { titleflag = false; loadflag = false; m_status = 0; completeflag = false; // ~~~ VAMP初期化 ~~~ // trueを指定すると収益が発生しないテスト広告が配信されるようになります。 // ストアに申請する際は必ずfalseを設定してください VAMPUnitySDK.setTestMode(false); // trueを指定するとログを詳細に出力するデバッグモードになります VAMPUnitySDK.setDebugMode(false); // VAMPを初期化します。必ずLoadより先に実行してください VAMPUnitySDK.initialize(placementID); // リスナーを設定します VAMPUnitySDK.setVAMPListener(this); VAMPUnitySDK.setAdvancedListener(this); DontDestroyOnLoad(this); // 動画広告がまだ準備されていないときはロードを開始します VAMPUnitySDK.load(); }
private IEnumerator _onEnd() { yield return(new WaitForSeconds(0.5f)); // オーディオを鳴らすなどの終了処理をここに書く if (m_status == 0) { Debug.LogFormat("load"); VAMPUnitySDK.load(); } if (titleflag) { titleflag = false; titlemgr.MovieEnd(completeflag); completeflag = false; } else if (loadflag) { loadflag = false; loadObj.MovieEnd(completeflag); completeflag = false; } else if (menuflag) { menuflag = false; menuObj.MovieEnd(completeflag); completeflag = false; } }
// IVAMPListener public void VAMPDidReceive(string placementId, string adnwName) { AddMessage(string.Format("Receive {0} {1}", placementId, adnwName)); isLoading = false; Debug.LogFormat("[VAMPUnitySDK] VAMPDidReceive: {0} {1}", placementId, adnwName); if (blk == Block.Ad2) { VAMPUnitySDK.show(); } }
public void PushMovie() { //動画を再生する SDKTest.SetLoadMovieObj(this); if (SDKTest.m_status == 1) { if (VAMPUnitySDK.show() == false) { SDKTest.m_status = 0; } } if (SDKTest.m_status == 0) { VAMPUnitySDK.load(); panelerr.SetActive(true); panelok.SetActive(false); } }
public static List <string> GetDeviceInfo() { List <string> infos = new List <string>(); infos.Add("--------------------"); #if UNITY_IOS && !UNITY_EDITOR if (Application.platform == RuntimePlatform.IPhonePlayer) { infos.Add("サポートOSバージョン:" + VAMPUnitySDK.SupportedOSVersion()); infos.Add("サポート対象OS:" + VAMPUnitySDK.isSupportedOSVersion()); infos.Add("--------------------"); infos.Add("SDK_Ver(VAMP):" + VAMPUnitySDK.SDKVersion()); infos.Add("SDK_Ver(Admob):" + GetAdnwSDKVersion("Admob")); infos.Add("SDK_Ver(AppLovin):" + GetAdnwSDKVersion("AppLovin")); infos.Add("SDK_Ver(FAN):" + GetAdnwSDKVersion("FAN")); infos.Add("SDK_Ver(Maio):" + GetAdnwSDKVersion("Maio")); infos.Add("SDK_Ver(Mintegral):" + GetAdnwSDKVersion("Mintegral")); infos.Add("SDK_Ver(MoPub):" + GetAdnwSDKVersion("MoPub")); infos.Add("SDK_Ver(Nend):" + GetAdnwSDKVersion("Nend")); infos.Add("SDK_Ver(Tapjoy):" + GetAdnwSDKVersion("Tapjoy")); infos.Add("SDK_Ver(UnityAds):" + GetAdnwSDKVersion("UnityAds")); infos.Add("SDK_Ver(Vungle):" + GetAdnwSDKVersion("Vungle")); infos.Add("--------------------"); infos.Add("BundleID:" + VAMPUnityTestDeviceInfo("BundleID")); infos.Add("バージョン名:" + VAMPUnityTestDeviceInfo("AppVer")); infos.Add("--------------------"); infos.Add("デバイス名:" + VAMPUnityTestDeviceInfo("DeviceName")); infos.Add("OS名:" + VAMPUnityTestDeviceInfo("OSName")); infos.Add("OSバージョン:" + VAMPUnityTestDeviceInfo("OSVersion")); infos.Add("OSモデル:" + VAMPUnityTestDeviceInfo("OSModel")); infos.Add("キャリア情報:" + VAMPUnityTestDeviceInfo("Carrier")); infos.Add("国コード:" + VAMPUnityTestDeviceInfo("CountryCode")); infos.Add("IDFA:" + VAMPUnityTestDeviceInfo("IDFA")); infos.Add("--------------------"); } #elif UNITY_ANDROID && !UNITY_EDITOR if (Application.platform == RuntimePlatform.Android) { string appName = ""; string packageName = ""; string versionName = ""; string androidVersion = ""; string manufacturer = ""; string model = ""; string brand = ""; int versionCode = 0; int apiLevel = -1; try { AndroidJavaClass playerCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = playerCls.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaObject packageManager = activity.Call <AndroidJavaObject>("getPackageManager"); AndroidJavaClass packageManagerCls = new AndroidJavaClass("android.content.pm.PackageManager"); packageName = activity.Call <string>("getPackageName"); int activities = packageManagerCls.GetStatic <int>("GET_ACTIVITIES"); AndroidJavaObject packageInfo = packageManager.Call <AndroidJavaObject>("getPackageInfo", packageName, activities); appName = packageManager.Call <string>("getApplicationLabel", packageInfo.Get <AndroidJavaObject>("applicationInfo")); versionCode = packageInfo.Get <int>("versionCode"); versionName = packageInfo.Get <string>("versionName"); AndroidJavaClass buildCls = new AndroidJavaClass("android.os.Build"); AndroidJavaClass versionCls = new AndroidJavaClass("android.os.Build$VERSION"); androidVersion = versionCls.GetStatic <string>("RELEASE"); apiLevel = versionCls.GetStatic <int>("SDK_INT"); manufacturer = buildCls.GetStatic <string>("MANUFACTURER"); model = buildCls.GetStatic <string>("MODEL"); brand = buildCls.GetStatic <string>("BRAND"); } catch (AndroidJavaException ex) { Debug.Log(ex.Message); } infos.Add("サポートAPI Level:" + VAMPUnitySDK.SupportedOSVersion()); infos.Add("サポート対象OS:" + VAMPUnitySDK.isSupportedOSVersion()); infos.Add("--------------------"); infos.Add("SDK_Ver(VAMP):" + VAMPUnitySDK.SDKVersion()); infos.Add("SDK_Ver(Admob):" + GetAdnwSDKVersion("Admob")); infos.Add("SDK_Ver(AppLovin):" + GetAdnwSDKVersion("AppLovin")); infos.Add("SDK_Ver(FAN):" + GetAdnwSDKVersion("FAN")); infos.Add("SDK_Ver(Maio):" + GetAdnwSDKVersion("Maio")); infos.Add("SDK_Ver(Mintegral):" + GetAdnwSDKVersion("Mintegral")); infos.Add("SDK_Ver(MoPub):" + GetAdnwSDKVersion("MoPub")); infos.Add("SDK_Ver(Nend):" + GetAdnwSDKVersion("Nend")); infos.Add("SDK_Ver(Tapjoy):" + GetAdnwSDKVersion("Tapjoy")); infos.Add("SDK_Ver(UnityAds):" + GetAdnwSDKVersion("UnityAds")); infos.Add("SDK_Ver(Vungle):" + GetAdnwSDKVersion("Vungle")); infos.Add("--------------------"); infos.Add("アプリ名:" + appName); infos.Add("パッケージ名:" + packageName); infos.Add("バージョンコード:" + versionCode); infos.Add("バージョン名:" + versionName); infos.Add("--------------------"); infos.Add("Androidバージョン:" + androidVersion); infos.Add("API Level:" + apiLevel); infos.Add("メーカー名:" + manufacturer); infos.Add("モデル番号:" + model); infos.Add("ブランド名:" + brand); infos.Add("--------------------"); } #endif infos.Add("isPlayerCancelable:" + VAMPUnitySDK.VAMPConfiguration.getInstance().PlayerCancelable); infos.Add("--------------------"); return(infos); }
void OnGUI() { GUIStyle btnStyle = GUI.skin.GetStyle("Button"); btnStyle.alignment = TextAnchor.MiddleCenter; btnStyle.fontSize = 30; GUIStyle labelStyle = GUI.skin.GetStyle("Label"); labelStyle.alignment = TextAnchor.MiddleCenter; labelStyle.fontSize = 30; labelStyle.clipping = TextClipping.Overflow; GUIStyle textFStyle = GUI.skin.GetStyle("TextField"); textFStyle.alignment = TextAnchor.MiddleCenter; textFStyle.fontSize = 30; GUI.matrix = Matrix4x4.Scale(scaleV3); EdgeInsets safeAreaInsets = SDKTest.safeAreaInsets; if (blk == Block.Title) { logoCube.SetActive(false); labelStyle.fontSize = 25; GUI.Label(new Rect(0, height - 60 - safeAreaInsets.Bottom, width, 50), "APP " + appVersion + " / SDK " + sdkVersion); labelStyle.fontSize = 30; GUI.matrix = matrix; GUI.DrawTexture(new Rect(190, 490, 160, 160), logoTexture); labelStyle.alignment = TextAnchor.MiddleRight; // GUI.enabled = !isVampInitialized; GUI.Label(new Rect(100, 90, 80, 60), "ID:"); placementID = GUI.TextField(new Rect(200, 90, 240, 60), placementID); GUI.Label(new Rect(100, 170, 240, 60), "TestMode:"); if (GUI.Button(new Rect(350, 180, 40, 40), testMode ? btnOnTexture : btnOffTexture)) { testMode = !testMode; } GUI.Label(new Rect(100, 250, 240, 60), "DebugMode:"); if (GUI.Button(new Rect(350, 260, 40, 40), debugMode ? btnOnTexture : btnOffTexture)) { debugMode = !debugMode; } if (GUI.Button(new Rect(100, 330, 340, 60), "AD1")) { blk = Block.Ad1; isVampInitialized = true; // trueを指定すると収益が発生しないテスト広告が配信されるようになります。 // ストアに申請する際は必ずfalseを設定してください VAMPUnitySDK.setTestMode(testMode); // trueを指定するとログを詳細に出力するデバッグモードになります VAMPUnitySDK.setDebugMode(debugMode); // VAMPを初期化します。必ずLoadより先に実行してください VAMPUnitySDK.initialize(placementID); VAMPUnitySDK.setVAMPListener(this); VAMPUnitySDK.setAdvancedListener(this); } if (GUI.Button(new Rect(100, 410, 340, 60), "AD2")) { blk = Block.Ad2; isVampInitialized = true; // trueを指定すると収益が発生しないテスト広告が配信されるようになります。 // ストアに申請する際は必ずfalseを設定してください VAMPUnitySDK.setTestMode(testMode); // trueを指定するとログを詳細に出力するデバッグモードになります VAMPUnitySDK.setDebugMode(debugMode); // VAMPを初期化します。必ずLoadより先に実行してください VAMPUnitySDK.initialize(placementID); VAMPUnitySDK.setVAMPListener(this); VAMPUnitySDK.setAdvancedListener(this); // 広告のプリロードを開始します VAMPUnitySDK.preload(); } if (GUI.Button(new Rect(100, 490, 340, 60), "AD3")) { blk = Block.Ad3; isVampInitialized = true; // trueを指定すると収益が発生しないテスト広告が配信されるようになります。 // ストアに申請する際は必ずfalseを設定してください VAMPUnitySDK.setTestMode(testMode); // trueを指定するとログを詳細に出力するデバッグモードになります VAMPUnitySDK.setDebugMode(debugMode); // VAMPを初期化します。必ずLoadより先に実行してください VAMPUnitySDK.initialize(placementID); VAMPUnitySDK.setVAMPListener(this); VAMPUnitySDK.setAdvancedListener(this); } if (GUI.Button(new Rect(100, 570, 340, 60), "INFO")) { blk = Block.Info; // 国コード取得サンプル VAMPUnitySDK.getCountryCode((string countryCode) => { this.countryCode = countryCode; AddMessage(string.Format("CountryCode {0}", countryCode)); Debug.Log("[VAMPUnitySDK] VAMPCountryCode: " + countryCode); //if (countryCode == "US") { // // COPPA対象ユーザである場合はtrueを設定する // VAMPUnitySDK.setCoppaChildDirected(true); //} }); } } else if (blk == Block.Ad1) { logoCube.SetActive(true); if (GUI.Button(new Rect(0, 60 + safeAreaInsets.Top, 120, 60), "<戻る")) { blk = Block.Title; VAMPUnitySDK.clearLoaded(); isLoading = false; messages.Clear(); logPosition = Vector2.zero; } if (GUI.Button(new Rect(140, 60 + safeAreaInsets.Top, 120, 60), "LOAD")) { AddMessage("click load button."); // 動画広告ロードを開始します Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.load()"); VAMPUnitySDK.load(); isLoading = true; } if (GUI.Button(new Rect(280, 60 + safeAreaInsets.Top, 120, 60), "SHOW")) { AddMessage("click show button."); // 動画広告が準備できているときは広告を表示します if (VAMPUnitySDK.isReady()) { Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.show()"); VAMPUnitySDK.show(); } } labelStyle.fontSize = 25; GUI.Label(new Rect(0, 130 + safeAreaInsets.Top, width, 50), "[Test:" + testMode + "] [Debug:" + debugMode + "]"); GUI.Label(new Rect(0, 180 + safeAreaInsets.Top, width, 50), "ID:" + placementID); GUILayout.BeginArea(new Rect(20, 230 + safeAreaInsets.Top, width - 40, height - 190 - safeAreaInsets.Bottom)); logPosition = GUILayout.BeginScrollView(logPosition); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.fontSize = 20; int count = 0; for (int i = messages.Count - 1; i >= 0; i--) { GUILayout.Label(messages[i], labelStyle); count++; if (count >= 200) { break; } } GUILayout.EndScrollView(); GUILayout.EndArea(); } else if (blk == Block.Ad2) { logoCube.SetActive(true); if (GUI.Button(new Rect(0, 60 + safeAreaInsets.Top, 120, 60), "<戻る")) { blk = Block.Title; VAMPUnitySDK.clearLoaded(); isLoading = false; messages.Clear(); logPosition = Vector2.zero; } if (GUI.Button(new Rect(140, 60 + safeAreaInsets.Top, 240, 60), "LOAD & SHOW")) { AddMessage("click load & show button."); if (!VAMPUnitySDK.isReady()) { // 動画広告ロードを開始します Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.load()"); VAMPUnitySDK.load(); isLoading = true; } else { // 動画広告が準備できているときは広告を表示します Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.show()"); VAMPUnitySDK.show(); } } labelStyle.fontSize = 25; GUI.Label(new Rect(0, 130 + safeAreaInsets.Top, width, 50), "[Test:" + testMode + "] [Debug:" + debugMode + "]"); GUI.Label(new Rect(0, 180 + safeAreaInsets.Top, width, 50), "ID:" + placementID); GUILayout.BeginArea(new Rect(20, 230 + safeAreaInsets.Top, width - 40, height - 190 - safeAreaInsets.Bottom)); logPosition = GUILayout.BeginScrollView(logPosition); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.fontSize = 20; int count = 0; for (int i = messages.Count - 1; i >= 0; i--) { GUILayout.Label(messages[i], labelStyle); count++; if (count >= 200) { break; } } GUILayout.EndScrollView(); GUILayout.EndArea(); } else if (blk == Block.Ad3) { logoCube.SetActive(true); if (GUI.Button(new Rect(0, 60 + safeAreaInsets.Top, 120, 60), "<戻る")) { blk = Block.Title; VAMPUnitySDK.clearLoaded(); isLoading = false; messages.Clear(); logPosition = Vector2.zero; } if (GUI.Button(new Rect(140, 60 + safeAreaInsets.Top, 120, 60), "LOAD")) { AddMessage("click load button."); // 動画広告ロードを開始します Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.load()"); VAMPUnitySDK.load(); isLoading = true; } if (GUI.Button(new Rect(280, 60 + safeAreaInsets.Top, 120, 60), "SHOW")) { AddMessage("click show button."); // 動画広告が準備できているときは広告を表示します if (VAMPUnitySDK.isReady()) { Debug.Log("[VAMPUnitySDK] VAMPUnitySDK.show()"); VAMPUnitySDK.show(); } } if (GUI.Button(new Rect(70, 130 + safeAreaInsets.Top, 400, 60), "SetFrequencyCap")) { AddMessage("click SetFrequencyCap button."); VAMPUnitySDK.setFrequencyCap(placementID, frequencyCap.impressions, frequencyCap.timeLimit); } if (GUI.Button(new Rect(70, 210 + safeAreaInsets.Top, 400, 60), "GetFrequencyCappedStatus")) { AddMessage("click GetFrequencyCappedStatus button."); using (var fpStatus = VAMPUnitySDK.getFrequencyCappedStatus(placementID)) { AddMessage(string.Format("capped:{0}, impressions:{1}, remainingTime:{2}, impressionLimit:{3}, timeLimit:{4}", fpStatus.IsCapped, fpStatus.Impressions, fpStatus.RemainingTime, fpStatus.ImpressionLimit, fpStatus.TimeLimit)); } } if (GUI.Button(new Rect(70, 290 + safeAreaInsets.Top, 400, 60), "ClearFrequencyCap")) { AddMessage("click clearFrequencyCap button"); VAMPUnitySDK.clearFrequencyCap(placementID); } if (GUI.Button(new Rect(70, 370 + safeAreaInsets.Top, 400, 60), "ResetFrequencyCap")) { AddMessage("click resetFrequencyCap button"); VAMPUnitySDK.resetFrequencyCap(placementID); } labelStyle.fontSize = 25; GUI.Label(new Rect(0, 450 + safeAreaInsets.Top, width, 50), "[Test:" + testMode + "] [Debug:" + debugMode + "]"); GUI.Label(new Rect(0, 500 + safeAreaInsets.Top, width, 50), "ID:" + placementID); GUILayout.BeginArea(new Rect(20, 550 + safeAreaInsets.Top, width - 40, height - 190 - safeAreaInsets.Bottom)); logPosition = GUILayout.BeginScrollView(logPosition); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.fontSize = 20; int count = 0; for (int i = messages.Count - 1; i >= 0; i--) { GUILayout.Label(messages[i], labelStyle); count++; if (count >= 200) { break; } } GUILayout.EndScrollView(); GUILayout.EndArea(); } else if (blk == Block.Info) { logoCube.SetActive(false); if (GUI.Button(new Rect(0, 60 + safeAreaInsets.Top, 120, 60), "<戻る")) { blk = Block.Title; } GUILayout.BeginArea(new Rect(20, 130 + safeAreaInsets.Top, width - 40, height - 90 - safeAreaInsets.Bottom)); infoPosition = GUILayout.BeginScrollView(infoPosition); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.fontSize = 20; for (int i = 0; i < infos.Count; i++) { GUILayout.Label(infos[i], labelStyle); } GUILayout.Label("Country Code:" + countryCode, labelStyle); GUILayout.EndScrollView(); GUILayout.EndArea(); } GUI.matrix = Matrix4x4.identity; GUI.skin = null; }
void Start() { #if UNITY_IOS placementID = iosPlacementID; #elif UNITY_ANDROID placementID = androidPlacementID; #endif #if UNITY_ANDROID // Android FANのテストデバイスIDを登録 if (androidFANHashedID != null && androidFANHashedID.Length > 0) { SDKTestUtil.AddFANTestDevice(androidFANHashedID); } #endif // ユーザ属性をセットします //var targeting = new VAMPUnitySDK.Targeting(); //targeting.Gender = userGender; //targeting.Birthday = new VAMPUnitySDK.Birthday(birthday.year, birthday.month, birthday.day); //VAMPUnitySDK.setTargeting(targeting); var vampConfiguration = VAMPUnitySDK.VAMPConfiguration.getInstance(); vampConfiguration.PlayerCancelable = vampConfig.playerCancelable; vampConfiguration.PlayerAlertTitleText = vampConfig.playerAlertTitleText; vampConfiguration.PlayerAlertBodyText = vampConfig.playerAlertBodyText; vampConfiguration.PlayerAlertCloseButtonText = vampConfig.playerAlertCloseButtonText; vampConfiguration.PlayerAlertContinueButtonText = vampConfig.playerAlertContinueButtonText; blk = Block.Title; isVampInitialized = false; logoCube = GameObject.Find("LogoCube"); logoCube.SetActive(false); isLoading = false; float scaleX = Screen.width / SCREEN_WIDTH; float scaleY = Screen.height / SCREEN_HEIGHT; float scale = scaleX < scaleY ? scaleX : scaleY; scaleV3 = new Vector3(scale, scale, 1.0f); matrix = Matrix4x4.TRS( new Vector2( (Screen.width - SCREEN_WIDTH * scale) / 2, (Screen.height - SCREEN_HEIGHT * scale) / 2 ), Quaternion.identity, scaleV3 ); width = Screen.width / scale; height = Screen.height / scale; sdkVersion = VAMPUnitySDK.SDKVersion(); appVersion = SDKTestUtil.GetAppVersion(); infos = SDKTestUtil.GetDeviceInfo(); // EU圏内からのアクセスか判定します // VAMPUnitySDK.isEUAccess((bool access) => { // AddMessage(string.Format("IsEUAccess {0}", access)); // Debug.Log("[VAMPUnitySDK] VAMPIsEUAccess: " + access); // if (access) // { // // TODO: ユーザに広告が個人に関連する情報を取得することの同意を求めます // // ユーザの入力を受け付けACCEPTEDまたはDENIEDをセットします // VAMPUnitySDK.setUserConsent(VAMPUnitySDK.ConsentStatus.ACCEPTED); // } // }); VAMPUnitySDK.setCoppaChildDirected(false); Debug.Log("[VAMPUnitySDK] Coppa:" + VAMPUnitySDK.isCoppaChildDirected()); }
static public void Initialize() { VAMPUnitySDK.initialize(placementID); VAMPUnitySDK.load(); }