36 lines
579 B
C#
36 lines
579 B
C#
using Godot;
|
|
using GodotSteam;
|
|
|
|
public partial class SteamworksHandler : Node
|
|
{
|
|
[Export] private bool enableSteam = false;
|
|
private bool isSteamInitialized = false;
|
|
|
|
public override void _Ready()
|
|
{
|
|
if (!enableSteam) return;
|
|
|
|
SteamInitExStatus status = Steam.SteamInitEx(false).Status;
|
|
if (status != 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
isSteamInitialized = true;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (!isSteamInitialized) return;
|
|
|
|
Steam.RunCallbacks();
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
if (!isSteamInitialized) return;
|
|
|
|
Steam.SteamShutdown();
|
|
}
|
|
}
|