Esempio n. 1
0
    public static void SetInteractable(this Canvas canvas, bool interactable)
    {
        IgnoreRaycast ignoreRaycast = canvas.GetComponent <IgnoreRaycast>();

        if (ignoreRaycast != null)
        {
            ignoreRaycast.interactable = interactable;
        }
    }
Esempio n. 2
0
    void OnStart()
    {
        if (!FB.IsLoggedIn)
        {
            // Check to show login FB
            if (UserData.Instance.ShowLoginFBTimes < 3 &&
                !Manager.Instance.isShowLoginFB &&
                UserData.Instance.Level >= 10)
            {
                UserData.Instance.ShowLoginFBTimes++;
                Manager.Instance.isShowLoginFB = true;
                Manager.Instance.ShowConfirm("Connect Facebook", "Please connect with facebook to save your progress and see your friends",
                                             (isOK) =>
                {
                    if (isOK)
                    {
                        Debug.Log("Connect FB, choosse OK ...");
                        ConnectFacebook();

                        UserData.Instance.ShowLoginFBTimes = 3;
                    }
                    else
                    {
                        Debug.Log("Cancel, no connect FB ...");
                    }
                });
            }
        }

        if (!Manager.Instance.isShowNewVersion && UserData.Instance.Level >= 4)
        {
            SCross.Instance.ShowMessage("cyrus_bean_jump", "1.6.0", (result, message) => {
            });
            Manager.Instance.isShowNewVersion = true;
        }


        if (UserData.Instance.Level > 15)
        {
            SCross.Instance.GetImage("cyrus_bean_jump", (result, message) => {
                if (result)
                {
                    SCross.Instance.ShowPopupScross();
                }
            });
        }

        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        // Update Facebook
        FBManager.Instance.OnUpdate();

        // Play BGM
        SoundManager.Instance.PlayMusic(SoundID.MainMenu);

        // Sunlight
        if (sunlight != null)
        {
            // Get top
            float top = Camera.main.orthographicSize;

            // Get right
            float right = Camera.main.GetOrthographicWidth();

            sunlight.transform.position      = new Vector3(right - Random.Range(0.0f, 0.1f), top + 2.0f, 0);
            sunlight.transform.localRotation = Quaternion.Euler(0, 0, Random.Range(240.0f, 250.0f));

            int count = sunlight.transform.childCount;

            for (int i = 0; i < count; i++)
            {
                sunlight.transform.GetChild(i).localScale = new Vector3(Random.Range(9.0f, 10.0f), Random.Range(0.85f, 1.0f), 1.0f);
            }

            float startOpacity = Random.value * 0.1f;
            sunlight.SetAlpha(startOpacity, true);

            var rotate  = RotateAction.RotateBy(Random.Range(-20.0f, -25.0f), 18.0f, Ease.Linear, LerpDirection.PingPongForever);
            var fadeIn  = FadeAction.RecursiveFadeTo(Random.Range(0.6f, 0.7f), 18.0f);
            var delay1  = DelayAction.Create(6.0f);
            var fadeOut = FadeAction.RecursiveFadeTo(startOpacity, 18.0f);
            var delay2  = DelayAction.Create(6.0f);
            var fade    = SequenceAction.Create(fadeIn, delay1, fadeOut, delay2);
            var action  = ParallelAction.ParallelAll(rotate, RepeatAction.RepeatForever(fade, false));

            sunlight.Play(action);
        }

        // Get ignore raycast
        _ignoreRaycast = GameObject.FindObjectOfType <IgnoreRaycast>();

        if (!UserData.Instance.PlayedCutscene1)
        {
            UserData.Instance.PlayedCutscene1 = true;
            cutscene1.SetActive(true);
        }

        // Update Connect button
        UpdateConnectFacebook(true);

        googleAnalytics.LogScreen("Main Menu");

        _requestUpdater.Play(UpdateRequests);

        Manager.Instance.SetUpdateSendRequests(true);
    }