BITFALL/Assets/BITKit/Extensions/Steamwork/SteamService.cs

38 lines
960 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();
}
}
}