Beispiel #1
0
 public CMallItem(CMallFactoryShopController.ShopProduct product, IconType iconType = 1)
 {
     this.m_type     = ItemType.Item;
     this.m_iconType = iconType;
     if (product != null)
     {
         this.m_useable    = CUseableManager.CreateUseable(product.Type, 0L, product.ID, (int)product.LimitCount, 0);
         this.m_product    = product;
         this.m_firstName  = this.m_useable.m_name;
         this.m_secondName = null;
         this.m_iconPath   = this.m_useable.GetIconPath();
         RES_SHOPBUY_COINTYPE coinType = product.CoinType;
         enPayType            type     = CMallSystem.ResBuyTypeToPayType((int)coinType);
         uint discount = product.Discount;
         uint buyPrice = this.m_useable.GetBuyPrice(coinType);
         uint num3     = (buyPrice * product.Discount) / 100;
         this.m_payInfoSet = new stPayInfoSet(1);
         this.m_payInfoSet.m_payInfoCount = 1;
         this.m_payInfoSet.m_payInfos[0].m_discountForDisplay = product.Discount;
         this.m_payInfoSet.m_payInfos[0].m_oriValue           = buyPrice;
         this.m_payInfoSet.m_payInfos[0].m_payType            = type;
         this.m_payInfoSet.m_payInfos[0].m_payValue           = num3;
     }
     else
     {
         this.m_useable    = null;
         this.m_firstName  = null;
         this.m_secondName = null;
         this.m_useable    = null;
         this.m_iconPath   = null;
         this.m_payInfoSet = new stPayInfoSet();
     }
 }
Beispiel #2
0
        private int CompareCoupons(ResHeroCfgInfo l, ResHeroCfgInfo r)
        {
            ResHeroPromotion resPromotion      = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion();
            ResHeroPromotion resPromotion2     = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion();
            stPayInfoSet     payInfoSetOfGood  = CMallSystem.GetPayInfoSetOfGood(l, resPromotion);
            stPayInfoSet     payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, resPromotion2);
            uint             num  = 4294967295u;
            uint             num2 = 4294967295u;

            for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++)
            {
                if ((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood.m_payInfos[i].m_payValue < num)
                {
                    num = payInfoSetOfGood.m_payInfos[i].m_payValue;
                }
            }
            for (int j = 0; j < payInfoSetOfGood2.m_payInfoCount; j++)
            {
                if ((payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.Diamond || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DianQuan || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood2.m_payInfos[j].m_payValue < num2)
                {
                    num2 = payInfoSetOfGood2.m_payInfos[j].m_payValue;
                }
            }
            if (num == 4294967295u && this.IsDesc())
            {
                num = 0u;
            }
            if (num2 == 4294967295u && this.IsDesc())
            {
                num2 = 0u;
            }
            return(num.CompareTo(num2));
        }
Beispiel #3
0
        private void SetHeroItem(CMallItemWidget mallWidget, ResHeroCfgInfo heroInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.color = CUIUtility.s_Color_White;
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, heroInfo.szImagePath);

            component.SetSprite(prefabPath, form, false, true, true);
            mallWidget.m_skinLabel.CustomSetActive(false);
            mallWidget.m_topNameLeftText.GetComponent <Text>().text = heroInfo.szName;
            mallWidget.m_topNameRightText.CustomSetActive(false);
            IHeroData data = CHeroDataFactory.CreateHeroData(heroInfo.dwCfgID);

            if (data != null)
            {
                ResHeroPromotion resPromotion = data.promotion();
                this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(heroInfo, resPromotion);
                uint num = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);
                this.SetItemTag(mallWidget, resPromotion, null, form);
                stUIEventParams eventParams = new stUIEventParams {
                    heroId             = heroInfo.dwCfgID,
                    commonUInt64Param1 = this._curFriendUid,
                    commonBool         = this._curFriendIsSns,
                    commonUInt32Param1 = this._curWorldId
                };
                mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroView_OpenBuyHeroForFriend, eventParams);
                mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.None, eventParams);
            }
        }
Beispiel #4
0
        public static bool IsCanBuy(uint heroId, uint skinId)
        {
            ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(heroId, skinId);

            if (heroSkin == null)
            {
                return(false);
            }
            if (!GameDataMgr.IsSkinAvailableAtShop(heroSkin.dwID))
            {
                return(false);
            }
            ResSkinPromotion resSkinPromotion = new ResSkinPromotion();
            stPayInfoSet     stPayInfoSet     = default(stPayInfoSet);

            resSkinPromotion = CSkinInfo.GetSkinPromotion(heroSkin.dwID);
            if (resSkinPromotion != null)
            {
                stPayInfoSet = CMallSystem.GetPayInfoSetOfGood(false, 0u, resSkinPromotion.bIsBuyCoupons > 0, resSkinPromotion.dwBuyCoupons, resSkinPromotion.bIsBuyDiamond > 0, resSkinPromotion.dwBuyDiamond, 10000u);
            }
            else
            {
                stPayInfoSet = CMallSystem.GetPayInfoSetOfGood(heroSkin);
            }
            return(stPayInfoSet.m_payInfoCount > 0);
        }
