ResizeToParrent() публичный статический Метод

public static ResizeToParrent ( GameObject go ) : void
go UnityEngine.GameObject
Результат void
 private void DrawError(XsollaError error)
 {
     if (mainScreenContainer != null)
     {
         currentActive = ActiveScreen.ERROR;
         GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR)) as GameObject;
         errorScreen.transform.SetParent(mainScreenContainer.transform);
         errorScreen.GetComponent <RectTransform> ().anchoredPosition     = new Vector2(0, 0);
         mainScreenContainer.GetComponentInParent <ScrollRect> ().content = errorScreen.GetComponent <RectTransform> ();
         ScreenErrorController controller = errorScreen.GetComponent <ScreenErrorController> ();
         controller.ErrorHandler += OnErrorRecivied;
         controller.DrawScreen(error);
     }
     else
     {
         GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR_MAIN)) as GameObject;
         errorScreen.transform.SetParent(container.transform);
         Text[] texts = errorScreen.GetComponentsInChildren <Text>();
         texts[1].text = "Somthing went wrong";
         texts[2].text = error.errorMessage;
         texts[3].text = error.errorCode.ToString();
         texts[3].gameObject.SetActive(false);
         Resizer.ResizeToParrent(errorScreen);
     }
 }
        protected override void ShowHistory(XsollaHistoryList pList)
        {
            GameObject        screenHistoryView;
            HistoryController controller;

            controller = GameObject.FindObjectOfType <HistoryController>();
            // if we have controller
            if (controller != null)
            {
                controller = GameObject.FindObjectOfType <HistoryController>();
                if (!controller.IsRefresh())
                {
                    controller.AddListRows(Utils.GetTranslations(), pList);
                }
                else
                {
                    controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
                }
            }
            else
            {
                currentActive     = ActiveScreen.HISTORY_LIST;
                screenHistoryView = Instantiate(Resources.Load(PREFAB_SCREEN_HISTORY_USER)) as GameObject;
                controller        = screenHistoryView.GetComponent <HistoryController>();
                if (controller != null)
                {
                    controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
                }
                // clear container
                //Resizer.DestroyChilds(mainScreenContainer.transform);
                screenHistoryView.transform.SetParent(mainScreenContainer.transform);
                screenHistoryView.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
                Resizer.ResizeToParrent(screenHistoryView);
            }
        }
        public void InitScreen(XsollaUtils utils, XsollaForm form)
        {
            XsollaTranslations translations = utils.GetTranslations();

            Resizer.ResizeToParrent(gameObject);
            bool isPurchaseNull = utils.GetPurchase() == null;

            if (isPurchaseNull || !utils.GetPurchase().IsPurchase() || !utils.GetPurchase().IsPaymentSystem())
            {
                if (!isPurchaseNull)
                {
                    isPrevStepPaymentList = !utils.GetPurchase().IsPaymentSystem();
                }
                paymentForm.OnClickBack += () => {
                    Back();
                };
            }
            paymentForm.InitView(translations, form);
            if (form.GetSummary() != null)
            {
                tower.InitView(translations, form.GetSummary());
            }
            else
            {
                tower.gameObject.SetActive(false);
            }
        }
