Page cover image

User Invite Button

Like what your seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

An abstract class used by the Friend Invite Dropdown to display the list of friends and handle click events driving the invite process.

using HeathenEngieering.SteamworksIntegration.UI;
public abstract class UserInviteButton;

Events

Click

A UnityEvent that should be invoked when the UI element is clicked and should report the user that is related to the click e.g. if a user clicks on a button representing Friend A then the event should report Friend A.

public UnityUserAndPointerDataEvent Click;

The typical handler for this event would take the form of

public void Handler(UserAndPointerData data)
{
    //Do Work
}

Fields and Attributes

UserData

Represents the user this button is related to

public UserData UserData { get; protected set; }

This can only be set by the inheriting class and is the UserData of the user this button represents.

Methods

OnPointerClick

This is an implementation of the UnityEvent.EventSystem.IPointerClickHandler and will be invoked when the user clicks on the UI element. This method will in turn invoke the Click event for you.

public void OnPointerClick(PointerEventData eventData)

SetFriend

This should be implamented by the inheriting class and should be used to configure the UI display to display the required features of the indicated user. You see an example of this in the BasicFriendInviteButton provided in the asset.

public abstract void SetFriend(UserData user);

The BasicFriendInviteButton component included with the asset implaments this method such as

public override void SetFriend(UserData user)
{
    this.UserData = user;
    avatar.UserData = user;
    displayName.UserData = user;
    status.UserData = user;
}

Last updated