添加了教育平台
This commit is contained in:
BIN
BITKit/Art/Containers/container_border_64.png
Normal file
BIN
BITKit/Art/Containers/container_border_64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 311 B |
34
BITKit/Art/Containers/container_border_64.png.import
Normal file
34
BITKit/Art/Containers/container_border_64.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://57gvsjws6ulq"
|
||||
path="res://.godot/imported/container_border_64.png-f2b35f21ddd76a96e8ad0d3eadb8ea64.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://BITKit/Art/Containers/container_border_64.png"
|
||||
dest_files=["res://.godot/imported/container_border_64.png-f2b35f21ddd76a96e8ad0d3eadb8ea64.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
|
BIN
BITKit/Art/Icons/icon_subscriber-identity-module.png
Normal file
BIN
BITKit/Art/Icons/icon_subscriber-identity-module.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 549 B |
34
BITKit/Art/Icons/icon_subscriber-identity-module.png.import
Normal file
34
BITKit/Art/Icons/icon_subscriber-identity-module.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cadf2webkrl7h"
|
||||
path="res://.godot/imported/icon_subscriber-identity-module.png-9a86a84f7460b20774ab72f58be37e74.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://BITKit/Art/Icons/icon_subscriber-identity-module.png"
|
||||
dest_files=["res://.godot/imported/icon_subscriber-identity-module.png-9a86a84f7460b20774ab72f58be37e74.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
|
BIN
BITKit/Art/Shapes/icon_squad_rounded-4px.png
Normal file
BIN
BITKit/Art/Shapes/icon_squad_rounded-4px.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
34
BITKit/Art/Shapes/icon_squad_rounded-4px.png.import
Normal file
34
BITKit/Art/Shapes/icon_squad_rounded-4px.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://k3xy782w6pa0"
|
||||
path="res://.godot/imported/icon_squad_rounded-4px.png-ac042c86ca87772fcbec79a004953fc3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://BITKit/Art/Shapes/icon_squad_rounded-4px.png"
|
||||
dest_files=["res://.godot/imported/icon_squad_rounded-4px.png-ac042c86ca87772fcbec79a004953fc3.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
|
@@ -17,19 +17,28 @@ public partial class FreeLookCamera : Node3D,IVirtualCamera
|
||||
|
||||
[Export] private float maxDistance;
|
||||
|
||||
[Export]
|
||||
private Vector3 rotation;
|
||||
private Vector3 position;
|
||||
void IActivable.SetActive(bool active) => isEnabled = active;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => isEnabled;
|
||||
set => isEnabled = value;
|
||||
}
|
||||
int IVirtualCamera.FOV => fov;
|
||||
bool IVirtualCamera.IsEnabled => isEnabled;
|
||||
// ReSharper disable once ConvertToAutoProperty
|
||||
Vector3 IVirtualCamera.Rotation =>rotation ;
|
||||
// ReSharper disable once ConvertToAutoProperty
|
||||
Vector3 IVirtualCamera.Position => position;
|
||||
|
||||
[Export()]
|
||||
private Vector3 euler;
|
||||
|
||||
private bool isMoving;
|
||||
private bool enabled;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
euler = Rotation;
|
||||
|
@@ -43,6 +43,12 @@ public partial class VirtualCamera : Node3D, IVirtualCamera
|
||||
isEnabled = active;
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => isEnabled;
|
||||
set => isEnabled = value;
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
CameraService.Register(this);
|
||||
|
33
BITKit/Scripts/Channel/MultiplexGroup.cs
Normal file
33
BITKit/Scripts/Channel/MultiplexGroup.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
|
||||
namespace BITKit;
|
||||
public partial class MultiplexGroup : Node
|
||||
{
|
||||
[Export] private Godot.Collections.Dictionary<string, Node> dictionary;
|
||||
[Export] public string CurrentElement { get; protected set; }
|
||||
public override void _Ready()
|
||||
{
|
||||
if (dictionary.Count > 0)
|
||||
{
|
||||
SetCurrentElement(dictionary.Keys.First());
|
||||
}
|
||||
}
|
||||
public void SetCurrentElement(string currentElement)
|
||||
{
|
||||
foreach (var x in dictionary)
|
||||
{
|
||||
if (x.Value is IActivable activable)
|
||||
{
|
||||
activable.Enabled = x.Key == currentElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
x.Value?.SetProcess(x.Key == currentElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,6 +10,7 @@ namespace BITKit;
|
||||
public partial class BITAppForGodot : Node
|
||||
{
|
||||
public static readonly ValidHandle AllowCursor = new();
|
||||
public static float DeltaTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在构造函数中注册Logger
|
||||
@@ -77,4 +78,9 @@ public partial class BITAppForGodot : Node
|
||||
{
|
||||
Input.MouseMode = allow ? Input.MouseModeEnum.Visible : Input.MouseModeEnum.Captured;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
DeltaTime =(float) delta;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ public partial class DataPlayer : Node
|
||||
public int CurrentFrame
|
||||
{
|
||||
get => _currentFrame;
|
||||
set => _currentFrame = Math.Clamp(value, 0, Values?.Length ?? 0);
|
||||
set => _currentFrame = Math.Clamp(value, 0, Values?.Length-1 ?? 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,6 +39,12 @@ public partial class DataPlayer : Node
|
||||
/// </summary>
|
||||
[Signal]
|
||||
public delegate void OnPlayEventHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 停止播放回调
|
||||
/// </summary>
|
||||
[Signal]
|
||||
public delegate void OnStopEventHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 暂停回调
|
||||
@@ -96,6 +102,7 @@ public partial class DataPlayer : Node
|
||||
public override void _Ready()
|
||||
{
|
||||
timer.Elapsed += Play;
|
||||
EmitSignal(nameof(OnStop));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -140,6 +147,7 @@ public partial class DataPlayer : Node
|
||||
if (!IsPlaying) return false;
|
||||
timer.Stop();
|
||||
IsPlaying = IsPaused = false;
|
||||
EmitSignal(nameof(OnStop));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -158,16 +166,27 @@ public partial class DataPlayer : Node
|
||||
/// 继续播放或暂停播放
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PlayOrPause()
|
||||
public void PlayOrPause()
|
||||
{
|
||||
if (!IsPlaying) return false;
|
||||
IsPaused = !IsPaused;
|
||||
return true;
|
||||
PlayOrPause(!IsPaused);
|
||||
}
|
||||
|
||||
public void PlayOrPause(bool play)
|
||||
{
|
||||
IsPaused = !play;
|
||||
EmitSignal(nameof(OnPlayOrPause), play);
|
||||
}
|
||||
//设置标准化播放时间(0-1进度)
|
||||
public void SetNormalizeTime(float normalizeTime)
|
||||
{
|
||||
CurrentFrame = (int)(Values.Length * normalizeTime);
|
||||
Process(CurrentFrame);
|
||||
}
|
||||
|
||||
public void SetNormalizeTimeThen(float normalizeTime, bool play)
|
||||
{
|
||||
SetNormalizeTime(normalizeTime);
|
||||
PlayOrPause(play);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -185,16 +204,23 @@ public partial class DataPlayer : Node
|
||||
{
|
||||
//等待返回主线程
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
//if (IsPaused) return;
|
||||
|
||||
if (IsPaused) return;
|
||||
|
||||
//如果超过了播放长度,停止播放
|
||||
if (CurrentFrame >= Values?.Length)
|
||||
if (CurrentFrame >= Values?.Length-1)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
EmitSignal(nameof(OnPlay));
|
||||
Process(CurrentFrame++);
|
||||
}
|
||||
|
||||
private void Process(int currentFrame)
|
||||
{
|
||||
//获取当前播放信息
|
||||
var current = Values?[CurrentFrame++];
|
||||
var current = Values?[currentFrame];
|
||||
var currentNormalizeTime = (float)CurrentFrame / Values!.Length;
|
||||
var currentTime = new DateTime().AddSeconds((float)CurrentFrame / frameRate);
|
||||
|
||||
|
36
BITKit/Scripts/GraphNode/GraphFlowService.cs
Normal file
36
BITKit/Scripts/GraphNode/GraphFlowService.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace BITKit;
|
||||
public partial class GraphFlowService : Node
|
||||
{
|
||||
[Export] private Godot.Collections.Dictionary<int,NodePath> nodes;
|
||||
[Export] private int currentIndex = -1;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (currentIndex is not -1 && currentIndex < nodes.Count)
|
||||
Entry(GetGraphNode(nodes[currentIndex]));
|
||||
}
|
||||
|
||||
private void EntryNext()
|
||||
{
|
||||
if ((currentIndex + 1) >= nodes.Count) return;
|
||||
currentIndex++;
|
||||
Entry(GetGraphNode(nodes[currentIndex]));
|
||||
}
|
||||
private void Entry(GraphNode node)
|
||||
{
|
||||
foreach (var _node in nodes)
|
||||
{
|
||||
GetGraphNode(_node.Value).Overlay = GraphNode.OverlayEnum.Disabled;
|
||||
}
|
||||
node.Overlay = GraphNode.OverlayEnum.Position;
|
||||
}
|
||||
|
||||
GraphNode GetGraphNode(string nodePath)
|
||||
{
|
||||
return GetNode<GraphNode>(nodePath);
|
||||
}
|
||||
}
|
18
BITKit/Scripts/GraphNode/GraphNodeConnector.cs
Normal file
18
BITKit/Scripts/GraphNode/GraphNodeConnector.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public partial class GraphNodeConnector : GraphEdit
|
||||
{
|
||||
// public override bool _IsNodeHoverValid(StringName fromNode, int fromPort, StringName toNode, int toPort)
|
||||
// {
|
||||
// //return base._IsNodeHoverValid(fromNode, fromPort, toNode, toPort);
|
||||
// ConnectNode(fromNode, fromPort, toNode, toPort);
|
||||
// return true;
|
||||
// }
|
||||
private void RequestConnection(StringName fromNode, int fromPort, StringName toNode, int toPort)
|
||||
{
|
||||
ConnectNode(fromNode, fromPort, toNode, toPort);
|
||||
}
|
||||
}
|
24
BITKit/Scripts/UX/UXDrag.cs
Normal file
24
BITKit/Scripts/UX/UXDrag.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BITKit;
|
||||
public partial class UXDrag : Control
|
||||
{
|
||||
public override Variant _GetDragData(Vector2 atPosition)
|
||||
{
|
||||
var label = new Label();
|
||||
label.Text = "Drag";
|
||||
return base._GetDragData(atPosition);
|
||||
}
|
||||
|
||||
public override bool _CanDropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
return base._CanDropData(atPosition, data);
|
||||
}
|
||||
|
||||
public override void _DropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
base._DropData(atPosition, data);
|
||||
}
|
||||
}
|
@@ -10,11 +10,12 @@ public partial class UXPanel : Control, IUXPanel
|
||||
[Export] private bool allowInput;
|
||||
[Export] private bool isStartPanel;
|
||||
public bool IsAnimate => isAnimate;
|
||||
public string Index => GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
|
||||
|
||||
public string Index => _index;
|
||||
public bool AllowCursor => allowCursor;
|
||||
|
||||
public bool AllowInput => allowInput;
|
||||
|
||||
private string _index;
|
||||
public virtual void OnEntry(){}
|
||||
public virtual void Entry()
|
||||
{
|
||||
@@ -32,6 +33,7 @@ public partial class UXPanel : Control, IUXPanel
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_index = GetType().FullName == typeof(UXPanel).FullName ? Name : GetType().FullName;
|
||||
UXService.Register(this);
|
||||
|
||||
if (isStartPanel)
|
||||
@@ -43,8 +45,13 @@ public partial class UXPanel : Control, IUXPanel
|
||||
{
|
||||
UXService.Open(this as IUXPanel);
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
UXService.UnRegister(this);
|
||||
}
|
||||
// protected override void Dispose(bool disposing)
|
||||
// {
|
||||
// UXService.UnRegister(this);
|
||||
// }
|
||||
}
|
||||
|
@@ -67,19 +67,27 @@ public partial class UXService : Control
|
||||
/// <param name="panel">UX面板</param>
|
||||
public static void UnRegister(IUXPanel panel)
|
||||
{
|
||||
UnRegistryQueue.Enqueue(panel);
|
||||
}
|
||||
|
||||
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 Return()
|
||||
{
|
||||
|
||||
if (History.TryPop(out _))
|
||||
{
|
||||
if(History.TryPop(out var returnPanel))
|
||||
{
|
||||
Open(returnPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Open(IUXPanel panel) => EnableQueue.Push(panel);
|
||||
|
||||
public static void Open(Control control)=>Open(control as IUXPanel);
|
||||
public static void Open(string name)
|
||||
{
|
||||
|
||||
@@ -89,6 +97,11 @@ public partial class UXService : Control
|
||||
/// 内部注册面板队列
|
||||
/// </summary>
|
||||
private static readonly Queue<IUXPanel> RegistryQueue = new();
|
||||
|
||||
/// <summary>
|
||||
/// 内部注销面板队列
|
||||
/// </summary>
|
||||
private static readonly Queue<IUXPanel> UnRegistryQueue = new();
|
||||
|
||||
/// <summary>
|
||||
/// 已注册面板字典
|
||||
@@ -106,11 +119,9 @@ public partial class UXService : Control
|
||||
private static readonly Stack<IUXPanel> EnabledPanels = new();
|
||||
|
||||
/// <summary>
|
||||
/// 等待隐藏的面板
|
||||
/// 历史面板
|
||||
/// </summary>
|
||||
private static readonly Stack<IUXPanel> WActivatedPanels = new();
|
||||
|
||||
|
||||
private static readonly Stack<IUXPanel> History = new();
|
||||
|
||||
/// <summary>
|
||||
/// 正在播放过渡动画的面板
|
||||
@@ -125,6 +136,10 @@ public partial class UXService : Control
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (TransitionPanles.Count is not 0) return;
|
||||
while (UnRegistryQueue.TryDequeue(out var result))
|
||||
{
|
||||
Panels.Remove(result.Index);
|
||||
}
|
||||
while (RegistryQueue.TryDequeue(out var result))
|
||||
{
|
||||
Panels.Add(result.Index, result);
|
||||
@@ -138,6 +153,7 @@ public partial class UXService : Control
|
||||
}
|
||||
next.Entry();
|
||||
EnabledPanels.Push(next);
|
||||
History.Push(next);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
13
BITKit/Scripts/UX/UXServiceProxy.cs
Normal file
13
BITKit/Scripts/UX/UXServiceProxy.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public partial class UXServiceProxy : Node
|
||||
{
|
||||
//public static void Return() => UXService.Return();
|
||||
public void Return()
|
||||
{
|
||||
UXService.Return();
|
||||
}
|
||||
}
|
87
BITKit/Scripts/Web/HttpGet.cs
Normal file
87
BITKit/Scripts/Web/HttpGet.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using BITKit.Packages.Core.LazyLoad;
|
||||
|
||||
namespace BITKit;
|
||||
public partial class HttpGet : Node,IActivable
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问的Url
|
||||
/// </summary>
|
||||
[Export] private string url;
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Export]
|
||||
public bool Enabled { get; set; } = true;
|
||||
[Signal]
|
||||
public delegate void OnGetEventHandler(string httpContext);
|
||||
/// <summary>
|
||||
/// 最大并行请求数量
|
||||
/// </summary>
|
||||
private readonly LimitTimes limitConcurrent =new (1);
|
||||
/// <summary>
|
||||
/// 请求数据的间隔
|
||||
/// </summary>
|
||||
private readonly IntervalTimer _intervalTimer = new(1);
|
||||
/// <summary>
|
||||
/// http客户端
|
||||
/// </summary>
|
||||
private readonly ServiceLoader<System.Net.Http.HttpClient> httpClient=new();
|
||||
/// <summary>
|
||||
/// 取消令牌,用于取消Http Get
|
||||
/// </summary>
|
||||
private CancellationToken _cancellationToken;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_cancellationToken = new CancellationToken();
|
||||
}
|
||||
/// <summary>
|
||||
/// 物理帧用于控制并发和间隔的同时请求数据
|
||||
/// </summary>
|
||||
/// <param name="delta"></param>
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if(Enabled is false)return;
|
||||
//等待依赖加载
|
||||
//请求间隔控制+请求并发控制
|
||||
if (_intervalTimer.Allow is false || httpClient.IsLoaded is false) return;
|
||||
//如果url为空
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
if (!limitConcurrent.AllowOnly) return;
|
||||
//提交并发
|
||||
limitConcurrent.CanUpdate();
|
||||
//发送请求
|
||||
Request();
|
||||
}
|
||||
private async void Request()
|
||||
{
|
||||
//获取json
|
||||
|
||||
try
|
||||
{
|
||||
var json = await httpClient.Value.GetStringAsync(url, _cancellationToken);
|
||||
//取消执行,如果已取消令牌
|
||||
_cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
//调用回调
|
||||
EmitSignal(nameof(OnGet), json);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
BIT4Log.Warnning(url);
|
||||
//返回并发数量
|
||||
limitConcurrent.Release();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//返回并发数量
|
||||
limitConcurrent.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActive(bool active) => Enabled=active;
|
||||
|
||||
}
|
Reference in New Issue
Block a user