Ejemplo n.º 1
0
        void FillList()
        {
            m_chapters = MinerWars.AppCode.Networking.MyLocalCache.LoadChapters().OrderByDescending(c => c.Item2).ToList();

            m_listbox.DeselectAll();
            m_listbox.RemoveAllRows();
            m_listbox.RemoveAllItems();
            int index = 0;

            for (int ind = 0; ind < m_chapters.Count; ind++)
            {
                var chapter = m_chapters[ind].Item3;

                string time = MyUtils.GetDatetimeAsSpentTime(m_chapters[ind].Item2);

                var name = new StringBuilder(time);
                name.Append(" - ");
                if (chapter.ActiveMissionID != -1)
                {
                    if (MyMissions.GetMissionByID((MyMissionID)chapter.ActiveMissionID) != null)
                    {
                        name.Append(MyTextsWrapper.Get(MyMissions.GetMissionByID((MyMissionID)chapter.ActiveMissionID).Name));
                    }
                    else
                    {
                        name.Append("<mission deleted>");
                    }
                }
                else
                {
                    name.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.FreeRoaming));
                }

                var lastEvent = GetLastEvent(chapter);
                if (lastEvent != null)
                {
                    name.Append(" - ");
                    if (MyMissions.GetMissionByID((MyMissionID)lastEvent.EventTypeID) != null)
                    {
                        name.Append(MyMissions.GetMissionByID((MyMissionID)lastEvent.EventTypeID).NameTemp);
                    }
                }

                var difficultyName = MyGameplayConstants.GetGameplayDifficultyProfile(chapter.SessionObjectBuilder.Difficulty).DifficultyName;

                name.Append(" - ");
                name.Append(MyTextsWrapper.Get(difficultyName));

                m_listbox.AddItem(index, name);
                index++;
            }
        }
        private StringBuilder GetGameType(MyGameInfo gameInfo)
        {
            switch (gameInfo.GameType)
            {
            case MyGameTypes.Story:
                return(new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.Story) + " (" + MyTextsWrapper.Get(MyGameplayConstants.GetGameplayDifficultyProfile(gameInfo.Difficulty).DifficultyName) + ")"));

                break;

            case MyGameTypes.Deathmatch:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.Deathmatch));

                break;

            default:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.UNKNOWN));

                break;
            }
        }