Commit 136fc4fa authored by nk161690's avatar nk161690

facebook login

parent 6ae93e82
fileFormatVersion: 2
guid: 1155ccc7646346249a5021b4a787af22
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.IO;
using UnityEngine;
using UnityEditor;
#if UNITY_IOS
using UnityEditor.Build.Reporting;
using UnityEditor.iOS.Xcode;
#endif
using UnityEditor.Callbacks;
namespace Facebook.Unity.PostProcess
{
    /// <summary>
    /// Automatically disables Bitcode on iOS builds
    /// </summary>
public static class DisableBitcode
{
[PostProcessBuildAttribute(999)]
public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuildProject)
{
#if UNITY_IOS
if (buildTarget != BuildTarget.iOS) return;
string projectPath = pathToBuildProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject pbxProject = new PBXProject();
pbxProject.ReadFromFile(projectPath);
//Disabling Bitcode on all targets
//Main
string target = pbxProject.GetUnityMainTargetGuid();
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
//Unity Tests
target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
//Unity Framework
target = pbxProject.GetUnityFrameworkTargetGuid();
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
pbxProject.WriteToFile(projectPath);
#endif
}
}
}
fileFormatVersion: 2
guid: 201fa01d552b84a74917c9cc8a4c297c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5aebe3a50b0a7504fa4b2fed486618bd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6bc0460e8e47fc847aa3c2a4e52bfda9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d3c5c5ae093a5c7459a7c2875d753562
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b7b977ddac702410d9afe830593d49d1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8aafe0b0d0d5f4e0eb3476e052977318
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 55cbe0f2ed59c472ab1f0f3ffdd43d0e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2910e11bc0de145b7bb6ca10a42a9a40
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d67e36cf70144eeeb62948707545ecfd
labels:
- gvh
- gvh_version-1.2.166
- gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md
timeCreated: 1584567712
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bb6999c8a5ce4ba99688ec579babe5b7
labels:
- gvh
- gvh_version-1.2.166
- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 35a6726adf03479eb04b8c082346d551
labels:
- gvh
- gvh_version-1.2.166
- gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE
timeCreated: 1584567712
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 11eb52f780284fd69194951ac46cb538
labels:
- gvh
- gvh_version-1.2.166
- gvhp_exportpath-ExternalDependencyManager/Editor/README.md
timeCreated: 1584567712
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/ExternalDependencyManager/Editor/CHANGELOG.md
Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll
Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll
Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll
Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb
Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll
Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.mdb
Assets/ExternalDependencyManager/Editor/LICENSE
Assets/ExternalDependencyManager/Editor/README.md
fileFormatVersion: 2
guid: 70e37c0d68034f8a953638d978633f87
labels:
- gvh
- gvh_manifest
- gvh_version-1.2.166
- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.166_manifest.txt
- gvhp_manifestname-0External Dependency Manager
- gvhp_manifestname-play-services-resolver
timeCreated: 1474401009
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0f02d67ebf474ff498bfb4817a71358a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using Facebook.Unity;
using UnityEngine.Android;
using Photon.Pun;
using System.Collections.Generic;
using Photon.Realtime;
using UnityEditor.VersionControl;
using TMPro;
using Unity.VisualScripting.Antlr3.Runtime;
public class FacebookLogin : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI message;
private readonly string[] facebookPermissions = { "public_profile", "email" };
private void Awake()
{
// Initialize the Facebook SDK
if (!FB.IsInitialized)
{
FB.Init(OnInitComplete);
}
else
{
OnInitComplete();
}
}
private void OnInitComplete()
{
if (FB.IsInitialized)
{
// Enable or disable automatic App Events logging
FB.ActivateApp();
}
else
{
Debug.Log("Failed to Initialize the Facebook SDK");
}
}
public void OnFacebookLoginButtonClicked()
{
// Check for required permissions and request them if not granted
foreach (string permission in facebookPermissions)
{
if (!Permission.HasUserAuthorizedPermission(permission))
{
// If not granted, request the permission
Permission.RequestUserPermission(permission);
}
}
// Request Facebook Login with read permissions
FB.LogInWithReadPermissions(facebookPermissions, OnLoginComplete);
}
private void OnLoginComplete(ILoginResult result)
{
if (result.Error == null && !result.Cancelled)
{
// Login successful, obtain the Facebook access token
string accessToken = AccessToken.CurrentAccessToken.TokenString;
Debug.Log("Facebook Login Successful! Access Token: " + accessToken);
// Use the accessToken to authenticate with Photon as a custom authentication type
OnFacebookLoggedIn();
}
else
{
// Login failed or user cancelled
Debug.Log("Facebook Login Failed or Cancelled");
}
}
private void OnFacebookLoggedIn()
{
// AccessToken class will have session details
string aToken = AccessToken.CurrentAccessToken.TokenString;
string facebookId = AccessToken.CurrentAccessToken.UserId;
PhotonNetwork.AuthValues = new AuthenticationValues();
PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.FacebookGaming;
PhotonNetwork.AuthValues.UserId = facebookId; // alternatively set by server
PhotonNetwork.AuthValues.AddAuthParameter("token", aToken);
PhotonNetwork.ConnectUsingSettings();
}
}
fileFormatVersion: 2
guid: ab1db3a1da2c2b541bc729810838e50f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0236098fb5911674e926ca3cb06aa598
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8655be4b4255582499423170ae257d04
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 54794606f6622524b86b154880782377
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4c5e54f177d1f4d4a97e1e85ee98de79
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0c512f4def5c9f24689b96510c709788
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2f433644f2a2d4e839bd2ef3d2a7b476
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ad530e173c64480499242cf086d023ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Facebook.Unity;
public class ProductRowPrefab : MonoBehaviour {
[SerializeField]
private RawImage _thumbImg;
[SerializeField]
private Text _titleText;
[SerializeField]
private Text _productIdText;
[SerializeField]
private GameObject _buyBtn;
private Product _product;
private LogScroller _logScroller;
private PurchasePage _parentScript;
private void Awake () {
}
public void OnLogBtnClick () {
_logScroller.Log(_product.ToString());
}
public void OnPurchaseBtnClick() {
_parentScript.MakePurchase(_product);
}
public void Initialize (PurchasePage parentScript, LogScroller logScroller, Product product) {
_parentScript = parentScript;
_logScroller = logScroller;
_product = product;
_titleText.text = product.Title;
_productIdText.text = product.ProductID;
_buyBtn.transform.GetChild(0).GetComponent<Text>().text = product.Price;
SetThumb(product.ProductID, product.ImageURI);
}
private void SetThumb (string productId, string url) {
StartCoroutine(Utility.GetTexture(productId, url, (texture) => {
_thumbImg.texture = texture;
}));
}
private void LogText (string text) {
_logScroller.Log(text);
}
}
fileFormatVersion: 2
guid: d5a426e03015442f1864eb0e805eda98
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6966b93684c434b41b2fb6dcce89caa3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Facebook.Unity;
public class PurchaseRowPrefab : MonoBehaviour {
[SerializeField]
private Text _purchaseTokenText;
[SerializeField]
private Text _productIdText;
[SerializeField]
private Text _purchaseTimeText;
[SerializeField]
private GameObject _consumeBtn;
private string DATE_FORMAT = @"M/d/yyyy hh:mm:ss tt";
private Purchase _purchase;
private LogScroller _logScroller;
private PurchasePage _parentScript;
public string GetPurchaseToken () {
return _purchase.PurchaseToken;
}
public void OnLogBtnClick () {
_logScroller.Log(_purchase.ToString());
}
public void OnConsumeBtnClick () {
_parentScript.ConsumePurchase(_purchase, delegate (bool success) {
Destroy(gameObject);
});
}
public void Initialize (PurchasePage parentScript, LogScroller logScroller, Purchase purchase) {
_parentScript = parentScript;
_logScroller = logScroller;
_purchase = purchase;
_purchaseTokenText.text = purchase.PurchaseToken;
_productIdText.text = purchase.ProductID;
_purchaseTimeText.text = purchase.PurchaseTime.ToLocalTime().ToString(DATE_FORMAT);
SetConsumeBtnData(purchase.IsConsumed);
}
private void SetConsumeBtnData (bool isConsumed) {
_consumeBtn.GetComponent<Button>().interactable = !isConsumed;
_consumeBtn.transform.GetChild(0).GetComponent<Text>().text = isConsumed ? "Consumed" : "Consume";
}
}
fileFormatVersion: 2
guid: 9feaad17c481d44469952dc10f3f4bf6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 43804ee08a8b34e12b7fa666fd586774
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: cd44ce6b90761cf40a56f4f255d8b95b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Facebook.Unity;
public class AdsPage : MonoBehaviour {
private LogScroller _logScroller;
// Replace the below INTERSTITIAL_ID and VIDEO_PLACEMENT_ID with your app placement IDs
private string INTERSTITIAL_PLACEMENT_ID = "123456";
private string VIDEO_PLACEMENT_ID = "123456";
private void Awake () {
_logScroller = transform.root.GetComponent<UIState>().logScroller;
}
public void OnLoadInterstitialBtnClick () {
_LogText("Loading Interstitial Ad");
FBGamingServices.LoadInterstitialAd(INTERSTITIAL_PLACEMENT_ID, delegate(IInterstitialAdResult result) {
if (result.Error == null && result.ResultDictionary != null) {
_LogText("Interstitial Ad Loaded");
} else {
_LogText("ERR: Failed to load Interstitial Ad\n" + result.Error.ToString());
}
});
}
public void OnLoadVideoBtnClick () {
_LogText("Loading Video Ad");
FBGamingServices.LoadRewardedVideo(VIDEO_PLACEMENT_ID, delegate(IRewardedVideoResult result) {
if (result.Error == null && result.ResultDictionary != null) {
_LogText("Video Ad Loaded");
} else {
_LogText("ERR: Failed to load Video Ad\n" + result.Error.ToString());
}
});
}
public void OnViewInterstitialBtnClick () {
_LogText("View Interstitial Ad");
FBGamingServices.ShowInterstitialAd(INTERSTITIAL_PLACEMENT_ID, delegate(IInterstitialAdResult result) {
if (result.Error == null && result.ResultDictionary != null) {
_LogText("Interstitial Ad Viewed");
} else {
_LogText("ERR: Failed to view Interstitial Ad\n" + result.Error.ToString());
}
});
}
public void OnViewVideoBtnClick () {
_LogText("View Video Ad");
FBGamingServices.ShowRewardedVideo(VIDEO_PLACEMENT_ID, delegate(IRewardedVideoResult result) {
if (result.Error == null && result.ResultDictionary != null) {
_LogText("Video Ad Viewed");
} else {
_LogText("ERR: Failed to watch Video Ad\n" + result.Error.ToString());
}
});
}
// private
private void _LogText (string text) {
_logScroller.Log(text);
}
}
fileFormatVersion: 2
guid: c27511b840ed846b385304666945e4db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bd18f8ae8b6af4dc68f7c88319ee024b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7d4353ba3d5f24acdbb20ccbd443012a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment