Example #1
0
        private void ShowRewardForm(CUIEvent uiEvent)
        {
            Singleton <CUIManager> .GetInstance().CloseForm(PVESettleSys.PATH_STAR);

            if (this.m_SettleData != null)
            {
                if (this.m_SettleData.stReward != null)
                {
                    COMDT_REWARD_DETAIL          stReward = this.m_SettleData.stReward;
                    ListView <COMDT_REWARD_INFO> listView = new ListView <COMDT_REWARD_INFO>();
                    for (int i = 0; i < (int)stReward.bNum; i++)
                    {
                        COMDT_REWARD_INFO cOMDT_REWARD_INFO = stReward.astRewardDetail[i];
                        byte bType = cOMDT_REWARD_INFO.bType;
                        if (bType == 6)
                        {
                            listView.Add(cOMDT_REWARD_INFO);
                        }
                    }
                    if (listView.get_Count() > 0 && listView.get_Item(0).bType == 6)
                    {
                        CSymbolItem       useable           = (CSymbolItem)CUseableManager.CreateUseable(5, 0uL, listView.get_Item(0).stRewardInfo.get_stSymbol().dwSymbolID, (int)listView.get_Item(0).stRewardInfo.get_stSymbol().dwCnt, 0);
                        CUseableContainer cUseableContainer = new CUseableContainer(enCONTAINER_TYPE.ITEM);
                        cUseableContainer.Add(useable);
                        CUICommonSystem.ShowSymbol(cUseableContainer, enUIEventID.Settle_ClickItemDetailEnd);
                        MonoSingleton <NewbieGuideManager> .GetInstance().CheckTriggerTime(NewbieGuideTriggerTimeType.getSymbolReward, new uint[0]);

                        return;
                    }
                }
                this.ShowPveExp();
            }
        }
Example #2
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);
            }
        }
        private void OnExchangeHeroSkinConfirm(CUIEvent uiEvent)
        {
            if (this._elementList == null)
            {
                return;
            }
            int commonUInt32Param = (int)uiEvent.m_eventParams.commonUInt32Param1;

            if (commonUInt32Param >= 0 && commonUInt32Param < this._elementList.Count)
            {
                uint     dwResItemID      = this._elementList[commonUInt32Param].phase.Config.dwResItemID;
                CUseable cUseable         = CUseableManager.CreateUseable((COM_ITEM_TYPE)this._elementList[commonUInt32Param].phase.Config.wResItemType, this._elementList[commonUInt32Param].phase.Config.dwResItemID, (int)this._elementList[commonUInt32Param].phase.Config.wResItemCnt);
                int      maxExchangeCount = this._elementList[commonUInt32Param].phase.GetMaxExchangeCount();
                if (maxExchangeCount > 1)
                {
                    stUIEventParams par = default(stUIEventParams);
                    par.commonUInt16Param1 = (ushort)commonUInt32Param;
                    Singleton <CUIManager> .GetInstance().OpenExchangeCountSelectForm(cUseable, maxExchangeCount, enUIEventID.Activity_PtExchangeCountReady, par, this._elementList[commonUInt32Param].phase.Config.dwPointCnt, Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().JiFen);
                }
                else
                {
                    string          arg_12E_0 = (cUseable == null) ? string.Empty : cUseable.m_name;
                    stUIEventParams par2      = default(stUIEventParams);
                    par2.commonUInt16Param1 = (ushort)commonUInt32Param;
                    this._elementList[commonUInt32Param].phase.SetExchangeCountOnce(1);
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Activity_PtExchangeConfirm, par2);
                }
            }
        }
Example #4
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);
        }