Beispiel #5
0
        private int CompareCoupons(ResHeroCfgInfo l, ResHeroCfgInfo r)
        {
            ResHeroPromotion resPromotion     = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion();
            ResHeroPromotion promotion2       = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion();
            stPayInfoSet     payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, resPromotion);
            stPayInfoSet     set2             = CMallSystem.GetPayInfoSetOfGood(r, promotion2);
            uint             maxValue         = uint.MaxValue;
            uint             payValue         = uint.MaxValue;

            for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++)
            {
                if ((((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan)) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan)) && (payInfoSetOfGood.m_payInfos[i].m_payValue < maxValue))
                {
                    maxValue = payInfoSetOfGood.m_payInfos[i].m_payValue;
                }
            }
            for (int j = 0; j < set2.m_payInfoCount; j++)
            {
                if ((((set2.m_payInfos[j].m_payType == enPayType.Diamond) || (set2.m_payInfos[j].m_payType == enPayType.DianQuan)) || (set2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan)) && (set2.m_payInfos[j].m_payValue < payValue))
                {
                    payValue = set2.m_payInfos[j].m_payValue;
                }
            }
            if ((maxValue == uint.MaxValue) && this.IsDesc())
            {
                maxValue = 0;
            }
            if ((payValue == uint.MaxValue) && this.IsDesc())
            {
                payValue = 0;
            }
            return(maxValue.CompareTo(payValue));
        }
Beispiel #6
0
 public CMallItem(CMallFactoryShopController.ShopProduct product, CMallItem.IconType iconType = CMallItem.IconType.Small)
 {
     this.m_type     = CMallItem.ItemType.Item;
     this.m_iconType = iconType;
     if (product != null)
     {
         this.m_useable    = CUseableManager.CreateUseable(product.Type, 0uL, product.ID, (int)product.LimitCount, 0);
         this.m_product    = product;
         this.m_firstName  = this.m_useable.m_name;
         this.m_secondName = null;
         this.m_iconPath   = this.m_useable.GetIconPath();
         RES_SHOPBUY_COINTYPE coinType = product.CoinType;
         enPayType            payType  = CMallSystem.ResBuyTypeToPayType(coinType);
         uint buyPrice = this.m_useable.GetBuyPrice(coinType);
         uint payValue = product.ConvertWithRealDiscount(buyPrice);
         this.m_payInfoSet = new stPayInfoSet(1);
         this.m_payInfoSet.m_payInfoCount = 1;
         this.m_payInfoSet.m_payInfos[0].m_discountForDisplay = product.DiscountForShow;
         this.m_payInfoSet.m_payInfos[0].m_oriValue           = buyPrice;
         this.m_payInfoSet.m_payInfos[0].m_payType            = payType;
         this.m_payInfoSet.m_payInfos[0].m_payValue           = payValue;
     }
     else
     {
         this.m_useable    = null;
         this.m_firstName  = null;
         this.m_secondName = null;
         this.m_useable    = null;
         this.m_iconPath   = null;
         this.m_payInfoSet = default(stPayInfoSet);
     }
 }
Beispiel #7
0
        private void SetSkinItem(CMallItemWidget mallWidget, ResHeroSkin skinInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.color = CUIUtility.s_Color_White;
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, skinInfo.szSkinPicID);

            component.SetSprite(prefabPath, form, false, true, true);
            mallWidget.m_skinLabel.CustomSetActive(true);
            CUICommonSystem.SetHeroSkinLabelPic(form, mallWidget.m_skinLabel, skinInfo.dwHeroID, skinInfo.dwSkinID);
            mallWidget.m_topNameLeftText.GetComponent <Text>().text = skinInfo.szHeroName;
            mallWidget.m_topNameRightText.CustomSetActive(true);
            mallWidget.m_topNameRightText.GetComponent <Text>().text = skinInfo.szSkinName;
            ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(skinInfo.dwHeroID, skinInfo.dwSkinID);

            this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(skinInfo, skinPromotion);
            uint num = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);

            this.SetItemTag(mallWidget, null, skinPromotion, form);
            stUIEventParams eventParams = new stUIEventParams();

            eventParams.openHeroFormPar.heroId = skinInfo.dwHeroID;
            eventParams.openHeroFormPar.skinId = skinInfo.dwSkinID;
            eventParams.commonUInt32Param1     = num;
            mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mall_GiftShowDetail, eventParams);
            stUIEventParams params2 = new stUIEventParams();

            params2.heroSkinParam.heroId      = skinInfo.dwHeroID;
            params2.heroSkinParam.skinId      = skinInfo.dwSkinID;
            params2.heroSkinParam.isCanCharge = true;
            params2.commonUInt64Param1        = this._curFriendUid;
            params2.commonBool         = this._curFriendIsSns;
            params2.commonUInt32Param1 = this._curWorldId;
            mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroSkin_OpenBuyHeroSkinForFriend, params2);
        }
