Example #1
0
    // Draw friends group
    void DrawFriendsGroup(FriendsGroup friendsGroup)
    {
        // Header
        using (new GUIHorizontal(groupHeaderStyle)) {
            GUI.color = friendsGroup.color;
            GUILayout.Label(friendsGroup.name, groupNameStyle);
            GUI.color = Color.white;
            GUILayout.FlexibleSpace();

            // Add friend
            if (GUIHelper.Button(addFriendContent))
            {
                new FriendAddWindow(
                    "Add a friend:",
                    "",
                    friendsGroup
                    );
            }

            // Remove group
            if (GUIHelper.Button(removeGroupContent))
            {
                new Confirm(
                    _("Do you really want to remove the group <b>{0}</b>? All friends in this group will be deleted from your list.", friendsGroup.name),
                    () => {
                    LogManager.General.Log(_("Removed friends list group {0}", friendsGroup.name));
                    Lobby.RPC("RemoveFriendsGroup", Lobby.lobby, friendsGroup.name);
                    friendsList.RemoveGroup(friendsGroup.name);
                }
                    );
            }
        }

        // Draw friends in this group
        using (new GUIVertical("box")) {
            if (friendsGroup.friends.Count == 0)
            {
                GUILayout.Label("This group doesn't have any contacts yet.", friendNameStyle);
            }
            else
            {
                foreach (var friend in friendsGroup.friends)
                {
                    DrawFriend(friendsGroup, friend);
                }
            }
        }
    }