breakpoint
This commit is contained in:
parent
a2d148cfa4
commit
c59d513cca
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Net.Http;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Godot;
|
||||
using IDIS;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BITKit.Apps;
|
||||
|
||||
public partial class GodotBasedApplicationService:EntityComponent, IApplicationService
|
||||
{
|
||||
private static readonly System.Net.Http.HttpClient _httpClient = new();
|
||||
[Export] public string DownloadLatestUrl { get; set; }
|
||||
[Export] public string CheckLatestVersionUrl { get; set; }
|
||||
|
||||
public event Action<string> OnClientVersionCheck;
|
||||
public event Action<string> OnLatestVersionCheck;
|
||||
public event Action<string> OnDownloadLatest;
|
||||
public event Action<float> OnDownloadProgress;
|
||||
public event Action<string> OnDownloadComplete;
|
||||
public event Action OnDetectedLatestVersion;
|
||||
|
||||
private ILogger<IApplicationService> _logger;
|
||||
|
||||
public override void BuildService(IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddSingleton<IApplicationService>(this);
|
||||
|
||||
}
|
||||
public override async void OnStart()
|
||||
{
|
||||
_logger = Entity.ServiceProvider.GetRequiredService<ILogger<IApplicationService>>();
|
||||
|
||||
var clientVersion = ProjectSettings.GetSetting("application/config/version").AsString();
|
||||
|
||||
_logger.LogInformation($"当前版本:{clientVersion}");
|
||||
|
||||
OnClientVersionCheck?.Invoke(clientVersion);
|
||||
|
||||
var response =await _httpClient.GetAsync(CheckLatestVersionUrl,Entity.CancellationToken);
|
||||
if (response.IsSuccessStatusCode is false)
|
||||
{
|
||||
throw new HttpRequestException(response.StatusCode.ToString());
|
||||
}
|
||||
var version =await response.Content.ReadAsStringAsync(Entity.CancellationToken);
|
||||
|
||||
OnLatestVersionCheck?.Invoke(version);
|
||||
|
||||
if (clientVersion != version)
|
||||
{
|
||||
OnDetectedLatestVersion?.Invoke();
|
||||
}
|
||||
|
||||
_logger.LogInformation($"最新版本:{version}");
|
||||
}
|
||||
|
||||
public UniTask<string> DownloadLatestVersionAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -3,8 +3,10 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using BITKit.Core.Entites;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BITKit;
|
||||
/// <summary>
|
||||
|
@ -29,11 +31,28 @@ public partial class Entity : Node,IEntity
|
|||
/// IEntity.Id实现
|
||||
/// </summary>
|
||||
public ulong Id { get; private set; }
|
||||
|
||||
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
|
||||
private CancellationTokenSource _cancellationTokenSource;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 服务提供者
|
||||
/// </summary>
|
||||
public IServiceProvider ServiceProvider { get; private set; }
|
||||
private IServiceCollection _serviceCollection;
|
||||
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载所有EntityComponent的内部实现
|
||||
/// </summary>
|
||||
|
@ -46,7 +65,6 @@ public partial class Entity : Node,IEntity
|
|||
_serviceCollection = new ServiceCollection();
|
||||
_serviceCollection.AddLogging();
|
||||
|
||||
|
||||
foreach (var x in MathNode.GetAllNode(this))
|
||||
{
|
||||
GetInstanceId();
|
||||
|
|
|
@ -14,4 +14,5 @@ public partial class EntityComponent : Node,IEntityComponent
|
|||
public virtual void BuildService(IServiceCollection serviceCollection){}
|
||||
public virtual void OnStart(){}
|
||||
public virtual void OnAwake(){}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using BITKit.Apps;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public partial class UXApplicationService : EntityComponent
|
||||
|
||||
{
|
||||
[Export] private Label currentVersionLabel;
|
||||
[Export] private Label latestVersionLabel;
|
||||
[Export] private Button downloadLatestButton;
|
||||
|
||||
private IApplicationService _service;
|
||||
public override void OnAwake()
|
||||
{
|
||||
_service = Entity.ServiceProvider.GetRequiredService<IApplicationService>();
|
||||
|
||||
downloadLatestButton.Hide();
|
||||
|
||||
downloadLatestButton.Pressed += () =>
|
||||
{
|
||||
OS.ShellOpen(_service.DownloadLatestUrl);
|
||||
};
|
||||
|
||||
_service.OnClientVersionCheck += x =>
|
||||
{
|
||||
currentVersionLabel.Text = x;
|
||||
};
|
||||
_service.OnLatestVersionCheck += x =>
|
||||
{
|
||||
latestVersionLabel.Text = x;
|
||||
};
|
||||
_service.OnDetectedLatestVersion += () =>
|
||||
{
|
||||
downloadLatestButton.Show();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
using IDIS.Models;
|
||||
using IDIS.Services;
|
||||
|
@ -47,7 +48,7 @@ public partial class IDIS_Query : EntityComponent
|
|||
|
||||
titleBarContainer.Show();
|
||||
|
||||
foreach (var x in data.IdData)
|
||||
foreach (var x in data.IdData.OrderBy(x=>x.Index).Reverse())
|
||||
{
|
||||
var container = contentBuilder.Build<HBoxContainer>();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bu5w3n4me3xj2"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bu5w3n4me3xj2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://6dpw3hl2gu10" path="res://Mods/工业数据采集与分析应用分享/Arts/Illustrations/Illustration_ABB_Rotbotic_Arm_Rendering_DWADWFF.jpg" id="1_uwo3j"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwdlewpjrt8pf" path="res://Mods/教育平台/Templates/选择课程.tscn" id="2_rvvu8"]
|
||||
|
@ -6,6 +6,12 @@
|
|||
[ext_resource type="Theme" uid="uid://dokwscirps6nt" path="res://Artists/Themes/Factory_Theme.tres" id="3_t8g27"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxsds46xgtfds" path="res://Artists/Art/Logos/logo-caict.png" id="4_2c082"]
|
||||
[ext_resource type="PackedScene" uid="uid://cngf2h2a5ne4a" path="res://Mods/工业数据采集与分析应用分享/标识注册与解析.tscn" id="6_1g0h3"]
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/Core/Entity.cs" id="7_rw1xt"]
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXApplicationService.cs" id="8_13hec"]
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/Application/GodotBasedApplicationService.cs" id="8_s3bvh"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fyknl"]
|
||||
bg_color = Color(0.9375, 0.578125, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0jsjw"]
|
||||
bg_color = Color(0, 0, 0, 0.501961)
|
||||
|
@ -81,7 +87,7 @@ layout_mode = 2
|
|||
size_flags_vertical = 1
|
||||
theme_type_variation = &"HeaderMedium"
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "虚拟仿真实训课程体系"
|
||||
text = "中国信息通信研究院"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="Panel/ColorRect/VBoxContainer"]
|
||||
|
@ -89,7 +95,7 @@ layout_mode = 2
|
|||
theme = ExtResource("3_t8g27")
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "中国信息通信院定制版"
|
||||
text = "虚拟仿真实训课程"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/ColorRect"]
|
||||
layout_mode = 1
|
||||
|
@ -108,6 +114,58 @@ texture = ExtResource("4_2c082")
|
|||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/ColorRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 11
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -269.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Panel/ColorRect/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/ColorRect/HBoxContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
columns = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "当前版本:"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="client_version-label" type="Label" parent="Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "1.0.0"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "最新版本:"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="latest_Version-label" type="Label" parent="Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "1.0.0"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="download_install-button" type="Button" parent="Panel/ColorRect/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"Accent"
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_fyknl")
|
||||
text = "下载最新版"
|
||||
|
||||
[node name="ReferenceRect" type="MarginContainer" parent="Panel"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
@ -137,6 +195,7 @@ theme_type_variation = &"HeaderLarge"
|
|||
text = "CAICT定制版"
|
||||
|
||||
[node name="Label2" type="Label" parent="Panel/ReferenceRect/TabContainer/教程/Layout/HBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "仅包括1个课程"
|
||||
|
@ -154,7 +213,7 @@ text = "教程与实训"
|
|||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
theme_override_colors/font_color = Color(0, 0.698039, 0.886275, 1)
|
||||
text = "导入链接(试用版未启用)"
|
||||
text = "导入链接(定制版未启用)"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="Panel/ReferenceRect/TabContainer/教程/Layout"]
|
||||
layout_mode = 2
|
||||
|
@ -164,7 +223,7 @@ theme_override_constants/separation = 32
|
|||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "最后更新时间:
|
||||
2023年6月28日13:46:24
|
||||
2023年9月19日19:30:31
|
||||
|
||||
Powered By
|
||||
[url]中安颖立智能科技有限公司[/url]
|
||||
|
@ -277,6 +336,19 @@ popup/item_2/id = 2
|
|||
popup/item_3/text = "2560x1440"
|
||||
popup/item_3/id = 3
|
||||
|
||||
[node name="场景实体" type="Node" parent="."]
|
||||
script = ExtResource("7_rw1xt")
|
||||
|
||||
[node name="版本控制" type="Node" parent="场景实体"]
|
||||
script = ExtResource("8_s3bvh")
|
||||
CheckLatestVersionUrl = "http://server.bitfall.icu:3001/api/GetLatestVersion?owner=root&repo=iFactory.Godot"
|
||||
|
||||
[node name="UX版本控制" type="Node" parent="场景实体" node_paths=PackedStringArray("currentVersionLabel", "latestVersionLabel", "downloadLatestButton")]
|
||||
script = ExtResource("8_13hec")
|
||||
currentVersionLabel = NodePath("../../Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer/client_version-label")
|
||||
latestVersionLabel = NodePath("../../Panel/ColorRect/HBoxContainer/MarginContainer2/HBoxContainer/GridContainer/latest_Version-label")
|
||||
downloadLatestButton = NodePath("../../Panel/ColorRect/HBoxContainer/download_install-button")
|
||||
|
||||
[connection signal="tab_changed" from="Panel/ColorRect/TabBar" to="Panel/ReferenceRect/TabContainer" method="set_current_tab"]
|
||||
|
||||
[editable path="Panel/ReferenceRect/TabContainer/教程/ScrollContainer/VBoxContainer/NinePatchRect4"]
|
||||
|
|
|
@ -17,6 +17,7 @@ config/features=PackedStringArray("4.1", "C#", "Forward Plus")
|
|||
run/low_processor_mode=true
|
||||
boot_splash/bg_color=Color(0.00392157, 0, 0.00392157, 1)
|
||||
config/icon="res://icon.svg"
|
||||
config/version="1.03"
|
||||
|
||||
[autoload]
|
||||
|
||||
|
|
Loading…
Reference in New Issue