添加了授权

This commit is contained in:
CortexCore
2023-09-21 03:49:27 +08:00
parent c59d513cca
commit c65fe87a6c
10 changed files with 317 additions and 20 deletions

View File

@@ -0,0 +1,25 @@
using Godot;
using System;
using BITKit;
using BITKit.Auth;
using Microsoft.Extensions.DependencyInjection;
namespace IDIS.Entities.License;
public partial class IDIS_License : EntityComponent
{
[Export] private PackedScene initialScene;
[Export] private Control licenseNode;
private IAuthService _authService;
public override void OnAwake()
{
_authService = Entity.ServiceProvider.GetRequiredService<IAuthService>();
_authService.OnAuthorized += OnAuthorized;
}
private async void OnAuthorized(string obj)
{
await BITApp.SwitchToMainThread();
GetParent().AddChild(initialScene.Instantiate());
licenseNode.QueueFree();
}
}