Example #5
0
        private void ShowRewardForm(CUIEvent uiEvent)
        {
            Singleton <CUIManager> .GetInstance().CloseForm(PATH_STAR);

            if (this.m_SettleData != null)
            {
                if (this.m_SettleData.stReward != null)
                {
                    COMDT_REWARD_DETAIL          stReward = this.m_SettleData.stReward;
                    ListView <COMDT_REWARD_INFO> view     = new ListView <COMDT_REWARD_INFO>();
                    for (int i = 0; i < stReward.bNum; i++)
                    {
                        COMDT_REWARD_INFO comdt_reward_info = stReward.astRewardDetail[i];
                        if (comdt_reward_info.bType == 6)
                        {
                            view.Add(comdt_reward_info);
                        }
                    }
                    if ((view.Count > 0) && (view[0].bType == 6))
                    {
                        CSymbolItem       useable   = (CSymbolItem)CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, 0L, view[0].stRewardInfo.stSymbol.dwSymbolID, (int)view[0].stRewardInfo.stSymbol.dwCnt, 0);
                        CUseableContainer container = new CUseableContainer(enCONTAINER_TYPE.ITEM);
                        container.Add(useable);
                        CUICommonSystem.ShowSymbol(container, enUIEventID.Settle_ClickItemDetailEnd);
                        MonoSingleton <NewbieGuideManager> .GetInstance().CheckTriggerTime(NewbieGuideTriggerTimeType.getSymbolReward, new uint[0]);

                        return;
                    }
                }
                this.ShowPveExp();
            }
        }
Example #6
0
        public static ListView <CUseable> GetUseableListFromItemList(COMDT_REWARD_ITEMLIST itemList)
        {
            ListView <CUseable> listView = new ListView <CUseable>();

            for (int i = 0; i < (int)itemList.wRewardCnt; i++)
            {
                ushort   wItemType = itemList.astRewardList[i].wItemType;
                ushort   wItemCnt  = itemList.astRewardList[i].wItemCnt;
                uint     dwItemID  = itemList.astRewardList[i].dwItemID;
                CUseable cUseable  = CUseableManager.CreateUseable((COM_ITEM_TYPE)wItemType, 0uL, dwItemID, (int)wItemCnt, 0);
                if (cUseable != null)
                {
                    byte bFromType = itemList.astRewardList[i].bFromType;
                    if (bFromType != 1)
                    {
                        if (bFromType == 2)
                        {
                            cUseable.ExtraFromType = (int)itemList.astRewardList[i].bFromType;
                            cUseable.ExtraFromData = (int)itemList.astRewardList[i].stFromInfo.stSkinInfo.dwSkinID;
                        }
                    }
                    else
                    {
                        cUseable.ExtraFromType = (int)itemList.astRewardList[i].bFromType;
                        cUseable.ExtraFromData = (int)itemList.astRewardList[i].stFromInfo.stHeroInfo.dwHeroID;
                    }
                    listView.Add(cUseable);
                }
            }
            return(listView);
        }
 public void InitData()
 {
     if (!this._inited)
     {
         this._inited = true;
         this._spDict = new DictionaryView <uint, ShopProduct>();
         this._spList = new ListView <ShopProduct>();
         DictionaryView <uint, ResSpecSale> .Enumerator enumerator = GameDataMgr.specSaleDict.GetEnumerator();
         while (enumerator.MoveNext())
         {
             KeyValuePair <uint, ResSpecSale> current = enumerator.Current;
             ResSpecSale config = current.Value;
             if (config != null)
             {
                 CUseable useable = CUseableManager.CreateUseable((COM_ITEM_TYPE)config.dwSpecSaleType, config.dwSpecSaleId, 0);
                 if ((useable != null) && (useable.m_baseID != 0))
                 {
                     ShopProduct item = new ShopProduct(config);
                     if (item.IsOnSale)
                     {
                         this._spList.Add(item);
                         this._spDict.Add(item.Key, item);
                     }
                 }
             }
         }
         if (< > f__am$cache5 == null)
         {
Example #8
0
        public int OnGetDjImageCallback(GameObject imgObj, int itemType, int itemID)
        {
            if (itemType < 0 || itemID < 0 || imgObj == null)
            {
                return(-1);
            }
            CUseable cUseable = CUseableManager.CreateUseable(itemType, (uint)itemID, 0);

            if (cUseable != null)
            {
                string iconPath  = cUseable.GetIconPath();
                Image  component = imgObj.GetComponent <Image>();
                int    result    = 0;
                if (component == null)
                {
                    imgObj.AddComponent <Image2>();
                }
                else
                {
                    result = 1;
                }
                Image component2 = imgObj.GetComponent <Image>();
                if (component2)
                {
                    CUIUtility.SetImageSprite(component2, iconPath, null, true, false, false, false);
                }
                return(result);
            }
            return(-2);
        }
Example #9
0
        private void OnExchangeHeroSkinConfirm(CUIEvent uiEvent)
        {
            if (this._elementList == null)
            {
                return;
            }
            int commonUInt32Param = (int)uiEvent.m_eventParams.commonUInt32Param1;

            if (commonUInt32Param >= 0 && commonUInt32Param < this._elementList.Count)
            {
                ResDT_Item_Info stResItemInfo    = this._elementList[commonUInt32Param].phase.Config.stResItemInfo;
                CUseable        cUseable         = CUseableManager.CreateUseable((COM_ITEM_TYPE)stResItemInfo.wItemType, stResItemInfo.dwItemID, 1);
                int             maxExchangeCount = this._elementList[commonUInt32Param].phase.GetMaxExchangeCount();
                if (maxExchangeCount > 1)
                {
                    stUIEventParams par = default(stUIEventParams);
                    par.commonUInt16Param1 = (ushort)commonUInt32Param;
                    Singleton <CUIManager> .GetInstance().OpenExchangeCountSelectForm(cUseable, maxExchangeCount, enUIEventID.Activity_ExchangeCountReady, par, 0u, 0u);
                }
                else
                {
                    string          arg_C2_0 = (cUseable == null) ? string.Empty : cUseable.m_name;
                    stUIEventParams par2     = default(stUIEventParams);
                    par2.commonUInt16Param1 = (ushort)commonUInt32Param;
                    this._elementList[commonUInt32Param].phase.SetExchangeCountOnce(1);
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Activity_ExchangeConfirm, par2);
                }
            }
        }
Example #10
0
 public static CUseable GetUseableFromReward(int reward_type, uint equip_id, int count)
 {
     if (reward_type != 4)
     {
         return(null);
     }
     return(CUseableManager.CreateUseable(3, 0uL, equip_id, count, 0));
 }
Example #11
0
 public static CUseable GetUseableFromReward(int reward_type, uint equip_id, int count)
 {
     if (reward_type != 4)
     {
         return(null);
     }
     return(CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP, 0L, equip_id, count, 0));
 }
Example #12
0
        private static void SetReward(CUIFormScript formScript, GameObject itemCell, ResLevelCfgInfo resLevelInfo, int difficulty)
        {
            ResDT_PveRewardShowInfo info = resLevelInfo.astRewardShowDetail[difficulty - 1];
            CUseable itemUseable         = CUseableManager.CreateUseable((COM_ITEM_TYPE)info.bRewardType, info.dwRewardID, 0);

            if (itemUseable != null)
            {
                CUICommonSystem.SetItemCell(formScript, itemCell, itemUseable, true, false);
            }
        }
Example #13
0
            public void Validate()
            {
                if ((this.phase != null) && (this.uiItem != null))
                {
                    this.uiItem.CustomSetActive(true);
                    ResDT_PointExchange    config = this.phase.Config;
                    PointsExchangeActivity owner  = this.phase.Owner as PointsExchangeActivity;
                    if ((owner != null) && (owner.PointsConfig != null))
                    {
                        ResWealPointExchange pointsConfig = owner.PointsConfig;
                        GameObject           gameObject   = this.uiItem.transform.FindChild("DuihuanBtn").gameObject;
                        gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt32Param1 = (uint)this.index;
                        uint maxExchangeCount = owner.GetMaxExchangeCount(this.index);
                        uint exchangeCount    = owner.GetExchangeCount(this.index);
                        uint dwPointCnt       = config.dwPointCnt;
                        uint jiFen            = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().JiFen;

                        bool isEnable = (jiFen >= dwPointCnt) && ((maxExchangeCount == 0) || (exchangeCount < maxExchangeCount));
                        if (this.owner.view.activity.timeState != Activity.TimeState.Going)
                        {
                            CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), isEnable, isEnable, true);
                        }
                        CUseable   itemUseable = CUseableManager.CreateVirtualUseable(enVirtualItemType.enDianJuanJiFen, 1);
                        GameObject itemCell    = this.uiItem.transform.FindChild("Panel/PointsCell").gameObject;
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, itemCell, itemUseable, true, false);
                        CUseable   useable2 = CUseableManager.CreateUseable((COM_ITEM_TYPE)config.wResItemType, config.dwResItemID, config.wResItemCnt);
                        GameObject obj4     = this.uiItem.transform.FindChild("Panel/GetItemCell").gameObject;
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, obj4, useable2, true, false);
                        Text component = this.uiItem.transform.FindChild("Panel/PointsCell/ItemCount").gameObject.GetComponent <Text>();
                        if (jiFen < config.dwPointCnt)
                        {
                            component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), jiFen, dwPointCnt);
                            CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                        }
                        else
                        {
                            component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), jiFen, dwPointCnt);
                        }
                        GameObject obj5 = this.uiItem.transform.FindChild("ExchangeCount").gameObject;
                        if (maxExchangeCount > 0)
                        {
                            obj5.CustomSetActive(true);
                            obj5.GetComponent <Text>().text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount);
                        }
                        else
                        {
                            obj5.CustomSetActive(false);
                        }
                    }
                }
            }
