Compare commits
5 commits
3e881fe33f
...
0be63d9ac9
| Author | SHA1 | Date | |
|---|---|---|---|
| 0be63d9ac9 | |||
| 3931f059db | |||
| b4f6258d5f | |||
| a46dfa0a8d | |||
| 51f8b73306 |
6 changed files with 93 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
.godot/
|
||||
.idea/
|
||||
*.DotSettings.user
|
||||
|
|
|
|||
|
|
@ -1,23 +1,45 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
[GlobalClass]
|
||||
[GlobalClass, Tool]
|
||||
public partial class LabelLineEdit : HBoxContainer
|
||||
{
|
||||
#region Exports
|
||||
#endregion
|
||||
|
||||
#region Nodes
|
||||
[Export, Notify] public partial string Label { get; set; }
|
||||
[Export, Notify] public partial string Text { get; set; }
|
||||
[Export, Notify] public partial int Spacing { get; set; }
|
||||
[Export, Notify] public partial bool Password { get; set; }
|
||||
|
||||
private Label _labelNode;
|
||||
private LineEdit _lineEdit;
|
||||
#endregion
|
||||
|
||||
public LabelLineEdit()
|
||||
{
|
||||
_labelNode = new Label();
|
||||
_lineEdit = new LineEdit();
|
||||
Spacing = 4;
|
||||
}
|
||||
|
||||
[GodotOverride]
|
||||
private void OnReady()
|
||||
{
|
||||
_labelNode ??= new Label();
|
||||
_lineEdit ??= new LineEdit();
|
||||
_lineEdit.SizeFlagsHorizontal = SizeFlags.ExpandFill;
|
||||
AddChild(_labelNode);
|
||||
AddChild(_lineEdit);
|
||||
_labelNode.Text = Label;
|
||||
_lineEdit.Text = Text;
|
||||
_lineEdit.Secret = Password;
|
||||
LabelChanged += () => _labelNode.Text = Label;
|
||||
TextChanged += () => _lineEdit.Text = Text;
|
||||
PasswordChanged += () => _lineEdit.Secret = Password;
|
||||
SpacingChanged += () => AddThemeConstantOverride("separation", Spacing);
|
||||
_lineEdit.TextChanged += async value =>
|
||||
{
|
||||
var pos = _lineEdit.GetCaretColumn();
|
||||
Text = value;
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
_lineEdit.SetCaretColumn(pos);
|
||||
};
|
||||
}
|
||||
|
||||
public override partial void _Ready();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<LangVersion>13</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GodotSharpExtras" Version="0.5.0" />
|
||||
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.6.0" />
|
||||
<PackageReference Include="Jellyfin.Sdk" Version="2024.10.28" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
using Godot;
|
||||
|
||||
[SceneTree(root: "Nodes")]
|
||||
public partial class TestingInterface : Control
|
||||
{
|
||||
[GodotOverride]
|
||||
void OnReady()
|
||||
{
|
||||
GD.Print("TestingInterface::OnReady");
|
||||
}
|
||||
|
||||
public override partial void _Ready();
|
||||
}
|
||||
|
|
|
|||
49
TestingInterface.tscn
Normal file
49
TestingInterface.tscn
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b6v8kn5pjdd1b"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://demxhjphd8gkg" path="res://TestingInterface.cs" id="1_1mh2b"]
|
||||
[ext_resource type="Script" uid="uid://c3juujxln4m38" path="res://Library/UI/LabelLineEdit.cs" id="2_a7i77"]
|
||||
|
||||
[node name="TestingInterface" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_1mh2b")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ServerUrl" type="HBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
script = ExtResource("2_a7i77")
|
||||
Label = "Server URL:"
|
||||
Spacing = 10
|
||||
metadata/_custom_type_script = "uid://c3juujxln4m38"
|
||||
|
||||
[node name="Username" type="HBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 14
|
||||
script = ExtResource("2_a7i77")
|
||||
Label = "Username:"
|
||||
Spacing = 14
|
||||
metadata/_custom_type_script = "uid://c3juujxln4m38"
|
||||
|
||||
[node name="Password" type="HBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
script = ExtResource("2_a7i77")
|
||||
Label = "Password:"
|
||||
Spacing = 20
|
||||
Password = true
|
||||
metadata/_custom_type_script = "uid://c3juujxln4m38"
|
||||
|
|
@ -12,7 +12,8 @@ config_version=5
|
|||
|
||||
config/name="MediaPortal"
|
||||
config/description="Enter an interesting project description here!"
|
||||
config/features=PackedStringArray("4.5")
|
||||
run/main_scene="uid://b6v8kn5pjdd1b"
|
||||
config/features=PackedStringArray("4.5", "C#")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[dotnet]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue