Ejemplo n.º 1
0
        IEnumerator Init()
        {
            yield return(new WaitForEndOfFrame());

            // init
            SetPagePositions();
            SetPage(startingPage);
            InitPageSelection();
            SetPageSelection(startingPage);
            // prev and next buttons
            if (nextButton)
            {
                nextButton.GetComponent <Button>().onClick.AddListener(() => { NextScreen(); });
            }
            if (prevButton)
            {
                prevButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
            }
            if (nextIbanButton)
            {
                nextIbanButton.GetComponent <Button>().onClick.AddListener(() => { NextScreen(); });
            }
            if (prevIbanButton)
            {
                prevIbanButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
            }
            if (prevIbanButton)
            {
                prevIdentityButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
            }
            //IdProof
            if (AddressButton)
            {
                AddressButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(2);
                });
            }
            if (IdButton)
            {
                IdButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0);
                });
            }
            //Goto Pages
            if (WalletButton)
            {
                WalletButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(2); ShowScene("Wallet");
                    //Age.SetActive(true);
                });
            }
            if (CompteButton)
            {
                CompteButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(1); ShowScene("Compte");
                });
            }
            if (HistoryButton)
            {
                HistoryButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(4); ShowScene("History");
                });
            }
            if (WithdrawButton)
            {
                WithdrawButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(3); ShowScene("Withdraw");
                });
            }
            if (ProfilButton)
            {
                ProfilButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    ProfilLastResultListController.profileSceneOpened = false;
                    LerpToPage(3); ShowScene("ProfilePresenter");
                });
            }
            if (SponsorButton)
            {
                SponsorButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(4); ShowScene("SponsorFriend");
                });
            }
            if (HelpCenterButton)
            {
                HelpCenterButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(4); ShowScene("HelpCenter");
                });
            }
            if (BackToMenuButton)
            {
                BackToMenuButton.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene(0); });
            }
            //PreviousToSetting
            if (WalletBackButton)
            {
                WalletBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                    BottomMenuController.Get.selectSettings();
                    ViewsEvents.Get.SettingsClick();
                    //Age.SetActive(false);
                });
            }
            if (CompteBackButton)
            {
                CompteBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0);
                    BottomMenuController.Get.selectSettings();
                    ViewsEvents.Get.SettingsClick();
                    ShowScene("Settings");
                });
            }
            if (ProfilBackButton)
            {
                ProfilBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                });
            }
            if (SponsorBackButton)
            {
                SponsorBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                });
            }
            if (HelpCenterBackButton)
            {
                HelpCenterBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                    BottomMenuController.Get.selectSettings();
                    ViewsEvents.Get.SettingsClick();
                });
            }
            if (HistoryBackButton)
            {
                HistoryBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                    BottomMenuController.Get.selectSettings();
                    ViewsEvents.Get.SettingsClick();
                });
            }
            if (WithdrawBackButton)
            {
                WithdrawBackButton.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(0); ShowScene("Settings");
                    BottomMenuController.Get.selectSettings();
                    ViewsEvents.Get.SettingsClick();
                });
            }
            if (Signin_SendEmail)
            {
                Signin_SendEmail.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(2);
                });
            }
            if (Signin_SubmitCode)
            {
                Signin_SubmitCode.GetComponent <Button>().onClick.AddListener(() =>
                {
                    LerpToPage(3);
                });
            }
            try
            {
                if (Signin_Resend.Length > 0)
                {
                    foreach (GameObject resend in Signin_Resend)
                    {
                        resend.GetComponent <Button>().onClick.AddListener(() =>
                        {
                            LerpToPage(1);
                        });
                    }
                }
            }
            catch (NullReferenceException)
            {
            }
            try
            {
                if (Signin_Done.Length > 0)
                {
                    foreach (GameObject done in Signin_Done)
                    {
                        done.GetComponent <Button>().onClick.AddListener(() =>
                        {
                            LerpToPage(0);
                        });
                    }
                }
            }
            catch (NullReferenceException)
            {
            }
        }