Пример #4
0
 protected override void RecieveUtils(XsollaUtils utils)
 {
     Resizer.ResizeToParrent(mainScreen);
     base.RecieveUtils(utils);
     InitHeader(utils);
     InitFooter(utils);
     if (utils.GetPurchase() == null || !utils.GetPurchase().IsPurchase())
     {
         InitMenu(utils);
     }
 }
        public void OpenPricepoints(string title, XsollaPricepointsManager pricepoints, string virtualCurrencyName, string buyBtnText, bool pCustomHref = false, XsollaUtils pUtils = null)
        {
            Resizer.ResizeToParrent(gameObject);
            menu.transform.parent.parent.gameObject.SetActive(false);
            SetTitle(title);
            // if we have custom amount we need show link object
            if (pCustomHref)
            {
                CustomAmountLink.SetActive(true);
                string customAmountShowTitle = pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_CUSTOM_AMOUNT_SHOW_TITLE);
                string customAmountHideTitle = pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_CUSTOM_AMOUNT_HIDE_TITLE);

                Text titleCustomAmount = CustomAmountLink.GetComponent <Text>();
                titleCustomAmount.text = customAmountShowTitle;

                Toggle toggle = CustomAmountLink.GetComponent <Toggle>();
                toggle.onValueChanged.AddListener((value) =>
                {
                    if (value)
                    {
                        titleCustomAmount.text = customAmountHideTitle;
                    }
                    else
                    {
                        titleCustomAmount.text = customAmountShowTitle;
                    }

                    CustomAmountScreen.SetActive(value);
                    ShopPanel.SetActive(!value);

                    Logger.Log("Change value toggle " + value.ToString());
                });

                CustomVirtCurrAmountController controller = CustomAmountScreen.GetComponent <CustomVirtCurrAmountController>() as CustomVirtCurrAmountController;
                controller.initScreen(pUtils, pricepoints.GetItemByPosition(1).currency, CalcCustomAmount, TryPayCustomAmount);
            }
            else
            {
                CustomAmountLink.SetActive(false);
            }

            pAdapter.SetManager(pricepoints, virtualCurrencyName, buyBtnText);
            if (pAdapter.OnBuyPricepoints == null)
            {
                pAdapter.OnBuyPricepoints += (outAmount) => {
                    Dictionary <string, object> map = new Dictionary <string, object> (1);
                    map.Add("out", outAmount);
                    OpenPaymentMethods(map, false);
                };
            }
            DrawContent(pAdapter, 3);
        }
 public void OpenGoods(XsollaGroupsManager groups)
 {
     Resizer.ResizeToParrent(gameObject);
     menu.transform.parent.parent.gameObject.SetActive(true);
     SetTitle(groups.GetItemByPosition(0).name);
     menu.SetData((groupId) => {
         XsollaGoodsGroup group = groups.GetItemByKey(groupId);
         radioGroup.SelectItem(groups.GetItemsList().IndexOf(group));
         ChooseItemsGroup(group.id, group.name);
     }, groups.GetNamesDict());
     radioGroup.SetButtons(menu.GetItems());
     radioGroup.SelectItem(0);
 }
