LoadImage() public method

public LoadImage ( Image imageView, string url ) : void
imageView UnityEngine.UI.Image
url string
return void
 public void setIcon(ImageLoader pLoader = null)
 {
     switch (_method.id)
     {
     case 1380:
         {
             _icon.sprite = Resources.Load<Sprite> ("Images/ic_cc");
             break;
         }
     case 1738:
         {
             _icon.sprite = Resources.Load<Sprite> ("Images/ic_mobile");
             break;
         }
     case 3012:
         {
             _icon.sprite = Resources.Load<Sprite> ("Images/ic_giftCard");
             break;
         }
     default:
         {
             if (pLoader != null)
                 pLoader.LoadImage(_icon, _method.GetImageUrl());
             break;
         }
     }
 }
        public void setIcon(long pMethodID, ImageLoader pLoader = null)
        {
            switch (pMethodID)
            {
            case 1380:
            {
                _iconMethod.sprite = Resources.Load <Sprite> ("Images/ic_cc");
                break;
            }

            case 1738:
            {
                _iconMethod.sprite = Resources.Load <Sprite> ("Images/ic_mobile");
                break;
            }

            case 3012:
            {
                _iconMethod.sprite = Resources.Load <Sprite> ("Images/ic_giftCard");
                break;
            }

            default:
            {
                if (pLoader != null)
                {
                    pLoader.LoadImage(_iconMethod, _method.GetImageUrl());
                }
                break;
            }
            }
        }
        public override GameObject GetView(int position)
        {
            GameObject          paymentItemInstance = Instantiate(paymentMethodPrefab) as GameObject;
            XsollaPaymentMethod item = GetItem(position);

            imageLoader.LoadImage(paymentItemInstance.GetComponentsInChildren <Image> ()[2], item.GetImageUrl());
            paymentItemInstance.GetComponentInChildren <Button> ().onClick.AddListener(() => {
                OnChoosePaymentMethod(item.id);
            });
            return(paymentItemInstance);
        }
        private void CreateMethodBtn(XsollaSavedPaymentMethod pMethod)
        {
            // Create object
            GameObject methodBtn = Instantiate(Resources.Load("Prefabs/SimpleView/_PaymentFormElements/SavedMethodBtn")) as GameObject;

            methodBtn.transform.SetParent(methodsGrid.transform);
            SavedMethodBtnController controller = methodBtn.GetComponent <SavedMethodBtnController>();

            listBtns.Add(controller);
            // Set method
            controller.setMethod(pMethod);
            // Set name
            controller.setNameMethod(pMethod.GetName());
            // Set Type
            controller.setNameType(pMethod.GetPsName());
            // Set icon
            imageLoader.LoadImage(controller._iconMethod, pMethod.GetImageUrl());
            // Set BtnList
            controller._btnMethod.onClick.AddListener(() => onMethodClick(controller.getMethod()));
        }
Ejemplo n.º 5
0
        public void initScreen(XsollaUtils pUtils, string pCustomCurrency, Action <Dictionary <string, object> > pActionCalc, Action <float> pTryPay)
        {
            if (pUtils.GetProject().isDiscrete)
            {
                virtCurrAmount.contentType = InputField.ContentType.IntegerNumber;
            }
            else
            {
                virtCurrAmount.contentType = InputField.ContentType.DecimalNumber;
            }

            // Set btn Name
            btnPay.gameObject.GetComponentInChildren <Text>().text = pUtils.GetTranslations().Get("form_continue");
            mTotalTitle     = pUtils.GetTranslations().Get("payment_summary_total");
            mCustomCurrency = pCustomCurrency;
            ImageLoader imageLoader = FindObjectOfType <ImageLoader>();

            Logger.Log("VirtIcon " + pUtils.GetProject().virtualCurrencyIconUrl);
            imageLoader.LoadImage(iconVirtCurr, "http:" + pUtils.GetProject().virtualCurrencyIconUrl);

            virtCurrAmount.onEndEdit.AddListener(delegate
            {
                if (!mSetValues)
                {
                    pActionCalc(GetParamsForCalc(true));
                }
            });

            realCurrAmount.onEndEdit.AddListener(delegate
            {
                if (!mSetValues)
                {
                    pActionCalc(GetParamsForCalc(false));
                }
            });

            btnPay.onClick.AddListener(delegate
            {
                pTryPay(GetOutAmount());
            });
        }
