public virtual void Init( HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { this.onHideUnityDelegate = hideUnityDelegate; this.onInitCompleteDelegate = onInitComplete; }
void Awake() { initDelegate = OnFacebookInitialized; hideUnityDelegate = OnHideUnity; onRoundInformationReceivedDelegate = OnRoundInformationReceived; FB.Init (OnFacebookInitialized, OnHideUnity); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, HideUnityDelegate hideUnityDelegate = null) { if (appId == null || appId == "") { throw new ArgumentException("appId cannot be null or empty!"); } FbDebug.Log("start android init"); var parameters = new Dictionary <string, object>(); if (appId != "") { parameters.Add("appId", appId); } if (cookie != false) { parameters.Add("cookie", true); } if (logging != true) { parameters.Add("logging", false); } if (status != true) { parameters.Add("status", false); } if (xfbml != false) { parameters.Add("xfbml", true); } if (channelUrl != "") { parameters.Add("channelUrl", channelUrl); } if (authResponse != null) { parameters.Add("authResponse", authResponse); } if (frictionlessRequests != false) { parameters.Add("frictionlessRequests", true); } var paramJson = MiniJSON.Json.Serialize(parameters); this.onInitComplete = onInitComplete; this.CallFB("Init", paramJson.ToString()); }
/// <summary> /// FB.Init as per Unity SDK /// </summary> /// <remarks> /// https://developers.facebook.com/docs/unity/reference/current/FB.Init /// </remarks> public static void Init(InitDelegate onInitComplete, string appId, HideUnityDelegate onHideUnity) { #if WINDOWS_PHONE_APP Dispatcher.InvokeOnUIThread(() => { _onHideUnity = onHideUnity; _fbSessionClient = Session.ActiveSession; Session.AppId = appId; Task.Run(async() => { // check and extend token if required await Session.CheckAndExtendTokenIfNeeded(); if (IsLoggedIn) { UserId = Settings.GetString(FBID_KEY); UserName = Settings.GetString(FBNAME_KEY); } if (onInitComplete != null) { Dispatcher.InvokeOnAppThread(() => { onInitComplete(); }); } }); if (onHideUnity != null) { throw new NotSupportedException("onHideUnity is not currently supported at this time."); } }); #else throw new PlatformNotSupportedException(""); #endif }
private IEnumerator OnInit( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { // wait until the native dialogs are loaded while (fb == null) { yield return(null); } fb.Init(onInitComplete, appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate); this.isInitialized = true; if (onInitComplete != null) { onInitComplete(); } }
/// <summary> /// FB.Init as per Unity SDK /// </summary> /// <remarks> /// https://developers.facebook.com/docs/unity/reference/current/FB.Init /// </remarks> public static void Init(InitDelegate onInitComplete, string appId, HideUnityDelegate onHideUnity) { #if WINDOWS_PHONE_APP Dispatcher.InvokeOnUIThread(() => { _onHideUnity = onHideUnity; _fbSessionClient = Session.ActiveSession; Session.AppId = appId; Task.Run(async () => { // check and extend token if required await Session.CheckAndExtendTokenIfNeeded(); if (IsLoggedIn) { UserId = Settings.GetString(FBID_KEY); UserName = Settings.GetString(FBNAME_KEY); } if (onInitComplete != null) { Dispatcher.InvokeOnAppThread(() => { onInitComplete(); }); } }); if (onHideUnity != null) throw new NotSupportedException("onHideUnity is not currently supported at this time."); }); #else throw new PlatformNotSupportedException(""); #endif }
private IEnumerator OnInit( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { // wait until the native dialogs are loaded while (fb == null) { yield return null; } fb.Init(onInitComplete, appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate); if (status || cookie) { isLoggedIn = true; } if (onInitComplete != null) { onInitComplete(); } }
public dbService(string dbPath, InitDelegate InitAction, LogDelegate logDelegate = null) { OnLog = logDelegate; db = new SQLiteAsyncConnection(dbPath); syncDb = db.GetConnection(); InitAction?.Invoke(this); }
public FurtherInit(InitDelegate init) { if (init != null) { FurtherInitFuncs.Add(init); } }
void Start() { // Always initialize FB if (FB.IsInitialized) { OnStart(); } else { if (Helper.IsOnline()) { InitDelegate onInitComplete = () => { FB.ActivateApp(); OnStart(); }; HideUnityDelegate onHideUnity = (isUnityShown) => { Time.timeScale = isUnityShown ? 1.0f : 0.0f; }; FB.Init(onInitComplete, onHideUnity); } else { OnStart(); } } MyAdmob.Instance.ShowBanner(); }
public override void Init( string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { base.Init( appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate, onInitComplete); IOSFacebook.IOSInit( appId, cookie, logging, status, frictionlessRequests, FacebookSettings.IosURLSuffix, Constants.UnitySDKUserAgentSuffixLegacy); }
public override void Init( string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { // Warn that editor behavior will not match supported platforms FacebookLogger.Warn(WarningMessage); base.Init( appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate, onInitComplete); this.EditorGameObject.OnInitComplete(string.Empty); }
public static bool InitApi(string p_strDllPath) { if (!File.Exists(p_strDllPath)) { return(false); } m_hDllHandle = LoadLibrary(p_strDllPath); if (m_hDllHandle == IntPtr.Zero) { return(false); } IntPtr pFunc = GetProcAddress(m_hDllHandle, "Init"); InitDelegate d = (InitDelegate)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitDelegate)); int ret = d(); if (ret <= 0) { return(false); } m_strDllFile = p_strDllPath; return(true); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } var args = new MethodArguments(); args.addNonNullOrEmptyParameter("appId", appId); args.addNonNullParameter("cookie", cookie); args.addNonNullParameter("logging", logging); args.addNonNullParameter("status", status); args.addNonNullParameter("xfbml", xfbml); args.addNonNullOrEmptyParameter("channelUrl", channelUrl); args.addNonNullOrEmptyParameter("authResponse", authResponse); args.addNonNullParameter("frictionlessRequests", frictionlessRequests); var initCall = new JavaMethodCall <IResult>(this, "Init"); initCall.call(args); this.CallFB("SetUserAgentSuffix", String.Format("Unity.{0}", Facebook.Unity.FacebookSdkVersion.Build)); }
public static void Launch(string apiKey, string appUserID, bool debugMode, InitDelegate onInitComplete = null) { if (_Instance != null) { return; } Debug.Log(string.Format("[Qonversion] Launch userID={0}", appUserID)); switch (Application.platform) { case RuntimePlatform.Android: _Instance = new QonversionWrapperAndroid(); break; case RuntimePlatform.IPhonePlayer: _Instance = new QonversionWrapperIOS(); break; default: _Instance = new PurchasesWrapperNoop(); break; } _Instance.Launch(apiKey, string.IsNullOrEmpty(appUserID) ? null : appUserID, debugMode, onInitComplete); }
protected override void CallInit(InitDelegate callback) { ((GameroomFacebook)this.Mock.Facebook).Init( "123456789", null, callback); }
public static void Init(InitDelegate onInitComplete, string appId, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, HideUnityDelegate onHideUnity = null, string authResponse = null) { FB.appId = appId; FB.cookie = cookie; FB.logging = logging; FB.status = status; FB.xfbml = xfbml; FB.frictionlessRequests = frictionlessRequests; FB.authResponse = authResponse; OnInitComplete = onInitComplete; OnHideUnity = onHideUnity; if (!isInitCalled) { FBBuildVersionAttribute versionAttributeOfType = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook)); if (versionAttributeOfType == null) { FbDebugOverride.Warn("Cannot find Facebook SDK Version"); } else { FbDebugOverride.Info(string.Format("Using SDK {0}, Build {1}", versionAttributeOfType.SdkVersion, versionAttributeOfType.BuildVersion)); } throw new NotImplementedException("Facebook API does not yet support this platform"); } FbDebugOverride.Warn("FB.Init() has already been called. You only need to call this once and only once."); if (FacebookImpl != null) { OnDllLoaded(); } }
/** * If you need a more programmatic way to set the facebook app id and other setting call this function. * Useful for a build pipeline that requires no human input. */ public static void Init( InitDelegate onInitComplete, string appId, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, HideUnityDelegate onHideUnity = null, string authResponse = null) { FB.appId = appId; FB.cookie = cookie; FB.logging = logging; FB.status = status; FB.xfbml = xfbml; FB.frictionlessRequests = frictionlessRequests; FB.authResponse = authResponse; FB.OnInitComplete = onInitComplete; FB.OnHideUnity = onHideUnity; if (!isInitCalled) { var versionInfo = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook)); if (versionInfo == null) { FbDebug.Warn("Cannot find Facebook SDK Version"); } else { FbDebug.Info(String.Format("Using SDK {0}, Build {1}", versionInfo.SdkVersion, versionInfo.BuildVersion)); } #if UNITY_EDITOR FBComponentFactory.GetComponent <EditorFacebookLoader>(); #elif UNITY_WEBPLAYER FBComponentFactory.GetComponent <CanvasFacebookLoader>(); #elif UNITY_IOS FBComponentFactory.GetComponent <IOSFacebookLoader>(); #elif UNITY_ANDROID FBComponentFactory.GetComponent <AndroidFacebookLoader>(); #elif UNITY_WP8 FBComponentFactory.GetComponent <WindowsPhoneFacebookLoader>(); #else throw new NotImplementedException("Facebook API does not yet support this platform"); #endif isInitCalled = true; return; } FbDebug.Warn("FB.Init() has already been called. You only need to call this once and only once."); // Init again if possible just in case something bad actually happened. if (FacebookImpl != null) { OnDllLoaded(); } }
public override void Init( string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { if (CanvasFacebook.IntegrationMethodJs == null) { throw new Exception("Cannot initialize facebook javascript"); } base.Init( appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate, onInitComplete); Application.ExternalEval(CanvasFacebook.IntegrationMethodJs); this.appId = appId; bool isPlayer = true; #if UNITY_WEBGL isPlayer = false; #endif MethodArguments parameters = new MethodArguments(); parameters.AddString("appId", appId); parameters.AddPrimative("cookie", cookie); parameters.AddPrimative("logging", logging); parameters.AddPrimative("status", status); parameters.AddPrimative("xfbml", xfbml); parameters.AddString("channelUrl", channelUrl); parameters.AddString("authResponse", authResponse); parameters.AddPrimative("frictionlessRequests", frictionlessRequests); parameters.AddString("version", SDKVersion); // use 1/0 for booleans, otherwise you'll get strings "True"/"False" Application.ExternalCall( "FBUnity.init", isPlayer ? 1 : 0, FacebookConnectURL, SDKLocale, this.sdkDebug ? 1 : 0, parameters.ToJsonString(), status ? 1 : 0); }
static NativeMethods() { IntPtr chromaSdkPointer; if (EnvironmentHelper.Is64BitProcess() && EnvironmentHelper.Is64BitOperatingSystem()) { // We are running 64-bit! chromaSdkPointer = Native.Kernel32.NativeMethods.LoadLibrary("RzChromaSDK64.dll"); } else { // We are running 32-bit! chromaSdkPointer = Native.Kernel32.NativeMethods.LoadLibrary("RzChromaSDK.dll"); } if (chromaSdkPointer == IntPtr.Zero) { throw new ColoreException( "Failed to dynamically load Chroma SDK library (Error " + Marshal.GetLastWin32Error() + ")."); } Init = GetDelegateFromLibrary <InitDelegate>(chromaSdkPointer, "Init"); UnInit = GetDelegateFromLibrary <UnInitDelegate>(chromaSdkPointer, "UnInit"); CreateEffect = GetDelegateFromLibrary <CreateEffectDelegate>(chromaSdkPointer, "CreateEffect"); CreateKeyboardEffect = GetDelegateFromLibrary <CreateKeyboardEffectDelegate>( chromaSdkPointer, "CreateKeyboardEffect"); CreateMouseEffect = GetDelegateFromLibrary <CreateMouseEffectDelegate>(chromaSdkPointer, "CreateMouseEffect"); CreateHeadsetEffect = GetDelegateFromLibrary <CreateHeadsetEffectDelegate>( chromaSdkPointer, "CreateHeadsetEffect"); CreateMousepadEffect = GetDelegateFromLibrary <CreateMousepadEffectDelegate>( chromaSdkPointer, "CreateMousepadEffect"); CreateKeypadEffect = GetDelegateFromLibrary <CreateKeypadEffectDelegate>( chromaSdkPointer, "CreateKeypadEffect"); DeleteEffect = GetDelegateFromLibrary <DeleteEffectDelegate>(chromaSdkPointer, "DeleteEffect"); SetEffect = GetDelegateFromLibrary <SetEffectDelegate>(chromaSdkPointer, "SetEffect"); RegisterEventNotification = GetDelegateFromLibrary <RegisterEventNotificationDelegate>( chromaSdkPointer, "RegisterEventNotification"); UnregisterEventNotification = GetDelegateFromLibrary <UnregisterEventNotificationDelegate>( chromaSdkPointer, "UnregisterEventNotification"); QueryDevice = GetDelegateFromLibrary <QueryDeviceDelegate>(chromaSdkPointer, "QueryDevice"); }
public override void Init(InitDelegate onInitComplete) { // Warn that editor behavior will not match supported platforms FacebookLogger.Warn(WarningMessage); base.Init(onInitComplete); this.editorWrapper.Init(); }
public void DelePaeInit(int glv, int ggread) // 초기화 하고 패를 돌리리는 장면을 위임하여 실행하도록 합니다. { // 초기화 하고 패를 돌리는 장면을 연출하는 MyInitalize 메소드를 호출할 델리게이트 선언 InitDelegate dInit = new InitDelegate(MyInitalize); // Invoke 메소드를 실행 this.Invoke(dInit, new object[] { glv, ggread }); }
private void StartInitialize(bool skipFailed) { btnOK.IsEnabled = false; prgressbar.Visibility = Visibility.Visible; InitDelegate d = Init; d.BeginInvoke(skipFailed, null, null); }
public static void Init( InitDelegate onInitComplete, string appId, HideUnityDelegate onHideUnity, string redirectUrl = null) { onInitComplete(); onHideUnity(false); }
// Call this from program.cs public void SerialDLLInit() { InitDG = new InitDelegate(Init); SetInitComCallback(InitDG); TxCharDG = new TxCharDelegate(Putc); SetTxCharCallback(TxCharDG); RxCharDG = new RxCharDelegate(Getc); SetRxCharCallback(RxCharDG); }
public void Init( string appId, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { base.Init(onInitComplete); this.appId = appId; this.gameroomWrapper.Init(this.OnInitComplete); }
/// <summary> /// Attach default methods to the delegates. If there isn't specified concrete methods the default /// are executed. There is no difference in the parameter order. /// </summary> /// <param name="delegates"> /// A <see cref="System.Delegate"/> /// Methods to handle the cache system functionality. /// </param> public CacheManager(params Delegate[] delegates) { this.storage = new Dictionary <TKey, CacheItem>(); foreach (Delegate d in delegates) { if (d is InitDelegate) { this.initDelegate = (InitDelegate)d; } else if (d is TouchDelegate) { this.touchDelegate = (TouchDelegate)d; } else if (d is ValidateDelegate) { this.validateDelegate = (ValidateDelegate)d; } else if (d is CalculateDelegate) { this.calculateDelegate = (CalculateDelegate)d; } else if (d is UpdateDelegate) { this.updateDelegate = (UpdateDelegate)d; } else if (d is DeleteDelegate) { this.deleteDelegate = (DeleteDelegate)d; } } if (this.initDelegate == null) { this.initDelegate = DefaultInitDelegate; } if (this.touchDelegate == null) { this.touchDelegate = DefaultTouchDelegate; } if (this.validateDelegate == null) { this.validateDelegate = DefaultValidateDelegate; } if (this.calculateDelegate == null) { this.calculateDelegate = DefaultCalculateDelegate; } if (this.updateDelegate == null) { this.updateDelegate = DefaultUpdateDelegate; } if (this.deleteDelegate == null) { this.deleteDelegate = DefaultDeleteDelegate; } }
public BT_BehaviorDelegator(NodeDescription.BT_NodeType type, UpdateDelegate onUpdate, InitDelegate onInit = null, EnterDelegate onEnter = null, ExitDelegate onExit = null, TerminateDelegate onTerm = null) { Description.Type = type; initDel = onInit; enterDel = onEnter; updateDel = onUpdate; exitDel = onExit; terminateDel = onTerm; }
public void Launch(string projectKey, string userID, bool debugMode, InitDelegate onInitComplete) { onInitCompleteDelegate = onInitComplete; #if UNITY_IOS _setDebugMode(debugMode); _launchWithKey(projectKey, userID, onSuccessInit); #endif }
public FuncFactory( string name, InitDelegate initer, LoadDelegate loader ) { this.name = name; this.initer = initer; this.loader = loader; }
public void Init(string appId, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { this.CallFB("SetUserAgentSuffix", string.Format(Constants.UnitySDKUserAgentSuffixLegacy, new object[0])); base.Init(hideUnityDelegate, onInitComplete); MethodArguments methodArguments = new MethodArguments(); methodArguments.AddString("appId", appId); AndroidFacebook.JavaMethodCall <IResult> javaMethodCall = new AndroidFacebook.JavaMethodCall <IResult>(this, "Init"); javaMethodCall.Call(methodArguments); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, HideUnityDelegate hideUnityDelegate = null) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } var parameters = new Dictionary<string, object>(); parameters.Add("appId", appId); if (cookie != false) { parameters.Add("cookie", true); } if (logging != true) { parameters.Add("logging", false); } if (status != true) { parameters.Add("status", false); } if (xfbml != false) { parameters.Add("xfbml", true); } if (!string.IsNullOrEmpty(channelUrl)) { parameters.Add("channelUrl", channelUrl); } if (!string.IsNullOrEmpty(authResponse)) { parameters.Add("authResponse", authResponse); } if (frictionlessRequests != false) { parameters.Add("frictionlessRequests", true); } var paramJson = MiniJSON.Json.Serialize(parameters); this.onInitComplete = onInitComplete; this.CallFB("Init", paramJson.ToString()); }
public abstract void Init( InitDelegate onInitComplete, string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate);
public SpanSortPerf( InitDelegate init, SortDelegate sort, int length, int loopsPerRun) { _init = init; _sort = sort; _keys = new int[length]; _loopsPerRun = loopsPerRun; }
public abstract void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, HideUnityDelegate hideUnityDelegate = null);
public void Initialize(InitDelegate initCb) { if (!FB.IsInitialized) { FB.Init(initCb, OnHideUnity); } else { initCb(); } }
/** * This is the preferred way to call FB.Init(). It will take the facebook app id specified in your * "Facebook" => "Edit Settings" menu when it is called. * * onInitComplete - Delegate is called when FB.Init() finished initializing everything. * By passing in a delegate you can find out when you can safely call the other methods. */ public static void Init(InitDelegate onInitComplete, HideUnityDelegate onHideUnity = null, string authResponse = null) { Init( onInitComplete, FBSettings.AppId, FBSettings.Cookie, FBSettings.Logging, FBSettings.Status, FBSettings.Xfbml, FBSettings.FrictionlessRequests, onHideUnity, authResponse); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { StartCoroutine(OnInit(onInitComplete, appId, cookie, logging, status, xfbml, channelUrl, authResponse, frictionlessRequests, hideUnityDelegate)); }
/** * If you need a more programmatic way to set the facebook app id and other setting call this function. * Useful for a build pipeline that requires no human input. */ public static void Init( InitDelegate onInitComplete, string appId, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, HideUnityDelegate onHideUnity = null, string authResponse = null) { FB.appId = appId; FB.cookie = cookie; FB.logging = logging; FB.status = status; FB.xfbml = xfbml; FB.frictionlessRequests = frictionlessRequests; FB.authResponse = authResponse; FB.OnInitComplete = onInitComplete; FB.OnHideUnity = onHideUnity; if (!isInitCalled) { var versionInfo = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof (IFacebook)); FbDebug.Info(String.Format("Using SDK {0}, Build {1}", versionInfo.Version, versionInfo.ToString())); #if UNITY_EDITOR FBComponentFactory.GetComponent<EditorFacebookLoader>(); #elif UNITY_WEBPLAYER FBComponentFactory.GetComponent<CanvasFacebookLoader>(); #elif UNITY_IOS FBComponentFactory.GetComponent<IOSFacebookLoader>(); #elif UNITY_ANDROID FBComponentFactory.GetComponent<AndroidFacebookLoader>(); #else throw new NotImplementedException("Facebook API does not yet support this platform"); #endif isInitCalled = true; return; } FbDebug.Warn("FB.Init() has already been called. You only need to call this once and only once."); // Init again if possible just in case something bad actually happened. if (FacebookImpl != null) { OnDllLoaded(); } }
public virtual void Init( string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { this.onHideUnityDelegate = hideUnityDelegate; this.onInitCompleteDelegate = onInitComplete; }
protected override void CallInit(InitDelegate callback) { ((CanvasFacebook)this.Mock.Facebook).Init( "123456789", true, true, true, false, null, null, false, "en_US", false, null, callback); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { this.isInitialized = true; if (onInitComplete != null) { onInitComplete(); } }
public static void Init(InitDelegate del) { FB.Init (del, OnHideUnity); }
/// <summary> /// If you need a more programmatic way to set the facebook app id and other setting call this function. /// Useful for a build pipeline that requires no human input. /// </summary> /// <param name="appId">App identifier.</param> /// <param name="cookie">If set to <c>true</c> cookie.</param> /// <param name="logging">If set to <c>true</c> logging.</param> /// <param name="status">If set to <c>true</c> status.</param> /// <param name="xfbml">If set to <c>true</c> xfbml.</param> /// <param name="frictionlessRequests">If set to <c>true</c> frictionless requests.</param> /// <param name="authResponse">Auth response.</param> /// <param name="onHideUnity"> /// A delegate to invoke when unity is hidden. /// </param> /// <param name="onInitComplete"> /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. /// </param> public static void Init( string appId, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } FB.appId = appId; FB.cookie = cookie; FB.logging = logging; FB.status = status; FB.xfbml = xfbml; FB.frictionlessRequests = frictionlessRequests; FB.authResponse = authResponse; FB.onInitComplete = onInitComplete; FB.onHideUnity = onHideUnity; if (!isInitCalled) { FB.LogVersion(); #if UNITY_EDITOR ComponentFactory.GetComponent<EditorFacebookLoader>(); #elif UNITY_WEBPLAYER || UNITY_WEBGL ComponentFactory.GetComponent<CanvasFacebookLoader>(); #elif UNITY_IOS ComponentFactory.GetComponent<IOSFacebookLoader>(); #elif UNITY_ANDROID ComponentFactory.GetComponent<AndroidFacebookLoader>(); #else throw new NotImplementedException("Facebook API does not yet support this platform"); #endif isInitCalled = true; return; } FacebookLogger.Warn("FB.Init() has already been called. You only need to call this once and only once."); // Init again if possible just in case something bad actually happened. if (FacebookImpl != null) { OnDllLoaded(); } }
protected override void CallInit(InitDelegate callback) { ((AndroidFacebook)this.Mock.Facebook).Init("123456789", null, callback); }
public virtual void Init(InitDelegate onInitComplete) { this.onInitCompleteDelegate = onInitComplete; }
protected override void CallInit(InitDelegate callback) { ((EditorFacebook)this.Mock.Facebook).Init(null, callback); }
public static void Init( InitDelegate onInitComplete, string appId, HideUnityDelegate onHideUnity, string redirectUrl = null) { #if NETFX_CORE if (_client != null) { if (onInitComplete != null) onInitComplete(); return; } if (_web == null) throw new MissingPlatformException(); if (string.IsNullOrEmpty(appId)) throw new ArgumentException("Invalid Facebook App ID"); if (!string.IsNullOrEmpty(redirectUrl)) _redirectUrl = redirectUrl; _client = new FacebookClient(); _client.GetCompleted += HandleGetCompleted; AppId = _client.AppId = appId; _onHideUnity = onHideUnity; if (Settings.HasKey(TOKEN_KEY)) { AccessToken = EncryptionProvider.Decrypt(Settings.GetString(TOKEN_KEY), AppId); if (Settings.HasKey(EXPIRY_DATE)) { string expDate = EncryptionProvider.Decrypt(Settings.GetString(EXPIRY_DATE), AppId); Expires = DateTime.Parse(expDate, CultureInfo.InvariantCulture); } else { long expDate = Settings.GetLong(EXPIRY_DATE_BIN); Expires = DateTime.FromBinary(expDate); } _client.AccessToken = AccessToken; UserId = Settings.GetString(FBID_KEY); UserName = Settings.GetString(FBNAME_KEY); // verifies if the token has expired: if (DateTime.Compare(DateTime.UtcNow, Expires) > 0) InvalidateData(); //var task = TestAccessToken(); //task.Wait(); } if (onInitComplete != null) onInitComplete(); #else throw new PlatformNotSupportedException(""); #endif }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { string unityUserAgentSuffix = String.Format("Unity.{0}", Facebook.FacebookSdkVersion.Build); iosInit(appId, cookie, logging, status, frictionlessRequests, FBSettings.IosURLSuffix, unityUserAgentSuffix); this.onInitComplete = onInitComplete; }
/// <summary> /// If you need a more programmatic way to set the facebook app id and other setting call this function. /// Useful for a build pipeline that requires no human input. /// </summary> /// <param name="appId">App identifier.</param> /// <param name="clientToken">App client token.</param> /// <param name="cookie">If set to <c>true</c> cookie.</param> /// <param name="logging">If set to <c>true</c> logging.</param> /// <param name="status">If set to <c>true</c> status.</param> /// <param name="xfbml">If set to <c>true</c> xfbml.</param> /// <param name="frictionlessRequests">If set to <c>true</c> frictionless requests.</param> /// <param name="authResponse">Auth response.</param> /// <param name="javascriptSDKLocale"> /// The locale of the js sdk used see /// https://developers.facebook.com/docs/internationalization#plugins. /// </param> /// <param name="onHideUnity"> /// A delegate to invoke when unity is hidden. /// </param> /// <param name="onInitComplete"> /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. /// </param> public static void Init( string appId, string clientToken = null, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, string javascriptSDKLocale = FB.DefaultJSSDKLocale, HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } FB.AppId = appId; FB.ClientToken = clientToken; if (!isInitCalled) { isInitCalled = true; if (Constants.IsEditor) { FB.OnDLLLoadedDelegate = delegate { ((EditorFacebook)FB.facebook).Init(onInitComplete); }; ComponentFactory.GetComponent<EditorFacebookLoader>(); } else { switch (Constants.CurrentPlatform) { case FacebookUnityPlatform.WebGL: FB.OnDLLLoadedDelegate = delegate { ((CanvasFacebook)FB.facebook).Init( appId, cookie, logging, status, xfbml, FacebookSettings.ChannelUrl, authResponse, frictionlessRequests, javascriptSDKLocale, Constants.DebugMode, onHideUnity, onInitComplete); }; ComponentFactory.GetComponent<CanvasFacebookLoader>(); break; case FacebookUnityPlatform.IOS: FB.OnDLLLoadedDelegate = delegate { ((IOSFacebook)FB.facebook).Init( appId, frictionlessRequests, FacebookSettings.IosURLSuffix, onHideUnity, onInitComplete); }; ComponentFactory.GetComponent<IOSFacebookLoader>(); break; case FacebookUnityPlatform.Android: FB.OnDLLLoadedDelegate = delegate { ((AndroidFacebook)FB.facebook).Init( appId, onHideUnity, onInitComplete); }; ComponentFactory.GetComponent<AndroidFacebookLoader>(); break; case FacebookUnityPlatform.Arcade: FB.OnDLLLoadedDelegate = delegate { ((ArcadeFacebook)FB.facebook).Init(appId, onHideUnity, onInitComplete); }; ComponentFactory.GetComponent<ArcadeFacebookLoader>(); break; default: throw new NotSupportedException("The facebook sdk does not support this platform"); } } } else { FacebookLogger.Warn("FB.Init() has already been called. You only need to call this once and only once."); } }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie, bool logging, bool status, bool xfbml, string channelUrl, string authResponse, bool frictionlessRequests, HideUnityDelegate hideUnityDelegate) { if (onInitComplete != null) { onInitComplete(); } var editorFB = ComponentFactory.GetComponent<EditorFacebookGameObject>(); editorFB.OnInitComplete(""); }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { //Init Facebook. This will load in UserID and AccessToken if made a previous login. FacebookWP8.Init(appId); if(FacebookWP8.IsLoggedIn){ //If Logged in (UserID and Token was saved and valid then set login = true //Dll checks if the token if valid. isLoggedIn = FacebookWP8.IsLoggedIn; //Only true if token and User are not blank. accessToken = FacebookWP8.AccessToken; userId = FacebookWP8.UserID; } else if(FacebookWP8.AccessToken.Length > 0){ //If Only access token is there, because login with DLL only produces the Acess Token, //Then Complete Login isLoggedIn = false; accessToken = FacebookWP8.AccessToken; StartCoroutine(LoginComplete()); } else{ //If AccessToken and User are blank in FacebookWP8 class then login if false. isLoggedIn = false; } if (onInitComplete != null){ onInitComplete(); } }
public void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, Facebook.HideUnityDelegate hideUnityDelegate = null) { iosInit(cookie, logging, status, frictionlessRequests); externalInitDelegate = onInitComplete; }
/// <summary> /// This is the preferred way to call FB.Init(). It will take the facebook app id specified in your "Facebook" /// => "Edit Settings" menu when it is called. /// </summary> /// <param name="onInitComplete"> /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find /// out when you can safely call the other methods. /// </param> /// <param name="onHideUnity">A delegate to invoke when unity is hidden.</param> /// <param name="authResponse">Auth response.</param> public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null) { Init( FacebookSettings.AppId, FacebookSettings.ClientToken, FacebookSettings.Cookie, FacebookSettings.Logging, FacebookSettings.Status, FacebookSettings.Xfbml, FacebookSettings.FrictionlessRequests, authResponse, FB.DefaultJSSDKLocale, onHideUnity, onInitComplete); }
public void Init( string appId, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { base.Init(onInitComplete); this.appId = appId; string accessTokenInfo; Utilities.CommandLineArguments.TryGetValue("/access_token", out accessTokenInfo); if (accessTokenInfo != null) { accessTokenInfo = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(accessTokenInfo)); this.OnInitComplete(new ResultContainer(accessTokenInfo)); } else { this.OnInitComplete(new ResultContainer(string.Empty)); } }
public override void Init( InitDelegate onInitComplete, string appId, bool cookie = false, bool logging = true, bool status = true, bool xfbml = false, string channelUrl = "", string authResponse = null, bool frictionlessRequests = false, HideUnityDelegate hideUnityDelegate = null) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentException("appId cannot be null or empty!"); } if (integrationMethodJs == null) { #if !UNITY_EDITOR throw new Exception("Cannot initialize facebook javascript"); #endif } this.onInitComplete = onInitComplete; OnHideUnity = hideUnityDelegate; var parameters = new Dictionary<string, object>(); this.appId = appId; parameters.Add("appId", appId); if (cookie != false) { parameters.Add("cookie", true); } if (logging != true) { parameters.Add("logging", false); } if (status != true) { parameters.Add("status", false); } if (xfbml != false) { parameters.Add("xfbml", true); } if (!string.IsNullOrEmpty(channelUrl)) { parameters.Add("channelUrl", channelUrl); } if (!string.IsNullOrEmpty(authResponse)) { parameters.Add("authResponse", authResponse); } if (frictionlessRequests != false) { parameters.Add("frictionlessRequests", true); } // Post-F8 SDK mandates specifying a version parameters.Add("version", "v2.2"); var paramJson = MiniJSON.Json.Serialize(parameters); Application.ExternalEval(integrationMethodJs); bool isPlayer = true; #if UNITY_WEBGL isPlayer = false; #endif // use 1/0 for booleans, otherwise you'll get strings "True"/"False" Application.ExternalCall("FBUnity.init", isPlayer ? 1 : 0, FacebookConnectURL, sdkLocale, sdkDebug ? 1 : 0, paramJson, status ? 1 : 0); }
public override void Init( HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { // Warn that editor behavior will not match supported platforms FacebookLogger.Warn(WarningMessage); base.Init( hideUnityDelegate, onInitComplete); this.editorWrapper.Init(); }