Beispiel #1
0
        private void initDeleteMethodPanel(SavedMethodBtnController pMethodObj)
        {
            // show edit panel
            mContainer.SetActive(false);
            mReplacePanelMethod.SetActive(false);
            mDelPanelMethod.SetActive(true);

            // clone object to panel edit
            SavedMethodBtnController controller = Instantiate(pMethodObj);

            controller.setMethod(pMethodObj.getMethod());
            controller.setDeleteBtn(false);
            controller.setMethodBtn(false);

            RectTransform methodPanelrecttransform = controller.GetComponent <RectTransform>();

            // clear currency state
            for (int i = 0; i < mPanelForDelMethod.transform.childCount; i++)
            {
                Logger.Log("Destroy child on panel for edit saved payment method with ind - " + i);
                Destroy(mPanelForDelMethod.transform.GetChild(i).gameObject);
            }

            controller.transform.SetParent(mPanelForDelMethod.transform);
            methodPanelrecttransform.anchorMin = new Vector2(0, 0);
            methodPanelrecttransform.anchorMax = new Vector2(1, 1);
            methodPanelrecttransform.pivot     = new Vector2(0.5f, 0.5f);
            methodPanelrecttransform.offsetMin = new Vector2(0, 0);
            methodPanelrecttransform.offsetMax = new Vector2(0, 0);

            // set text
            mTitle.text         = mUtilsLink.GetTranslations().Get("delete_payment_account_page_title");
            mQuestionLabel.text = mUtilsLink.GetTranslations().Get("payment_account_delete_confirmation_question");

            mLinkCancel.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("cancel");
            mLinkCancel.GetComponent <Button>().onClick.RemoveAllListeners();
            mLinkCancel.GetComponent <Button>().onClick.AddListener(() => onClickCancelEditMethod());

            mLinkDelete.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("delete_payment_account_button");
            mLinkDelete.GetComponent <Button>().onClick.RemoveAllListeners();
            mLinkDelete.GetComponent <Button>().onClick.AddListener(() => onClickConfirmDeletePaymentMethod(controller.getMethod()));

            mBtnReplace.GetComponentInChildren <Text>().text = mUtilsLink.GetTranslations().Get("replace_payment_account_button");
            mBtnReplace.GetComponent <Button>().onClick.RemoveAllListeners();
            mBtnReplace.GetComponent <Button>().onClick.AddListener(() => onClickReplacePeymentMethod(controller.getMethod()));
        }
Beispiel #2
0
        private void onClickReplacePeymentMethod(XsollaSavedPaymentMethod pMethod)
        {
            Logger.Log("Click replace method");
            mListReplacedMethods = new ArrayList();

            // open form with replaced methods
            mInfoPanel.SetActive(false);
            mDelPanelMethod.SetActive(false);
            mContainer.SetActive(false);
            mReplacePanelMethod.SetActive(true);

            for (int i = 0; i < mPanelForReplacedMethods.transform.childCount; i++)
            {
                Logger.Log("Destroy child on panel for edit saved payment method with ind - " + i);
                Destroy(mPanelForReplacedMethods.transform.GetChild(i).gameObject);
            }

            // TODO
            // if we don't have account on replace we must click on another method

            // set all
            foreach (GameObject btnObj in mListBtnsObjs)
            {
                // check if this method not method those replaced
                SavedMethodBtnController controller = btnObj.GetComponent <SavedMethodBtnController>();
                if (controller.getMethod().GetKey() == pMethod.GetKey())
                {
                    continue;
                }

                // add this obj on panel
                SavedMethodBtnController controllerClone = Instantiate(controller);
                controllerClone.setMethod(controller.getMethod());
                controllerClone.setDeleteBtn(false);
                controllerClone.setMethodBtn(false);
                controllerClone.setToggleObj(true, onToggleChange);

                controllerClone.transform.SetParent(mPanelForReplacedMethods.transform);
                RectTransform methodPanelrecttransform = controllerClone.GetComponent <RectTransform>();
                methodPanelrecttransform.anchorMin = new Vector2(0, 0);
                methodPanelrecttransform.anchorMax = new Vector2(1, 1);
                methodPanelrecttransform.pivot     = new Vector2(0.5f, 0.5f);
                methodPanelrecttransform.offsetMin = new Vector2(0, 0);
                methodPanelrecttransform.offsetMax = new Vector2(0, 0);

                mListReplacedMethods.Add(controllerClone);
            }

            // set titles for replace screen
            mLinkGetAnotherMethods.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("savedmethod_other_change_account_label");
            Button linkAnotherMethod = mLinkGetAnotherMethods.GetComponent <Button>();

            linkAnotherMethod.onClick.RemoveAllListeners();
            linkAnotherMethod.onClick.AddListener(() => onClickConfirmReplacedAnotherMethod(pMethod));

            mLinkBack.GetComponent <Text>().text = mUtilsLink.GetTranslations().Get("back_to_paymentaccount");
            Button linkBack = mLinkBack.GetComponent <Button>();

            linkBack.onClick.RemoveAllListeners();
            linkBack.onClick.AddListener(() => onClickCancelEditMethod());

            mBtnContinue.GetComponentInChildren <Text>().text = mUtilsLink.GetTranslations().Get("form_continue");
            Button btnContinue = mBtnContinue.GetComponent <Button>();

            btnContinue.onClick.RemoveAllListeners();
            btnContinue.onClick.AddListener(() => onClickConfirmReplaced(pMethod));
        }