// Use this for initialization
    void Start()
    {
        _scrollSnap = GameObjectHelper.GetChildComponentOnNamedGameObject <HorizontalScrollSnap>(gameObject, "ScrollView", true);
        _nextButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "NextButton", true);

        container = gameObject;

        //

        AddBanner();

        GameManager.SafeAddListener <BannerLoadedMessage>(BannerLoadedHandler);
        GameManager.SafeAddListener <VideoAdShowingMessage>(VideoAdShowingHandler);

        StartCoroutine(CoRoutines.DelayedCallback(0.5f, BonusCoins));

        ((CustomGameManager)GameManager.Instance).ResetDefaultSound();

        if (!Debug.isDebugBuild)
        {
            FlurryIOS.LogPageView();
            FlurryAndroid.OnPageView();

            Fabric.Answers.Answers.LogContentView("Levels", "Screen");
        }

        _rankSignGameObject  = GameObjectHelper.GetChildNamedGameObject(packsContainer, "Sign", true);
        _rankSignText        = GameObjectHelper.GetChildComponentOnNamedGameObject <Text>(_rankSignGameObject, "RankName", true);
        _ranksVerticalScroll = GameObjectHelper.GetChildComponentOnNamedGameObject <CustomVerticalScrollSnap>(packsContainer, "ScrollView", true);

        PrepareRankForLevel(GameManager.Instance.Levels.Selected);

        _ranksVerticalScroll.StartingScreen = LevelController.Ranks().Items.Length - (_currentRank.Number - 1) - 1;

        if (PreferencesFactory.GetInt(Constants.KeyShowSelectedPack) > 0 &&
            GameManager.Instance.Levels.Selected != null)
        {
            PreferencesFactory.DeleteKey(Constants.KeyShowSelectedPack);

            GoToLevel(GameManager.Instance.Levels.Selected);
        }

#if !UNITY_EDITOR
        AdColonyManager.Instance.RequestAd(); // request ads to cache for CustomLevelButton.cs
#endif
    }
    // Use this for initialization
    void Start()
    {
        Branch.initSession(CallbackWithBranchUniversalObject);

        int show = PreferencesFactory.GetInt(Constants.KeyShowBannerOnMainMenuScreen, 0);

        container = GameObject.Find("Container");

        if (PreferencesFactory.GetInt(Constants.KeyNoAds, 0) == 1)
        {
            show = 0; // disable ads
        }

        _rewardShareButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "RewardButton", true);

        if (_rewardShareButton != null && RewardsShareHelper.WillReward())
        {
            ShowRewardShareButton();
        }

        #if !UNITY_EDITOR
        // delay request until AdColony is configured
        StartCoroutine(CoRoutines.DelayedCallback(1.5f, () =>
        {
            AdColonyManager.Instance.RequestAd();
        }));
        #endif

        if (show > 0)             // show banner only when return to main screen, not cold start
        {
            AddBanner();
            PreferencesFactory.DeleteKey(Constants.KeyShowBannerOnMainMenuScreen);

            int CountClicks = PreferencesFactory.GetInt(Constants.KeyCountMainMenuClicks);
            PreferencesFactory.SetInt(Constants.KeyCountMainMenuClicks, CountClicks + 1);

            //         if (CountClicks > 0 && CountClicks % Constants.ShowAdsPerTime == 0 && Reachability.Instance.IsReachable ()) {
            //	Loading.Instance.Show ();

            //	AdColonyManager.Instance.SetCallback (BannerMainMenuClosed);
            //             AdColonyManager.Instance.PlayAd(AdColonyManager.Instance.AdForZoneId());
            //}
        }
        else             // show banner on cold start
        {
            ColdStart = true;

            int CountMainMenuColdStart = PreferencesFactory.GetInt(Constants.KeyCountMainMenuColdStart);
            PreferencesFactory.SetInt(Constants.KeyCountMainMenuColdStart, CountMainMenuColdStart + 1);
        }

        GameManager.SafeAddListener <BannerLoadedMessage> (BannerLoadedHandler);
        GameManager.SafeAddListener <VideoAdShowingMessage> (VideoAdShowingHandler);

        ((CustomGameManager)GameManager.Instance).ResetDefaultSound();

        if (!Debug.isDebugBuild)
        {
            FlurryIOS.LogPageView();
            FlurryAndroid.OnPageView();

            Fabric.Answers.Answers.LogContentView("Menu", "Screen");
        }

        StartCoroutine(CoRoutines.DelayedCallback(0.5f, () =>
        {
            CheckForPrize();
        }));

        GameSparksManager.Instance.SetGameMode(GameMode.Single);

        AnimatePig();
    }