Esempio n. 1
0
        public void OnPucharseProduct()
        {
            if (Singleton <NetworkManager> .Instance.DispatchSeverData.forbidRecharge)
            {
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ForbidRecharge", new object[0]), 2f), UIType.Any);
            }
            else if ((Singleton <NetworkManager> .Instance.DispatchSeverData.rechargeMaxLimit > 0) && (Singleton <ShopWelfareModule> .Instance.totalPayHCoin >= Singleton <NetworkManager> .Instance.DispatchSeverData.rechargeMaxLimit))
            {
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopRechargeHCoinLimit", new object[0]), 2f), UIType.Any);
            }
            else if (string.IsNullOrEmpty(this._currentSelectedProductID))
            {
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopNoSelect", new object[0]), 2f), UIType.Any);
            }
            else
            {
                RechargeDataItem storeItemByProductID = Singleton <AccountManager> .Instance.manager.GetStoreItemByProductID(this._currentSelectedProductID);

                if (storeItemByProductID != null)
                {
                    if (!storeItemByProductID.CanPurchase())
                    {
                        Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("IAPTPurchaseLimit", new object[0]), 2f), UIType.Any);
                    }
                    else
                    {
                        Singleton <AccountManager> .Instance.manager.Pay(this._currentSelectedProductID, storeItemByProductID.productName, ((float)storeItemByProductID.serverPrice) / 100f);
                    }
                }
                else
                {
                    this._currentSelectedProductID = string.Empty;
                }
            }
        }
