Exemple #1
0
    /// <summary>
    /// 升级引导
    /// </summary>
    public void SetUpgradeLevelGuide(int arenaExp = 0)
    {
        m_listUpgradeLevelGuideData.Clear();
        List <int> idList = UpgradeGuideData.GetLevelNoEnoughList();

        for (int i = 0; i < idList.Count; i++)
        {
            UpgradeGuideData      xmlData = UpgradeGuideData.GetData(idList[i]);
            UpgradeLevelGuideData upgradeLevelGuideData;
            upgradeLevelGuideData.ID         = xmlData.id;
            upgradeLevelGuideData.title      = LanguageData.GetContent(xmlData.title);
            upgradeLevelGuideData.icon       = IconData.GetIconPath(xmlData.icon);
            upgradeLevelGuideData.buttonName = LanguageData.GetContent(47902);

            bool           useMinLevel    = true;
            LevelGuideData levelGuideData = new LevelGuideData();
            levelGuideData.level = new List <int>();
            levelGuideData.level.Add(int.MaxValue);

            foreach (var item in LevelGuideData.dataMap)
            {
                if (xmlData.id != item.Value.type)
                {
                    continue;
                }

                if (levelGuideData.level[0] > item.Value.level[0])
                {
                    levelGuideData = item.Value;
                }

                if (MogoWorld.thePlayer.level > item.Value.level[0] &&
                    MogoWorld.thePlayer.level < item.Value.level[1])
                {
                    useMinLevel    = false;
                    levelGuideData = item.Value;
                    break;
                }
            }

            if (useMinLevel)
            {
                upgradeLevelGuideData.desc = LanguageData.dataMap.Get(xmlData.describtion).Format(AvatarLevelData.dataMap.Get(levelGuideData.level[0]).expStandard *levelGuideData.rate);
            }
            else
            {
                upgradeLevelGuideData.desc = LanguageData.dataMap.Get(xmlData.describtion).Format(AvatarLevelData.dataMap.Get(MogoWorld.thePlayer.level).expStandard *levelGuideData.rate);
            }

            // ID = 2(竞技场)
            // ID = 1(每日任务)
            // ID = 5(飞龙大赛)
            // ID = 6(保卫女神)
            if (xmlData.id == 2)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.ArenaIcon;
            }
            else if (xmlData.id == 1)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.DailyTaskIcon;
            }
            else if (xmlData.id == 5)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.DRAGONMATCH;
            }
            else if (xmlData.id == 6)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.OGREMUSTDIE;
            }
            else if (xmlData.id == 7)
            {
                upgradeLevelGuideData.requestLevel = 0;
            }
            else
            {
                upgradeLevelGuideData.requestLevel = 0;
                upgradeLevelGuideData.desc         = string.Empty;
            }

            m_listUpgradeLevelGuideData.Add(upgradeLevelGuideData);
        }

        // 按照开启等级从小到大排序
        m_listUpgradeLevelGuideData.Sort(delegate(UpgradeLevelGuideData a, UpgradeLevelGuideData b)
        {
            if (a.requestLevel < b.requestLevel)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });

        // 创建UI
        LevelNoEnoughUIViewManager.Instance.SetUIGridList(m_listUpgradeLevelGuideData.Count, () =>
        {
            LevelNoEnoughUIViewManager.Instance.SetGridListData(m_listUpgradeLevelGuideData);
        });
    }
    /// <summary>
    /// 升级引导
    /// </summary>
    public void SetUpgradeLevelGuide(int arenaExp = 0)
    {
        m_listUpgradeLevelGuideData.Clear();
        List<int> idList = UpgradeGuideData.GetLevelNoEnoughList();
        for (int i = 0; i < idList.Count; i++)
        {
            UpgradeGuideData xmlData = UpgradeGuideData.GetData(idList[i]);
            UpgradeLevelGuideData upgradeLevelGuideData;
            upgradeLevelGuideData.ID = xmlData.id;
            upgradeLevelGuideData.title = LanguageData.GetContent(xmlData.title);
            upgradeLevelGuideData.icon = IconData.GetIconPath(xmlData.icon);
            upgradeLevelGuideData.buttonName = LanguageData.GetContent(47902);

            bool useMinLevel = true;
            LevelGuideData levelGuideData = new LevelGuideData();
            levelGuideData.level = new List<int>();
            levelGuideData.level.Add(int.MaxValue);

            foreach (var item in LevelGuideData.dataMap)
            {
                if (xmlData.id != item.Value.type)
                    continue;

                if (levelGuideData.level[0] > item.Value.level[0])
                    levelGuideData = item.Value;

                if (MogoWorld.thePlayer.level > item.Value.level[0] 
                    && MogoWorld.thePlayer.level < item.Value.level[1])
                {
                    useMinLevel = false;
                    levelGuideData = item.Value;
                    break;
                }
            }

            if (useMinLevel)
            {
                upgradeLevelGuideData.desc = LanguageData.dataMap.Get(xmlData.describtion).Format(AvatarLevelData.dataMap.Get(levelGuideData.level[0]).expStandard * levelGuideData.rate);
            }
            else
            {
                upgradeLevelGuideData.desc = LanguageData.dataMap.Get(xmlData.describtion).Format(AvatarLevelData.dataMap.Get(MogoWorld.thePlayer.level).expStandard * levelGuideData.rate);
            }

            // ID = 2(竞技场)
            // ID = 1(每日任务)
            // ID = 5(飞龙大赛)
            // ID = 6(保卫女神)
            if (xmlData.id == 2)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.ArenaIcon;                
            }
            else if (xmlData.id == 1)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.DailyTaskIcon;             
            }
            else if(xmlData.id == 5)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.DRAGONMATCH;        
            }
            else if (xmlData.id == 6)
            {
                upgradeLevelGuideData.requestLevel = SystemRequestLevel.OGREMUSTDIE;     
            }
            else if (xmlData.id == 7)
            {
                upgradeLevelGuideData.requestLevel = 0;
            }
            else
            {
                upgradeLevelGuideData.requestLevel = 0;
                upgradeLevelGuideData.desc = string.Empty;
            }

            m_listUpgradeLevelGuideData.Add(upgradeLevelGuideData);
        }

        // 按照开启等级从小到大排序
        m_listUpgradeLevelGuideData.Sort(delegate(UpgradeLevelGuideData a, UpgradeLevelGuideData b)
        {
            if (a.requestLevel < b.requestLevel)
                return -1;
            else
                return 1;
        });

        // 创建UI
        LevelNoEnoughUIViewManager.Instance.SetUIGridList(m_listUpgradeLevelGuideData.Count, () =>
        {
            LevelNoEnoughUIViewManager.Instance.SetGridListData(m_listUpgradeLevelGuideData);
        });
    }