33 lines
884 B
C#
33 lines
884 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Steamworks;
|
|
using BITKit.SubSystems;
|
|
namespace BITKit.Steam
|
|
{
|
|
public class SteamworkSystem : SubBITSystem
|
|
{
|
|
public override void OnStart()
|
|
{
|
|
if (SteamAPI.Init())
|
|
{
|
|
Debug.Log("Steamwork已初始化完成");
|
|
BehaviourHelper.Add(Init);
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("Steamwork初始化失败");
|
|
}
|
|
}
|
|
void Init()
|
|
{
|
|
var userId = SteamUser.GetSteamID();
|
|
BITSteamUtils.GetUserAvatar(userId, OnAvatarCallback);
|
|
Data.Set<string>("SteamName", SteamFriends.GetPersonaName());
|
|
}
|
|
void OnAvatarCallback(Texture2D texture)
|
|
{
|
|
Data.Set<Texture2D>("SteamAvatar", texture);
|
|
}
|
|
}
|
|
} |