本文整理汇总了C++中LLViewerRegion::getAllowDamage方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::getAllowDamage方法的具体用法?C++ LLViewerRegion::getAllowDamage怎么用?C++ LLViewerRegion::getAllowDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::getAllowDamage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
if(gDisconnected)
return; //or crash if the sim crashes; because: already ~LLMenuBarGL()
// Adding Net Stat Meter back in
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
// Let's not have to reformat time everywhere, shall we? -- MC
gViewerTime->refresh();
mTextTime->setText(gViewerTime->getCurTimeStr());
mTextTime->setToolTip(gViewerTime->getCurDateStr());
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
bool search_visible = gSavedSettings.getBOOL("ShowSearchBar");
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby())
{
childGetRect( "scriptout", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("scriptout",r);
childSetVisible("scriptout", true);
x += buttonRect.getWidth();
}
else
{
childSetVisible("scriptout", false);
}
if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) )
{
// set visibility based on flashing
if( mHealthTimer->hasExpired() )
{
childSetVisible("health", true);
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
childSetVisible("health", flash);
}
mTextHealth->setVisible(TRUE);
// Health
childGetRect( "health", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("health", r);
x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
mTextHealth->setRect(r);
x += health_width;
}
else
{
// invisible if region doesn't allow damage
childSetVisible("health", false);
mTextHealth->setVisible(FALSE);
}
if ((region && region->getBlockFly()) ||
(parcel && !parcel->getAllowFly()) )
{
// No Fly Zone
childGetRect( "no_fly", buttonRect );
childSetVisible( "no_fly", true );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "no_fly", r );
x += buttonRect.getWidth();
}
else
{
// Fly Zone
childSetVisible("no_fly", false);
}
BOOL no_build = parcel && !parcel->getAllowModify();
//.........这里部分代码省略.........
示例2: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
if(gDisconnected)
return; //or crash if the sim crashes; because: already ~LLMenuBarGL()
// Adding Net Stat Meter back in
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
// *TODO: Localize / translate time
// Get current UTC time, adjusted for the user's clock
// being off.
time_t utc_time;
utc_time = time_corrected();
// There's only one internal tm buffer.
struct tm* internal_time;
// Convert to Pacific, based on server's opinion of whether
// it's daylight savings time there.
internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
std::string t;
timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortTimeFormat"), t);
if (gPacificDaylightTime)
{
t += " PDT";
}
else
{
t += " PST";
}
mTextTime->setText(t);
std::string date;
timeStructToFormattedString(internal_time, gSavedSettings.getString("LongDateFormat"), date);
mTextTime->setToolTip(date);
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
bool search_visible = gSavedSettings.getBOOL("ShowSearchBar");
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby())
{
childGetRect( "scriptout", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("scriptout",r);
childSetVisible("scriptout", true);
x += buttonRect.getWidth();
}
else
{
childSetVisible("scriptout", false);
}
if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) )
{
// set visibility based on flashing
if( mHealthTimer->hasExpired() )
{
childSetVisible("health", true);
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
childSetVisible("health", flash);
}
mTextHealth->setVisible(TRUE);
// Health
childGetRect( "health", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("health", r);
x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
mTextHealth->setRect(r);
x += health_width;
//.........这里部分代码省略.........
示例3: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
bool net_stats_visible = gSavedSettings.getBOOL("ShowNetStats");
if (net_stats_visible)
{
// Adding Net Stat Meter back in
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
}
// Get current UTC time, adjusted for the user's clock
// being off.
time_t utc_time;
utc_time = time_corrected();
std::string timeStr = getString("time");
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
mTextTime->setText(timeStr);
// set the tooltip to have the date
std::string dtStr = getString("timeTooltip");
LLStringUtil::format (dtStr, substitution);
mTextTime->setToolTip (dtStr);
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby())
{
childGetRect( "scriptout", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("scriptout",r);
childSetVisible("scriptout", true);
x += buttonRect.getWidth();
}
else
{
childSetVisible("scriptout", false);
}
if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK &&
((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage())))
{
// set visibility based on flashing
if( mHealthTimer->hasExpired() )
{
childSetVisible("health", true);
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
childSetVisible("health", flash);
}
mTextHealth->setVisible(TRUE);
// Health
childGetRect( "health", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("health", r);
x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
mTextHealth->setRect(r);
x += health_width;
}
else
{
// invisible if region doesn't allow damage
childSetVisible("health", false);
mTextHealth->setVisible(FALSE);
}
mSGBandwidth->setVisible(net_stats_visible);
mSGPacketLoss->setVisible(net_stats_visible);
childSetEnabled("stat_btn", net_stats_visible);
// update the master volume button state
bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
//.........这里部分代码省略.........
示例4: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
// Adding Net Stat Meter back in
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
// *TODO: Localize / translate time
// Get current UTC time, adjusted for the user's clock
// being off.
time_t utc_time;
utc_time = time_corrected();
// There's only one internal tm buffer.
struct tm* internal_time;
// Convert to Pacific, based on server's opinion of whether
// it's daylight savings time there.
internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
S32 hour = internal_time->tm_hour;
S32 min = internal_time->tm_min;
std::string am_pm = "AM";
if (hour > 11)
{
hour -= 12;
am_pm = "PM";
}
std::string tz = "PST";
if (gPacificDaylightTime)
{
tz = "PDT";
}
// Zero hour is 12 AM
if (hour == 0) hour = 12;
std::ostringstream t;
t << std::setfill(' ') << std::setw(2) << hour << ":"
<< std::setfill('0') << std::setw(2) << min
<< " " << am_pm << " " << tz;
mTextTime->setText(t.str());
// Year starts at 1900, set the tooltip to have the date
std::ostringstream date;
date << sDays[internal_time->tm_wday] << ", "
<< std::setfill('0') << std::setw(2) << internal_time->tm_mday << " "
<< sMonths[internal_time->tm_mon] << " "
<< internal_time->tm_year + 1900;
mTextTime->setToolTip(date.str());
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
bool search_visible = gSavedSettings.getBOOL("ShowSearchBar");
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby())
{
childGetRect( "scriptout", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("scriptout",r);
childSetVisible("scriptout", true);
x += buttonRect.getWidth();
}
else
{
childSetVisible("scriptout", false);
}
if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) )
{
// set visibility based on flashing
if( mHealthTimer->hasExpired() )
{
childSetVisible("health", true);
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
childSetVisible("health", flash);
}
//.........这里部分代码省略.........
示例5: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
// Get current UTC time, adjusted for the user's clock
// being off.
U32 utc_time;
utc_time = time_corrected();
// There's only one internal tm buffer.
struct tm* internal_time;
// Convert to Pacific, based on server's opinion of whether
// it's daylight savings time there.
internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
S32 hour = internal_time->tm_hour;
S32 min = internal_time->tm_min;
std::string am_pm = "AM";
if (hour > 11)
{
hour -= 12;
am_pm = "PM";
}
std::string tz = "PST";
if (gPacificDaylightTime)
{
tz = "PDT";
}
// Zero hour is 12 AM
if (hour == 0) hour = 12;
std::ostringstream t;
t << std::setfill(' ') << std::setw(2) << hour << ":"
<< std::setfill('0') << std::setw(2) << min
<< " " << am_pm << " " << tz;
mTextTime->setText(t.str().c_str());
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = gParcelMgr->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby())
{
childGetRect( "scriptout", buttonRect );
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
mBtnScriptOut->setRect(r);
mBtnScriptOut->setVisible(TRUE);
x += buttonRect.getWidth();
}
else
{
mBtnScriptOut->setVisible(FALSE);
}
if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) )
{
// set visibility based on flashing
if( mHealthTimer->hasExpired() )
{
mBtnHealth->setVisible( TRUE );
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
mBtnHealth->setVisible( flash );
}
mTextHealth->setVisible(TRUE);
// Health
childGetRect( "health", buttonRect );
r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight());
mBtnHealth->setRect(r);
x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") );
r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
mTextHealth->setRect(r);
x += health_width;
}
//.........这里部分代码省略.........
示例6: refresh
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
if(gDisconnected)
return; //or crash if the sim crashes; because: already ~LLMenuBarGL()
// Adding Net Stat Meter back in
F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
mSGBandwidth->setMin(0.f);
mSGBandwidth->setMax(bwtotal*1.25f);
mSGBandwidth->setThreshold(0, bwtotal*0.75f);
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
// Singu Note: Use system's time if the user desires, otherwise use server time
static const LLCachedControl<bool> show_local_time("LiruLocalTime");
// Get current UTC time, adjusted for the user's clock
// being off.
time_t utc_time = show_local_time ? time(NULL) : time_corrected();
// There's only one internal tm buffer.
struct tm* internal_time;
// Convert to Pacific, based on server's opinion of whether
// it's daylight savings time there.
internal_time = show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime);
static const LLCachedControl<std::string> short_time_fmt(gSavedSettings, "ShortTimeFormat");
std::string t;
timeStructToFormattedString(internal_time, short_time_fmt, t);
if (show_local_time)
{
static const std::string local(" " + getString("Local"));
t += local;
}
else if (gPacificDaylightTime)
{
t += " PDT";
}
else
{
t += " PST";
}
mTextTime->setText(t);
static const LLCachedControl<std::string> long_date_fmt(gSavedSettings, "LongDateFormat");
std::string date;
timeStructToFormattedString(internal_time, long_date_fmt, date);
mTextTime->setToolTip(date);
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0;
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (LLHUDIcon::iconsNearby())
{
const LLRect& buttonRect = mScriptOut->getRect();
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
mScriptOut->setRect(r);
mScriptOut->setVisible(true);
x += buttonRect.getWidth();
}
else
{
mScriptOut->setVisible(false);
}
if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) )
{
// set visibility based on flashing
mHealthV->setVisible(mHealthTimer->hasExpired() || S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1);
mTextHealth->setVisible(TRUE);
// Health
const LLRect& buttonRect = mHealthV->getRect();
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
mHealthV->setRect(r);
x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
mTextHealth->setRect(r);
x += health_width;
}
else
{
// invisible if region doesn't allow damage
mHealthV->setVisible(false);
//.........这里部分代码省略.........