Beispiel #8
0
        public static bool IsCanBuy(uint heroId, uint skinId)
        {
            ResHeroSkin heroSkin = GetHeroSkin(heroId, skinId);

            if (heroSkin == null)
            {
                return(false);
            }
            if (!GameDataMgr.IsSkinAvailableAtShop(heroSkin.dwID))
            {
                return(false);
            }
            ResSkinPromotion skinPromotion    = new ResSkinPromotion();
            stPayInfoSet     payInfoSetOfGood = new stPayInfoSet();

            skinPromotion = GetSkinPromotion(heroSkin.dwID);
            if (skinPromotion != null)
            {
                payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(false, 0, skinPromotion.bIsBuyCoupons > 0, skinPromotion.dwBuyCoupons, skinPromotion.bIsBuyDiamond > 0, skinPromotion.dwBuyDiamond, 0x2710);
            }
            else
            {
                payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(heroSkin);
            }
            return(payInfoSetOfGood.m_payInfoCount > 0);
        }
Beispiel #9
0
        private void UpdateItemPricePnl(CUIFormScript form, Transform pricePnlTrans, Transform tagTrans, COMDT_AKALISHOP_GOODS productInfo)
        {
            GameObject obj              = Utility.FindChild(pricePnlTrans.gameObject, "oldPricePanel");
            Text       componetInChild  = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "oldPricePanel/oldPriceText");
            Image      componetInChild2 = Utility.GetComponetInChild <Image>(pricePnlTrans.gameObject, "newPricePanel/costImage");
            Text       componetInChild3 = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "newPricePanel/newCostText");
            Text       componetInChild4 = Utility.GetComponetInChild <Text>(tagTrans.gameObject, "Text");

            tagTrans.gameObject.CustomSetActive(false);
            obj.CustomSetActive(false);
            tagTrans.gameObject.CustomSetActive(true);
            float num = productInfo.dwItemDiscount / 10u;

            if (Math.Abs(num % 1f) < 1.401298E-45f)
            {
                componetInChild4.set_text(string.Format("{0}折", ((int)num).ToString("D")));
            }
            else
            {
                componetInChild4.set_text(string.Format("{0}折", num.ToString("0.0")));
            }
            obj.CustomSetActive(true);
            componetInChild.set_text(productInfo.dwOrigPrice.ToString());
            componetInChild3.set_text(productInfo.dwRealPrice.ToString());
            componetInChild2.SetSprite(CMallSystem.GetPayTypeIconPath(enPayType.DianQuan), form, true, false, false, false);
        }
Beispiel #10
0
        public void BuyShopProduct(ShopProduct shopProduct, uint count, bool needConfirm, CUIEvent uiEvent = null)
        {
            CUseable  useable  = CUseableManager.CreateUseable(shopProduct.Type, shopProduct.ID, 0);
            enPayType payType  = CMallSystem.ResBuyTypeToPayType((int)shopProduct.CoinType);
            uint      payValue = 0;

            if ((shopProduct != null) && shopProduct.m_bChangeGiftPrice)
            {
                payValue = shopProduct.m_newGiftPrice * count;
            }
            else
            {
                payValue = shopProduct.ConvertWithRealDiscount(useable.GetBuyPrice(shopProduct.CoinType) * count);
            }
            if (uiEvent == null)
            {
                uiEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent();

                uiEvent.m_eventID         = enUIEventID.Mall_Product_Confirm_Buy;
                uiEvent.m_eventParams.tag = (int)shopProduct.Key;
                uiEvent.m_eventParams.commonUInt32Param1 = count;
            }
            else
            {
                uiEvent.m_eventParams.commonUInt32Param1 = count;
            }
            CMallSystem.TryToPay(enPayPurpose.Buy, string.Format("{0}{1}", useable.m_name, (count <= 1) ? string.Empty : ("x" + count)), payType, payValue, uiEvent.m_eventID, ref uiEvent.m_eventParams, enUIEventID.None, needConfirm, true, false);
        }
Beispiel #11
0
        private int CompareCoupons(ResHeroSkin l, ResHeroSkin r)
        {
            ResSkinPromotion skinPromotion    = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID);
            ResSkinPromotion resPromotion     = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID);
            stPayInfoSet     payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, skinPromotion);
            stPayInfoSet     set2             = CMallSystem.GetPayInfoSetOfGood(r, resPromotion);
            uint             maxValue         = uint.MaxValue;
            uint             payValue         = uint.MaxValue;

            for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++)
            {
                if ((((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan)) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan)) && (payInfoSetOfGood.m_payInfos[i].m_payValue < maxValue))
                {
                    maxValue = payInfoSetOfGood.m_payInfos[i].m_payValue;
                }
            }
            for (int j = 0; j < set2.m_payInfoCount; j++)
            {
                if ((((set2.m_payInfos[j].m_payType == enPayType.Diamond) || (set2.m_payInfos[j].m_payType == enPayType.DianQuan)) || (set2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan)) && (set2.m_payInfos[j].m_payValue < payValue))
                {
                    payValue = set2.m_payInfos[j].m_payValue;
                }
            }
            if ((maxValue == uint.MaxValue) && this.IsDesc())
            {
                maxValue = 0;
            }
            if ((payValue == uint.MaxValue) && this.IsDesc())
            {
                payValue = 0;
            }
            return(maxValue.CompareTo(payValue));
        }
