Beispiel #1
0
 public dbService(string dbPath, InitDelegate InitAction, LogDelegate logDelegate = null)
 {
     OnLog  = logDelegate;
     db     = new SQLiteAsyncConnection(dbPath);
     syncDb = db.GetConnection();
     InitAction?.Invoke(this);
 }
Beispiel #2
0
        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 = "en_US", HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null)
        {
#if SA_FB_INSTALLED
            FB_Plugin.FB.Init(appId,
                              clientToken,
                              cookie,
                              logging,
                              status,
                              xfbml,
                              frictionlessRequests,
                              authResponse,
                              javascriptSDKLocale,
                              (isUnityShown) => {
                if (onHideUnity != null)
                {
                    onHideUnity.Invoke(isUnityShown);
                }
            },
                              () => {
                if (onInitComplete != null)
                {
                    onInitComplete.Invoke();
                }
            });
#endif
        }
 /// <summary>
 /// Sets the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors.
 /// This function can only be called once during the lifetime of the object; later calls lead to undefined behavior.
 ///
 /// Also <see cref="ActivateApp()"/> method will be called automatically when initialization is completed
 /// </summary>
 /// <param name="appId">The Facebook application ID of the initializing app. </param>
 /// <param name="clientToken">Client Token</param>
 /// <param name="cookie">Sets a cookie which your server-side code can use to validate a user's Facebook session</param>
 /// <param name="logging">If true, outputs a verbose log to the Javascript console to facilitate debugging. Effective on Web only.</param>
 /// <param name="status">If true, attempts to initialize the Facebook object with valid session data.*</param>
 /// <param name="xfbml">If true, Facebook will immediately parse any XFBML elements on the Facebook Canvas page hosting the app, like the page plugin. Effective on Web only.</param>
 /// <param name="frictionlessRequests">Frictionless Requests</param>
 /// <param name="authResponse">effective in Web Player only, rarely used A Facebook auth_response you have cached to preserve a session, represented in JSON. If an auth_response is provided, FB will initialize itself using the data from that session, with no additional checks.</param>
 /// <param name="javascriptSDKLocale">javascript SDK Locale</param>
 /// <param name="onHideUnity">A function that will be called when Facebook tries to display HTML content within the boundaries of the Canvas. When called with its sole argument set to false, your game should pause and prepare to lose focus. If it's called with its argument set to true, your game should prepare to regain focus and resume play. Your game should check whether it is in fullscreen mode when it resumes, and offer the player a chance to go to fullscreen mode if appropriate.</param>
 /// <param name="onInitComplete">A function that will be called once all data structures in the SDK are initialized; any code that should synchronize with the player's Facebook session should be in onInitComplete().</param>
 // ReSharper disable once IdentifierTypo
 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 = "en_US", HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null)
 {
     FbUnity.Init(appId, clientToken, cookie, logging, status, xfbml, frictionlessRequests, authResponse, javascriptSDKLocale, onHideUnity, () =>
     {
         FbUnity.ActivateApp();
         onInitComplete?.Invoke();
     });
 }
Beispiel #4
0
        /// <summary>
        /// Generates the CMake file
        /// </summary>
        public static void GenerateCMakeFiles()
        {
            Init?.Invoke();
            foreach (var dir in DirList)
            {
                ProcessDir(dir);
            }

            CMakeWriter?.Invoke();
        }
Beispiel #5
0
        public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null)
        {
#if SA_FB_INSTALLED
            FB_Plugin.FB.Init(() => {
                if (onInitComplete != null)
                {
                    onInitComplete.Invoke();
                }
            }, (isUnityShown) => {
                if (onHideUnity != null)
                {
                    onHideUnity.Invoke(isUnityShown);
                }
            },
                              authResponse);
#endif
        }
Beispiel #6
0
        /// <summary>
        /// Sets the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors.
        /// This function can only be called once during the lifetime of the object; later calls lead to undefined behavior.
        /// Relies on properties that are set in the Unity Editor using the Facebook | Edit settings menu option,
        ///
        /// Also <see cref="FB.ActivateApp()"/> method will be callend automaticly when initialization is completed
        /// </summary>
        /// <param name="onInitComplete">A function that will be called once all data structures in the SDK are initialized; any code that should synchronize with the player's Facebook session should be in onInitComplete().</param>
        /// <param name="onHideUnity">A function that will be called when Facebook tries to display HTML content within the boundaries of the Canvas. When called with its sole argument set to false, your game should pause and prepare to lose focus. If it's called with its argument set to true, your game should prepare to regain focus and resume play. Your game should check whether it is in fullscreen mode when it resumes, and offer the player a chance to go to fullscreen mode if appropriate.</param>
        /// <param name="authResponse">effective in Web Player only, rarely used A Facebook auth_response you have cached to preserve a session, represented in JSON. If an auth_response is provided, FB will initialize itself using the data from that session, with no additional checks.</param>
        public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null)
        {
            if (s_isInitializing)
            {
                if (onInitComplete != null)
                {
                    s_initCallback += onInitComplete;
                }
                return;
            }

            s_isInitializing = true;
            SA_FB_Proxy.Init(() => {
                SA_FB_Proxy.ActivateApp();
                s_initCallback += onInitComplete;
                s_initCallback.Invoke();
            }, onHideUnity, authResponse);
        }
Beispiel #7
0
        private void InitItem(GridItem c, int i)
        {
            int iRow = i / lineItemSize;
            int iCol = i % lineItemSize;

            if (i < contentData.Count)
            {
                initDelegate?.Invoke(c, contentData[i], i);
                if (items[i] == null)
                {
                    items[i] = new ItemData(i);
                    var bound =
                        c.bound != null ?
                        new Bounds(c.rect.rect.center, c.rect.rect.size) :
                        RectTransformUtility.CalculateRelativeRectTransformBounds(c.rect);
                    var min = bound.min;
                    var max = bound.max;

                    float x = 0;
                    if (iCol == 0)
                    {
                        if (alignX)
                        {
                            var left  = 0;
                            var right = localClipBounds.width;
                            x = isLeftPivot ? left - min.x + border.x : isRightPivot? right - max.x - border.x: (left + right) * 0.5f;
                        }
                        else if (prefab != null)
                        {
                            x = prefab.rect.localPosition.x;
                        }
                        else // for editor purpose
                        {
                            x = c.rect.localPosition.x;
                        }
                    }
                    else
                    {
                        if (i == startIndex - 1)
                        {
                            var prevBound = items[startIndex].bounds;
                            x = isLeftPivot ? prevBound.min.x - padding.x : isRightPivot? prevBound.max.x + padding.x: prevBound.center.x;
                        }
                        // add to bottom
                        else if (i == endIndex + 1)
                        {
                            var prevBound = items[endIndex].bounds;
                            x = isLeftPivot ? prevBound.max.x + padding.x : isRightPivot? prevBound.min.x - padding.x: prevBound.center.x;
                        }
                    }

                    if (startIndex >= 0)
                    {
                        // add to top
                        if (i == startIndex - 1)
                        {
                            if (iCol == 0)
                            {
                                var dy  = -min.y;
                                var b0  = items[startIndex].bounds;
                                var top = b0.max.y; //upper bound of previous
                                var pos = new Vector2(x, Mathf.RoundToInt(top + 1 + dy + padding.y));
                                min.x += pos.x;
                                min.y += pos.y;
                                max.x += pos.x;
                                max.y += pos.y; // move on the top of the previous
                                bound.SetMinMax(min, max);
                                items[i].pos = pos;
                            }
                            else
                            {
                                bound = items[startIndex].bounds;
                                var pos = items[startIndex].pos;
                                pos.x       += items[startIndex].bounds.size.x + padding.x;
                                items[i].pos = pos;
                            }
                            startIndex = i;
                        }
                        // add to bottom
                        else if (i == endIndex + 1)
                        {
                            if (iCol == 0)
                            {
                                var dy  = max.y;
                                var b0  = items[endIndex].bounds;
                                var pos = isBottomPivot?
                                          new Vector2(x, Mathf.Round(b0.max.y + 1 + dy + padding.y)): // go upward
                                          new Vector2(x, Mathf.Round(b0.min.y - 1 - dy - padding.y)); // go downward
                                min.x += pos.x;
                                min.y += pos.y;
                                max.x += pos.x;
                                max.y += pos.y;
                                bound.SetMinMax(min, max);
                                items[i].pos = pos;
                            }
                            else
                            {
                                bound = items[endIndex].bounds;
                                var pos  = items[endIndex].pos;
                                var span = items[endIndex].bounds.size.x + padding.x;
                                pos.x        = isLeftPivot? pos.x + span: isRightPivot? pos.x - span: pos.x;
                                items[i].pos = pos;
                            }
                            endIndex = i;
                        }
                        else
                        {
                            UnityEngine.Assertions.Assert.IsTrue(false, i.ToString());
                        }
                        items[i].bounds = bound;
                    }
                    else
                    {
                        // for the very first cell
                        var dy = isBottomPivot ? bottom - min.y : top - max.y - border.y;
                        min.x += x;
                        max.x += x;
                        min.y += dy;
                        max.y += dy;

                        bound.SetMinMax(min, max);
                        items[i].bounds = bound;
                        items[i].pos    = new Vector2(Mathf.Round(x), Mathf.Round(dy));
                        startIndex      = i;
                        endIndex        = i;
                    }
                }
                c.item = items[i];
                c.pos  = items[i].pos;
            }
            else
            {
                if (hideInactive)
                {
                    c.gameObject.SetActive(false);
                }
            }
        }
 private static void onSuccessInit()
 {
     onInitCompleteDelegate?.Invoke();
 }
Beispiel #9
0
 public void onSuccessInit(string uid)
 {
     InitComplete?.Invoke();
 }