Esempio n. 1
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 static void OnResExchange(CSPkg msg)
        {
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            if (msg.stPkgData.stWealExchangeRes.dwWealID != 0u)
            {
                ListView <CUseable> useableListFromItemList = CUseableManager.GetUseableListFromItemList(msg.stPkgData.stWealExchangeRes.stExchangeRes);
                if (useableListFromItemList.Count > 0)
                {
                    CUseableManager.ShowUseableItem(useableListFromItemList[0]);
                }
                if (msg.stPkgData.stWealExchangeRes.bWealType == 4)
                {
                    ExchangeActivity exchangeActivity = (ExchangeActivity)Singleton <ActivitySys> .GetInstance().GetActivity(COM_WEAL_TYPE.COM_WEAL_EXCHANGE, msg.stPkgData.stWealExchangeRes.dwWealID);

                    if (exchangeActivity != null)
                    {
                        exchangeActivity.IncreaseExchangeCount((int)msg.stPkgData.stWealExchangeRes.bWealIdx, msg.stPkgData.stWealExchangeRes.dwDrawCnt);
                        exchangeActivity.UpdateView();
                    }
                }
                else if (msg.stPkgData.stWealExchangeRes.bWealType == 5)
                {
                    PointsExchangeActivity pointsExchangeActivity = (PointsExchangeActivity)Singleton <ActivitySys> .GetInstance().GetActivity(COM_WEAL_TYPE.COM_WEAL_PTEXCHANGE, msg.stPkgData.stWealExchangeRes.dwWealID);

                    if (pointsExchangeActivity != null)
                    {
                        pointsExchangeActivity.IncreaseExchangeCount((int)msg.stPkgData.stWealExchangeRes.bWealIdx, msg.stPkgData.stWealExchangeRes.dwDrawCnt);
                        pointsExchangeActivity.UpdateView();
                    }
                }
                return;
            }
        }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
        public static CUseable CreateUsableByRandowReward(RES_RANDOM_REWARD_TYPE type, int cnt, uint baseId)
        {
            COM_REWARDS_TYPE type2;

            CUseableManager.RandomRewardTypeToComRewardType(type, out type2);
            return(CUseableManager.CreateUsableByServerType(type2, cnt, baseId));
        }
Esempio n. 6
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();
            }
        }
        private void RefreshRenewalPanel()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CPaySystem.s_renewalDianQuanFormPath);

            if (form == null)
            {
                return;
            }
            uint dwConfValue = GameDataMgr.globalInfoDatabin.GetDataByKey(61u).dwConfValue;
            ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(dwConfValue);
            Transform            transform = form.transform.Find("Panel_Renewal/bodyPanel");
            Text component = transform.Find("rewardDescText").GetComponent <Text>();

            component.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szRewardDesc));
            GameObject gameObject  = transform.Find("itemCellFirst").gameObject;
            CUseable   itemUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[0].bItemType, (int)dataByKey.astRewardDetail[0].dwLowCnt, dataByKey.astRewardDetail[0].dwItemID);

            CUICommonSystem.SetItemCell(form, gameObject, itemUseable, true, false, false, false);
            CUIListScript component2 = transform.Find("List").GetComponent <CUIListScript>();

            this.RefreshRewardList(form, component2, ref dataByKey.astRewardDetail, 1);
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            bool       flag        = masterRoleInfo.IsGuidedStateSet(24);
            bool       flag2       = masterRoleInfo.IsGuidedStateSet(25);
            GameObject gameObject2 = transform.Find("payButton").gameObject;
            GameObject gameObject3 = transform.Find("getButton").gameObject;

            CUICommonSystem.SetButtonName(gameObject2, Singleton <CTextManager> .GetInstance().GetText("Pay_Btn_Top_Up"));
            gameObject2.CustomSetActive(!flag);
            CUICommonSystem.SetButtonName(gameObject3, Singleton <CTextManager> .GetInstance().GetText("Pay_Btn_Get_Reward"));
            gameObject3.CustomSetActive(flag && !flag2);
        }
Esempio n. 8
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 RefreshRewardList(CUIFormScript form, CUIListScript listScript, ref ResDT_RandomRewardInfo[] rewardInfoArr, int index = 0)
        {
            if (form == null || listScript == null)
            {
                return;
            }
            int num = 0;

            for (int i = index; i < rewardInfoArr.Length; i++)
            {
                if (rewardInfoArr[i].bItemType == 0)
                {
                    break;
                }
                num++;
            }
            listScript.SetElementAmount(num);
            for (int j = 0; j < num; j++)
            {
                CUIListElementScript elemenet    = listScript.GetElemenet(j);
                CUseable             itemUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)rewardInfoArr[j + index].bItemType, (int)rewardInfoArr[j + index].dwLowCnt, rewardInfoArr[j + index].dwItemID);
                GameObject           gameObject  = elemenet.transform.Find("itemCell").gameObject;
                CUICommonSystem.SetItemCell(form, gameObject, itemUseable, true, false, false, false);
            }
        }
Esempio n. 10
0
        private void _show_task_award(uint taskid)
        {
            CTask task = this.model.task_Data.GetTask(taskid);

            if (task != null)
            {
                ResTaskReward resAward = task.resAward;
                if (resAward == null)
                {
                    return;
                }
                int num = 0;
                for (int i = 0; i < resAward.astRewardInfo.Length; i++)
                {
                    ResTaskRewardDetail resTaskRewardDetail = resAward.astRewardInfo[i];
                    if (resTaskRewardDetail.iCnt > 0)
                    {
                        num++;
                    }
                }
                CUseable[] array = new CUseable[num];
                for (int j = 0; j < resAward.astRewardInfo.Length; j++)
                {
                    ResTaskRewardDetail resTaskRewardDetail2 = resAward.astRewardInfo[j];
                    if (resTaskRewardDetail2.iCnt > 0)
                    {
                        array[j] = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)resTaskRewardDetail2.dwRewardType, resTaskRewardDetail2.iCnt, resTaskRewardDetail2.dwRewardID);
                    }
                }
                Singleton <CUIManager> .GetInstance().OpenAwardTip(array, null, false, enUIEventID.Task_Award_Get_Confirm, false, false, "Form_Award");
            }
        }
 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)
         {
Esempio n. 12
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);
        }
Esempio n. 13
0
        private void OnAchievementOpenAwardForm(CUIEvent uiEvent)
        {
            uint           tagUInt   = uiEvent.m_eventParams.tagUInt;
            ResAchievement dataByKey = GameDataMgr.achieveDatabin.GetDataByKey(tagUInt);

            if (dataByKey != null)
            {
                ListView <CUseable> inList = new ListView <CUseable>();
                CUseable            item   = CUseableManager.CreateVirtualUseable(enVirtualItemType.enAchievementPoint, (int)dataByKey.dwPoint);
                inList.Add(item);
                for (int i = 0; i < dataByKey.astReward.Length; i++)
                {
                    if ((dataByKey.astReward[i].bRewardType != 0) && (dataByKey.astReward[i].dwRewardNum > 0))
                    {
                        CUseable useable2 = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)dataByKey.astReward[i].bRewardType, (int)dataByKey.astReward[i].dwRewardNum, dataByKey.astReward[i].dwRewardID);
                        if (useable2 != null)
                        {
                            inList.Add(useable2);
                        }
                    }
                }
                if (inList.Count > 0)
                {
                    Singleton <CUIManager> .GetInstance().OpenAwardTip(LinqS.ToArray <CUseable>(inList), Singleton <CTextManager> .GetInstance().GetText("Achievement_Get_Award_Success"), false, enUIEventID.None, false, false, "Form_Award");
                }
            }
        }
Esempio n. 14
0
        private static void ShowSeasonEndRewardPanel(CUIFormScript form)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            uint key = (uint)((masterRoleInfo.m_rankSeasonHighestGrade <= 0) ? 1 : masterRoleInfo.m_rankSeasonHighestGrade);
            ResRankRewardConf dataByKey = GameDataMgr.rankRewardDatabin.GetDataByKey(key);

            if (dataByKey != null)
            {
                ListView <CUseable> listView = new ListView <CUseable>();
                for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                {
                    ResDT_ChapterRewardInfo resDT_ChapterRewardInfo = dataByKey.astRewardDetail[i];
                    if (resDT_ChapterRewardInfo.bType != 0)
                    {
                        CUseable cUseable = CUseableManager.CreateUsableByServerType(resDT_ChapterRewardInfo.bType, (int)resDT_ChapterRewardInfo.dwNum, resDT_ChapterRewardInfo.dwID);
                        if (cUseable != null)
                        {
                            listView.Add(cUseable);
                        }
                    }
                }
                if (listView.get_Count() > 0)
                {
                    GameObject widget = form.GetWidget(13);
                    CUICommonSystem.SetItemCell(form, widget, listView.get_Item(0), true, false, false, false);
                }
            }
        }
Esempio n. 15
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);
        }
Esempio n. 16
0
        private void RefreshAwardPanel(CUIFormScript shareForm, uint achievementId)
        {
            ResAchievement dataByKey = GameDataMgr.achieveDatabin.GetDataByKey(achievementId);

            if (dataByKey != null)
            {
                ListView <CUseable> view = new ListView <CUseable>();
                CUseable            item = CUseableManager.CreateVirtualUseable(enVirtualItemType.enAchievementPoint, (int)dataByKey.dwPoint);
                view.Add(item);
                for (int i = 0; i < dataByKey.astReward.Length; i++)
                {
                    if ((dataByKey.astReward[i].bRewardType != 0) && (dataByKey.astReward[i].dwRewardNum > 0))
                    {
                        CUseable useable2 = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)dataByKey.astReward[i].bRewardType, (int)dataByKey.astReward[i].dwRewardNum, dataByKey.astReward[i].dwRewardID);
                        if (useable2 != null)
                        {
                            view.Add(useable2);
                        }
                    }
                }
                CUIListScript component = shareForm.GetWidget(11).GetComponent <CUIListScript>();
                component.SetElementAmount(view.Count);
                for (int j = 0; j < view.Count; j++)
                {
                    CUIListElementScript elemenet = component.GetElemenet(j);
                    if (elemenet != null)
                    {
                        GameObject gameObject = elemenet.gameObject;
                        CUICommonSystem.SetItemCell(shareForm, gameObject, view[j], true, false);
                    }
                }
            }
        }
Esempio n. 17
0
        public static ListView <CUseable> CreateUsableListByRandowReward(RES_RANDOM_REWARD_TYPE type, int cnt, uint baseId)
        {
            ListView <CUseable>  listView = new ListView <CUseable>();
            ResRandomRewardStore dataByKey;

            if (type != RES_RANDOM_REWARD_TYPE.RES_RANDOM_REWARD_TYPE_NEST)
            {
                CUseable cUseable = CUseableManager.CreateUsableByRandowReward(type, cnt, baseId);
                if (cUseable != null)
                {
                    listView.Add(cUseable);
                }
            }
            else if ((dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(baseId)) != null)
            {
                for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                {
                    if (dataByKey.astRewardDetail[i].bItemType == 0 || dataByKey.astRewardDetail[i].bItemType >= 18)
                    {
                        break;
                    }
                    listView.AddRange(CUseableManager.CreateUsableListByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID));
                }
            }
            return(listView);
        }
        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);
                }
            }
        }
Esempio n. 19
0
        public static void OpenChapterRewardPanel(CUIFormScript formScript, GameObject root, int ChapterId, int difficulty, bool bCanGet)
        {
            GameObject gameObject = root.transform.Find("ChapterRewardPanel").gameObject;

            gameObject.CustomSetActive(true);
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((uint)ChapterId);

            object[] inParameters = new object[] { ChapterId };
            DebugHelper.Assert(dataByKey != null, "Can't find chapter config with ID: {0}", inParameters);
            ResDT_ChapterRewardInfo[] astNormalRewardDetail = null;
            astNormalRewardDetail = dataByKey.astNormalRewardDetail;
            if (difficulty == 1)
            {
                astNormalRewardDetail = dataByKey.astNormalRewardDetail;
            }
            else if (difficulty == 2)
            {
                astNormalRewardDetail = dataByKey.astEliteRewardDetail;
            }
            else if (difficulty == 3)
            {
                astNormalRewardDetail = dataByKey.astMasterRewardDetail;
            }
            else if (difficulty == 4)
            {
                astNormalRewardDetail = dataByKey.astAbyssRewardDetail;
            }
            object[] objArray2 = new object[] { ChapterId, difficulty };
            DebugHelper.Assert(astNormalRewardDetail != null, "Chapter RewardArr is NULL! -- ID: {0}, Difficulty: {1}", objArray2);
            for (int i = 0; i < astNormalRewardDetail.Length; i++)
            {
                ResDT_ChapterRewardInfo info2 = astNormalRewardDetail[i];
                GameObject obj3 = gameObject.transform.Find(string.Format("RewardCon/itemCell{0}", i + 1)).gameObject;
                if (info2.bType != 0)
                {
                    obj3.CustomSetActive(true);
                    CUseable itemUseable = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)info2.bType, (int)info2.dwNum, info2.dwID);
                    CUICommonSystem.SetItemCell(formScript, obj3, itemUseable, true, false);
                }
                else
                {
                    obj3.CustomSetActive(false);
                }
            }
            GameObject obj4 = gameObject.transform.Find("BtnGetReward").gameObject;

            if (bCanGet)
            {
                obj4.GetComponentInChildren <Text>().text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Can_Get_The_Box");

                obj4.GetComponent <Button>().interactable = true;
            }
            else
            {
                obj4.GetComponentInChildren <Text>().text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Not_Enough_Starts");

                obj4.GetComponent <Button>().interactable = false;
            }
        }
Esempio n. 20
0
        public static void OnReceiveDianQuanReward(CSPkg msg)
        {
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            SCPKG_CMD_COUPONS_REWARDINFO stCouponsRewardRsp = msg.stPkgData.stCouponsRewardRsp;
            bool       flag     = true;
            CPaySystem instance = Singleton <CPaySystem> .GetInstance();

            instance.rewardItems.Clear();
            int num = Mathf.Min(stCouponsRewardRsp.stRewardInfo.bNum, stCouponsRewardRsp.stRewardInfo.astRewardDetail.Length);

            for (int i = 0; i < num; i++)
            {
                if (stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].bType == 5)
                {
                    CUICommonSystem.ShowNewHeroOrSkin(stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].stRewardInfo.stHero.dwHeroID, 0, enUIEventID.Pay_ClickGetNewHeroPanel, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, false, null, enFormPriority.Priority1, 0, 0);
                    flag = false;
                    break;
                }
                if (stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].bType == 10)
                {
                    uint num3;
                    uint num4;
                    CSkinInfo.ResolveHeroSkin(stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].stRewardInfo.stSkin.dwSkinID, out num3, out num4);
                    CUICommonSystem.ShowNewHeroOrSkin(num3, num4, enUIEventID.Pay_ClickGetNewHeroPanel, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, false, null, enFormPriority.Priority1, 0, 0);
                    flag = false;
                    break;
                }
                if (stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].bType == 1)
                {
                    if (stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].bFromType == 1)
                    {
                        uint           dwHeroID  = stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].stFromInfo.stHeroInfo.dwHeroID;
                        ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(dwHeroID);
                        if (dataByKey != null)
                        {
                            CUICommonSystem.ShowNewHeroOrSkin(dwHeroID, 0, enUIEventID.Pay_ClickGetNewHeroPanel, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, dataByKey.dwChgItemCnt, 0);
                        }
                    }
                    else if (stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].bFromType == 2)
                    {
                        uint dwSkinID = stCouponsRewardRsp.stRewardInfo.astRewardDetail[i].stFromInfo.stSkinInfo.dwSkinID;
                        uint heroId   = 0;
                        uint skinId   = 0;
                        CSkinInfo.ResolveHeroSkin(dwSkinID, out heroId, out skinId);
                        ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(heroId, skinId);
                        if (heroSkin != null)
                        {
                            CUICommonSystem.ShowNewHeroOrSkin(heroId, skinId, enUIEventID.Pay_ClickGetNewHeroPanel, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, heroSkin.dwChgItemCnt, 0);
                        }
                    }
                }
            }
            instance.rewardItems = CUseableManager.GetUseableListFromReward(stCouponsRewardRsp.stRewardInfo);
            if (flag)
            {
                Singleton <CUIManager> .GetInstance().OpenAwardTip(LinqS.ToArray <CUseable>(instance.rewardItems), null, false, enUIEventID.None, false, false, "Form_Award");
            }
        }
Esempio n. 21
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));
 }
Esempio n. 22
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));
 }
Esempio n. 23
0
 public CUseable GetUseable(int index)
 {
     if ((this.RewardDrop != null) && (index < this.RewardCount))
     {
         ResDT_WealRewardItem item = this.RewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)item.bItemType, (int)item.dwLowCnt, item.dwItemID));
     }
     return(null);
 }
Esempio n. 24
0
 public CUseable GetExtraUseable(int index)
 {
     if ((this.ExtraRewardDrop != null) && (index < this.ExtraRewardCount))
     {
         ResDT_RandomRewardInfo info = this.ExtraRewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)info.bItemType, (int)info.dwLowCnt, info.dwItemID));
     }
     return(null);
 }
Esempio n. 25
0
 public CUseable GetExtraUseable(int index)
 {
     if (this.ExtraRewardDrop != null && index < this.ExtraRewardCount)
     {
         ResDT_RandomRewardInfo resDT_RandomRewardInfo = this.ExtraRewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward(resDT_RandomRewardInfo.bItemType, (int)resDT_RandomRewardInfo.dwLowCnt, resDT_RandomRewardInfo.dwItemID));
     }
     return(null);
 }
Esempio n. 26
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);
            }
        }
Esempio n. 27
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);
                        }
                    }
                }
            }
Esempio n. 28
0
 public static CUseable GetUseableByRewardInfo(ResRandomRewardStore inRewardInfo)
 {
     if (inRewardInfo != null)
     {
         COM_REWARDS_TYPE type;
         CUseableManager.RandomRewardTypeToComRewardType((RES_RANDOM_REWARD_TYPE)inRewardInfo.astRewardDetail[0].bItemType, out type);
         int  dwLowCnt = (int)inRewardInfo.astRewardDetail[0].dwLowCnt;
         uint dwItemID = inRewardInfo.astRewardDetail[0].dwItemID;
         return(CUseableManager.CreateUsableByServerType(type, dwLowCnt, dwItemID));
     }
     return(null);
 }
Esempio n. 29
0
 private void OnItemBreakAnimatorEnd(CUIEvent uiEvent)
 {
     if (s_breakSymbolCoinCnt > 0)
     {
         CUseable useable = CUseableManager.CreateVirtualUseable(enVirtualItemType.enSymbolCoin, s_breakSymbolCoinCnt);
         if (useable != null)
         {
             CUseable[] items = new CUseable[] { useable };
             Singleton <CUIManager> .GetInstance().OpenAwardTip(items, null, false, enUIEventID.None, false, false, "Form_Award");
         }
         s_breakSymbolCoinCnt = 0;
     }
 }
Esempio n. 30
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);
        }