void OnAchieveRewardBtnUp()
    {
        Mogo.Util.LoggerHelper.Debug("Reward");
        int id = SanctuaryRewardXMLData.GetAccuNextRankItemID((int)SanctuaryUILogicManager.Instance.weekContri);

        InventoryManager.Instance.ShowItemTip(id, null);
    }
Esempio n. 2
0
    /// <summary>
    /// 设置圣域守卫战奖励数据
    /// </summary>
    public void SetSanctuaryGridListData(List <int> listSancturyID)
    {
        for (int index = 0; index < listSancturyID.Count; index++)
        {
            if (m_mapGrid.ContainsKey(index))
            {
                RankingRewardUIGrid gridUI = m_mapGrid[index];
                gridUI.LoadResourceInsteadOfAwake();

                string        title = string.Format(LanguageData.GetContent(46908), index + 1);
                List <string> tips  = SanctuaryRewardXMLData.GetWeekRewardNameList(index);

                string info = "";
                for (int i = 0; i < tips.Count; i++)
                {
                    if (i == 0)
                    {
                        info += tips[i];
                    }
                    else
                    {
                        info += string.Concat(LanguageData.GetContent(46909), tips[i]);
                    }
                }

                gridUI.Index = index;
                gridUI.SetRankingReward(title, info);
            }
        }
    }
    void OnRewardGridDown(int i)
    {
        ShowRewardGridTip(true);
        switch ((SanctuaryUITab)CurPageTab)
        {
        case SanctuaryUITab.MyAchievementTab:
            break;

        case SanctuaryUITab.WeekRankTab:
        {
            List <string> tips = SanctuaryRewardXMLData.GetWeekRewardNameList(i);
            SanctuaryUIViewManager.Instance.SetRewardGridTipData(tips, String.Format("第{0}名奖励", i + 1));
        }
        break;

        case SanctuaryUITab.TodayRankTab:
        {
            List <string> tips = SanctuaryRewardXMLData.GetDayRewardNameList(i);
            SanctuaryUIViewManager.Instance.SetRewardGridTipData(tips, String.Format("第{0}名奖励", i + 1));
        }
        break;

        default:
            break;
        }
    }
    public void SetSanctuaryReward()
    {
        if (RankingRewardUIViewManager.Instance != null)
        {
            RankingRewardUIViewManager.Instance.SetRankingRewardUITitle(LanguageData.GetContent(46907));

            List <int> weekRankRewardList = SanctuaryRewardXMLData.GetWeekRankID();

            RankingRewardUIViewManager.Instance.SetUIGridList(weekRankRewardList.Count, () =>
            {
                RankingRewardUIViewManager.Instance.SetSanctuaryGridListData(weekRankRewardList);
            });
        }
    }
    public void RefreshUI(int page)
    {
        switch (page)
        {
        case 0:
        {
            //SanctuaryUIViewManager.Instance.SetCurrentAchieve(weekContri.ToString());
            //SanctuaryUIViewManager.Instance.SetNextAchieve(MyInfo.nextLvNeedContribution.ToString());
            //SanctuaryUIViewManager.Instance.SetAcieveReward(SanctuaryRewardXMLData.GetAccuNextRankIcon(weekContri));
            //SanctuaryUIViewManager.Instance.SetNextAchievementRewardGoldNum(SanctuaryRewardXMLData.GetAccuNextGold(weekContri));
            var rwd = new List <MyRewardData>();
            foreach (var item in SanctuaryRewardXMLData.dataMap.
                     Where(x => x.Value.type == 3 && x.Value.level[0] <= weekLevel &&
                           weekLevel <= x.Value.level[1]))
            {
                if (weekContri >= item.Value.contribution)
                {
                    //可以领取
                    if (alreadyGetList.Contains(item.Key))
                    {
                        //已经领取过了
                        rwd.Add(new MyRewardData()
                            {
                                name         = string.Concat(ItemParentData.GetItem((int)ItemCode.GOLD).Name, " x ", item.Value.gold),
                                rewardID     = item.Key,
                                icon         = IconData.dataMap.Get(item.Value.icon).path,
                                isAlreadyGet = true,
                                isEnable     = true,
                                needScore    = item.Value.contribution,
                                progress     = (LanguageData.GetContent(46915, String.Concat(weekContri, '/', item.Value.contribution)))
                            });
                    }
                    else
                    {
                        rwd.Add(new MyRewardData()
                            {
                                name         = string.Concat(ItemParentData.GetItem((int)ItemCode.GOLD).Name, " x ", item.Value.gold),
                                rewardID     = item.Key,
                                icon         = IconData.dataMap.Get(item.Value.icon).path,
                                isAlreadyGet = false,
                                isEnable     = true,
                                needScore    = item.Value.contribution,
                                progress     = (LanguageData.GetContent(46915, String.Concat(weekContri, '/', item.Value.contribution)))
                            });
                    }
                }
                else
                {
                    rwd.Add(new MyRewardData()
                        {
                            name         = string.Concat(ItemParentData.GetItem((int)ItemCode.GOLD).Name, " x ", item.Value.gold),
                            rewardID     = item.Key,
                            icon         = IconData.dataMap.Get(item.Value.icon).path,
                            isAlreadyGet = false,
                            isEnable     = false,
                            needScore    = item.Value.contribution,
                            progress     = (LanguageData.GetContent(46915, String.Concat(weekContri, '/', item.Value.contribution)))
                        });
                }
            }

            SanctuaryUIViewManager.Instance.GenerateMyRewardList(rwd);
        }
        break;

        case 1:
        {
            SanctuaryUIViewManager.Instance.ClearRankGridList();
            for (int i = 0; i < weekData.Count; i++)
            {
                RankGridData data = new RankGridData();
                data.achieve = weekData[i].contribution.ToString();
                data.name    = weekData[i].name;
                data.rank    = (i + 1).ToString();
                if (data.name.Equals(MogoWorld.thePlayer.name))
                {
                    data.highLight = true;
                }
                else
                {
                    data.highLight = false;
                }
                SanctuaryUIViewManager.Instance.AddRankGrid(data, i);
            }
            SanctuaryUIViewManager.Instance.SetPlayerName(MogoWorld.thePlayer.name);
            SanctuaryUIViewManager.Instance.SetPlayerRank(MyWeek.ToString());
            SanctuaryUIViewManager.Instance.SetPlayerContribute(weekContri.ToString());
            var weekRank = SanctuaryRewardXMLData.GetWeekRankID();
            SanctuaryUIViewManager.Instance.ClearRewardGridList();

            for (int i = 0; i < weekRank.Count; i++)
            {
                RankRewardGridData rrgd = new RankRewardGridData();
                rrgd.imgName = IconData.dataMap.Get(SanctuaryRewardXMLData.dataMap.Get(weekRank[i]).icon).path;
                rrgd.text    = String.Format("第{0}名宝箱", i + 1);
                SanctuaryUIViewManager.Instance.AddRewardGrid(rrgd);
            }
            break;
        }

        case 2:
        {
            SanctuaryUIViewManager.Instance.ClearRankGridList();
            for (int i = 0; i < dayData.Count; i++)
            {
                RankGridData data = new RankGridData();
                data.achieve = dayData[i].contribution.ToString();
                data.name    = dayData[i].name;
                data.rank    = (i + 1).ToString();
                if (data.name.Equals(MogoWorld.thePlayer.name))
                {
                    data.highLight = true;
                }
                else
                {
                    data.highLight = false;
                }
                SanctuaryUIViewManager.Instance.AddRankGrid(data, i);
            }
            SanctuaryUIViewManager.Instance.SetPlayerName(MogoWorld.thePlayer.name);
            SanctuaryUIViewManager.Instance.SetPlayerRank(MyDay.ToString());
            SanctuaryUIViewManager.Instance.SetPlayerContribute(dayContri.ToString());
            var dayRank = SanctuaryRewardXMLData.GetDayRankID();
            SanctuaryUIViewManager.Instance.ClearRewardGridList();

            for (int i = 0; i < dayRank.Count; i++)
            {
                RankRewardGridData rrgd = new RankRewardGridData();
                rrgd.imgName = IconData.dataMap.Get(SanctuaryRewardXMLData.dataMap.Get(dayRank[i]).icon).path;
                rrgd.text    = String.Format("第{0}名宝箱", i + 1);
                SanctuaryUIViewManager.Instance.AddRewardGrid(rrgd);
            }
            break;
        }

        default:
            break;
        }
    }