コード例 #1
0
/** Called every frame. It will check if results from an achievement request
 *  have been received, and if so, display them.
 */
void OnlineProfileAchievements::onUpdate(float delta)
{
    if (!m_waiting_for_achievements) return;

    if (!m_visiting_profile->isReady())
    {
        // This will display an increasing number of dots while waiting.
        m_achievements_list_widget->renameItem("loading", 
                       StringUtils::loadingDots(_("Fetching achievements")));  
        return;
    }

    // Now reesults are available, display them.
    m_achievements_list_widget->clear();
    const OnlineProfile::IDList &a = m_visiting_profile->getAchievements();
    for (unsigned int i = 0; i < a.size(); i++)
    {
        AchievementInfo *info =
                          AchievementsManager::get()->getAchievementInfo(a[i]);
        m_achievements_list_widget->addItem(StringUtils::toString(info->getID()),
                                            info->getTitle()                   );
    }
    m_waiting_for_achievements = false;

}   // onUpdate
コード例 #2
0
// ----------------------------------------------------------------------------
void OnlineProfileAchievements::onUpdate(float delta)
{
    if(m_waiting_for_achievements)
    {
        if(m_visiting_profile->isReady())
        {
            m_achievements_list_widget->clear();
            for(unsigned int i = 0; i < m_visiting_profile->getAchievements().size(); i++)
            {
                AchievementInfo * info = AchievementsManager::get()->getAchievementInfo(m_visiting_profile->getAchievements()[i]);
                m_achievements_list_widget->addItem(StringUtils::toString(info->getID()), info->getTitle());
            }
            m_waiting_for_achievements = false;
        }
        else
        {
                m_achievements_list_widget->renameItem("loading", Messages::fetchingFriends());
        }
    }
}