Example #14
0
        public CUseable GetUsable(ushort id)
        {
            CUseable cUseable = null;

            this.useable_cfg.TryGetValue(id, ref cUseable);
            if (cUseable == null)
            {
                ResRecruitmentReward cfgReward = this.GetCfgReward(id);
                cUseable = CUseableManager.CreateUseable(2, cfgReward.dwRewardID, 0);
                this.useable_cfg.Add(id, cUseable);
            }
            return(cUseable);
        }
        public CUseable GetUsable(ushort id)
        {
            CUseable cUseable = null;

            this.useable_cfg.TryGetValue(id, out cUseable);
            if (cUseable == null)
            {
                ResRecruitmentReward cfgReward = this.GetCfgReward(id);
                cUseable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, cfgReward.dwRewardID, 0);
                this.useable_cfg.Add(id, cUseable);
            }
            return(cUseable);
        }
Example #16
0
        public CMail(CustomMailType mailType, ref CSDT_ASKFORREQ_DETAIL pkg)
        {
            this.mailType  = mailType;
            this.subType   = (byte)mailType;
            this.mailIndex = pkg.iReqIndex;
            this.mailState = ((pkg.bIsRead > 0) ? COM_MAIL_STATE.COM_MAIL_HAVEREAD : COM_MAIL_STATE.COM_MAIL_UNREAD);
            this.autoDel   = false;
            this.from      = Utility.UTF8Convert(pkg.stReqInfo.szAcntName);
            this.sendTime  = pkg.stReqInfo.dwReqTime;
            COM_ITEM_TYPE wItemType = (COM_ITEM_TYPE)pkg.stReqInfo.stReqItem.wItemType;
            uint          dwItemID  = pkg.stReqInfo.stReqItem.dwItemID;
            int           dwItemCnt = (int)pkg.stReqInfo.stReqItem.dwItemCnt;
            CUseable      cUseable  = CUseableManager.CreateUseable(wItemType, dwItemID, dwItemCnt);

            if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
            {
                this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Skin"), cUseable.m_name);
            }
            else
            {
                this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Hero"), cUseable.m_name);
            }
            if (pkg.stReqInfo.stMsgInfo.bMsgType == 1)
            {
                this.mailContent = StringHelper.UTF8BytesToString(ref pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgString.szContentStr);
                if (string.IsNullOrEmpty(this.mailContent))
                {
                    this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name);
                }
            }
            else
            {
                uint  dwMsgID = pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgIDInfo.dwMsgID;
                ulong num     = Convert.ToUInt64(dwMsgID);
                num <<= 32;
                int              num2      = Convert.ToInt32(wItemType);
                long             key       = (long)(num + (ulong)((long)num2));
                ResAskforTemplet dataByKey = GameDataMgr.askForTemplateDatabin.GetDataByKey(key);
                if (dataByKey == null)
                {
                    this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name);
                }
                else
                {
                    this.mailContent = string.Format(dataByKey.szContent, cUseable.m_name);
                }
            }
            this.accessUseableGeted = 0;
            this.accessUseable.Clear();
            this.accessUseable.Add(cUseable);
        }
        private bool CheckNameChangeCardCount()
        {
            int nameChangeHaveItemCount = this.GetNameChangeHaveItemCount(this.m_curChangeType);
            int nameChangeCostItemCount = this.GetNameChangeCostItemCount(this.m_curChangeType);

            if (nameChangeHaveItemCount < nameChangeCostItemCount)
            {
                if (CSysDynamicBlock.bLobbyEntryBlocked)
                {
                    string text = Singleton <CTextManager> .GetInstance().GetText("NameChange_ErrorItemNotEnough");

                    Singleton <CUIManager> .GetInstance().OpenMessageBox(text, false);
                }
                else
                {
                    uint nameChangeCardShopProductKey = this.GetNameChangeCardShopProductKey(this.m_curChangeType);
                    CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(nameChangeCardShopProductKey);

                    if (product == null)
                    {
                        DebugHelper.Assert(false, "错误的特卖商品ID");
                        return(false);
                    }
                    ResPropInfo dataByKey = GameDataMgr.itemDatabin.GetDataByKey(product.ID);
                    if (dataByKey == null)
                    {
                        DebugHelper.Assert(false, "错误的商品ID");
                        return(false);
                    }
                    CUseable cUseable = CUseableManager.CreateUseable(product.Type, 0uL, product.ID, (int)product.LimitCount, 0);
                    uint     num      = product.ConvertWithRealDiscount(cUseable.GetBuyPrice(product.CoinType));
                    int      num2     = nameChangeCostItemCount - nameChangeHaveItemCount;
                    string   text2    = Singleton <CTextManager> .GetInstance().GetText("NameChange_GuideToMall", new string[]
                    {
                        num2.ToString(),
                        dataByKey.szName,
                        ((long)num2 * (long)((ulong)num)).ToString()
                    });

                    stUIEventParams par = default(stUIEventParams);
                    par.tag = num2;
                    Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(text2, enUIEventID.NameChange_GuideToMall, enUIEventID.None, par, false);
                }
                return(false);
            }
            return(true);
        }
