Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
ce1586532d
@ -57,6 +57,8 @@
|
||||
I18N="In the main screen" text="Help" label_location="hover"/>
|
||||
<icon-button id="startTutorial" width="64" height="64" icon="gui/tutorial.png" extend_label="150"
|
||||
I18N="In the main screen" text="Tutorial" label_location="hover"/>
|
||||
<icon-button id="achievements" width="64" height="64" icon="gui/gp_copy.png" extend_label="150"
|
||||
I18N="In the main screen" text="Achievements" label_location="hover"/>
|
||||
<icon-button id="gpEditor" width="64" height="64" icon="gui/gpeditor.png" extend_label="150"
|
||||
I18N="In the main screen" text="Grand Prix Editor" label_location="hover"/>
|
||||
<icon-button id="about" width="64" height="64" icon="gui/main_about.png" extend_label="50"
|
||||
|
@ -8,13 +8,6 @@
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the profile screen" text="Achievements"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row" padding="6">
|
||||
<list id="achievements_list" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
|
22
data/gui/online/profile_achievements_tab.stkgui
Normal file
22
data/gui/online/profile_achievements_tab.stkgui
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
||||
|
||||
<header id="title" text_align="center" width="80%" align="center" text="..."/>
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"
|
||||
I18N="Section in the profile screen" text="Achievements"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row" padding="6">
|
||||
<list id="achievements_list" x="0" y="0" width="100%" height="100%"/>
|
||||
</box>
|
||||
</div>
|
||||
</stkgui>
|
@ -16,6 +16,11 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
|
||||
#include "config/hardware_stats.hpp"
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
|
@ -663,24 +663,24 @@ namespace UserConfigParams
|
||||
"If the kart is driving backwards faster than this value,\n"
|
||||
"switch automatically to reverse camera (set to 0 to disable).") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_direction_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fspcam_rotation_speed",
|
||||
PARAM_PREFIX FloatUserConfigParam m_fpscam_direction_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fpscam_rotation_speed",
|
||||
&m_camera,
|
||||
"How fast the first person camera's direction speed changes when\n"
|
||||
"moving the mouse (means acceleration).") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_smooth_direction_max_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fspcam_smooth_rotation_max_speed",
|
||||
PARAM_PREFIX FloatUserConfigParam m_fpscam_smooth_direction_max_speed
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fpscam_smooth_rotation_max_speed",
|
||||
&m_camera,
|
||||
"How fast the first person camera's direction can change.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fspcam_angular_velocity",
|
||||
PARAM_PREFIX FloatUserConfigParam m_fpscam_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fpscam_angular_velocity",
|
||||
&m_camera,
|
||||
"How fast the first person camera's rotation speed changes.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_fspcam_max_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fspcam_max_angular_velocity",
|
||||
PARAM_PREFIX FloatUserConfigParam m_fpscam_max_angular_velocity
|
||||
PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fpscam_max_angular_velocity",
|
||||
&m_camera,
|
||||
"How fast the first person camera can rotate.") );
|
||||
|
||||
|
@ -501,13 +501,13 @@ void Camera::update(float dt)
|
||||
// Angular velocity
|
||||
if (m_angular_velocity < m_target_angular_velocity)
|
||||
{
|
||||
m_angular_velocity += UserConfigParams::m_fspcam_angular_velocity;
|
||||
m_angular_velocity += UserConfigParams::m_fpscam_angular_velocity;
|
||||
if (m_angular_velocity > m_target_angular_velocity)
|
||||
m_angular_velocity = m_target_angular_velocity;
|
||||
}
|
||||
else if (m_angular_velocity > m_target_angular_velocity)
|
||||
{
|
||||
m_angular_velocity -= UserConfigParams::m_fspcam_angular_velocity;
|
||||
m_angular_velocity -= UserConfigParams::m_fpscam_angular_velocity;
|
||||
if (m_angular_velocity < m_target_angular_velocity)
|
||||
m_angular_velocity = m_target_angular_velocity;
|
||||
}
|
||||
@ -525,13 +525,13 @@ void Camera::update(float dt)
|
||||
diff = m_target_direction - direction;
|
||||
if (diff.X != 0 || diff.Y != 0 || diff.Z != 0)
|
||||
{
|
||||
diff.setLength(UserConfigParams::m_fspcam_direction_speed);
|
||||
diff.setLength(UserConfigParams::m_fpscam_direction_speed);
|
||||
m_direction_velocity += diff;
|
||||
if (m_direction_velocity.getLengthSQ() >
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed *
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed)
|
||||
UserConfigParams::m_fpscam_smooth_direction_max_speed *
|
||||
UserConfigParams::m_fpscam_smooth_direction_max_speed)
|
||||
m_direction_velocity.setLength(
|
||||
UserConfigParams::m_fspcam_smooth_direction_max_speed);
|
||||
UserConfigParams::m_fpscam_smooth_direction_max_speed);
|
||||
direction += m_direction_velocity;
|
||||
m_target_direction = direction;
|
||||
}
|
||||
@ -541,9 +541,9 @@ void Camera::update(float dt)
|
||||
if (diff.X != 0 || diff.Y != 0 || diff.Z != 0)
|
||||
{
|
||||
if (diff.getLengthSQ() >
|
||||
UserConfigParams::m_fspcam_angular_velocity *
|
||||
UserConfigParams::m_fspcam_angular_velocity)
|
||||
diff.setLength(UserConfigParams::m_fspcam_angular_velocity);
|
||||
UserConfigParams::m_fpscam_angular_velocity *
|
||||
UserConfigParams::m_fpscam_angular_velocity)
|
||||
diff.setLength(UserConfigParams::m_fpscam_angular_velocity);
|
||||
up += diff;
|
||||
}
|
||||
}
|
||||
|
@ -131,16 +131,22 @@ void ParticleSystemProxy::generateParticlesFromPointEmitter(scene::IParticlePoin
|
||||
ParticleData* ParticleParamsTmp = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * m_count);
|
||||
ParticleData* InitialValuesTmp = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* m_count);
|
||||
|
||||
if(ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
if (ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
{
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from point particles.", m_count);
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
if(InitialValuesTmp != NULL)
|
||||
if (InitialValuesTmp != NULL)
|
||||
{
|
||||
InitialValues = InitialValuesTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::fatal("GPUParticles", "Not enough memory for %d from point particles.", m_count);
|
||||
InitialValues = InitialValuesTmp;
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
|
||||
@ -166,17 +172,23 @@ void ParticleSystemProxy::generateParticlesFromBoxEmitter(scene::IParticleBoxEmi
|
||||
ParticleData* ParticleParamsTmp = (ParticleData *) realloc(ParticleParams, sizeof(ParticleData) * m_count);
|
||||
ParticleData* InitialValuesTmp = (ParticleData *)realloc(InitialValues, sizeof(ParticleData)* m_count);
|
||||
|
||||
if(ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
if (ParticleParamsTmp != NULL) // In case memory allocation succeeded
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from box particles.", m_count);
|
||||
ParticleParams = ParticleParamsTmp;
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
if(InitialValuesTmp != NULL)
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from box particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
if (InitialValuesTmp != NULL)
|
||||
{
|
||||
InitialValues = InitialValuesTmp;
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::error("GPUParticles", "Not enough memory for %d from box particles.", m_count);
|
||||
m_count = m_previous_count;
|
||||
}
|
||||
|
||||
const core::vector3df& extent = emitter->getBox().getExtent();
|
||||
|
@ -515,7 +515,8 @@ void IrrDriver::initDevice()
|
||||
#else
|
||||
m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1));
|
||||
#endif
|
||||
initGL();
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
initGL();
|
||||
m_sync = 0;
|
||||
|
||||
// Parse extensions
|
||||
|
@ -97,6 +97,9 @@ public:
|
||||
{
|
||||
ScalableFont* out = new ScalableFont(*this);
|
||||
out->m_is_hollow_copy = true;
|
||||
//FIXME: test only. Reset the reference counter of the copy to 1
|
||||
while (out->getReferenceCount() > 1)
|
||||
out->drop();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
|
||||
// -----------------------------------------------------------------------------
|
||||
DynamicRibbonWidget::~DynamicRibbonWidget()
|
||||
{
|
||||
delete m_font;
|
||||
m_font->drop();
|
||||
if (m_animated_contents)
|
||||
{
|
||||
GUIEngine::needsUpdate.remove(this);
|
||||
|
@ -107,7 +107,8 @@ void IconButtonWidget::add()
|
||||
|
||||
if (m_properties[PROP_CUSTOM_RATIO] != "")
|
||||
{
|
||||
m_custom_aspect_ratio = atof(m_properties[PROP_CUSTOM_RATIO].c_str());
|
||||
StringUtils::fromString(m_properties[PROP_CUSTOM_RATIO],
|
||||
m_custom_aspect_ratio);
|
||||
m_scale_mode = SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
|
||||
Camera *active_cam = Camera::getActiveCamera();
|
||||
active_cam->setAngularVelocity(value ?
|
||||
UserConfigParams::m_fspcam_max_angular_velocity : 0.0f);
|
||||
UserConfigParams::m_fpscam_max_angular_velocity : 0.0f);
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_E:
|
||||
@ -225,7 +225,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
|
||||
Camera *active_cam = Camera::getActiveCamera();
|
||||
active_cam->setAngularVelocity(value ?
|
||||
-UserConfigParams::m_fspcam_max_angular_velocity : 0);
|
||||
-UserConfigParams::m_fpscam_max_angular_velocity : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -971,9 +971,9 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
int diff_x = event.MouseInput.X - m_mouse_val_x;
|
||||
int diff_y = event.MouseInput.Y - m_mouse_val_y;
|
||||
float mouse_x = ((float) diff_x) *
|
||||
UserConfigParams::m_fspcam_direction_speed;
|
||||
UserConfigParams::m_fpscam_direction_speed;
|
||||
float mouse_y = ((float) diff_y) *
|
||||
-UserConfigParams::m_fspcam_direction_speed;
|
||||
-UserConfigParams::m_fpscam_direction_speed;
|
||||
// No movement the first time it's used
|
||||
// At the moment there's also a hard limit because the mouse
|
||||
// gets reset to the middle of the screen and sometimes there
|
||||
@ -1044,7 +1044,10 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
Camera *cam = Camera::getActiveCamera();
|
||||
if (event.MouseInput.Wheel < 0)
|
||||
{
|
||||
cam->setMaximumVelocity(cam->getMaximumVelocity() - 3);
|
||||
float vel = cam->getMaximumVelocity() - 3;
|
||||
if (vel < 0.0f)
|
||||
vel = 0.0f;
|
||||
cam->setMaximumVelocity(vel);
|
||||
}
|
||||
else if (event.MouseInput.Wheel > 0)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_SKIDDING_AI_HPP
|
||||
#define HEADER_SKIDDING_AI__HPP
|
||||
#define HEADER_SKIDDING_AI_HPP
|
||||
|
||||
#include "karts/controller/ai_base_controller.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
@ -124,10 +124,10 @@ private:
|
||||
|
||||
/** The actual start delay used. */
|
||||
float m_start_delay;
|
||||
|
||||
|
||||
/** Time an item has been collected and not used. */
|
||||
float m_time_since_last_shot;
|
||||
|
||||
|
||||
float m_time_since_stuck;
|
||||
|
||||
/** Direction of crash: -1 = left, 1 = right, 0 = no crash. */
|
||||
|
@ -533,17 +533,13 @@ bool KartSelectionScreen::joinPlayer(InputDevice* device)
|
||||
}
|
||||
}
|
||||
|
||||
// select something (anything) in the ribbon; by default, only the
|
||||
// game master has something selected. Thus, when a new player joins,
|
||||
// we need to select something for them
|
||||
w->setSelection(new_player_id, new_player_id, true);
|
||||
|
||||
if (!first_player)
|
||||
{
|
||||
// select something (anything) in the ribbon; by default, only the
|
||||
// game master has something selected. Thus, when a new player joins,
|
||||
// we need to select something for them
|
||||
w->setSelection(new_player_id, new_player_id, true);
|
||||
|
||||
newPlayerWidget->m_player_ident_spinner
|
||||
->setFocusForPlayer(new_player_id);
|
||||
}
|
||||
newPlayerWidget->m_player_ident_spinner
|
||||
->setFocusForPlayer(new_player_id);
|
||||
|
||||
if (!m_multiplayer)
|
||||
{
|
||||
|
@ -496,7 +496,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
// For 0.8.2 disable the server menu, instead go to online profile
|
||||
//OnlineScreen::getInstance()->push();
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
TabOnlineProfileAchievements::getInstance()->push();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -522,6 +522,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
GrandPrixEditorScreen::getInstance()->push();
|
||||
}
|
||||
else if (selection == "achievements")
|
||||
{
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -40,21 +40,22 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileAchievements );
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileAchievements );
|
||||
DEFINE_SCREEN_SINGLETON( TabOnlineProfileAchievements );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Constructor.
|
||||
*/
|
||||
OnlineProfileAchievements::OnlineProfileAchievements()
|
||||
: OnlineProfileBase("online/profile_achievements.stkgui")
|
||||
BaseOnlineProfileAchievements::BaseOnlineProfileAchievements(const std::string &name)
|
||||
: OnlineProfileBase(name)
|
||||
{
|
||||
m_selected_achievement_index = -1;
|
||||
} // OnlineProfileAchievements
|
||||
} // BaseOnlineProfileAchievements
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Callback when the xml file was loaded.
|
||||
*/
|
||||
void OnlineProfileAchievements::loadedFromFile()
|
||||
void BaseOnlineProfileAchievements::loadedFromFile()
|
||||
{
|
||||
OnlineProfileBase::loadedFromFile();
|
||||
m_achievements_list_widget = getWidget<ListWidget>("achievements_list");
|
||||
@ -65,7 +66,7 @@ void OnlineProfileAchievements::loadedFromFile()
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Callback before widgets are added. Clears all widgets.
|
||||
*/
|
||||
void OnlineProfileAchievements::beforeAddingWidget()
|
||||
void BaseOnlineProfileAchievements::beforeAddingWidget()
|
||||
{
|
||||
OnlineProfileBase::beforeAddingWidget();
|
||||
m_achievements_list_widget->clearColumns();
|
||||
@ -82,11 +83,12 @@ void OnlineProfileAchievements::beforeAddingWidget()
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Called when entering this menu (after widgets have been added).
|
||||
*/
|
||||
void OnlineProfileAchievements::init()
|
||||
void BaseOnlineProfileAchievements::init()
|
||||
{
|
||||
OnlineProfileBase::init();
|
||||
m_profile_tabs->select( m_achievements_tab->m_properties[PROP_ID],
|
||||
PLAYER_ID_GAME_MASTER );
|
||||
if (m_profile_tabs)
|
||||
m_profile_tabs->select(m_achievements_tab->m_properties[PROP_ID],
|
||||
PLAYER_ID_GAME_MASTER);
|
||||
|
||||
// For current user add the progrss information.
|
||||
// m_visiting_profile is NULL if the user is not logged in.
|
||||
@ -129,7 +131,7 @@ void OnlineProfileAchievements::init()
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
void BaseOnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
@ -155,7 +157,7 @@ void OnlineProfileAchievements::eventCallback(Widget* widget,
|
||||
/** 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)
|
||||
void BaseOnlineProfileAchievements::onUpdate(float delta)
|
||||
{
|
||||
if (!m_waiting_for_achievements) return;
|
||||
|
||||
|
@ -35,18 +35,20 @@ namespace GUIEngine { class Widget; }
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileAchievements : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileAchievements>
|
||||
class BaseOnlineProfileAchievements : public OnlineProfileBase
|
||||
{
|
||||
private:
|
||||
OnlineProfileAchievements();
|
||||
|
||||
GUIEngine::ListWidget * m_achievements_list_widget;
|
||||
|
||||
int m_selected_achievement_index;
|
||||
bool m_waiting_for_achievements;
|
||||
|
||||
protected:
|
||||
BaseOnlineProfileAchievements(const std::string &filename);
|
||||
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileAchievements>;
|
||||
friend class GUIEngine::ScreenSingleton<BaseOnlineProfileAchievements>;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
@ -61,7 +63,46 @@ public:
|
||||
|
||||
virtual void beforeAddingWidget() OVERRIDE;
|
||||
|
||||
virtual void refreshAchievementsList() { m_waiting_for_achievements = true; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void refreshAchievementsList()
|
||||
{
|
||||
m_waiting_for_achievements = true;
|
||||
} // refreshAchievementsList
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class TabOnlineProfileAchievements : public BaseOnlineProfileAchievements,
|
||||
public GUIEngine::ScreenSingleton<TabOnlineProfileAchievements>
|
||||
{
|
||||
protected:
|
||||
friend class GUIEngine::ScreenSingleton<TabOnlineProfileAchievements>;
|
||||
|
||||
TabOnlineProfileAchievements()
|
||||
: BaseOnlineProfileAchievements("online/profile_achievements_tab.stkgui")
|
||||
{}
|
||||
|
||||
}; // TabOnlineProfileAchievements
|
||||
|
||||
// ============================================================================
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileAchievements : public BaseOnlineProfileAchievements,
|
||||
public GUIEngine::ScreenSingleton < OnlineProfileAchievements >
|
||||
{
|
||||
protected:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileAchievements>;
|
||||
|
||||
OnlineProfileAchievements()
|
||||
: BaseOnlineProfileAchievements("online/profile_achievements.stkgui")
|
||||
{}
|
||||
|
||||
}; // class
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -38,7 +38,8 @@ using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
|
||||
OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
|
||||
OnlineProfileBase::OnlineProfileBase(const std::string &filename)
|
||||
: Screen(filename.c_str())
|
||||
{
|
||||
} // OnlineProfileBase
|
||||
|
||||
@ -48,19 +49,19 @@ OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
|
||||
void OnlineProfileBase::loadedFromFile()
|
||||
{
|
||||
m_profile_tabs = getWidget<RibbonWidget>("profile_tabs");
|
||||
assert(m_profile_tabs != NULL);
|
||||
|
||||
m_header = getWidget<LabelWidget>("title");
|
||||
assert(m_header != NULL);
|
||||
|
||||
m_friends_tab =
|
||||
m_friends_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_friends");
|
||||
assert(m_friends_tab != NULL);
|
||||
m_achievements_tab =
|
||||
assert(m_profile_tabs == NULL || m_friends_tab != NULL);
|
||||
m_achievements_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget*)m_profile_tabs->findWidgetNamed("tab_achievements");
|
||||
assert(m_achievements_tab != NULL);
|
||||
m_settings_tab =
|
||||
assert(m_profile_tabs == NULL || m_achievements_tab != NULL);
|
||||
m_settings_tab = !m_profile_tabs ? NULL :
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings");
|
||||
assert(m_settings_tab != NULL);
|
||||
assert(m_profile_tabs == NULL || m_settings_tab != NULL);
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -70,17 +71,20 @@ void OnlineProfileBase::loadedFromFile()
|
||||
void OnlineProfileBase::beforeAddingWidget()
|
||||
{
|
||||
m_visiting_profile = ProfileManager::get()->getVisitingProfile();
|
||||
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
|
||||
m_settings_tab->setVisible(false);
|
||||
else
|
||||
m_settings_tab->setVisible(true);
|
||||
|
||||
// If not logged in, don't show profile or friends
|
||||
if (!m_visiting_profile)
|
||||
if (m_profile_tabs)
|
||||
{
|
||||
m_friends_tab->setVisible(false);
|
||||
m_profile_tabs->setVisible(false);
|
||||
}
|
||||
if (!m_visiting_profile || !m_visiting_profile->isCurrentUser())
|
||||
m_settings_tab->setVisible(false);
|
||||
else
|
||||
m_settings_tab->setVisible(true);
|
||||
|
||||
// If not logged in, don't show profile or friends
|
||||
if (!m_visiting_profile)
|
||||
{
|
||||
m_friends_tab->setVisible(false);
|
||||
m_profile_tabs->setVisible(false);
|
||||
}
|
||||
} // if m_profile_tabhs
|
||||
} // beforeAddingWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -90,20 +94,26 @@ void OnlineProfileBase::init()
|
||||
{
|
||||
Screen::init();
|
||||
|
||||
m_friends_tab->setTooltip( _("Friends") );
|
||||
m_achievements_tab->setTooltip( _("Achievements") );
|
||||
m_settings_tab->setTooltip( _("Account Settings") );
|
||||
|
||||
// If no visiting_profile is defined, use the data of the current player.
|
||||
if (!m_visiting_profile || m_visiting_profile->isCurrentUser())
|
||||
m_header->setText(_("Your profile"), false);
|
||||
else if (m_visiting_profile)
|
||||
if (m_profile_tabs)
|
||||
{
|
||||
m_header->setText(m_visiting_profile->getUserName() + _("'s profile"), false);
|
||||
}
|
||||
else
|
||||
Log::error("OnlineProfileBase", "No visting profile");
|
||||
m_friends_tab->setTooltip(_("Friends"));
|
||||
m_achievements_tab->setTooltip(_("Achievements"));
|
||||
m_settings_tab->setTooltip(_("Account Settings"));
|
||||
|
||||
// If no visiting_profile is defined, use the data of the current player.
|
||||
if (!m_visiting_profile || m_visiting_profile->isCurrentUser())
|
||||
m_header->setText(_("Your profile"), false);
|
||||
else if (m_visiting_profile)
|
||||
{
|
||||
m_header->setText(m_visiting_profile->getUserName() + _("'s profile"), false);
|
||||
}
|
||||
else
|
||||
Log::error("OnlineProfileBase", "No visting profile");
|
||||
}
|
||||
else // no tabs, so must be local player achievements:
|
||||
{
|
||||
m_header->setText(_("Your profile"), false);
|
||||
}
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -115,7 +125,8 @@ bool OnlineProfileBase::onEscapePressed()
|
||||
|
||||
//return to your profile if it's another profile
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
StateManager::get()->replaceTopMostScreen(
|
||||
TabOnlineProfileAchievements::getInstance());
|
||||
return false;
|
||||
} // onEscapePressed
|
||||
|
||||
@ -125,7 +136,7 @@ bool OnlineProfileBase::onEscapePressed()
|
||||
void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
if (name == m_profile_tabs->m_properties[PROP_ID])
|
||||
if (m_profile_tabs && name == m_profile_tabs->m_properties[PROP_ID])
|
||||
{
|
||||
std::string selection =
|
||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
@ -37,7 +37,7 @@ namespace GUIEngine { class Widget; }
|
||||
class OnlineProfileBase : public GUIEngine::Screen
|
||||
{
|
||||
protected:
|
||||
OnlineProfileBase(const char* filename);
|
||||
OnlineProfileBase(const std::string &filename);
|
||||
|
||||
/** Pointer to the various widgets on the screen. */
|
||||
GUIEngine::LabelWidget * m_header;
|
||||
|
Loading…
Reference in New Issue
Block a user