Esempio n. 1
0
 /// <summary>
 /// 点击充值按钮
 /// </summary>
 void OnClickPayButton(DBPay.PayItemInfo pay_info)
 {
     if (pay_info.LimitGID != 0)
     {
         //UIManager.Instance.ShowWindow("UIChargeTreasureWindow", pay_info);
         uint state = ChargeManager.Instance.GetLimitState();
         if (state == 0)
         {
             //可购买0
             UIManager.Instance.ShowWaitScreen(true, 2.0f);
             ChargeManager.Instance.Pay(pay_info);
         }
     }
     else
     {
         UIManager.Instance.ShowWaitScreen(true, 2.0f);
         ChargeManager.Instance.Pay(pay_info);
     }
 }
Esempio n. 2
0
        protected override void ResetUI()
        {
            base.ResetUI();

            if (ShowParam == null || ShowParam.Length <= 0)
            {
                return;
            }

            var item_info = (DBPay.PayItemInfo)ShowParam[0];

            mPayItemInfo = item_info;
            uint limit_times = ChargeManager.Instance.GetLimitTimes(item_info.Id);

            if (item_info.TreasureGID != null)
            {
                int i = 0;
                foreach (var gid in item_info.TreasureGID.Keys)
                {
                    var num = item_info.TreasureGID[gid];
                    SetReward(i, gid, num);
                    i++;
                }
            }

            if (limit_times >= mPayItemInfo.LimitTimes)
            {
                mBuyButton.interactable = false;
                mBuyText.text           = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_96");
            }
            else
            {
                mBuyButton.interactable = true;
                mBuyText.text           = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_97");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 根据当前档位充值次数来设置ui的显示
        /// </summary>
        /// <param name="pay_item_trans"></param>
        /// <param name="pay_info"></param>
        /// <param name="bought_times"></param>
        /// <param name="limit_times"></param>
        void SetPayItemInfo(Transform pay_item_trans, DBPay.PayItemInfo pay_info, uint bought_times, uint limit_times)
        {
            if (pay_item_trans == null || pay_info == null)
            {
                return;
            }

            // 元宝数量
            var gold_num_text = GetChildComponent <Text>(pay_item_trans, "GoldTag/GoldNum");

            if (gold_num_text != null)
            {
                gold_num_text.text = string.Format("{0}", pay_info.Diamond);
            }

            // 购买价格
            var price_num_text = GetChildComponent <Text>(pay_item_trans, "PriceNum");

            if (price_num_text != null)
            {
                var price_str = CommonTool.ParsePrice(pay_info.RmbLow);
                price_num_text.text = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_98"), price_str);
            }

            // 充值图标
            var icon_image = GetChildComponent <Image>(pay_item_trans, "Treasure");

            if (icon_image != null && !string.IsNullOrEmpty(pay_info.Icon))
            {
                var ori_sprite = icon_image.sprite;
                var new_sprite = LoadSprite(pay_info.Icon);
                if (ori_sprite != new_sprite)
                {
                    icon_image.sprite = new_sprite;
                    icon_image.SetNativeSize();
                }
            }

            // 按钮事件
            var button = pay_item_trans.GetComponent <Button>();

            if (button != null)
            {
                button.onClick.RemoveAllListeners();
                button.onClick.AddListener(() => { OnClickPayButton(pay_info); });
            }

            var limit_trans       = pay_item_trans.Find("LimitTag");
            var present_tag_trans = pay_item_trans.Find("PresentTag");
            var gold_tag_trans    = pay_item_trans.Find("GoldTag");

            // 限购物品类型
            if (pay_info.LimitGID != 0)
            {
                if (present_tag_trans != null)
                {
                    present_tag_trans.gameObject.SetActive(false);
                }

                if (gold_tag_trans != null)
                {
                    gold_tag_trans.gameObject.SetActive(false);
                }

                if (limit_trans == null)
                {
                    return;
                }

                limit_trans.gameObject.SetActive(true);



                uint state = ChargeManager.GetInstance().GetLimitState();
                //可购买0,可领取1,已领取2


                var limit_name_text = GetChildComponent <Text>(limit_trans, "LimitName");
                if (limit_name_text != null)
                {
                    limit_name_text.gameObject.SetActive(state == 0);
                    limit_name_text.text = GoodsHelper.GetGoodsOriginalNameByTypeId(pay_info.LimitGID);
                }

                var get_btn = GetChildComponent <Button>(limit_trans, "GetButton");
                if (get_btn != null)
                {
                    get_btn.gameObject.SetActive(state == 1);
                    get_btn.onClick.RemoveAllListeners();
                    get_btn.onClick.AddListener(() =>
                    {
                        C2SBindGoldBoxGet data = new C2SBindGoldBoxGet();
                        NetClient.GetBaseClient().SendData <C2SBindGoldBoxGet>(NetMsg.MSG_BIND_GOLD_BOX_GET, data);
                    });
                }

                var received = GetChildComponent <Transform>(limit_trans, "Received");
                if (received != null)
                {
                    received.gameObject.SetActive(state == 2);
                }

                var redPoint = GetChildComponent <Transform>(limit_trans, "RedPoint");
                if (redPoint != null)
                {
                    redPoint.gameObject.SetActive(ChargeManager.Instance.GetRedPointState());
                }



                if (state == 0)
                {
                    //可购买0
                    var limit_title = GetChildComponent <Text>(limit_trans, "LimitTitle");
                    if (limit_title != null)
                    {
                        limit_title.text = string.Format(DBConstText.GetText("CHARGE_BOX_LAST_TEXT"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_GOLD_NUM"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_DAYS"));
                    }
                }
                else
                {
                    //可领取1 已领取2
                    var limit_title = GetChildComponent <Text>(limit_trans, "LimitTitle");
                    if (limit_title != null)
                    {
                        limit_title.text = string.Format(DBConstText.GetText("CHARGE_BOX_LEAVE_TEXT"), GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_GOLD_NUM"), ChargeManager.GetInstance().GetLimitedLeftTime());
                    }
                }
            }
            // 充值赠送元宝类型
            else
            {
                if (limit_trans != null)
                {
                    limit_trans.gameObject.SetActive(false);
                }

                if (gold_tag_trans != null)
                {
                    gold_tag_trans.gameObject.SetActive(true);
                }

                if (present_tag_trans == null)
                {
                    return;
                }

                if (pay_info.BonusFirst != 0 || pay_info.BonusOther != 0)
                {
                    var present_object  = GetChildComponent <Transform>(present_tag_trans, "Present");
                    var present2_object = GetChildComponent <Transform>(present_tag_trans, "Present2");
                    var gold_icon       = GetChildComponent <Image>(present_tag_trans, "GoldIcon");
                    var present_text    = GetChildComponent <Text>(present_tag_trans, "PresentNum");

                    // 首次充值
                    if (bought_times == 0)
                    {
                        if (gold_icon != null)
                        {
                            var ori_sprite = gold_icon.sprite;
                            var new_sprite = LoadSprite(LocalPlayerManager.GetMoneySpriteName((int)pay_info.BonusFirstType));
                            if (ori_sprite != new_sprite)
                            {
                                gold_icon.sprite = new_sprite;
                            }
                        }

                        if (pay_info.BonusFirst != 0) // 首充赠送金额
                        {
                            if (present_text != null)
                            {
                                present_text.text = pay_info.BonusFirst.ToString();
                            }

                            if (present_object != null)
                            {
                                present_object.gameObject.SetActive(true);
                            }

                            if (present2_object != null)
                            {
                                present2_object.gameObject.SetActive(false);
                            }

                            present_tag_trans.gameObject.SetActive(true);
                        }
                        else
                        {
                            present_tag_trans.gameObject.SetActive(false);
                        }
                    }
                    // 多次充值
                    else
                    {
                        if (gold_icon != null)
                        {
                            var ori_sprite = gold_icon.sprite;
                            var new_sprite = LoadSprite(LocalPlayerManager.GetMoneySpriteName((int)pay_info.BonusOtherType));
                            if (ori_sprite != new_sprite)
                            {
                                gold_icon.sprite = new_sprite;
                            }
                        }

                        if (pay_info.BonusOther != 0)// 普通赠送金额
                        {
                            if (present_text != null)
                            {
                                present_text.text = pay_info.BonusOther.ToString();
                            }

                            if (present_object != null)
                            {
                                present_object.gameObject.SetActive(false);
                            }

                            if (present2_object != null)
                            {
                                present2_object.gameObject.SetActive(true);
                            }

                            present_tag_trans.gameObject.SetActive(true);
                        }
                        else
                        {
                            present_tag_trans.gameObject.SetActive(false);
                        }
                    }
                }
                else
                {
                    present_tag_trans.gameObject.SetActive(false);
                }
            }

            // ios审核包隐藏首冲赠送的控件

            /*if(GlobalConfig.Instance.IosPackageInfo.Open)
             * {
             *  if (present_tag_trans != null)
             *      present_tag_trans.gameObject.SetActive(false);
             * }*/
            if (SysConfigManager.Instance.CheckSysHasOpened(GameConst.SYS_OPEN_BONUS_PAY) == false)
            {
                if (present_tag_trans != null)
                {
                    present_tag_trans.gameObject.SetActive(false);
                }
            }



            //iphone
            if (AuditManager.Instance.AuditAndIOS())
            {
                LoadMaJiaImage majiaImage = pay_item_trans.gameObject.GetComponent <LoadMaJiaImage>();
                if (majiaImage == null)
                {
                    majiaImage       = pay_item_trans.gameObject.AddComponent <LoadMaJiaImage>();
                    majiaImage.mPath = string.Format("ChargeItem_{0}.png", pay_info.Diamond);
                    majiaImage.SetCallBack(() =>
                    {
                        RawImage rawImage = majiaImage.GetRawImage();
                        if (rawImage != null)
                        {
                            if (icon_image != null)
                            {
                                icon_image.gameObject.SetActive(false);
                            }
                            rawImage.rectTransform.SetAsFirstSibling();
                        }
                    });
                }
            }
        }