在为项目配置好Steam为Service之后,通过 IOnlineSubsystem::Get()获取到指向OnlineSubsystem的指针,然后得到Session的接口。
//OnlineSubsystem - Series of interfaces to support communicating
//with various web/platform layer services
OnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get();
if (OnlineSubsystem)
{
// Get the interface for accessing the session management services
IOnlineSessionPtr SessionInterface = OnlineSubsystem->GetSessionInterface();
}
其中GetSessionInterface的定义如下:
virtual IOnlineSessionPtr GetSessionInterface() const = 0;
返回的是一个IOnlineSessionPtr ,再进一步深入可以发现这是一个Typedef定义的智能指针:
typedef TSharedPtrIOnlineSessionPtr;
Typedef其中一个功能就是将比较难记忆且复杂的类型名换一个意义明确可读性强的别名。如图就是将:
TSharedPtr取了个别名为IOnlineSessionPtr;