Beispiel #12
0
        private void OnBuyReturn(CSPkg msg)
        {
            SCPKG_CMD_SPECSALEBUY stSpecSaleBuyRsp = msg.stPkgData.stSpecSaleBuyRsp;

            if (stSpecSaleBuyRsp.iErrCode == 0)
            {
                CSDT_SPECSALEBUYINFO stSpecSaleBuyInfo = stSpecSaleBuyRsp.stSpecSaleBuyInfo;
                if (this._spDict.ContainsKey(stSpecSaleBuyInfo.dwId))
                {
                    ShopProduct sp = this._spDict[stSpecSaleBuyInfo.dwId];
                    sp.BoughtCount += stSpecSaleBuyInfo.dwNum;
                    if ((sp.Type != COM_ITEM_TYPE.COM_OBJTYPE_HERO) && (((sp.Type != COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) || !sp.IsPropGift) || !sp.IsPropGiftUseImm))
                    {
                        CUseable   useable = CUseableManager.CreateUseable(sp.Type, sp.ID, (int)stSpecSaleBuyInfo.dwNum);
                        CUseable[] items   = new CUseable[] { useable };
                        Singleton <CUIManager> .GetInstance().OpenAwardTip(items, Singleton <CTextManager> .GetInstance().GetText("Buy_Ok"), false, enUIEventID.None, false, false, "Form_Award");
                    }
                    this.FilterProduct(sp);
                    CMallSystem instance = Singleton <CMallSystem> .GetInstance();

                    if (((instance.m_MallForm != null) && instance.m_IsMallFormOpen) && (instance.CurTab == CMallSystem.Tab.Factory_Shop))
                    {
                        this.Draw(instance.m_MallForm);
                    }
                    Singleton <EventRouter> .GetInstance().BroadCastEvent <ShopProduct>(EventID.Mall_Factory_Shop_Product_Bought_Success, sp);
                }
            }
            else
            {
                Singleton <CUIManager> .GetInstance().OpenMessageBox(string.Format("{0}(错误码{1})", Singleton <CTextManager> .GetInstance().GetText("buySpecSaleFailed"), stSpecSaleBuyRsp.iErrCode), false);
            }
        }