Ejemplo n.º 6
0
        private GameObject GetSummaryItem(IXsollaSummaryItem purchase)
        {
            GameObject purchaseItemInstance = Instantiate(summaryItemPrefab) as GameObject;

            Image[] image = purchaseItemInstance.GetComponentsInChildren <Image>();
            string  img   = purchase.GetImgUrl();

            if (!"".Equals(img))
            {
                imageLoader.LoadImage(image [1], purchase.GetImgUrl());
            }
            else
            {
                image [1].gameObject.transform.parent.gameObject.SetActive(false);
            }
            Text[] texts = purchaseItemInstance.GetComponentsInChildren <Text>();
            texts[0].text = purchase.GetName();
            texts[1].text = purchase.GetPrice();
            texts[2].text = purchase.GetDescription();
            texts[3].text = purchase.GetBonus();
            return(purchaseItemInstance);
        }
Ejemplo n.º 7
0
        public void initScreen(XsollaUtils pUtils, XsollaSavedPaymentMethods pMethods, Action pAddPaymentMethod, bool pAddState)
        {
            mUtilsLink        = pUtils;
            mActionAddPayment = pAddPaymentMethod;

            if (pMethods != null)
            {
                mListMethods = pMethods;
            }
            else
            {
                GetSavedMethod(pAddState, true);
                return;
            }

            if (mListBtnsObjs == null)
            {
                mListBtnsObjs = new ArrayList();
            }
            else
            {
                mListBtnsObjs.Clear();
            }

            mTitle.text            = pUtils.GetTranslations().Get("payment_account_page_title");
            mInformationTitle.text = pUtils.GetTranslations().Get("payment_account_add_title");
            mInformation.text      = pUtils.GetTranslations().Get("payment_account_add_info");
            mContinueLink.text     = pUtils.GetTranslations().Get("payment_account_back_button");
            mCanceltext.text       = pUtils.GetTranslations().Get("cancel");
            mCloseNotify.onClick.AddListener(CloseStatus);

            Button continueBtn = mContinueLink.GetComponent <Button>();

            continueBtn.onClick.RemoveAllListeners();
            continueBtn.onClick.AddListener(() =>
            {
                Destroy(this.gameObject);
                mOnClose();
            });
            Text textBtn = mBtnAddPaymentObj.GetComponentInChildren <Text>();

            textBtn.text = pUtils.GetTranslations().Get("payment_account_add_button");

            // clear btn Grid
            for (int i = 0; i < mBtnGrid.transform.childCount; i++)
            {
                Destroy(mBtnGrid.transform.GetChild(i).gameObject);
            }

            if (mListMethods.GetCount() == 0)
            {
                mContainer.SetActive(false);
                mDelPanelMethod.SetActive(false);
                mReplacePanelMethod.SetActive(false);
                mInfoPanel.SetActive(true);

                Button btnAddPayment = mBtnAddPaymentObj.GetComponent <Button>();
                btnAddPayment.onClick.RemoveAllListeners();
                btnAddPayment.onClick.AddListener(() => { CloseStatus(); mActionAddPayment(); });
            }
            else
            {
                mInfoPanel.SetActive(false);
                mDelPanelMethod.SetActive(false);
                mReplacePanelMethod.SetActive(false);
                mContainer.SetActive(true);
                foreach (XsollaSavedPaymentMethod item in mListMethods.GetItemList())
                {
                    // Create prefab on btn saved method, set parent and set controller on them
                    GameObject methodBtn = Instantiate(Resources.Load("Prefabs/SimpleView/_PaymentFormElements/SavedMethodBtnNew")) as GameObject;
                    methodBtn.transform.SetParent(mBtnGrid.transform);

                    // Add objects btn on list
                    mListBtnsObjs.Add(methodBtn);

                    SavedMethodBtnController controller = methodBtn.GetComponent <SavedMethodBtnController>();

                    // Activated btn delete
                    controller.setDeleteBtn(true);
                    controller.setMethodBtn(false);
                    controller.setDeleteBtnName(pUtils.GetTranslations().Get("delete_payment_account_button"));

                    // Set btn property
                    // Set method
                    controller.setMethod(item);
                    // Set name
                    controller.setNameMethod(item.GetName());
                    // Set Type
                    controller.setNameType(item.GetPsName());
                    // Set icon
                    mImgLoader.LoadImage(controller._iconMethod, item.GetImageUrl());
                    // Set BtnDelAction
                    controller.getBtnDelete().onClick.AddListener(() => { CloseStatus(); onClickDeletePaymentMethod(controller); });
                }

                // Add button "Add payment metnod"
                GameObject objAddMethodClone = Instantiate <GameObject>(mBtnAddPaymentObj);
                objAddMethodClone.transform.SetParent(mBtnGrid.transform);
                //set onclickListener
                Button btnAddMethod = objAddMethodClone.GetComponent <Button>();
                btnAddMethod.onClick.RemoveAllListeners();
                btnAddMethod.onClick.AddListener(() => { CloseStatus(); mActionAddPayment(); });
            }
        }