38 lines
960 B
C#
38 lines
960 B
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using Steamworks;
|
||
namespace BITKit.Steamwork
|
||
{
|
||
public class SteamService : MonoBehaviour,ISteamService
|
||
{
|
||
[Header(Constant.Header.Settings)]
|
||
[SerializeField]private uint appId=480;
|
||
//接口实现
|
||
public ulong GetSteamId => SteamClient.SteamId;
|
||
public string GetName => SteamClient.Name;
|
||
|
||
private void Start()
|
||
{
|
||
try
|
||
{
|
||
SteamClient.Init(appId);
|
||
|
||
BIT4Log.Log<SteamService>("已初始化Steam");
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
BIT4Log.LogException(e);
|
||
|
||
BIT4Log.Log<SteamService>("Steam初始化失败,请验证客户端是否运行");
|
||
}
|
||
}
|
||
private void OnDestroy()
|
||
{
|
||
SteamClient.Shutdown();
|
||
}
|
||
}
|
||
|
||
}
|