Example #18
0
 private void OnClickExchange(CUIEvent uiEvent)
 {
     if (this._elementList != null)
     {
         int num = (int)uiEvent.m_eventParams.commonUInt32Param1;
         if ((num >= 0) && (num < this._elementList.Count))
         {
             ResDT_Item_Info stResItemInfo = this._elementList[num].phase.Config.stResItemInfo;
             CUseable        useable       = CUseableManager.CreateUseable((COM_ITEM_TYPE)stResItemInfo.wItemType, stResItemInfo.dwItemID, 1);
             string          str           = (useable != null) ? useable.m_name : string.Empty;
             stUIEventParams par           = new stUIEventParams {
                 commonUInt32Param1 = (uint)num
             };
             Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format(Singleton <CTextManager> .GetInstance().GetText("confirmExchange"), str), enUIEventID.Activity_ExchangeConfirm, enUIEventID.None, par, false);
         }
     }
 }
Example #19
0
 private void OnClickExchangeCountSelectReady(CUIEvent uiEvent)
 {
     if (this._elementList != null)
     {
         uint commonUInt32Param = uiEvent.m_eventParams.commonUInt32Param1;
         int  commonUInt16Param = (int)uiEvent.m_eventParams.commonUInt16Param1;
         if (commonUInt16Param >= 0 && commonUInt16Param < this._elementList.get_Count())
         {
             ResDT_Item_Info stResItemInfo = this._elementList.get_Item(commonUInt16Param).phase.Config.stResItemInfo;
             CUseable        cUseable      = CUseableManager.CreateUseable(stResItemInfo.wItemType, stResItemInfo.dwItemID, 1);
             string          text          = (cUseable != null) ? cUseable.m_name : string.Empty;
             stUIEventParams par           = default(stUIEventParams);
             par.commonUInt16Param1 = (ushort)commonUInt16Param;
             this._elementList.get_Item(commonUInt16Param).phase.SetExchangeCountOnce((int)commonUInt32Param);
             Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format(Singleton <CTextManager> .GetInstance().GetText("confirmExchange"), commonUInt32Param, text), enUIEventID.Activity_ExchangeConfirm, enUIEventID.None, par, false);
         }
     }
 }