Beispiel #13
0
        private int CompareCoupons(ResHeroSkin l, ResHeroSkin r)
        {
            ResSkinPromotion skinPromotion     = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID);
            ResSkinPromotion skinPromotion2    = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID);
            stPayInfoSet     payInfoSetOfGood  = CMallSystem.GetPayInfoSetOfGood(l, skinPromotion);
            stPayInfoSet     payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, skinPromotion2);
            uint             num  = 4294967295u;
            uint             num2 = 4294967295u;

            for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++)
            {
                if ((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood.m_payInfos[i].m_payValue < num)
                {
                    num = payInfoSetOfGood.m_payInfos[i].m_payValue;
                }
            }
            for (int j = 0; j < payInfoSetOfGood2.m_payInfoCount; j++)
            {
                if ((payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.Diamond || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DianQuan || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood2.m_payInfos[j].m_payValue < num2)
                {
                    num2 = payInfoSetOfGood2.m_payInfos[j].m_payValue;
                }
            }
            if (num == 4294967295u && this.IsDesc())
            {
                num = 0u;
            }
            if (num2 == 4294967295u && this.IsDesc())
            {
                num2 = 0u;
            }
            return(num.CompareTo(num2));
        }
Beispiel #14
0
        private void OnClickReviveBtn(CUIEvent uiEvent)
        {
            stUIEventParams stUIEventParams = default(stUIEventParams);

            stUIEventParams.commonUInt32Param1 = (uint)PVEReviveHeros.m_iRemainReviveNum;
            CMallSystem.TryToPay(enPayPurpose.Relive, string.Empty, this.m_relivePayType, this.m_relivePayValue, enUIEventID.ReviveHero_OnConfirmRevive, ref stUIEventParams, enUIEventID.ReviveHero_OnReviveFailed, true, true, false);
        }
Beispiel #15
0
        private void OnClickReviveBtn(CUIEvent uiEvent)
        {
            stUIEventParams confirmEventParams = new stUIEventParams {
                commonUInt32Param1 = (uint)m_iRemainReviveNum
            };

            CMallSystem.TryToPay(enPayPurpose.Relive, string.Empty, this.m_relivePayType, this.m_relivePayValue, enUIEventID.ReviveHero_OnConfirmRevive, ref confirmEventParams, enUIEventID.ReviveHero_OnReviveFailed, true, true);
        }
Beispiel #16
0
        public static stPayInfoSet GetSkinPayInfoSet(uint heroId, uint skinId)
        {
            ResSkinPromotion resPromotion = new ResSkinPromotion();
            stPayInfoSet     set          = new stPayInfoSet();

            resPromotion = GetSkinPromotion(heroId, skinId);
            return(CMallSystem.GetPayInfoSetOfGood(GetHeroSkin(heroId, skinId), resPromotion));
        }
Beispiel #17
0
        private void InitFromView(CUIFormScript formScript)
        {
            SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

            this.InitBuffItem(formScript, curLvelContext);
            this.m_relivePayType  = CMallSystem.ResBuyTypeToPayType((int)curLvelContext.m_reviveInfo[curLvelContext.m_levelDifficulty].astReviveCost[3 - PVEReviveHeros.m_iRemainReviveNum].bCostType);
            this.m_relivePayValue = curLvelContext.m_reviveInfo[curLvelContext.m_levelDifficulty].astReviveCost[3 - PVEReviveHeros.m_iRemainReviveNum].dwCostPrice;
            string     text   = string.Format(Singleton <CTextManager> .GetInstance().GetText("ReliveMessage"), Singleton <CTextManager> .GetInstance().GetText(CMallSystem.s_payTypeNameKeys[(int)this.m_relivePayType]));
            GameObject widget = formScript.GetWidget(0);

            if (widget != null)
            {
                Text component = widget.GetComponent <Text>();
                if (component != null)
                {
                    component.text = text;
                }
            }
            GameObject widget2 = formScript.GetWidget(1);

            if (widget2 != null)
            {
                Image component2 = widget2.GetComponent <Image>();
                if (component2 != null)
                {
                    component2.SetSprite(CMallSystem.GetPayTypeIconPath(this.m_relivePayType), formScript, true, false, false, false);
                }
            }
            GameObject widget3 = formScript.GetWidget(2);

            if (widget3 != null)
            {
                Text component3 = widget3.GetComponent <Text>();
                if (component3 != null)
                {
                    component3.text = this.m_relivePayValue.ToString();
                }
            }
            GameObject gameObject = this.m_form.transform.Find("buffInfoPanel").gameObject;

            if (gameObject == null)
            {
                return;
            }
            GameObject gameObject2 = gameObject.transform.Find("ReviveText/NumText").gameObject;

            if (gameObject2 == null)
            {
                return;
            }
            gameObject2.GetComponent <Text>().text = PVEReviveHeros.m_iRemainReviveNum.ToString();
            CUITimerScript component4    = gameObject.transform.Find("Timer").GetComponent <CUITimerScript>();
            byte           reviveTimeMax = curLvelContext.m_reviveTimeMax;

            component4.SetTotalTime((float)reviveTimeMax);
        }
Beispiel #18
0
        private void Talent_Buy_BtnSellClick(CUIEvent uiEvent)
        {
            enPayType payType = CMallSystem.ResBuyTypeToPayType(uiEvent.m_eventParams.tag);
            uint      tagUInt = uiEvent.m_eventParams.tagUInt;

            string[] args = new string[] { uiEvent.m_eventParams.tagStr };
            string   text = Singleton <CTextManager> .instance.GetText("Talent_Buy_5", args);

            CMallSystem.TryToPay(enPayPurpose.Buy, text, payType, tagUInt, enUIEventID.Talent_Buy_ConfirmClick, ref uiEvent.m_eventParams, enUIEventID.None, true, true);
        }
Beispiel #19
0
        public static stPayInfoSet GetSkinPayInfoSet(uint heroId, uint skinId)
        {
            ResSkinPromotion resPromotion = new ResSkinPromotion();
            stPayInfoSet     stPayInfoSet = default(stPayInfoSet);

            resPromotion = CSkinInfo.GetSkinPromotion(heroId, skinId);
            ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(heroId, skinId);

            return(CMallSystem.GetPayInfoSetOfGood(heroSkin, resPromotion));
        }
Beispiel #20
0
        private void InitFromView(CUIFormScript formScript)
        {
            SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

            ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(curLvelContext.iLevelID);

            this.InitBuffItem(formScript, curLvelContext, dataByKey);
            this.m_relivePayType  = CMallSystem.ResBuyTypeToPayType(dataByKey.astReviveInfo[curLvelContext.difficulty].astReviveCost[3 - m_iRemainReviveNum].bCostType);
            this.m_relivePayValue = dataByKey.astReviveInfo[curLvelContext.difficulty].astReviveCost[3 - m_iRemainReviveNum].dwCostPrice;
            string     str    = string.Format(Singleton <CTextManager> .GetInstance().GetText("ReliveMessage"), Singleton <CTextManager> .GetInstance().GetText(CMallSystem.s_payTypeNameKeys[(int)this.m_relivePayType]));
            GameObject widget = formScript.GetWidget(0);

            if (widget != null)
            {
                Text component = widget.GetComponent <Text>();
                if (component != null)
                {
                    component.text = str;
                }
            }
            GameObject obj3 = formScript.GetWidget(1);

            if (obj3 != null)
            {
                Image image = obj3.GetComponent <Image>();
                if (image != null)
                {
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(this.m_relivePayType), formScript, true, false, false);
                }
            }
            GameObject obj4 = formScript.GetWidget(2);

            if (obj4 != null)
            {
                Text text2 = obj4.GetComponent <Text>();
                if (text2 != null)
                {
                    text2.text = this.m_relivePayValue.ToString();
                }
            }
            GameObject gameObject = this.m_form.transform.Find("buffInfoPanel").gameObject;

            if (gameObject != null)
            {
                GameObject obj6 = gameObject.transform.Find("ReviveText/NumText").gameObject;
                if (obj6 != null)
                {
                    obj6.GetComponent <Text>().text = m_iRemainReviveNum.ToString();
                    CUITimerScript script         = gameObject.transform.Find("Timer").GetComponent <CUITimerScript>();
                    byte           bReviveTimeMax = dataByKey.bReviveTimeMax;
                    script.SetTotalTime((float)bReviveTimeMax);
                }
            }
        }
        private void OnBuyItem(CUIEvent uiEvent)
        {
            enPayType     tag           = (enPayType)uiEvent.m_eventParams.tag;
            uint          payValue      = uiEvent.m_eventParams.commonUInt32Param1;
            string        goodName      = string.Empty;
            COM_ITEM_TYPE com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_NULL;
            uint          uniSkinId     = 0;
            long          key           = 0L;

            if (uiEvent.m_eventParams.heroSkinParam.skinId != 0)
            {
                com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN;
                uniSkinId     = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId);
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(uniSkinId);
                DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", uniSkinId));
                if (heroSkin == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName);
            }
            else if (uiEvent.m_eventParams.heroId != 0)
            {
                com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HERO;
                uniSkinId     = uiEvent.m_eventParams.heroId;
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(uniSkinId);
                DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", uniSkinId));
                if (dataByKey == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName);
            }
            else
            {
                DebugHelper.Assert(false, "神秘商店购买不支持该物品类型");
                return;
            }
            key = GameDataMgr.GetDoubleKey((uint)com_item_type, uniSkinId);
            CMallMysteryProduct product = new CMallMysteryProduct();

            if (!this.m_ProductDic.TryGetValue(key, out product))
            {
                DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), com_item_type), uniSkinId));
            }
            else
            {
                CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent();

                uIEvent.m_eventID         = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item;
                uIEvent.m_eventParams.tag = (int)product.ID;
                CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, payValue, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true);
            }
        }
