void TradeActor::AddIdle(void) { delete m_curAction; m_curAction = new Action(GOODACTION_IDLE, ACTIONEND_INTERRUPT); m_curAction->SetAnim(CreateAnim(GOODACTION_IDLE)); m_curGoodAction = GOODACTION_IDLE; }
FeatureAnim::FeatureAnim(const char* imgName,bool bTemp/* = false*/) { m_roler = NULL; m_imgName = imgName; m_bTemp = bTemp; CreateAnim(); }
void MyPositionController::OnCompassUpdate(location::CompassInfo const & info, ScreenBase const & screen) { double const oldAzimut = GetDrawableAzimut(); if ((IsInRouting() && m_mode == location::FollowAndRotate) || m_lastGPSBearing.ElapsedSeconds() < kGpsBearingLifetimeSec) return; SetDirection(info.m_bearing); if (m_isPositionAssigned && !AlmostCurrentAzimut(oldAzimut) && m_mode == location::FollowAndRotate) { CreateAnim(GetDrawablePosition(), oldAzimut, screen); m_isDirtyViewport = true; } }
void WorkerActor::AddIdle(void) { m_curAction = new Action(UNITACTION_IDLE, ACTIONEND_ANIMEND); m_curAction->SetAnim(CreateAnim(UNITACTION_IDLE)); m_curUnitAction = UNITACTION_IDLE; }
void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool isNavigable, ScreenBase const & screen) { m2::PointD const oldPos = GetDrawablePosition(); double const oldAzimut = GetDrawableAzimut(); m2::RectD const rect = MercatorBounds::MetresToXY(info.m_longitude, info.m_latitude, info.m_horizontalAccuracy); // Use FromLatLon instead of rect.Center() since in case of large info.m_horizontalAccuracy // there is significant difference between the real location and the estimated one. m_position = MercatorBounds::FromLatLon(info.m_latitude, info.m_longitude); m_errorRadius = rect.SizeX() * 0.5; bool const hasBearing = info.HasBearing(); if ((isNavigable && hasBearing) || (!isNavigable && hasBearing && info.HasSpeed() && info.m_speed > kMinSpeedThresholdMps)) { SetDirection(my::DegToRad(info.m_bearing)); m_lastGPSBearing.Reset(); } if (m_listener) m_listener->PositionChanged(Position()); if (m_isPositionAssigned && (!AlmostCurrentPosition(oldPos) || !AlmostCurrentAzimut(oldAzimut))) { CreateAnim(oldPos, oldAzimut, screen); m_isDirtyViewport = true; } if (m_notFollowAfterPending && m_mode == location::PendingPosition) { ChangeMode(location::NotFollow); if (m_isInRouting) m_routingNotFollowTimer.Reset(); m_notFollowAfterPending = false; } else if (!m_isPositionAssigned) { ChangeMode(m_isFirstLaunch ? location::Follow : m_desiredInitMode); if (!m_isFirstLaunch || !AnimationSystem::Instance().AnimationExists(Animation::MapPlane)) { if (m_mode == location::Follow) ChangeModelView(m_position, kDoNotChangeZoom); else if (m_mode == location::FollowAndRotate) ChangeModelView(m_position, m_drawDirection, m_isInRouting ? GetRoutingRotationPixelCenter() : m_pixelRect.Center(), kDoNotChangeZoom); } } else if (m_mode == location::PendingPosition || m_mode == location::NotFollowNoPosition) { if (m_isInRouting) { ChangeMode(location::FollowAndRotate); UpdateViewport(kMaxScaleZoomLevel); } else { ChangeMode(location::Follow); if (!m_isFirstLaunch) { if (GetZoomLevel(screen, m_position, m_errorRadius) <= kMaxScaleZoomLevel) { m2::PointD const size(m_errorRadius, m_errorRadius); ChangeModelView(m2::RectD(m_position - size, m_position + size)); } else { ChangeModelView(m_position, kMaxScaleZoomLevel); } } else { if (!AnimationSystem::Instance().AnimationExists(Animation::MapPlane)) ChangeModelView(m_position, kDoNotChangeZoom); } } } m_isPositionAssigned = true; SetIsVisible(true); double const kEps = 1e-5; if (fabs(m_lastLocationTimestamp - info.m_timestamp) > kEps) { m_lastLocationTimestamp = info.m_timestamp; m_updateLocationTimer.Reset(); } }