This commit is contained in:
CortexCore 2023-06-19 00:41:44 +08:00
parent 073996ce6c
commit bf122c66dc
48 changed files with 683 additions and 84 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://df80xi7s3tq22"
path="res://.godot/imported/Icon_Exit.png-076485796af3297254be2e5d0b479730.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Icon_Exit.png"
dest_files=["res://.godot/imported/Icon_Exit.png-076485796af3297254be2e5d0b479730.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dytwon7lxa5gw"
path="res://.godot/imported/Icon_Registry_Editor.png-8fca1ecd05f4dcbccb2441763c7d8c46.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Icon_Registry_Editor.png"
dest_files=["res://.godot/imported/Icon_Registry_Editor.png-8fca1ecd05f4dcbccb2441763c7d8c46.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://58y4a67wwco4"
path="res://.godot/imported/Icon_Settings.png-3dfccfa9038d22ce946ffc2204216370.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Icon_Settings.png"
dest_files=["res://.godot/imported/Icon_Settings.png-3dfccfa9038d22ce946ffc2204216370.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cjk4xep1wgmul"
path="res://.godot/imported/Icon_ic_baseline-video-file.png-4d5c19b3a5bb9e09f31555cd3b0bbffd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Icon_ic_baseline-video-file.png"
dest_files=["res://.godot/imported/Icon_ic_baseline-video-file.png-4d5c19b3a5bb9e09f31555cd3b0bbffd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bqgou7g0vqbov"
path="res://.godot/imported/Icon_mdi_cog-refresh.png-035d6a3f2bfd7118b2bf5ba388532b26.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Icon_mdi_cog-refresh.png"
dest_files=["res://.godot/imported/Icon_mdi_cog-refresh.png-035d6a3f2bfd7118b2bf5ba388532b26.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cmerxcdq74b5l"
path="res://.godot/imported/Ionc_save.png-304c9d462b21c4c99af983555adaae81.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Artists/Art/Icons/Ionc_save.png"
dest_files=["res://.godot/imported/Ionc_save.png-304c9d462b21c4c99af983555adaae81.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -1,12 +1,12 @@
[gd_scene load_steps=27 format=3 uid="uid://vlopmythikrl"]
[ext_resource type="Environment" uid="uid://jt4uyj7mecg4" path="res://Artists/Maps/new_environment.tres" id="2_2nuxq"]
[ext_resource type="Script" path="res://Artists/Scripts/Camera/CameraService.cs" id="3_ma5v7"]
[ext_resource type="Script" path="res://Artists/Scripts/ECS/Entity.cs" id="5_wn1xl"]
[ext_resource type="Script" path="res://BITKit/Scripts/Camera/CameraService.cs" id="3_ma5v7"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/Entity.cs" id="5_wn1xl"]
[ext_resource type="Script" path="res://Artists/Scripts/Factory/IdComponent.cs" id="6_ftlno"]
[ext_resource type="Script" path="res://Artists/Scripts/Factory/RotationComponent.cs" id="7_gtndm"]
[ext_resource type="Texture2D" uid="uid://cwsuu3lt01tiy" path="res://Artists/Art/Icons/icon_window-min-line.png" id="8_8jp70"]
[ext_resource type="Script" path="res://Artists/Scripts/Camera/VirtualCamera.cs" id="8_kaklc"]
[ext_resource type="Script" path="res://BITKit/Scripts/Camera/VirtualCamera.cs" id="8_kaklc"]
[ext_resource type="Theme" uid="uid://dokwscirps6nt" path="res://Artists/Themes/Factory_Theme.tres" id="8_rbvrl"]
[ext_resource type="Texture2D" uid="uid://cqrw55bdyolpi" path="res://Artists/Art/Icons/icon_window-max-line.png" id="9_3u1gn"]
[ext_resource type="Texture2D" uid="uid://csg5g2yikwbqv" path="res://Artists/Art/Icons/icon_window-close.png" id="10_nkt8s"]

View File

@ -0,0 +1,88 @@
using Godot;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using BITKit;
using BITKit.IO;
using Microsoft.Extensions.DependencyInjection;
using Cysharp.Threading.Tasks;
namespace BITKit;
public partial class PlaybackService : UXPanel
{
[Export] private string path;
[Export] private Node root;
[Export] private Label label;
[Export] private PackedScene template;
[Export] private PackedScene labelTemplate;
[Export] private DataPlayer dataPlayer;
public PlaybackService()
{
BITApp.ServiceCollection.AddSingleton(this);
}
public override void _Ready()
{
OnExit();
}
public override void OnEntry()
{
var files =
new DirectoryInfo(PathHelper.GetFolderPath("Demos", GetTree().CurrentScene.Name))
.GetFiles()
.Where(x => x.Extension is ".demo");
;
foreach (var x in files)
{
var playableInfo = BITAssets.ReadAs<PlayableInfo>(x.FullName);
var instance = template.Instantiate<Button>();
instance.Text = playableInfo.Name;
root.AddChild(instance);
instance.Pressed += OnClick;
async void OnClick()
{
BIT4Log.Log<PlaybackService>($"正在播放:{playableInfo.Name}");
Stopwatch stopwatch = new();
stopwatch.Start();
OnExit();
label.Text = $"正在加载:{playableInfo.Name},创建时间:{playableInfo.CreateTime}";
label.Show();
await UniTask.SwitchToTaskPool();
var array = BITAssets.Read<string[]>(x.FullName, "base64");
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
stopwatch.Stop();
BIT4Log.Log<PlaybackService>($"已加载:{playableInfo.Name},耗时:{stopwatch.ElapsedMilliseconds}ms");
dataPlayer.Play(array);
label.Text = $"已加载,耗时{stopwatch.ElapsedMilliseconds}ms,点击任意位置返回";
BIT4Log.Log<PlaybackService>($"正在播放:{playableInfo.Name}");
}
}
}
public override void OnExit()
{
foreach (var x in root.GetChildren())
{
x.QueueFree();
}
label.Hide();
}
}

View File

@ -1,5 +1,4 @@
using Godot;
using RosBridgeClient;
using RosSharp.RosBridgeClient.Protocols;
namespace BITKit;

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bf5bt01qpxi26"]
[ext_resource type="Script" path="res://Artists/Scripts/Core/BITAppForGodot.cs" id="1_d1x01"]
[ext_resource type="Script" path="res://BITKit/Scripts/Core/BITAppForGodot.cs" id="1_d1x01"]
[node name="BITApp" type="Node3D"]
script = ExtResource("1_d1x01")

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://dw884h5a1l014"]
[ext_resource type="Script" path="res://Artists/Scripts/UX/UXMetaService.cs" id="1_c1yne"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXMetaService.cs" id="1_c1yne"]
[ext_resource type="PackedScene" uid="uid://c1f7dq6mepq75" path="res://Artists/Templates/UXMetaElement.tscn" id="2_ywyc4"]
[node name="UXMetaService" type="Control"]

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://y8ycnndhmpw5"]
[ext_resource type="Script" path="res://Artists/Scripts/UX/UXService.cs" id="1_dyebr"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXService.cs" id="1_dyebr"]
[node name="UXService" type="Control"]
layout_mode = 3

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b32l3iwogkdf5"]
[ext_resource type="Script" path="res://Artists/Scripts/ECS/GodotEntitiesService.cs" id="1_ewsld"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/GodotEntitiesService.cs" id="1_ewsld"]
[node name="EntitiesManager" type="Node"]
script = ExtResource("1_ewsld")

View File

@ -0,0 +1,31 @@
[gd_scene format=3 uid="uid://njxsnsho85w6"]
[node name="PlaybackWindow" type="Window"]
initial_position = 2
title = "Playback"
size = Vector2i(308, 128)
wrap_controls = true
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="CurrentTime" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "当前时间"
[node name="NormalizeTime" type="HSlider" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
max_value = 1.0
step = 0.01
[node name="TotalTime" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "总时间"

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://bw0rcgp1ftr1q"]
[ext_resource type="Texture2D" uid="uid://cmerxcdq74b5l" path="res://Artists/Art/Icons/Ionc_save.png" id="1_3vvky"]
[node name="UXPlayback_Element" type="Button"]
offset_right = 256.0
offset_bottom = 64.0
text = "FileName...."
icon = ExtResource("1_3vvky")

View File

@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using Godot;
namespace BITKit;
@ -17,9 +16,6 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
private float distance;
[Export] private float maxDistance;
[Export]
private StringResource stringResource;
private Vector3 rotation;
private Vector3 position;
@ -31,12 +27,12 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
// ReSharper disable once ConvertToAutoProperty
Vector3 IVirtualCamera.Position => position;
private Vector3 eulur;
private Vector3 euler;
private bool isMoving;
public override void _Ready()
{
eulur = Rotation;
euler = Rotation;
position = Position;
CameraService.Register(this);
}
@ -48,16 +44,18 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
public override void _Process(double delta)
{
var _rot = Quaternion.FromEuler(eulur);
var _rot = Quaternion.FromEuler(euler);
var _dir = _rot * Vector3.Forward * distance;
var newPos = Position - _dir;
position = position.Lerp(newPos, 1);
rotation = rotation.Lerp(eulur, 1);
rotation = rotation.Lerp(euler, 1);
BITAppForGodot.AllowCursor.SetDisableElements(this,Input.IsMouseButtonPressed(MouseButton.Middle));
isMoving = Input.IsKeyPressed(Key.Shift);
SetMeta("CurrentRot",_rot);
}
public override void _Input(InputEvent @event)
@ -71,7 +69,7 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
{
var velocity = mouseMotion.Relative;
Position +=
Quaternion.FromEuler(eulur) *
Quaternion.FromEuler(euler) *
new Vector3()
{
X= -velocity.X,
@ -81,16 +79,16 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
else
{
var mouseVelocity = mouseMotion.Relative /* 0.022f*/ * 1.81f * (float)GetProcessDeltaTime();
eulur.X -= mouseVelocity.Y;
eulur.Y -= mouseVelocity.X;
eulur.Y %= 360;
euler.X -= mouseVelocity.Y;
euler.Y -= mouseVelocity.X;
euler.Y %= 360;
eulur.X = Math.Clamp(eulur.X, -80, 80);
euler.X = Math.Clamp(euler.X, -80, 80);
}
break;
case InputEventMouseButton mouseButton:
var delta =(float) GetProcessDeltaTime() * wheelCurve.Sample(distance*0.1f);
var delta =(float) GetProcessDeltaTime() * (wheelCurve?.Sample(distance*0.1f) ?? 32);
switch (mouseButton.ButtonIndex)
{
case MouseButton.WheelUp:
@ -99,8 +97,6 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
case MouseButton.WheelDown:
distance += delta;
break;
default:
break;
}
distance = Math.Clamp(distance,0, maxDistance);
break;

View File

@ -1,8 +1,6 @@
using System;
using System.Threading;
using Godot;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using HttpClient = System.Net.Http.HttpClient;
namespace BITKit;
@ -12,6 +10,7 @@ namespace BITKit;
public partial class BITAppForGodot : Node
{
public static readonly ValidHandle AllowCursor = new();
/// <summary>
/// 在构造函数中注册Logger
/// </summary>
@ -21,14 +20,11 @@ public partial class BITAppForGodot : Node
BIT4Log.OnWarning += GD.PushWarning;
BIT4Log.OnNextLine += () => GD.Print();
BIT4Log.OnException += x=>GD.PrintErr(x.ToString());
BIT4Log.UseLogTime();
//启动BITApp
BITApp.Start(ProjectSettings.GetSetting("application/config/name").AsString());
BIT4Log.Log<BITAppForGodot>("已创建BITApp");
}
public override void _Ready()

View File

@ -0,0 +1,11 @@
using Godot;
using System;
namespace BITKit;
public partial class BITAppProxy : Node
{
private void Exit()
{
GetTree().Quit();
}
}

View File

@ -1,5 +1,4 @@
using Godot;
using System;
using System.IO;
using Environment = System.Environment;

View File

@ -1,6 +1,7 @@
using Godot;
using System;
using System.Timers;
using Cysharp.Threading.Tasks;
namespace BITKit;
@ -111,7 +112,11 @@ public partial class DataPlayer : Node
Values = values;
timer.Interval = TimeSpan.FromSeconds(1f / frameRate).Milliseconds;
Play();
timer.Start();
var totalTime = new DateTime().AddSeconds((float)Values!.Length / frameRate);
EmitSignal(nameof(OnSetTotalTime), totalTime.ToString(timeFormat));
return true;
}
@ -121,8 +126,8 @@ public partial class DataPlayer : Node
/// <returns></returns>
public bool Play()
{
if (!IsPlaying) return false;
IsPaused = false;
IsPlaying = true;
return true;
}
@ -159,6 +164,11 @@ public partial class DataPlayer : Node
IsPaused = !IsPaused;
return true;
}
//设置标准化播放时间(0-1进度)
public void SetNormalizeTime(float normalizeTime)
{
CurrentFrame = (int)(Values.Length * normalizeTime);
}
protected override void Dispose(bool disposing)
{
@ -171,16 +181,30 @@ public partial class DataPlayer : Node
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected virtual void Play(object sender, ElapsedEventArgs e)
protected virtual async void Play(object sender, ElapsedEventArgs e)
{
if (IsPlaying is false || IsPaused) return;
if (CurrentFrame > Values?.Length)
//等待返回主线程
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
//if (IsPaused) return;
//如果超过了播放长度,停止播放
if (CurrentFrame >= Values?.Length)
{
Stop();
return;
}
//获取当前播放信息
var current = Values?[CurrentFrame++];
var variant = Variant.From(current);
EmitSignal(nameof(OnProcessPlayEventHandler), variant);
var currentNormalizeTime = (float)CurrentFrame / Values!.Length;
var currentTime = new DateTime().AddSeconds((float)CurrentFrame / frameRate);
//调用信号
EmitSignal(nameof(OnProcessPlay), current);
EmitSignal(nameof(OnSetPlaybackTime), currentTime.ToString(timeFormat));
EmitSignal(nameof(OnSetNormalizeTime), currentNormalizeTime);
//设置Meta
SetMeta(nameof(OnProcessPlay),current);
SetMeta(nameof(OnSetNormalizeTime),currentNormalizeTime);
}
}

View File

@ -40,7 +40,7 @@ public partial class Entity : Node,IEntity
if (x is not IEntityComponent component) continue;
component.Entity = this;
TypeComponents.TryAdd(x.GetType(),component);
BIT4Log.Log<Entity>($"已加载组件:{x.Name}");
//BIT4Log.Log<Entity>($"已加载组件:{x.Name}");
component.OnAwake();
entityComponents.Add(component);
}
@ -50,6 +50,7 @@ public partial class Entity : Node,IEntity
}
_entitiesService.Register(this);
this._components = entityComponents.ToArray();
SetMeta("Components",Variant.From(_components.Select(x=>x.GetType().Name).ToArray()));
}
public bool TryGetComponent<T>(out T component) where T : IEntityComponent
{

View File

@ -1,5 +1,4 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

View File

@ -1,5 +1,4 @@
using Godot;
using System;
namespace BITKit;

View File

@ -0,0 +1,50 @@
using Godot;
using System;
namespace BITKit;
public partial class UXPanel : Control, IUXPanel
{
[Export] private bool isAnimate;
[Export] private bool allowCursor;
[Export] private bool allowInput;
[Export] private bool isStartPanel;
public bool IsAnimate => isAnimate;
public string Index => GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
public bool AllowCursor => allowCursor;
public bool AllowInput => allowInput;
public virtual void OnEntry(){}
public virtual void Entry()
{
Show();
OnEntry();
}
public virtual void Exit()
{
Hide();
OnExit();
}
public virtual void OnExit(){}
public override void _Ready()
{
UXService.Register(this);
if (isStartPanel)
{
UXService.Open(this as IUXPanel);
}
}
private void Open()
{
UXService.Open(this as IUXPanel);
}
protected override void Dispose(bool disposing)
{
UXService.UnRegister(this);
}
}

View File

@ -1,6 +1,6 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Xml;
using Microsoft.Extensions.DependencyInjection;
namespace BITKit;
@ -29,6 +29,8 @@ public interface IUXPanel
/// 该面板是否启用玩家输入
/// </summary>
bool AllowInput { get; }
void Entry();
void Exit();
}
/// <summary>
@ -40,6 +42,7 @@ public interface IUXPanel
public partial class UXService : Control
{
private static UXService Singleton;
/// <summary>
/// 在构造函数中注入依赖
/// </summary>
@ -66,50 +69,76 @@ public partial class UXService : Control
{
}
public static void Open<T>() where T : IUXPanel
{
}
public static void Open(IUXPanel panel) => EnableQueue.Push(panel);
public static void Open(Control control)
{
}
public static void Open(string name)
{
}
/// <summary>
/// 内部注册面板队列
/// </summary>
private static readonly Queue<IUXPanel> RegistryQueue = new();
/// <summary>
/// 已注册面板字典
/// </summary>
private static readonly Dictionary<string, IUXPanel> Panels = new();
/// <summary>
/// 等待启用的面板队列
/// </summary>
private static readonly Stack<IUXPanel> WaitingActivePanels = new();
private static readonly Stack<IUXPanel> EnableQueue = new();
/// <summary>
/// 已启用面板
/// </summary>
private static readonly Stack<IUXPanel> ActivatedPanels = new();
private static readonly Stack<IUXPanel> EnabledPanels = new();
/// <summary>
/// 等待隐藏的面板
/// </summary>
private static readonly Stack<IUXPanel> WActivatedPanels = new();
/// <summary>
/// 正在播放过渡动画的面板
/// </summary>
private static readonly Stack<IUXPanel> TransitionPanles = new();
public override void _Ready()
private void _Entry(IUXPanel panel)
{
if (RegistryQueue.TryDequeue(out var panel))
{
Panels.Add(panel.Index,panel);
}
}
private void Entry(IUXPanel panel)
{
}
public override void _Process(double delta)
{
if(TransitionPanles.Count is not 0)return;
if (TransitionPanles.Count is not 0) return;
while (RegistryQueue.TryDequeue(out var result))
{
Panels.Add(result.Index, result);
result.Exit();
}
if (EnableQueue.TryPop(out var next))
{
while (EnabledPanels.TryPop(out var enabledPanel))
{
enabledPanel.Exit();
}
next.Entry();
EnabledPanels.Push(next);
return;
}
}
}

View File

@ -1,23 +1,31 @@
[gd_scene load_steps=24 format=3 uid="uid://cn6oq3npyox2m"]
[gd_scene load_steps=31 format=3 uid="uid://cn6oq3npyox2m"]
[ext_resource type="Script" path="res://Artists/Scripts/Core/Exec.cs" id="1_ahx04"]
[ext_resource type="Script" path="res://Artists/Scripts/Camera/CameraService.cs" id="1_jxrvb"]
[ext_resource type="Script" path="res://BITKit/Scripts/Core/Exec.cs" id="1_ahx04"]
[ext_resource type="Script" path="res://BITKit/Scripts/Camera/CameraService.cs" id="1_jxrvb"]
[ext_resource type="Texture2D" uid="uid://bymrjkd63p3fs" path="res://Mods/EIPC/Art/Background/智慧车间.png" id="4_lngwv"]
[ext_resource type="PackedScene" uid="uid://du51aijsw1md8" path="res://Mods/EIPC/Models/塞昇_仓储单元.glb" id="4_twm4i"]
[ext_resource type="PackedScene" uid="uid://c3obewoadhw2g" path="res://Mods/EIPC/Models/塞昇_装配单元.glb" id="5_slm5m"]
[ext_resource type="PackedScene" uid="uid://u5wgu77krbjd" path="res://Mods/EIPC/Models/塞昇_交付单元.glb" id="6_pkxbi"]
[ext_resource type="PackedScene" uid="uid://dsq4xhhjxpfrn" path="res://Mods/EIPC/Models/塞昇_仓储台屏幕.glb" id="7_7bqbr"]
[ext_resource type="Texture2D" uid="uid://cfqud28feqbuv" path="res://Mods/EIPC/Art/Texture/塞昇_Header.png" id="7_ejfcw"]
[ext_resource type="Script" path="res://Artists/Scripts/Camera/FreeLookCamera.cs" id="7_t1qox"]
[ext_resource type="Script" path="res://BITKit/Scripts/Camera/FreeLookCamera.cs" id="7_t1qox"]
[ext_resource type="Texture2D" uid="uid://bu1alfkonwago" path="res://Mods/EIPC/Art/Texture/赛昇_DateTime_Container.png" id="8_3erlx"]
[ext_resource type="PackedScene" uid="uid://ckckny52056cw" path="res://Mods/EIPC/Models/塞昇_仓储台机械臂底座.glb" id="8_kpd65"]
[ext_resource type="PackedScene" uid="uid://dexpjn6olm54e" path="res://Mods/EIPC/Models/塞昇_物料箱.glb" id="9_plq0l"]
[ext_resource type="PackedScene" uid="uid://b5duoofl4hmtv" path="res://Mods/EIPC/Models/塞昇_交付转台.glb" id="9_x5y85"]
[ext_resource type="Script" path="res://Artists/Scripts/Node2D/DateTimeNode.cs" id="9_y03m7"]
[ext_resource type="Script" path="res://BITKit/Scripts/Node2D/DateTimeNode.cs" id="9_y03m7"]
[ext_resource type="PackedScene" uid="uid://cspfisaj7i6i6" path="res://Mods/EIPC/Models/塞昇_Lite快换放置座2v4.glb" id="10_505q5"]
[ext_resource type="Script" path="res://Artists/Scripts/Data/DataPlayer.cs" id="11_o32l8"]
[ext_resource type="Script" path="res://BITKit/Scripts/Data/DataPlayer.cs" id="11_o32l8"]
[ext_resource type="PackedScene" uid="uid://hwdvb2o5dqn5" path="res://Mods/EIPC/Models/塞昇_螺钉箱.glb" id="12_85p72"]
[ext_resource type="PackedScene" uid="uid://b052dbve60nep" path="res://Mods/EIPC/Templates/塞昇机械臂.tscn" id="12_h3fov"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXPanel.cs" id="14_cq27g"]
[ext_resource type="Texture2D" uid="uid://cjk4xep1wgmul" path="res://Artists/Art/Icons/Icon_ic_baseline-video-file.png" id="18_h1whe"]
[ext_resource type="Texture2D" uid="uid://58y4a67wwco4" path="res://Artists/Art/Icons/Icon_Settings.png" id="19_v6ulc"]
[ext_resource type="Texture2D" uid="uid://df80xi7s3tq22" path="res://Artists/Art/Icons/Icon_Exit.png" id="20_rs8fa"]
[ext_resource type="Script" path="res://BITKit/Scripts/Core/BITAppProxy.cs" id="21_nxmi3"]
[ext_resource type="Script" path="res://Artists/Scripts/Factory/PlaybackService.cs" id="22_wvbt5"]
[ext_resource type="PackedScene" uid="uid://bw0rcgp1ftr1q" path="res://Artists/Templates/UXPlayback_Element.tscn" id="23_7djjv"]
[ext_resource type="PackedScene" uid="uid://njxsnsho85w6" path="res://Artists/Templates/PlaybackWindow.tscn" id="24_keupm"]
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_3gjuw"]
panorama = ExtResource("4_lngwv")
@ -44,8 +52,6 @@ max_value = 64.0
_data = [Vector2(0.01, 8), 0.0, 0.0, 0, 0, Vector2(0.1, 32), 0.0, 0.0, 0, 0, Vector2(1, 64), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="Resource" id="Resource_appdf"]
[node name="CPS" type="Node"]
[node name="Camera3D" type="Camera3D" parent="."]
@ -137,7 +143,20 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TextureRect" type="TextureRect" parent="UX Node"]
[node name="HUD" type="Control" parent="UX Node"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("14_cq27g")
allowCursor = true
allowInput = true
isStartPanel = true
[node name="TextureRect" type="TextureRect" parent="UX Node/HUD"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
@ -150,7 +169,7 @@ texture = ExtResource("7_ejfcw")
expand_mode = 1
stretch_mode = 5
[node name="TextureRect2" type="NinePatchRect" parent="UX Node"]
[node name="TextureRect2" type="NinePatchRect" parent="UX Node/HUD"]
layout_direction = 2
layout_mode = 1
anchors_preset = 1
@ -168,7 +187,7 @@ patch_margin_right = 4
patch_margin_bottom = 16
metadata/_edit_group_ = true
[node name="Label" type="Label" parent="UX Node/TextureRect2"]
[node name="Label" type="Label" parent="UX Node/HUD/TextureRect2"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -181,7 +200,7 @@ vertical_alignment = 1
script = ExtResource("9_y03m7")
timeFormat = "yyyy-MM-dd HH:mm:ss"
[node name="Label" type="Label" parent="UX Node"]
[node name="Label" type="Label" parent="UX Node/HUD"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
@ -189,9 +208,9 @@ anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -113.0
offset_top = 240.0
offset_top = 227.0
offset_right = 113.0
offset_bottom = 344.0
offset_bottom = 357.0
grow_horizontal = 2
grow_vertical = 2
text = "操作方式:
@ -200,6 +219,124 @@ text = "操作方式:
滑动[鼠标滚轮]缩放视角
按下[Home]切换性能视图"
[node name="VBoxContainer" type="HBoxContainer" parent="UX Node/HUD"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
alignment = 1
[node name="Playback" type="Button" parent="UX Node/HUD/VBoxContainer"]
layout_mode = 2
text = "回放"
icon = ExtResource("18_h1whe")
flat = true
[node name="Settings" type="Button" parent="UX Node/HUD/VBoxContainer"]
layout_mode = 2
text = "设置"
icon = ExtResource("19_v6ulc")
flat = true
[node name="Exit" type="Button" parent="UX Node/HUD/VBoxContainer"]
layout_mode = 2
text = "退出"
icon = ExtResource("20_rs8fa")
flat = true
script = ExtResource("21_nxmi3")
[node name="ItemList" type="ItemList" parent="UX Node/HUD"]
layout_mode = 0
offset_left = 75.0
offset_top = 657.0
offset_right = 537.0
offset_bottom = 915.0
auto_height = true
item_count = 4
same_column_width = true
item_0/text = "测试数据1"
item_0/selectable = false
item_1/text = "测试数据2"
item_1/selectable = false
item_2/text = "测试数据3"
item_2/selectable = false
item_3/text = "测试数据4"
item_3/selectable = false
[node name="Playback" type="Panel" parent="UX Node" node_paths=PackedStringArray("root", "label", "dataPlayer")]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("22_wvbt5")
root = NodePath("VFlowContainer")
label = NodePath("Label")
template = ExtResource("23_7djjv")
dataPlayer = NodePath("../../DataPlayer")
allowCursor = true
allowInput = true
[node name="ReturnButton" type="TextureButton" parent="UX Node/Playback"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VFlowContainer" type="HFlowContainer" parent="UX Node/Playback"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="UX Node/Playback"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -12.5
offset_right = 32.0
offset_bottom = 12.5
grow_horizontal = 2
grow_vertical = 2
text = "回放面板"
[node name="Options" type="Panel" parent="UX Node"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("14_cq27g")
allowCursor = true
allowInput = true
[node name="ReturnButton" type="TextureButton" parent="UX Node/Options"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PlaybackWindow" parent="UX Node" instance=ExtResource("24_keupm")]
[node name="DataPlayer" type="Node" parent="."]
script = ExtResource("11_o32l8")
@ -211,7 +348,6 @@ isEnabled = true
wheelCurve = SubResource("Curve_ro1wv")
distance = 4.0
maxDistance = 8.0
stringResource = SubResource("Resource_appdf")
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.01909, 0.387762)
@ -233,5 +369,15 @@ text = "螺钉枪和夹爪的模型也非常复杂
需要很多步骤去优化"
font_size = 12
[connection signal="pressed" from="UX Node/HUD/VBoxContainer/Playback" to="UX Node/Playback" method="Open"]
[connection signal="pressed" from="UX Node/HUD/VBoxContainer/Settings" to="UX Node/Options" method="Open"]
[connection signal="pressed" from="UX Node/HUD/VBoxContainer/Exit" to="UX Node/HUD/VBoxContainer/Exit" method="Exit"]
[connection signal="pressed" from="UX Node/Playback/ReturnButton" to="UX Node/HUD" method="Open"]
[connection signal="pressed" from="UX Node/Options/ReturnButton" to="UX Node/HUD" method="Open"]
[connection signal="value_changed" from="UX Node/PlaybackWindow/VBoxContainer/HBoxContainer/NormalizeTime" to="DataPlayer" method="SetNormalizeTime"]
[connection signal="OnSetPlaybackTime" from="DataPlayer" to="UX Node/PlaybackWindow/VBoxContainer/HBoxContainer/CurrentTime" method="set_text"]
[connection signal="OnSetTotalTime" from="DataPlayer" to="UX Node/PlaybackWindow/VBoxContainer/HBoxContainer/TotalTime" method="set_text"]
[editable path="装配机械臂"]
[editable path="螺钉机械臂"]
[editable path="UX Node/PlaybackWindow"]

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://b052dbve60nep"]
[ext_resource type="PackedScene" uid="uid://dl7swvw8ur323" path="res://Mods/EIPC/Models/赛昇机械臂/塞昇机械臂.glb" id="1_1e8se"]
[ext_resource type="Script" path="res://Artists/Scripts/ECS/Entity.cs" id="2_gninw"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/Entity.cs" id="2_gninw"]
[ext_resource type="Script" path="res://Artists/Scripts/Factory/RotationComponent.cs" id="2_jew8k"]
[ext_resource type="Script" path="res://Artists/Scripts/Factory/IdComponent.cs" id="3_oookn"]
[ext_resource type="Script" path="res://Artists/Scripts/UX/UXMetaElement.cs" id="5_mwcgj"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXMetaElement.cs" id="5_mwcgj"]
[node name="塞昇机械臂" instance=ExtResource("1_1e8se")]
script = ExtResource("2_gninw")

View File

@ -16,13 +16,15 @@
## Installation 安装过程
1.首先你需要安装 **Godot4.0.3 Net** 👉[GodotEngine.Net](https://godotengine.org/download/windows/)
2.通过Git Clone两个仓库到与该仓库相同路径的文件夹,文件结构看起来像这样:
2.通过Git Clone一些仓库到与该仓库相同路径的文件夹,文件结构看起来像这样:
> GitHub (你的项目文件夹的上一级)
> >iFactory.Godot [外网仓库链接](http://server.bitfall.icu:3000/root/iFactory.Godot.git)
>
> >BITKit [外网仓库链接](http://server.bitfall.icu:3000/root/BITKit.git)
>
> >BITKit.Godot [BITKit.Godot](http://server.bitfall.icu:3000/root/BITKit.Godot)
>
> >AGV_System [内网仓库链接](http://192.168.1.50:3000/cn-intelli/AGV_System.git)
3.最后在**Godot**中导入**iFactory.Godot**

View File

@ -1,6 +1,5 @@
#if TOOLS
using Godot;
using System;
namespace BITKit;
[Tool]

View File

@ -8,11 +8,11 @@ public partial class RegistryPlugin : EditorPlugin
{
public override void _EnterTree()
{
var type = typeof(StringResource);
const string classPath = "res://Artists/Scripts/Resource/StringResource.cs";
var script = GD.Load<Script>(classPath);
GD.Print($"已加载{script.ResourceName??script.ToString()}");
AddCustomType(type.Name, "Resource", script, null);
// var type = typeof(StringResource);
// const string classPath = "res://Artists/Scripts/Resource/StringResource.cs";
// var script = GD.Load<Script>(classPath);
// GD.Print($"已加载{script.ResourceName??script.ToString()}");
// AddCustomType(type.Name, "Resource", script, null);
}
}
#endif

View File

@ -10,5 +10,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-preview.4.23259.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-preview.4.23259.5" />
<PackageReference Include="UniTask" Version="2.3.3" />
</ItemGroup>
</Project>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -25,6 +25,7 @@ BITApp="*res://Artists/Services/BITApp.tscn"
DebugMenu="*res://addons/debug_menu/debug_menu.tscn"
UXMetaService="*res://Artists/Services/UXMetaService.tscn"
UXService="*res://Artists/Services/UXService.tscn"
PlaybackWindow="res://Artists/Templates/PlaybackWindow.tscn"
[display]
@ -42,7 +43,7 @@ export/ssil/half_size=true
[editor_plugins]
enabled=PackedStringArray("res://addons/ui_design_tool/plugin.cfg", "res://addons/BITPlugins/plugin.cfg", "res://addons/debug_menu/plugin.cfg")
enabled=PackedStringArray("res://addons/ui_design_tool/plugin.cfg", "res://addons/debug_menu/plugin.cfg")
[filesystem]