Ejemplo n.º 2
0
 void Start()
 {
     _scrollRectComponent = GetComponent <ScrollRect>();
     _scrollRectRect      = GetComponent <RectTransform>();
     _container           = _scrollRectComponent.content;
     _pageCount           = _container.childCount;
     // is it horizontal or vertical scrollrect
     if (_scrollRectComponent.horizontal && !_scrollRectComponent.vertical)
     {
         _horizontal = true;
     }
     else if (!_scrollRectComponent.horizontal && _scrollRectComponent.vertical)
     {
         _horizontal = false;
     }
     else
     {
         //Debug.LogWarning("Confusing setting of horizontal/vertical direction. Default set to horizontal.");
         _horizontal = true;
     }
     _lerp = false;
     // init
     SetPagePositions();
     SetPage(startingPage);
     InitPageSelection();
     SetPageSelection(startingPage);
     // prev and next buttons
     if (nextButton)
     {
         nextButton.GetComponent <Button>().onClick.AddListener(() => { NextScreen(); });
     }
     if (prevButton)
     {
         prevButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
     }
     if (nextIbanButton)
     {
         nextIbanButton.GetComponent <Button>().onClick.AddListener(() => { NextScreen(); });
     }
     if (prevIbanButton)
     {
         prevIbanButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
     }
     if (prevIbanButton)
     {
         prevIdentityButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
     }
     //IdProof
     if (AddressButton)
     {
         AddressButton.GetComponent <Button>().onClick.AddListener(() =>
         {
             LerpToPage(2);
         });
     }
     if (IdButton)
     {
         IdButton.GetComponent <Button>().onClick.AddListener(() =>
         {
             LerpToPage(0);
         });
     }
     //Goto Pages
     if (WalletButton)
     {
         WalletButton.GetComponent <Button>().onClick.AddListener(() => {
             LerpToPage(2); ShowScene("Wallet");
             Age.SetActive(true);
         });
     }
     if (CompteButton)
     {
         CompteButton.GetComponent <Button>().onClick.AddListener(() => {
             LerpToPage(1); ShowScene("Compte");
         });
     }
     if (HistoryButton)
     {
         HistoryButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(4); ShowScene("History"); });
     }
     if (WithdrawButton)
     {
         WithdrawButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(3); ShowScene("Withdraw"); });
     }
     if (ProfilButton)
     {
         ProfilButton.GetComponent <Button>().onClick.AddListener(() => {
             ProfilLastResultListController.profileSceneOpened = false;
             LerpToPage(3); ShowScene("Profile");
         });
     }
     if (SponsorButton)
     {
         SponsorButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(4); ShowScene("SponsorFriend"); });
     }
     if (HelpCenterButton)
     {
         HelpCenterButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(4); ShowScene("HelpCenter"); });
     }
     if (BackToMenuButton)
     {
         BackToMenuButton.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("FirstScene"); });
     }
     //PreviousToSetting
     if (WalletBackButton)
     {
         WalletBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings");
                                                                              Age.SetActive(false); });
     }
     if (CompteBackButton)
     {
         CompteBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings"); });
     }
     if (ProfilBackButton)
     {
         ProfilBackButton.GetComponent <Button>().onClick.AddListener(() =>
         {
             LerpToPage(0); ShowScene("Settings");
         });
     }
     if (SponsorBackButton)
     {
         SponsorBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings"); });
     }
     if (HelpCenterBackButton)
     {
         HelpCenterBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings"); });
     }
     if (HistoryBackButton)
     {
         HistoryBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings"); });
     }
     if (WithdrawBackButton)
     {
         WithdrawBackButton.GetComponent <Button>().onClick.AddListener(() => { LerpToPage(0); ShowScene("Settings"); });
     }
     if (Signin_SendEmail)
     {
         Signin_SendEmail.GetComponent <Button>().onClick.AddListener(() => {
             LerpToPage(2);
         });
     }
     if (Signin_SubmitCode)
     {
         Signin_SubmitCode.GetComponent <Button>().onClick.AddListener(() => {
             LerpToPage(3);
         });
     }
     try{
         foreach (GameObject resend in Signin_Resend)
         {
             resend.GetComponent <Button>().onClick.AddListener(() => {
                 LerpToPage(1);
             });
         }
     }catch (NullReferenceException ex) {
     }
     try{
         foreach (GameObject done in Signin_Done)
         {
             done.GetComponent <Button>().onClick.AddListener(() => {
                 LerpToPage(0);
             });
         }
     }catch (NullReferenceException ex) {
     }
 }