添加了授权
This commit is contained in:
25
Mods/工业数据采集与分析应用分享/Scripts/IDIS_License.cs
Normal file
25
Mods/工业数据采集与分析应用分享/Scripts/IDIS_License.cs
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user