Example #20
0
        public CUseable GetUsable(ushort id)
        {
            CUseable useable = null;

            this.useable_cfg.TryGetValue(id, out useable);
            if (useable != null)
            {
                return(useable);
            }
            ResHuoYueDuReward rewardCfg          = this.GetRewardCfg(id);
            ResDT_HuoYueDuReward_PeriodInfo info = this.IsInTime(rewardCfg);

            if (info == null)
            {
                return(CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, rewardCfg.dwRewardID, 0));
            }
            return(CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, info.dwRewardID, (int)info.dwRewardNum));
        }
 private void OnClickExchangeCountSelectReady(CUIEvent uiEvent)
 {
     if (this._elementList != null)
     {
         uint commonUInt32Param = uiEvent.m_eventParams.commonUInt32Param1;
         int  commonUInt16Param = (int)uiEvent.m_eventParams.commonUInt16Param1;
         if (commonUInt16Param >= 0 && commonUInt16Param < this._elementList.Count)
         {
             uint            dwResItemID = this._elementList[commonUInt16Param].phase.Config.dwResItemID;
             CUseable        cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)this._elementList[commonUInt16Param].phase.Config.wResItemType, this._elementList[commonUInt16Param].phase.Config.dwResItemID, 1);
             string          text        = (cUseable == null) ? string.Empty : cUseable.m_name;
             stUIEventParams par         = default(stUIEventParams);
             par.commonUInt16Param1 = (ushort)commonUInt16Param;
             this._elementList[commonUInt16Param].phase.SetExchangeCountOnce((int)commonUInt32Param);
             Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format(Singleton <CTextManager> .GetInstance().GetText("confirmExchange"), commonUInt32Param, text), enUIEventID.Activity_PtExchangeConfirm, enUIEventID.None, par, false);
         }
     }
 }
        public static void ReciveSymbolMakeRsp(CSPkg msg)
        {
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            SCPKG_CMD_SYMBOL_MAKE stSymbolMakeRsp = msg.stPkgData.stSymbolMakeRsp;

            if (stSymbolMakeRsp.iResult == 0)
            {
                CUseable useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, stSymbolMakeRsp.stSymbolInfo.dwSymbolID, stSymbolMakeRsp.stSymbolInfo.iSymbolCnt);
                if ((useable != null) && (((CSymbolItem)useable) != null))
                {
                    CUseableContainer container = new CUseableContainer(enCONTAINER_TYPE.ITEM);
                    container.Add(useable);
                    CUICommonSystem.ShowSymbol(container, enUIEventID.None);
                }
                Singleton <CSymbolSystem> .GetInstance().m_symbolMakeCtrl.RefreshSymbolTransformForm();
            }
        }
        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);
            }
        }