Beispiel #22
0
        private void On_Chat_Text_Send(CUIEvent uiEvent)
        {
            if ((this.view != null) && this.view.bShow)
            {
                string inputText = this.view.GetInputText();
                switch (this.CheckSend(this.view.CurTab, inputText, true))
                {
                case enCheckChatResult.Success:
                    Singleton <CChatController> .GetInstance().On_InputFiled_EndEdit(inputText);

                    this.view.ClearInputText();
                    break;

                case enCheckChatResult.EmptyLimit:
                    Singleton <CUIManager> .instance.OpenTips("Chat_Common_Tips_10", true, 1f, null, new object[0]);

                    break;

                case enCheckChatResult.FunUnlockLimit:
                    Singleton <CUIManager> .instance.OpenTips("Chat_Common_Tips_6", true, 1f, null, new object[0]);

                    break;

                case enCheckChatResult.BanLimit:
                {
                    DateTime banTime = MonoSingleton <IDIPSys> .GetInstance().GetBanTime(COM_ACNT_BANTIME_TYPE.COM_ACNT_BANTIME_DENYCHAT);

                    object[] args       = new object[] { banTime.Year, banTime.Month, banTime.Day, banTime.Hour, banTime.Minute };
                    string   strContent = string.Format("您已被禁言!禁言截止时间为{0}年{1}月{2}日{3}时{4}分", args);
                    Singleton <CUIManager> .GetInstance().OpenMessageBox(strContent, false);

                    this.view.ClearInputText();
                    break;
                }

                case enCheckChatResult.CdLimit:
                {
                    int num = this.model.channelMgr.GetChannel(this.view.CurTab).Get_Left_CDTime();
                    Singleton <CUIManager> .instance.OpenTips("chat_input_cd", true, 1f, null, new object[0]);

                    this.view.ClearInputText();
                    break;
                }

                case enCheckChatResult.FreeCntLimit:
                    uiEvent.m_eventParams.tagStr = inputText;
                    CMallSystem.TryToPay(enPayPurpose.Chat, string.Empty, enPayType.DiamondAndDianQuan, (uint)Singleton <CChatController> .instance.model.sysData.chatCostNum, enUIEventID.Chat_Cost_Send, ref uiEvent.m_eventParams, enUIEventID.None, false, true);
                    break;
                }
            }
        }
