1
This commit is contained in:
33
Unity/Extensions/Steamwork/SteamworkSystem.cs
Normal file
33
Unity/Extensions/Steamwork/SteamworkSystem.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user