Merge remote-tracking branch 'upstream/master'
@@ -105,7 +105,6 @@ when the border that intersect at this corner are enabled.
|
||||
left_border="75" right_border="75" top_border="0" bottom_border="15"
|
||||
hborder_out_portion="0.2" />
|
||||
|
||||
|
||||
<!-- Stateless -->
|
||||
<element type="squareFocusHalo" image="ocean/glass_square_focused.png"
|
||||
left_border="6" right_border ="6" top_border="6" bottom_border="6"
|
||||
@@ -132,6 +131,21 @@ when the border that intersect at this corner are enabled.
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
|
||||
<!-- player name spinner color in multiplayer-->
|
||||
<element type="spinner1" state="neutral" image="ocean/glass_square1.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner2" state="neutral" image="ocean/glass_square2.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner3" state="neutral" image="ocean/glass_square3.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner4" state="neutral" image="ocean/glass_square4.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
|
||||
|
||||
<!-- This one is a bit special. Only area(s) LEFT and/or RIGHT will be rendered. They will be overlaid
|
||||
on top of the spinner's background -->
|
||||
<element type="spinner" state="down" image="ocean/glassspinner_down.png"
|
||||
|
||||
@@ -132,6 +132,19 @@ when the border that intersect at this corner are enabled.
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
|
||||
<element type="spinner1" state="neutral" image="peach/glass_square1.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner2" state="neutral" image="peach/glass_square2.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner3" state="neutral" image="peach/glass_square3.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
<element type="spinner4" state="neutral" image="peach/glass_square4.png"
|
||||
left_border="110" right_border="110" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
|
||||
|
||||
<!-- This one is a bit special. Only area(s) LEFT and/or RIGHT will be rendered. They will be overlaid
|
||||
on top of the spinner's background -->
|
||||
<element type="spinner" state="down" image="peach/glassspinner_down.png"
|
||||
|
||||
BIN
data/skins/ocean/glass_square1.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
data/skins/ocean/glass_square2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
data/skins/ocean/glass_square3.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/skins/ocean/glass_square4.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
data/skins/peach/glass_square1.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/skins/peach/glass_square2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
data/skins/peach/glass_square3.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
data/skins/peach/glass_square4.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
@@ -556,7 +556,6 @@ void Camera::positionCamera(float dt, float above_kart, float cam_angle,
|
||||
// Rotate the up vector (0,1,0) by the rotation ... which is just column 1
|
||||
Vec3 up = m_kart->getTrans().getBasis().getColumn(1);
|
||||
float f = 0.04f; // weight for new up vector to reduce shaking
|
||||
f = 0;
|
||||
m_camera->setUpVector(f * up.toIrrVector() +
|
||||
(1.0f - f) * m_camera->getUpVector());
|
||||
} // kart && !flying
|
||||
|
||||
@@ -1226,7 +1226,42 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
? SkinConfig::m_render_params["spinner::focused"]
|
||||
: SkinConfig::m_render_params["spinner::neutral"];
|
||||
|
||||
if (widget->isFocusedForPlayer(1))
|
||||
// defining a spinner widget to use the spinner widget class property(getBackgroundColor)
|
||||
SpinnerWidget* q = dynamic_cast<SpinnerWidget*>(widget);
|
||||
if(q->getUseBackgroundColor())
|
||||
{
|
||||
int player_id=q->getSpinnerWidgetPlayerID();
|
||||
if(player_id==0)
|
||||
params=SkinConfig::m_render_params["spinner1::neutral"];
|
||||
else if(player_id==1)
|
||||
params=SkinConfig::m_render_params["spinner2::neutral"];
|
||||
else if(player_id==2)
|
||||
params=SkinConfig::m_render_params["spinner3::neutral"];
|
||||
else if(player_id==3)
|
||||
params=SkinConfig::m_render_params["spinner4::neutral"];
|
||||
}
|
||||
else if (focused|| pressed)
|
||||
{
|
||||
params=SkinConfig::m_render_params["spinner::focused"];
|
||||
}
|
||||
else
|
||||
{
|
||||
params=SkinConfig::m_render_params["spinner::neutral"];
|
||||
}
|
||||
|
||||
if (widget->isFocusedForPlayer(0))
|
||||
{
|
||||
core::recti rect2 = rect;
|
||||
rect2.UpperLeftCorner.X += 2;
|
||||
rect2.UpperLeftCorner.Y -= 3;
|
||||
rect2.LowerRightCorner.X -= 2;
|
||||
rect2.LowerRightCorner.Y += 5;
|
||||
drawBoxFromStretchableTexture(widget, rect2,
|
||||
SkinConfig::m_render_params["squareFocusHalo::neutral"]);
|
||||
|
||||
|
||||
}
|
||||
else if (widget->isFocusedForPlayer(1))
|
||||
{
|
||||
core::recti rect2 = rect;
|
||||
rect2.UpperLeftCorner.X += 2;
|
||||
@@ -1284,6 +1319,7 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
|
||||
// ---- If this spinner is of "gauge" type, draw filling
|
||||
const SpinnerWidget* w = dynamic_cast<const SpinnerWidget*>(widget);
|
||||
|
||||
if (w->isGauge() && !w->m_deactivated)
|
||||
{
|
||||
const int handle_size = (int)( widget->m_h*params.m_left_border
|
||||
|
||||
@@ -132,7 +132,6 @@ using namespace irr;
|
||||
*/
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
/**
|
||||
* In order to avoid calculating render information every frame, it's
|
||||
* stored in a SkinWidgetContainer for each widget (or each widget part
|
||||
@@ -269,11 +268,8 @@ namespace GUIEngine
|
||||
|
||||
|
||||
video::ITexture* bg_image;
|
||||
|
||||
|
||||
std::vector<Widget*> m_tooltips;
|
||||
std::vector<bool> m_tooltip_at_mouse;
|
||||
|
||||
#ifdef USE_PER_LINE_BACKGROUND
|
||||
public:
|
||||
#endif
|
||||
@@ -323,12 +319,12 @@ namespace GUIEngine
|
||||
|
||||
void drawTooltip(Widget* widget, bool atMouse);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// dirty way to have dialogs that zoom in
|
||||
bool m_dialog;
|
||||
float m_dialog_size;
|
||||
|
||||
/**
|
||||
* \brief load a skin from the file specified in the user configuration file
|
||||
* \throw std::runtime_error if file cannot be read
|
||||
|
||||
@@ -45,7 +45,8 @@ SpinnerWidget::SpinnerWidget(const bool gauge) : Widget(WTYPE_SPINNER)
|
||||
m_check_inside_me = true; //FIXME: not sure this is necessary
|
||||
m_supports_multiplayer = true;
|
||||
m_value = -1;
|
||||
|
||||
m_use_background_color=false;
|
||||
m_spinner_widget_player_id=-1;
|
||||
m_min = 0;
|
||||
m_max = 999;
|
||||
}
|
||||
@@ -160,6 +161,7 @@ void SpinnerWidget::add()
|
||||
{
|
||||
label->setText(m_labels[m_value].c_str() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -173,9 +175,10 @@ void SpinnerWidget::add()
|
||||
m_children[2].m_id = m_children[2].m_element->getID();
|
||||
|
||||
// refresh display
|
||||
|
||||
|
||||
setValue(m_value);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ITexture* SpinnerWidget::getTexture()
|
||||
|
||||
@@ -68,6 +68,10 @@ namespace GUIEngine
|
||||
* it displays how close the value is to the maximum by filling a line
|
||||
*/
|
||||
bool m_gauge;
|
||||
|
||||
//for setting background
|
||||
bool m_use_background_color;
|
||||
int m_spinner_widget_player_id;
|
||||
|
||||
/** \brief Whether to wrap back to the first value when going "beyond" the last value */
|
||||
bool m_wrap_around;
|
||||
@@ -93,7 +97,7 @@ namespace GUIEngine
|
||||
|
||||
/** Call only if this spinner is graphical. Returns the current texture to display */
|
||||
irr::video::ITexture* getTexture();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
LEAK_CHECK()
|
||||
@@ -104,7 +108,15 @@ namespace GUIEngine
|
||||
|
||||
void addLabel(irr::core::stringw label);
|
||||
void clearLabels();
|
||||
|
||||
|
||||
// next four functions are for background colour behind playername in multikart screen selection
|
||||
void setUseBackgroundColor() {m_use_background_color=true;}
|
||||
bool getUseBackgroundColor() {return m_use_background_color;}
|
||||
void setSpinnerWidgetPlayerID(int playerID) {m_spinner_widget_player_id=playerID;}
|
||||
int getSpinnerWidgetPlayerID() {return m_spinner_widget_player_id;}
|
||||
|
||||
|
||||
|
||||
void setListener(ISpinnerConfirmListener* listener) { m_listener = listener; }
|
||||
|
||||
/** \brief implement method from base class Widget */
|
||||
@@ -166,7 +178,7 @@ namespace GUIEngine
|
||||
/** Display custom text in spinner */
|
||||
void setCustomText(const core::stringw& text);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -197,9 +197,28 @@ namespace Online
|
||||
|
||||
if(m_parameters.size()==0)
|
||||
Log::info("HTTPRequest", "Downloading %s", m_url.c_str());
|
||||
else
|
||||
else if (Log::getLogLevel()<=Log::LL_INFO)
|
||||
{
|
||||
// Avoid printing the password or token, just replace them with *s
|
||||
std::string param = m_parameters;
|
||||
for (unsigned int j = 0; j < 2; j++)
|
||||
{
|
||||
// Get the string that should be replaced.
|
||||
std::string s = (j == 0 ? "&password=" : "&token=");
|
||||
std::size_t pos = param.find(s);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
pos += s.size();
|
||||
while (pos < param.size() && param[pos] != '&')
|
||||
{
|
||||
param[pos] = '*';
|
||||
pos++;
|
||||
} // while not end
|
||||
} // if string found
|
||||
} // for j < 2
|
||||
Log::info("HTTPRequest", "Sending %s to %s",
|
||||
m_parameters.c_str(), m_url.c_str());
|
||||
param.c_str(), m_url.c_str());
|
||||
}
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_POSTFIELDS,
|
||||
m_parameters.c_str());
|
||||
std::string uagent( std::string("SuperTuxKart/") + STK_VERSION );
|
||||
|
||||
@@ -104,12 +104,12 @@ private:
|
||||
void storeAchievements(const XMLNode * input);
|
||||
|
||||
public:
|
||||
Profile(const uint32_t & userid,
|
||||
const irr::core::stringw & username,
|
||||
bool is_current_user = false );
|
||||
Profile(const XMLNode * xml,
|
||||
ConstructorType type = C_DEFAULT);
|
||||
~Profile();
|
||||
Profile(const uint32_t & userid,
|
||||
const irr::core::stringw & username,
|
||||
bool is_current_user = false );
|
||||
Profile(const XMLNode * xml,
|
||||
ConstructorType type = C_DEFAULT);
|
||||
~Profile();
|
||||
void fetchFriends();
|
||||
const IDList& getFriends();
|
||||
void fetchAchievements();
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
void addFriend(const uint32_t id);
|
||||
void deleteRelationalInfo();
|
||||
const IDList& getAchievements();
|
||||
void merge(Profile * profile);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the achievements for this profile have been fetched. */
|
||||
bool hasFetchedAchievements() const { return m_has_fetched_achievements; }
|
||||
@@ -127,24 +128,34 @@ public:
|
||||
/** True if the profile is not fetching data atm. */
|
||||
bool isReady() const { return m_state == S_READY; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this item is the current user. */
|
||||
bool isCurrentUser() const { return m_is_current_user; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isFriend() const { return m_is_friend; }
|
||||
bool isFriend() const { return m_is_friend; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setFriend() { m_is_friend = true; }
|
||||
void setFriend() { m_is_friend = true; }
|
||||
// ------------------------------------------------------------------------
|
||||
RelationInfo* getRelationInfo() { return m_relation_info; }
|
||||
RelationInfo* getRelationInfo() { return m_relation_info; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setRelationInfo(RelationInfo * r)
|
||||
{
|
||||
delete m_relation_info; m_relation_info = r;
|
||||
} // setRelationInfo
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the cache bit of this profile. Used by the cache eviction
|
||||
* algorithm. */
|
||||
void setCacheBit(bool cache_bit) { m_cache_bit = cache_bit; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the cache bit for this profile. Used by the cache eviction
|
||||
* algorithm. */
|
||||
bool getCacheBit() const { return m_cache_bit; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the online id of this profile. */
|
||||
uint32_t getID() const { return m_id; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the user name of this profile. */
|
||||
const irr::core::stringw& getUserName() const { return m_username; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setRelationInfo(RelationInfo * r){ delete m_relation_info; m_relation_info = r; }
|
||||
|
||||
void setCacheBit(bool cache_bit) { m_cache_bit = cache_bit; }
|
||||
bool getCacheBit() const { return m_cache_bit; }
|
||||
|
||||
uint32_t getID() const { return m_id; }
|
||||
const irr::core::stringw & getUserName() const { return m_username; }
|
||||
|
||||
void merge(Profile * profile);
|
||||
|
||||
|
||||
}; // class Profile
|
||||
|
||||
|
||||
@@ -134,6 +134,10 @@ PlayerNameSpinner::PlayerNameSpinner(KartSelectionScreen* parent,
|
||||
m_incorrect = false;
|
||||
m_red_mark_widget = NULL;
|
||||
m_parent = parent;
|
||||
m_use_background_color = true;
|
||||
|
||||
setUseBackgroundColor();//except for multiplayer kart selection, this is false
|
||||
setSpinnerWidgetPlayerID(m_player_id);
|
||||
} // PlayerNameSpinner
|
||||
// ------------------------------------------------------------------------
|
||||
void PlayerNameSpinner::setID(const int m_player_id)
|
||||
@@ -270,6 +274,7 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
||||
|
||||
//m_player_ident_spinner->m_event_handler = this;
|
||||
m_children.push_back(m_player_ident_spinner);
|
||||
|
||||
|
||||
|
||||
// ----- Kart model view
|
||||
@@ -410,12 +415,13 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID)
|
||||
|
||||
// Change the player ID
|
||||
m_player_id = newPlayerID;
|
||||
|
||||
// restore previous focus, but with new player ID
|
||||
if (focus != NULL) focus->setFocusForPlayer(m_player_id);
|
||||
|
||||
if (m_player_ident_spinner != NULL)
|
||||
{
|
||||
m_player_ident_spinner->setID(m_player_id);
|
||||
}
|
||||
} // setPlayerID
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -481,7 +487,7 @@ void PlayerKartWidget::add()
|
||||
const int player_amount = PlayerManager::get()->getNumPlayers();
|
||||
for (int n=0; n<player_amount; n++)
|
||||
{
|
||||
core::stringw name = PlayerManager::get()->getPlayer(n)->getName();
|
||||
core::stringw name = PlayerManager::get()->getPlayer(n)->getName();
|
||||
m_player_ident_spinner->addLabel( translations->fribidize(name) );
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace GUIEngine
|
||||
class Widget;
|
||||
class BubbleWidget;
|
||||
enum EventPropagation;
|
||||
|
||||
}
|
||||
namespace Online
|
||||
{
|
||||
@@ -203,7 +204,6 @@ class PlayerNameSpinner : public GUIEngine::SpinnerWidget
|
||||
bool m_incorrect;
|
||||
irr::gui::IGUIImage* m_red_mark_widget;
|
||||
KartSelectionScreen* m_parent;
|
||||
|
||||
//virtual EventPropagation focused(const int m_playerID) ;
|
||||
|
||||
public:
|
||||
|
||||
@@ -42,7 +42,8 @@ OnlineProfileBase::OnlineProfileBase(const char* filename) : Screen(filename)
|
||||
} // OnlineProfileBase
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** Callback when the xml file was loaded.
|
||||
*/
|
||||
void OnlineProfileBase::loadedFromFile()
|
||||
{
|
||||
m_profile_tabs = this->getWidget<RibbonWidget>("profile_tabs");
|
||||
@@ -50,18 +51,24 @@ void OnlineProfileBase::loadedFromFile()
|
||||
m_header = this->getWidget<LabelWidget>("title");
|
||||
assert(m_header != NULL);
|
||||
|
||||
m_overview_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_overview");
|
||||
m_overview_tab =
|
||||
(IconButtonWidget *)m_profile_tabs->findWidgetNamed("tab_overview");
|
||||
assert(m_overview_tab != NULL);
|
||||
m_friends_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_friends");
|
||||
m_friends_tab =
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_friends");
|
||||
assert(m_friends_tab != NULL);
|
||||
m_achievements_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_achievements");
|
||||
m_achievements_tab =
|
||||
(IconButtonWidget*)m_profile_tabs->findWidgetNamed("tab_achievements");
|
||||
assert(m_achievements_tab != NULL);
|
||||
m_settings_tab = (IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings");
|
||||
m_settings_tab =
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_settings");
|
||||
assert(m_settings_tab != NULL);
|
||||
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Callback before widgets are added. Clears all widgets and saves the
|
||||
* current profile.
|
||||
*/
|
||||
void OnlineProfileBase::beforeAddingWidget()
|
||||
{
|
||||
m_visiting_profile = ProfileManager::get()->getVisitingProfile();
|
||||
@@ -70,6 +77,8 @@ void OnlineProfileBase::beforeAddingWidget()
|
||||
} // beforeAddingWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Called when entering this menu (before widgets are added).
|
||||
*/
|
||||
void OnlineProfileBase::init()
|
||||
{
|
||||
Screen::init();
|
||||
@@ -91,17 +100,24 @@ void OnlineProfileBase::init()
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||
/** Called when an event occurs (i.e. user clicks on something).
|
||||
*/
|
||||
void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
if (name == m_profile_tabs->m_properties[PROP_ID])
|
||||
{
|
||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
||||
|
||||
if (selection == m_overview_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileOverview::getInstance());
|
||||
else if (selection == m_friends_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileFriends::getInstance());
|
||||
else if (selection == m_achievements_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
else if (selection == m_settings_tab->m_properties[PROP_ID]) StateManager::get()->replaceTopMostScreen(OnlineProfileSettings::getInstance());
|
||||
std::string selection =
|
||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
StateManager *sm = StateManager::get();
|
||||
if (selection == m_overview_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileOverview::getInstance());
|
||||
else if (selection == m_friends_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileFriends::getInstance());
|
||||
else if (selection == m_achievements_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
else if (selection == m_settings_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileSettings::getInstance());
|
||||
}
|
||||
else if (name == "back")
|
||||
{
|
||||
|
||||
@@ -29,14 +29,17 @@
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
|
||||
/**
|
||||
* \brief Online profile base screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
/** Online profile base screen. Used for displaying friends, achievements,
|
||||
* overview, and settings. It handles the tabs which are common to each
|
||||
* of those screens, and keeps track of the profile to display.
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileBase : public GUIEngine::Screen
|
||||
{
|
||||
protected:
|
||||
OnlineProfileBase(const char* filename);
|
||||
|
||||
/** Pointer to the various widgets on the screen. */
|
||||
GUIEngine::LabelWidget * m_header;
|
||||
GUIEngine::RibbonWidget* m_profile_tabs;
|
||||
GUIEngine::IconButtonWidget * m_overview_tab;
|
||||
@@ -44,7 +47,8 @@ protected:
|
||||
GUIEngine::IconButtonWidget * m_achievements_tab;
|
||||
GUIEngine::IconButtonWidget * m_settings_tab;
|
||||
|
||||
Online::Profile * m_visiting_profile;
|
||||
/** The profile that should be shown. */
|
||||
Online::Profile *m_visiting_profile;
|
||||
|
||||
public:
|
||||
|
||||
@@ -52,7 +56,9 @@ public:
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE;
|
||||
virtual void eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init() OVERRIDE;
|
||||
|
||||
@@ -21,17 +21,14 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/online_user_search.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "states_screens/online_user_search.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <IGUIButton.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
@@ -40,28 +37,30 @@ using namespace Online;
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileFriends );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
OnlineProfileFriends::OnlineProfileFriends() : OnlineProfileBase("online/profile_friends.stkgui")
|
||||
/** Constructor for a display of all friends.
|
||||
*/
|
||||
OnlineProfileFriends::OnlineProfileFriends()
|
||||
: OnlineProfileBase("online/profile_friends.stkgui")
|
||||
{
|
||||
m_selected_friend_index = -1;
|
||||
} // OnlineProfileFriends
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** Callback when the xml file was loaded.
|
||||
*/
|
||||
void OnlineProfileFriends::loadedFromFile()
|
||||
{
|
||||
OnlineProfileBase::loadedFromFile();
|
||||
m_friends_list_widget = getWidget<GUIEngine::ListWidget>("friends_list");
|
||||
m_friends_list_widget = getWidget<ListWidget>("friends_list");
|
||||
assert(m_friends_list_widget != NULL);
|
||||
m_search_button_widget = getWidget<GUIEngine::ButtonWidget>("search_button");
|
||||
m_search_button_widget = getWidget<ButtonWidget>("search_button");
|
||||
assert(m_search_button_widget != NULL);
|
||||
m_search_box_widget = getWidget<GUIEngine::TextBoxWidget>("search_box");
|
||||
m_search_box_widget = getWidget<TextBoxWidget>("search_box");
|
||||
assert(m_search_box_widget != NULL);
|
||||
|
||||
} // loadedFromFile
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/** Callback before widgets are added. Clears all widgets.
|
||||
*/
|
||||
void OnlineProfileFriends::beforeAddingWidget()
|
||||
{
|
||||
OnlineProfileBase::beforeAddingWidget();
|
||||
@@ -72,23 +71,29 @@ void OnlineProfileFriends::beforeAddingWidget()
|
||||
m_friends_list_widget->addColumn( _("Since"), 1 );
|
||||
m_friends_list_widget->addColumn( _("Status"), 2 );
|
||||
}
|
||||
}
|
||||
} // beforeAddingWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** Called when entering this menu (before widgets are added).
|
||||
*/
|
||||
void OnlineProfileFriends::init()
|
||||
{
|
||||
OnlineProfileBase::init();
|
||||
m_profile_tabs->select( m_friends_tab->m_properties[PROP_ID], PLAYER_ID_GAME_MASTER );
|
||||
m_profile_tabs->select( m_friends_tab->m_properties[PROP_ID],
|
||||
PLAYER_ID_GAME_MASTER );
|
||||
assert(m_visiting_profile != NULL);
|
||||
m_visiting_profile->fetchFriends();
|
||||
m_waiting_for_friends = true;
|
||||
m_friends_list_widget->clear();
|
||||
m_friends_list_widget->addItem("loading", Messages::fetchingFriends());
|
||||
} // init
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileFriends::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Called when an event occurs (i.e. user clicks on something).
|
||||
*/
|
||||
void OnlineProfileFriends::eventCallback(Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
OnlineProfileBase::eventCallback( widget, name, playerID);
|
||||
if (name == m_search_button_widget->m_properties[GUIEngine::PROP_ID])
|
||||
@@ -99,44 +104,73 @@ void OnlineProfileFriends::eventCallback(Widget* widget, const std::string& name
|
||||
}
|
||||
else if (name == m_friends_list_widget->m_properties[GUIEngine::PROP_ID])
|
||||
{
|
||||
m_selected_friend_index = m_friends_list_widget->getSelectionID();
|
||||
new UserInfoDialog(m_visiting_profile->getFriends()[m_selected_friend_index]);
|
||||
int index = m_friends_list_widget->getSelectionID();
|
||||
new UserInfoDialog(m_visiting_profile->getFriends()[index]);
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Displays the friends from a given profile.
|
||||
*/
|
||||
void OnlineProfileFriends::displayResults()
|
||||
{
|
||||
m_friends_list_widget->clear();
|
||||
const Profile::IDList &friends = m_visiting_profile->getFriends();
|
||||
for (unsigned int i = 0; i < friends.size(); i++)
|
||||
{
|
||||
std::vector<ListWidget::ListCell> row;
|
||||
Profile* friend_profile =
|
||||
ProfileManager::get()->getProfileByID(friends[i]);
|
||||
|
||||
// When looking at friends of a friend those profiles are not
|
||||
// guaranteed to be persistent, so they might not be found in cache.
|
||||
if (!friend_profile)
|
||||
{
|
||||
Log::warn("OnlineProfileFriends",
|
||||
"Profile for %d not found - ignored.", friends[i]);
|
||||
continue;
|
||||
}
|
||||
row.push_back(ListWidget::ListCell(friend_profile->getUserName(),
|
||||
-1, 2) );
|
||||
if (m_visiting_profile->isCurrentUser())
|
||||
{
|
||||
Profile::RelationInfo * relation_info =
|
||||
friend_profile->getRelationInfo();
|
||||
row.push_back(ListWidget::ListCell(relation_info->getDate(),
|
||||
-1, 1, true) );
|
||||
irr::core::stringw status("");
|
||||
if (relation_info->isPending())
|
||||
{
|
||||
status = (relation_info->isAsker() ? _("New Request")
|
||||
: _("Pending") );
|
||||
}
|
||||
else
|
||||
status = (relation_info->isOnline() ? _("Online")
|
||||
: _("Offline") );
|
||||
row.push_back(ListWidget::ListCell(status, -1, 2, true));
|
||||
}
|
||||
m_friends_list_widget->addItem("friend", row);
|
||||
}
|
||||
m_waiting_for_friends = false;
|
||||
|
||||
} // displayResults
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called each frame to check if results have arrived.
|
||||
* \param delta Time step size.
|
||||
*/
|
||||
void OnlineProfileFriends::onUpdate(float delta)
|
||||
{
|
||||
if(m_waiting_for_friends)
|
||||
{
|
||||
if(m_visiting_profile->isReady())
|
||||
{
|
||||
m_friends_list_widget->clear();
|
||||
for(unsigned int i = 0; i < m_visiting_profile->getFriends().size(); i++)
|
||||
{
|
||||
std::vector<GUIEngine::ListWidget::ListCell> row;
|
||||
Profile* friend_profile = ProfileManager::get()->getProfileByID(m_visiting_profile->getFriends()[i]);
|
||||
row.push_back(GUIEngine::ListWidget::ListCell(friend_profile->getUserName(),-1,2));
|
||||
if(m_visiting_profile->isCurrentUser())
|
||||
{
|
||||
Profile::RelationInfo * relation_info = friend_profile->getRelationInfo();
|
||||
row.push_back(GUIEngine::ListWidget::ListCell(relation_info->getDate(),-1,1, true));
|
||||
irr::core::stringw status("");
|
||||
if(relation_info->isPending())
|
||||
{
|
||||
status = (relation_info->isAsker() ? _("New Request") : _("Pending"));
|
||||
}
|
||||
else
|
||||
status = (relation_info->isOnline() ? _("Online") : _("Offline"));
|
||||
row.push_back(GUIEngine::ListWidget::ListCell(status,-1,2, true));
|
||||
}
|
||||
m_friends_list_widget->addItem("friend", row);
|
||||
}
|
||||
m_waiting_for_friends = false;
|
||||
displayResults();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_friends_list_widget->renameItem("loading", Messages::fetchingFriends());
|
||||
m_friends_list_widget->renameItem("loading",
|
||||
Messages::fetchingFriends());
|
||||
}
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
||||
@@ -31,22 +31,22 @@
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
/** Online profile overview screen.
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileFriends : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileFriends>
|
||||
{
|
||||
private:
|
||||
OnlineProfileFriends();
|
||||
|
||||
GUIEngine::ListWidget * m_friends_list_widget;
|
||||
GUIEngine::ButtonWidget * m_search_button_widget;
|
||||
GUIEngine::TextBoxWidget * m_search_box_widget;
|
||||
/** Pointer to the various widgets on the screen. */
|
||||
GUIEngine::ListWidget *m_friends_list_widget;
|
||||
GUIEngine::ButtonWidget *m_search_button_widget;
|
||||
GUIEngine::TextBoxWidget *m_search_box_widget;
|
||||
|
||||
int m_selected_friend_index;
|
||||
bool m_waiting_for_friends;
|
||||
|
||||
void displayResults();
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileFriends>;
|
||||
|
||||
@@ -54,16 +54,19 @@ public:
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE;
|
||||
virtual void eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init() OVERRIDE;
|
||||
|
||||
virtual void onUpdate(float delta) OVERRIDE;
|
||||
|
||||
virtual void beforeAddingWidget() OVERRIDE;
|
||||
|
||||
virtual void refreshFriendsList() {m_waiting_for_friends = true; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Triggers a reload of the friend list next time this menu is shown. */
|
||||
void refreshFriendsList() {m_waiting_for_friends = true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -251,12 +251,14 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
|
||||
void TrackObjectPresentationMesh::init(const XMLNode* xml_node, scene::ISceneNode* parent, bool enabled)
|
||||
{
|
||||
bool skeletal_animation = true; // for backwards compatibility, if unspecified assume there is
|
||||
xml_node->get("skeletal-animation", &skeletal_animation);
|
||||
if(xml_node)
|
||||
xml_node->get("skeletal-animation", &skeletal_animation);
|
||||
|
||||
bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects ||
|
||||
World::getWorld()->getIdent() == IDENT_CUTSCENE);
|
||||
bool displacing = false;
|
||||
xml_node->get("displacing", &displacing);
|
||||
if(xml_node)
|
||||
xml_node->get("displacing", &displacing);
|
||||
animated &= !displacing;
|
||||
|
||||
m_mesh->grab();
|
||||
@@ -281,11 +283,11 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node, scene::ISceneNod
|
||||
m_node = node;
|
||||
|
||||
m_frame_start = node->getStartFrame();
|
||||
if (xml_node != NULL)
|
||||
if (xml_node)
|
||||
xml_node->get("frame-start", &m_frame_start);
|
||||
|
||||
m_frame_end = node->getEndFrame();
|
||||
if (xml_node != NULL)
|
||||
if (xml_node)
|
||||
xml_node->get("frame-end", &m_frame_end);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -109,6 +109,11 @@ public:
|
||||
m_min_log_level = (LogLevel)n;
|
||||
} // setLogLevel
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the log level. This is useful if some work is necessary to
|
||||
* preprate output strings, which might not be used at all (example:
|
||||
* replacing the cleartext password in an http request). */
|
||||
static LogLevel getLogLevel() { return m_min_log_level; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Disable coloring of log messages. */
|
||||
static void disableColor()
|
||||
|
||||