Esempio n. 2
0
 private bool CheckNeedGetProductListFromMarket()
 {
     if (Singleton <AccountManager> .Instance.accountConfig.paymentBranch == ConfigAccount.PaymentBranch.APPSTORE_CN)
     {
         if (this._rechargeItemListFromMarket == null)
         {
             return(true);
         }
         for (int i = 0; i < this._rechargeItemListFromServer.Count; i++)
         {
             RechargeDataItem item = new RechargeDataItem(this._rechargeItemListFromServer[i]);
             bool             flag = false;
             for (int j = 0; j < this._rechargeItemListFromMarket.Count; j++)
             {
                 if (item.productID == this._rechargeItemListFromMarket[j].productID)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 3
0
 private bool OnGetProductsListRsp(GetProductListRsp rsp)
 {
     this._rechargeItemListFromServer = new List <RechargeDataItem>();
     if (rsp.get_retcode() == null)
     {
         foreach (Product product in rsp.get_product_list())
         {
             RechargeDataItem item = new RechargeDataItem(product);
             this._rechargeItemListFromServer.Add(item);
         }
     }
     return(false);
 }
Esempio n. 4
0
 public RechargeDataItem(RechargeDataItem rechargeItem)
 {
     this.formattedPrice    = string.Empty;
     this.productID         = rechargeItem.productID;
     this.productName       = rechargeItem.productName;
     this.formattedPrice    = rechargeItem.formattedPrice;
     this.productType       = rechargeItem.productType;
     this.payHardCoin       = rechargeItem.payHardCoin;
     this.freeHardCoin      = rechargeItem.freeHardCoin;
     this.serverPrice       = rechargeItem.serverPrice;
     this.leftBuyTimes      = rechargeItem.leftBuyTimes;
     this.cardDailyHardCoin = rechargeItem.cardDailyHardCoin;
     this.cardLeftDays      = rechargeItem.cardLeftDays;
 }
Esempio n. 5
0
        public void OnSelectProduct(string productID)
        {
            this._currentSelectedProductID = productID;
            this._scrollViewTrans.GetComponent <MonoGridScroller>().RefreshCurrent();
            RechargeDataItem storeItemByProductID = Singleton <AccountManager> .Instance.manager.GetStoreItemByProductID(productID);

            if (storeItemByProductID != null)
            {
                base.transform.parent.Find("CartInfoPanel/BuyBtn").GetComponent <Button>().interactable = true;
                base.transform.parent.Find("CartInfoPanel/Info").gameObject.SetActive(true);
                object[] replaceParams = new object[] { storeItemByProductID.formattedPrice, storeItemByProductID.productName };
                base.transform.parent.Find("CartInfoPanel/Info/Desc").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_ShopRechargeBuyDesc", replaceParams);
                this.SetupPayMethodView();
            }
        }
Esempio n. 6
0
 private bool OnRechargeSuccNotify(RechargeFinishNotify rsp)
 {
     if (this._loadingWheelDialogContext != null)
     {
         this._loadingWheelDialogContext.Finish();
         this._loadingWheelDialogContext = null;
     }
     if ((rsp.get_retcode() == null) || ((rsp.get_retcode() == 2) && !string.IsNullOrEmpty(this.GetReceipt())))
     {
         RechargeDataItem storeItemByProductID = this.GetStoreItemByProductID(rsp.get_product_name());
         string           str = (storeItemByProductID == null) ? string.Empty : storeItemByProductID.productName;
         int num = (int)(rsp.get_pay_hcoin() + rsp.get_free_hcoin());
         GeneralConfirmDialogContext dialogContext = new GeneralConfirmDialogContext {
             type = GeneralConfirmDialogContext.ButtonType.SingleButton
         };
         object[] replaceParams = new object[] { str, num };
         dialogContext.desc = LocalizationGeneralLogic.GetText("IAPTransitionSuccess", replaceParams);
         if (< > f__am$cache8 == null)
         {
Esempio n. 7
0
 private void MergeStoreItemList()
 {
     this._rechargeItemList.Clear();
     for (int i = 0; i < this._rechargeItemListFromServer.Count; i++)
     {
         RechargeDataItem item = new RechargeDataItem(this._rechargeItemListFromServer[i]);
         if (this._rechargeItemListFromMarket != null)
         {
             for (int j = 0; j < this._rechargeItemListFromMarket.Count; j++)
             {
                 if (item.productID == this._rechargeItemListFromMarket[j].productID)
                 {
                     item.formattedPrice = this._rechargeItemListFromMarket[j].formattedPrice;
                     this._rechargeItemList.Add(item);
                     break;
                 }
             }
         }
         else
         {
             this._rechargeItemList.Add(item);
         }
     }
 }
Esempio n. 8
0
        public void SetupView(RechargeDataItem rechargeDataItem, bool isSelected)
        {
            this._storeDataItem = rechargeDataItem;
            base.transform.Find("InnerPanel/BG/Selected").gameObject.SetActive(isSelected);
            base.transform.Find("InnerPanel/BG/Unselected").gameObject.SetActive(!isSelected);
            base.transform.Find("InnerPanel/BG/Unselected/NowPrize/Num").GetComponent <Text>().text = rechargeDataItem.formattedPrice;
            base.transform.Find("InnerPanel/BG/Selected/NowPrize/Num").GetComponent <Text>().text   = rechargeDataItem.formattedPrice;
            base.transform.Find("InnerPanel/NumPanel/Num/Num").GetComponent <Text>().text           = rechargeDataItem.payHardCoin.ToString();
            if (Singleton <NetworkManager> .Instance.DispatchSeverData.isReview && (rechargeDataItem.productType == 3))
            {
                rechargeDataItem.productType = 1;
            }
            if (rechargeDataItem.productType == 3)
            {
                if (rechargeDataItem.cardLeftDays > 0)
                {
                    base.transform.Find("InnerPanel/MonthCardLeftDaysPanel").gameObject.SetActive(true);
                    base.transform.Find("InnerPanel/MonthCardDescPanel").gameObject.SetActive(false);
                    object[] replaceParams = new object[] { rechargeDataItem.cardLeftDays };
                    base.transform.Find("InnerPanel/MonthCardLeftDaysPanel/Desc").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_GiftHardCoinDaysLeft", replaceParams);
                }
                else
                {
                    base.transform.Find("InnerPanel/MonthCardLeftDaysPanel").gameObject.SetActive(false);
                    base.transform.Find("InnerPanel/MonthCardDescPanel").gameObject.SetActive(true);
                    object[] objArray2 = new object[] { rechargeDataItem.cardDailyHardCoin };
                    base.transform.Find("InnerPanel/MonthCardDescPanel/Desc").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_GifthardCoinDesc", objArray2);
                }
                base.transform.Find("InnerPanel/LimitBuyPanel").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/MonthCardLimitBuyPanel").gameObject.SetActive(rechargeDataItem.cardLeftDays < 180);
            }
            else
            {
                base.transform.Find("InnerPanel/MonthCardLeftDaysPanel").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/MonthCardDescPanel").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/MonthCardLimitBuyPanel").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/LimitBuyPanel").gameObject.SetActive(true);
                if (rechargeDataItem.productType == 2)
                {
                    base.transform.Find("InnerPanel/LimitBuyPanel/addition/Label").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_FirstRechargeBonus", new object[0]);
                    object[] objArray3 = new object[] { rechargeDataItem.leftBuyTimes };
                    base.transform.Find("InnerPanel/LimitBuyPanel/Desc").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_FirstHardCoinDesc", objArray3);
                }
                else
                {
                    base.transform.Find("InnerPanel/LimitBuyPanel/addition/Label").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("MenuRechargeBonus", new object[0]);
                    base.transform.Find("InnerPanel/LimitBuyPanel/Desc").gameObject.SetActive(false);
                }
            }
            if (rechargeDataItem.productType == 3)
            {
                base.transform.Find("InnerPanel/SaleLabel/SalePatten5").gameObject.SetActive(true);
                base.transform.Find("InnerPanel/SaleLabel/SalePatten4").gameObject.SetActive(false);
            }
            else if (rechargeDataItem.productType == 2)
            {
                base.transform.Find("InnerPanel/SaleLabel/SalePatten4").gameObject.SetActive(true);
                base.transform.Find("InnerPanel/SaleLabel/SalePatten5").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/LimitBuyPanel/addition/Num").GetComponent <Text>().text = rechargeDataItem.freeHardCoin.ToString();
            }
            else
            {
                if (rechargeDataItem.freeHardCoin > 0)
                {
                    base.transform.Find("InnerPanel/LimitBuyPanel/addition/Num").GetComponent <Text>().text = rechargeDataItem.freeHardCoin.ToString();
                }
                else
                {
                    base.transform.Find("InnerPanel/LimitBuyPanel/").gameObject.SetActive(false);
                }
                base.transform.Find("InnerPanel/SaleLabel/SalePatten4").gameObject.SetActive(false);
                base.transform.Find("InnerPanel/SaleLabel/SalePatten5").gameObject.SetActive(false);
            }
            string str = string.Empty;

            if (rechargeDataItem.productID.StartsWith("Bh3First"))
            {
                str = str + rechargeDataItem.productID.Substring(8);
            }
            else
            {
                str = str + rechargeDataItem.productID.Substring(3);
            }
            if (Singleton <NetworkManager> .Instance.DispatchSeverData.isReview && (str == "GiftHardCoinTier5"))
            {
                str = "HardCoinTier5";
            }
            base.transform.Find("InnerPanel/ItemIcon/Icon").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(this._iconPathPrex + str);
            if (rechargeDataItem.productType == 3)
            {
                RectTransform component = base.transform.Find("InnerPanel/ItemIcon/Icon").GetComponent <RectTransform>();
                component.anchoredPosition = new Vector2(component.anchoredPosition.x, 35f);
            }
        }
Esempio n. 9
0
        private void OnScrollChange(Transform trans, int index)
        {
            RechargeDataItem rechargeDataItem = this._rechargeDataItemList[index];

            trans.GetComponent <MonoRechargeItem>().SetupView(rechargeDataItem, rechargeDataItem.productID == this._currentSelectedProductID);
        }