public static Sprite GetAvatar(User u)
        {
            Sprite sprite = (Sprite)null;

            if (!UIInviteMenu.avatars.TryGetValue(u.id, out sprite))
            {
                sprite = UIInviteMenu.PrepareSprite(u);
            }
            return(sprite);
        }
 public static void Initialize()
 {
     if (!Steam.IsInitialized())
     {
         return;
     }
     foreach (User friend in Steam.friends)
     {
         UIInviteMenu.avatars[friend.id] = UIInviteMenu.PrepareSprite(friend);
     }
 }
 protected override void OnStart()
 {
     Options.Initialize();
     Global.Initialize();
     Teams.Initialize();
     DuckRig.Initialize();
     Unlocks.Initialize();
     ConnectionStatusUI.Initialize();
     Unlocks.CalculateTreeValues();
     Profiles.Initialize();
     Dialogue.Initialize();
     DuckTitle.Initialize();
     News.Initialize();
     Script.Initialize();
     DuckNews.Initialize();
     VirtualBackground.InitializeBack();
     AmmoType.InitializeTypes();
     DestroyType.InitializeTypes();
     VirtualTransition.Initialize();
     Unlockables.Initialize();
     UIInviteMenu.Initialize();
     LevelGenerator.Initialize();
     DuckFile.CompleteSteamCloudInitializate();
     Main.ResetMatchStuff();
     foreach (Profile profile in Profiles.active)
     {
         profile.RecordPreviousStats();
     }
     Main.editor = new DuckGameEditor();
     foreach (string file in DuckFile.GetFiles(Directory.GetCurrentDirectory(), "*.hat"))
     {
         Team t = Team.Deserialize(file);
         if (t != null)
         {
             Teams.AddExtraTeam(t);
         }
     }
     Main.SetPurchaseDetails(9.99f, "USD");
     if (Main.connectID != 0UL)
     {
         NCSteam.inviteLobbyID = Main.connectID;
         Level.current         = (Level) new JoinServer(Main.connectID);
     }
     else
     {
         Level.current = !MonoMain.noIntro ? (Level) new BIOSScreen() : (!MonoMain.startInEditor ? (Level) new TitleScreen() : (Level)Main.editor);
     }
     this._font = new BitmapFont("biosFont", 8);
     Highlights.StartRound();
 }
 public override void Open()
 {
     HUD.CloseAllCorners();
     HUD.AddCornerControl(HUDCorner.BottomLeft, "INVITE@SHOOT@");
     HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@EXIT");
     this._users.Clear();
     if (Steam.IsInitialized())
     {
         IOrderedEnumerable <User> source1 = Steam.friends.OrderBy <User, int>((Func <User, int>)(u => UIInviteMenu._sortDictionary[(int)u.state]));
         int num = source1.Count <User>();
         for (int index = 0; index < num; ++index)
         {
             User   u       = source1.ElementAt <User>(index);
             string source2 = u.name;
             if (source2.Count <char>() > 17)
             {
                 source2 = source2.Substring(0, 16) + ".";
             }
             UserInfo info = u.info;
             if (info.relationship == FriendRelationship.Friend)
             {
                 this._users.Add(new UIInviteUser()
                 {
                     user       = u,
                     sprite     = UIInviteMenu.GetAvatar(u),
                     state      = info.state,
                     name       = source2,
                     inGame     = info.inGame,
                     inDuckGame = info.inCurrentGame,
                     inMyLobby  = info.inLobby
                 });
             }
         }
         this._users = this._users.OrderBy <UIInviteUser, UIInviteUser>((Func <UIInviteUser, UIInviteUser>)(h => h), (IComparer <UIInviteUser>) new CompareUsers()).ToList <UIInviteUser>();
     }
     base.Open();
 }