Beispiel #23
0
        private void OnBuyItem(CUIEvent uiEvent)
        {
            enPayType     tag = (enPayType)uiEvent.m_eventParams.tag;
            uint          commonUInt32Param = uiEvent.m_eventParams.commonUInt32Param1;
            string        goodName          = string.Empty;
            COM_ITEM_TYPE cOM_ITEM_TYPE;
            uint          num;

            if (uiEvent.m_eventParams.heroSkinParam.skinId != 0u)
            {
                cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN;
                num           = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId);
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(num);
                DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", num));
                if (heroSkin == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName);
            }
            else
            {
                if (uiEvent.m_eventParams.heroId == 0u)
                {
                    DebugHelper.Assert(false, "神秘商店购买不支持该物品类型");
                    return;
                }
                cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HERO;
                num           = uiEvent.m_eventParams.heroId;
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(num);
                DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", num));
                if (dataByKey == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName);
            }
            int productID = this.GetProductID(num);

            if (productID < 0)
            {
                DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), cOM_ITEM_TYPE), num));
                return;
            }
            CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent();

            uIEvent.m_eventID         = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item;
            uIEvent.m_eventParams.tag = productID;
            CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, commonUInt32Param, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true, false);
        }
Beispiel #24
0
        private void ManageShelf()
        {
            bool flag  = this.HandleSaleOff();
            bool flag2 = this.HandleSaleOn();

            if (flag || flag2)
            {
                this.SortProducts();
                CMallSystem instance = Singleton <CMallSystem> .GetInstance();

                if (((instance.m_MallForm != null) && instance.m_IsMallFormOpen) && (instance.CurTab == CMallSystem.Tab.Factory_Shop))
                {
                    this.Draw(instance.m_MallForm);
                }
            }
        }
        private void OnBuyPickDialogConfirm(CUIEvent uiEvent, uint count)
        {
            int      bCount  = (int)count;
            uint     tagUInt = uiEvent.m_eventParams.tagUInt;
            int      tag     = uiEvent.m_eventParams.tag;
            CUseable useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, tagUInt, bCount);

            if (useable != null)
            {
                int             num4               = (int)(useable.GetBuyPrice((RES_SHOPBUY_COINTYPE)tag) * bCount);
                enPayType       payType            = CMallSystem.ResBuyTypeToPayType(tag);
                stUIEventParams confirmEventParams = new stUIEventParams {
                    tag = bCount
                };
                string[] args = new string[] { bCount.ToString(), useable.m_name };
                CMallSystem.TryToPay(enPayPurpose.Buy, Singleton <CTextManager> .GetInstance().GetText("Union_Battle_Tips5", args), payType, (uint)num4, enUIEventID.Union_Battle_ConfirmBuyItem, ref confirmEventParams, enUIEventID.None, true, true);
            }
        }
        private void UpdateItemPricePnl(CUIFormScript form, Transform pricePnlTrans, Transform tagTrans, ref stPayInfoSet payInfoSet)
        {
            GameObject obj2            = Utility.FindChild(pricePnlTrans.gameObject, "oldPricePanel");
            Text       componetInChild = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "oldPricePanel/oldPriceText");
            Image      image           = Utility.GetComponetInChild <Image>(pricePnlTrans.gameObject, "newPricePanel/costImage");
            Text       text2           = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "newPricePanel/newCostText");
            Text       text3           = Utility.GetComponetInChild <Text>(tagTrans.gameObject, "Text");

            tagTrans.gameObject.CustomSetActive(false);
            obj2.CustomSetActive(false);
            for (int i = 0; i < payInfoSet.m_payInfoCount; i++)
            {
                stPayInfo info = payInfoSet.m_payInfos[i];
                if (!Singleton <CMallMysteryShop> .GetInstance().HasGotDiscount)
                {
                    tagTrans.gameObject.CustomSetActive(true);
                    text3.text = "?折";
                    text2.text = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
                else if (Singleton <CMallMysteryShop> .GetInstance().HasGotDiscount&& ((info.m_discountForDisplay == 0x2710) || (info.m_oriValue == info.m_payValue)))
                {
                    text2.text = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
                else
                {
                    tagTrans.gameObject.CustomSetActive(true);
                    float num2 = ((float)info.m_discountForDisplay) / 1000f;
                    if (Math.Abs((float)(num2 % 1f)) < float.Epsilon)
                    {
                        text3.text = string.Format("{0}折", ((int)num2).ToString("D"));
                    }
                    else
                    {
                        text3.text = string.Format("{0}折", num2.ToString("0.0"));
                    }
                    obj2.CustomSetActive(true);
                    componetInChild.text = info.m_oriValue.ToString();
                    text2.text           = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
            }
        }
Beispiel #27
0
 public CMallItem(uint heroID, CMallItem.IconType iconType = CMallItem.IconType.Normal)
 {
     this.m_type     = CMallItem.ItemType.Hero;
     this.m_iconType = iconType;
     this.m_heroData = CHeroDataFactory.CreateHeroData(heroID);
     if (this.m_heroData != null)
     {
         this.m_firstName  = this.m_heroData.heroName;
         this.m_secondName = null;
         string s_Sprite_Dynamic_Icon_Dir = CUIUtility.s_Sprite_Dynamic_Icon_Dir;
         if (iconType == CMallItem.IconType.Small)
         {
             this.m_useable = CUseableManager.CreateUseable(4, heroID, 1);
             if (this.m_useable != null)
             {
                 this.m_iconPath = this.m_useable.GetIconPath();
             }
             else
             {
                 this.m_iconPath = null;
             }
         }
         else if (this.m_heroData.heroCfgInfo != null)
         {
             this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_heroData.heroCfgInfo.szImagePath;
         }
         else
         {
             this.m_iconPath = null;
         }
         ResHeroPromotion resPromotion = this.m_heroData.promotion();
         this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_heroData.heroCfgInfo, resPromotion);
     }
     else
     {
         this.m_useable    = null;
         this.m_firstName  = null;
         this.m_secondName = null;
         this.m_iconPath   = null;
         this.m_payInfoSet = default(stPayInfoSet);
     }
 }
Beispiel #28
0
 public CMallItem(uint heroID, IconType iconType = 0)
 {
     this.m_type     = ItemType.Hero;
     this.m_iconType = iconType;
     this.m_heroData = CHeroDataFactory.CreateHeroData(heroID);
     if (this.m_heroData != null)
     {
         this.m_firstName  = this.m_heroData.heroName;
         this.m_secondName = null;
         string str = CUIUtility.s_Sprite_Dynamic_Icon_Dir;
         if (iconType == IconType.Small)
         {
             this.m_useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_HERO, heroID, 1);
             if (this.m_useable != null)
             {
                 this.m_iconPath = this.m_useable.GetIconPath();
             }
             else
             {
                 this.m_iconPath = null;
             }
         }
         else
         {
             this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_heroData.imagePath;
         }
         ResHeroPromotion resPromotion = this.m_heroData.promotion();
         this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_heroData.heroCfgInfo, resPromotion);
     }
     else
     {
         this.m_useable    = null;
         this.m_firstName  = null;
         this.m_secondName = null;
         this.m_iconPath   = null;
         this.m_payInfoSet = new stPayInfoSet();
     }
 }