Пример #7
0
        public void OpenPricepoints(XsollaPricepoints pricepoints)
        {
            GridView           gridView = GetComponentInChildren <GridView> ();
            PricePointsAdapter adapter  = GetComponentInChildren <PricePointsAdapter>();

            adapter.SetManager(pricepoints);
            adapter.OnBuyPricepoints += (outAmount) => {
                Dictionary <string, object> map = new Dictionary <string, object> (1);
                map.Add("out", outAmount);
                //				StartPayment (map);
                OpenPaymentMethods(map);
            };
            gridView.SetAdapter(adapter, 3);
            Resizer.ResizeToParrent(gameObject);
        }
 public void OpenSubscriptions(string title, XsollaSubscriptions subscriptions)
 {
     Resizer.ResizeToParrent(gameObject);
     menu.transform.parent.parent.gameObject.SetActive(false);
     SetTitle(title);
     sAdapter.SetManager(subscriptions);
     if (sAdapter.OnBuySubscription == null)
     {
         sAdapter.OnBuySubscription += (subscriptionId) => {
             Dictionary <string, object> map = new Dictionary <string, object> (1);
             map.Add("id_package", subscriptionId);
             OpenPaymentMethods(map, false);
         };
     }
     DrawContent(sAdapter, 1);
 }
 protected override void RecieveUtils(XsollaUtils utils)
 {
     StyleManager.Instance.ChangeTheme(utils.GetSettings().GetTheme());
     mainScreen = Instantiate(mainScreen);
     mainScreen.transform.SetParent(container.transform);
     mainScreen.SetActive(true);
     mainScreenContainer = mainScreen.GetComponentsInChildren <ScrollRect> ()[0].gameObject;
     menuTransform       = mainScreen.GetComponentsInChildren <RectTransform> ()[8].transform;
     Resizer.ResizeToParrent(mainScreen);
     base.RecieveUtils(utils);
     InitHeader(utils);
     InitFooter(utils);
     if (utils.GetPurchase() == null || !utils.GetPurchase().IsPurchase())
     {
         InitMenu(utils);
     }
 }
        public void ShowRedeemCoupon()
        {
            currentActive = ActiveScreen.REDEEM_COUPONS;
            GameObject screenRedeemCoupons = Instantiate(Resources.Load(PREFAB_SCREEN_REDEEM_COUPON)) as GameObject;

            // clear container
            Resizer.DestroyChilds(mainScreenContainer.transform);
            screenRedeemCoupons.transform.SetParent(mainScreenContainer.transform);
            screenRedeemCoupons.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
            Resizer.ResizeToParrent(screenRedeemCoupons);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = screenRedeemCoupons.GetComponent <RectTransform> ();
            _couponController = screenRedeemCoupons.GetComponent <RedeemCouponViewController>();
            _couponController.InitScreen(base.Utils);
            _couponController._btnApply.onClick.AddListener(delegate
            {
                CouponApplyClick(_couponController.GetCode());
            });
        }
        protected override void RecieveUtils(XsollaUtils utils)
        {
            StyleManager.Instance.ChangeTheme(utils.GetSettings().GetTheme());
            mainScreen = Instantiate(mainScreen);
            mainScreen.transform.SetParent(container.transform);
            mainScreen.SetActive(true);
            mMainScreenController = mainScreen.GetComponent <MainScreenController>();
            mainScreenContainer   = mMainScreenController.mMainContainer;
            Resizer.ResizeToParrent(mainScreen);
            //base.RecieveUtils(utils);
            base.Utils = utils;
            InitHeader(utils);
            InitFooter(utils);
            InitNavMenu(utils);

            // Выделяем первый элемент
            mNavMenuController.onNavMenuItemClick(0);
        }
        protected override void WaitChangeSavedMethod()
        {
            if (_SavedPaymentController == null)
            {
                GameObject paymentManager = Instantiate(Resources.Load(PREFAB_SCREEN_PAYMENT_MANAGER)) as GameObject;
                _SavedPaymentController = paymentManager.GetComponent <PaymentManagerController>();
                _SavedPaymentController.setOnCloseMethod(() =>
                {
                    //LoadGoodsGroups();
                    NavMenuClick(RadioButton.RadioType.SCREEN_GOODS);
                });
                paymentManager.transform.SetParent(mainScreenContainer.transform);
                paymentManager.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
                Resizer.ResizeToParrent(paymentManager);
                currentActive = ActiveScreen.PAYMENT_MANAGER;
            }

            SetLoading(false);
            // Remove purchase part
            Restart();
            _SavedPaymentController.initWaitScreen(Utils, AddPaymentAccount);
        }
Пример #13
0
 void Start()
 {
     Resizer.ResizeToParrent(mainScreen);
     //OpenPaystation ("OOhhYf0lVZyUtsBZ3d4jV8KhZ1uSQdgO", true);//OOhhYf0lVZyUtsBZ3d4jV8KhZ1uSQdgO T1SdYOJJQNbaWDnyyuB05N1YDeqwgLlM 9TvKEQa71wMHrPN4u2arTMcYnqns7wFr
     // sandbox. NORMAL-WITH PURCHASE: yB9wwrtqanwlvatrNakqjRuI3qtuB0I0 NORMAL: jDN50MF8wzU3WVdpnd6RXT0r8bfeKRPa ZIP: nKPgvF6VGkmRQ7oGOsi9AVba2LMS08OG
 }