/// <summary> /// Register the hud /// </summary> /// <param name="playerId"></param> /// <param name="part"></param> protected HudView RegisterHud(UUID playerId, SceneObjectPart part) { HudView hud; lock (m_localIdToHud) { HudView oldHud = null; // If a player logs in directly to the region, this will get fired both by the attachment and by the // make root agent procedure. if (m_playerIdToHud.ContainsKey(playerId)) { oldHud = DeregisterHudByPlayerId(playerId); } m_log.DebugFormat("[WATER WARS]: Registering hud {0} {1} for {2}", part.Name, part.LocalId, playerId); hud = new HudView(m_controller, part.ParentGroup.Scene, playerId); hud.Initialize(part); m_localIdToHud[part.LocalId] = hud; m_playerIdToHud[playerId] = hud; if (oldHud != null) { hud.SetTickerFromPreviousHud(oldHud); } if (!m_controller.State.UpdateHudStatus(playerId)) { ResetHud(playerId); } // An experiment in trying to resolve hud display problems by forcing an update. Unfortunately, works // occasionally but not at all often. /* * Timer forceUpdateTimer = new Timer(2000); * forceUpdateTimer.AutoReset = false; * forceUpdateTimer.Elapsed += new ElapsedEventHandler( * delegate(object source, ElapsedEventArgs e) * { * m_log.InfoFormat("[WATER WARS]: Forcing hud client update for {0}", playerId); * part.ParentGroup.SendGroupFullUpdate(); * } * ); * forceUpdateTimer.Start(); */ return(hud); } }