Beispiel #29
0
        private int CompareCoin(ResHeroCfgInfo l, ResHeroCfgInfo r)
        {
            ResHeroPromotion resPromotion  = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion();
            ResHeroPromotion resPromotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion();
            ResHeroShop      resHeroShop   = null;
            ResHeroShop      resHeroShop2  = null;

            GameDataMgr.heroShopInfoDict.TryGetValue(l.dwCfgID, out resHeroShop);
            GameDataMgr.heroShopInfoDict.TryGetValue(r.dwCfgID, out resHeroShop2);
            stPayInfoSet payInfoSetOfGood  = CMallSystem.GetPayInfoSetOfGood(l, resPromotion);
            stPayInfoSet payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, resPromotion2);
            uint         num  = 4294967295u;
            uint         num2 = 4294967295u;

            for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++)
            {
                if (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.GoldCoin && payInfoSetOfGood.m_payInfos[i].m_payValue <= num)
                {
                    num = payInfoSetOfGood.m_payInfos[i].m_payValue;
                }
            }
            for (int j = 0; j < payInfoSetOfGood2.m_payInfoCount; j++)
            {
                if (payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.GoldCoin && payInfoSetOfGood2.m_payInfos[j].m_payValue <= num2)
                {
                    num2 = payInfoSetOfGood2.m_payInfos[j].m_payValue;
                }
            }
            if (num == 4294967295u && this.IsDesc())
            {
                num = 0u;
            }
            if (num2 == 4294967295u && this.IsDesc())
            {
                num2 = 0u;
            }
            return(num.CompareTo(num2));
        }
Beispiel #30
0
 public CMallItem(uint heroID, uint skinID, IconType iconType = 0)
 {
     this.m_type     = ItemType.Skin;
     this.m_iconType = iconType;
     this.m_heroData = CHeroDataFactory.CreateHeroData(heroID);
     this.m_skinData = CSkinInfo.GetHeroSkin(heroID, skinID);
     if ((this.m_heroData != null) && (this.m_skinData != null))
     {
         this.m_firstName  = this.m_heroData.heroName;
         this.m_secondName = this.m_skinData.szSkinName;
         if (iconType == IconType.Small)
         {
             this.m_useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN, this.m_skinData.dwID, 1);
             if (this.m_useable != null)
             {
                 this.m_iconPath = this.m_useable.GetIconPath();
             }
             else
             {
                 this.m_iconPath = null;
             }
         }
         else
         {
             this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_skinData.szSkinPicID;
         }
         ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(heroID, skinID);
         this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_skinData, skinPromotion);
     }
     else
     {
         this.m_useable    = null;
         this.m_firstName  = null;
         this.m_secondName = null;
         this.m_iconPath   = null;
         this.m_payInfoSet = new stPayInfoSet();
     }
 }