Example #24
0
        public CUseable Add(COM_ITEM_TYPE useableType, ulong objID, uint baseID, int iCount, int addTime)
        {
            CUseable useableByObjID = null;

            if (((useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) || (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP)) || (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL))
            {
                useableByObjID = this.GetUseableByObjID(objID);
                if (useableByObjID == null)
                {
                    CUseable useable = CUseableManager.CreateUseable(useableType, objID, baseID, iCount, addTime);
                    this.Add(useable);
                    return(useable);
                }
                useableByObjID.m_stackCount += iCount;
                useableByObjID.ResetTime();
            }
            return(useableByObjID);
        }
        public CUseable GetUsable(ushort id)
        {
            CUseable cUseable = null;

            this.useable_cfg.TryGetValue(id, out cUseable);
            if (cUseable == null)
            {
                ResHuoYueDuReward rewardCfg = this.GetRewardCfg(id);
                ResDT_HuoYueDuReward_PeriodInfo resDT_HuoYueDuReward_PeriodInfo = this.IsInTime(rewardCfg);
                if (resDT_HuoYueDuReward_PeriodInfo == null)
                {
                    cUseable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, rewardCfg.dwRewardID, 0);
                }
                else
                {
                    cUseable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, resDT_HuoYueDuReward_PeriodInfo.dwRewardID, (int)resDT_HuoYueDuReward_PeriodInfo.dwRewardNum);
                }
            }
            return(cUseable);
        }
        public CUseable Add(COM_ITEM_TYPE useableType, ulong objID, uint baseID, int iCount, int addTime)
        {
            CUseable cUseable = null;

            if (useableType == 2 || useableType == 3 || useableType == 5)
            {
                cUseable = this.GetUseableByObjID(objID);
                if (cUseable == null)
                {
                    CUseable cUseable2 = CUseableManager.CreateUseable(useableType, objID, baseID, iCount, addTime);
                    this.Add(cUseable2);
                    cUseable = cUseable2;
                }
                else
                {
                    cUseable.m_stackCount += iCount;
                    cUseable.ResetTime();
                }
            }
            return(cUseable);
        }
        private void OnClickStartMatch(CUIEvent uiEvt)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);
                if (CUICommonSystem.IsMatchOpened(RES_BATTLE_MAP_TYPE.RES_BATTLE_MAP_TYPE_REWARDMATCH, this.m_selectMapID))
                {
                    int num             = useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID) + useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumFreeItemID);
                    int dwCousumItemNum = (int)this.m_selectMapRes.dwCousumItemNum;
                    if (num >= dwCousumItemNum)
                    {
                        this.SendBeginMatchReq();
                    }
                    else
                    {
                        int      bCount  = dwCousumItemNum - num;
                        CUseable useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID, bCount);
                        if (useable != null)
                        {
                            int             num4               = (int)(useable.GetBuyPrice((RES_SHOPBUY_COINTYPE)this.m_selectMapRes.bCoinType) * bCount);
                            enPayType       payType            = CMallSystem.ResBuyTypeToPayType(this.m_selectMapRes.bCoinType);
                            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);
                        }
                    }
                }
                else
                {
                    Singleton <CUIManager> .instance.OpenTips("Union_Battle_Tips4", true, 1f, null, new object[0]);
                }
            }
        }
Example #28
0
        public BuyPickDialog(COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(s_Form_Path, false, true);

            if (null != script)
            {
                this._root                 = script.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._count                = 1;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Desc/Image/Text");
                    if (this._descText != null)
                    {
                        this._descText.text = this._usb.m_description;
                    }
                    Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/Icon").SetSprite(CUIUtility.GetSpritePrefeb(this._usb.GetIconPath(), false, false));
                    Utility.GetComponetInChild <Text>(this._root, "Panel/Name").text = this._usb.m_name;
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                        Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(this._usb.GetBuyPrice(coinType), this._realDiscount).ToString();
                    }
                    Image componetInChild = Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/imgExperienceMark");
                    if (componetInChild != null)
                    {
                        if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsHeroExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false));
                        }
                        else if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsSkinExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false));
                        }
                        else
                        {
                            componetInChild.gameObject.CustomSetActive(false);
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
Example #29
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root                 = formScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    uint num3 = 0;
                    int  num4 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)this._usb;
                        if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4))
                        {
                            this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f;
                        }
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                this._bHeroSkinGift = true;
                                CHeroItem item3          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID))
                                {
                                    num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                this._bHeroSkinGift = true;
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                    Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild.text = string.Empty;
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice = this._usb.GetBuyPrice(coinType);
                        Button btn      = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num4 >= view.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip");

                            this._heroSkinGiftCost = 0;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip");

                            uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount);
                            if ((buyPrice >= num3) && (num7 >= (buyPrice / 10)))
                            {
                                this._heroSkinGiftCost = num7;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
Example #30
0
        public CUseable GetSkinRewardUseable()
        {
            uint dwConfValue = GameDataMgr.globalInfoDatabin.GetDataByKey(300u).dwConfValue;

            return(CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN, dwConfValue, 0));
        }