public ConnectionIndicatorDetail GetDetail(ConnectionIndicatorType t)
        {
            if (this.details.ContainsKey(t))
            {
                return(this.details[t]);
            }
            ConnectionIndicatorDetail connectionIndicatorDetail = new ConnectionIndicatorDetail();

            this.details[t] = connectionIndicatorDetail;
            return(connectionIndicatorDetail);
        }
 public static void Update()
 {
     foreach (KeyValuePair <NetworkConnection, ConnectionIndicatorElement> connection in ConnectionIndicator._connections)
     {
         if (connection.Value.duck != null && (connection.Value.duck.removeFromLevel || connection.Value.duck.level != Level.current))
         {
             connection.Value.duck = (Duck)null;
         }
         connection.Value.position = connection.Value.duck == null ? new Vec2(-1000f, -1000f) : connection.Value.duck.cameraPosition;
         foreach (KeyValuePair <ConnectionIndicatorType, ConnectionIndicatorDetail> detail in connection.Value.details)
         {
             detail.Value.buildup -= Maths.IncFrameTimer() * 0.25f;
             if ((double)detail.Value.buildup > (double)detail.Value.maxBuildup)
             {
                 detail.Value.buildup = detail.Value.maxBuildup;
             }
             if ((double)detail.Value.buildup < 0.0)
             {
                 detail.Value.buildup = 0.0f;
                 detail.Value.popOut += 0.02f;
                 if ((double)detail.Value.popOut > 1.0)
                 {
                     detail.Value.popOut = 1f;
                 }
                 detail.Value.grow -= 0.1f;
                 if ((double)detail.Value.grow < 0.0)
                 {
                     detail.Value.grow = 0.0f;
                 }
             }
             else
             {
                 detail.Value.popOut = 0.0f;
                 detail.Value.grow   = Lerp.FloatSmooth(detail.Value.grow, 1f, 0.2f);
                 if ((double)detail.Value.grow > 1.0)
                 {
                     detail.Value.grow = 1f;
                 }
             }
         }
     }
     foreach (Duck duck in Level.current.things[typeof(Duck)])
     {
         NetworkConnection key = (NetworkConnection)null;
         if (duck.profile != null && duck.profile.connection != null)
         {
             key = duck.profile.connection;
         }
         if (Network.isActive && key != null)
         {
             ConnectionIndicatorElement indicatorElement = (ConnectionIndicatorElement)null;
             if (!ConnectionIndicator._connections.TryGetValue(key, out indicatorElement))
             {
                 indicatorElement = new ConnectionIndicatorElement();
                 ConnectionIndicator._connections[key] = indicatorElement;
             }
             indicatorElement.duck = duck;
             if ((double)key.manager.ping > 0.25)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Lag).buildup += Maths.IncFrameTimer();
             }
             if ((double)key.manager.ping > 0.899999976158142 || key.status != ConnectionStatus.Connected)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Failure).buildup += Maths.IncFrameTimer();
             }
             if (key.manager.lossThisFrame)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.2f;
                 key.manager.lossThisFrame = false;
             }
             if ((double)key.manager.jitter > 0.800000011920929)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.25f;
             }
             ConnectionIndicatorDetail detail1 = indicatorElement.GetDetail(ConnectionIndicatorType.AFK);
             if (!duck.afk)
             {
                 detail1.buildup = 0.0f;
             }
             else
             {
                 detail1.buildup += Maths.IncFrameTimer();
             }
             ConnectionIndicatorDetail detail2 = indicatorElement.GetDetail(ConnectionIndicatorType.Chatting);
             if (duck.chatting)
             {
                 detail2.buildup += 0.25f;
             }
             else
             {
                 detail2.buildup = 0.0f;
             }
         }
     }
     if (ConnectionIndicator._lagIcons != null)
     {
         return;
     }
     ConnectionIndicator._lagIcons = new SpriteMap("lagturtle", 16, 16);
     ConnectionIndicator._lagIcons.CenterOrigin();
     ConnectionIndicator._rainbowGradient = new Sprite("rainbowGradient");
 }