NAT godot playground UI implementation skeleton
This commit is contained in:
1
projects/nat-godot-playground/.gitignore
vendored
1
projects/nat-godot-playground/.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
*.import
|
*.import
|
||||||
.import/
|
.import/
|
||||||
.mono/
|
.mono/
|
||||||
|
build/
|
@@ -1,11 +1,16 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Playground.gd" type="Script" id=1]
|
[ext_resource path="res://scripts/Playground.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://EntryControl.gd" type="Script" id=2]
|
[ext_resource path="res://scripts/EntryContainer.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://build/src/RootNode.cs" type="Script" id=3]
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="RootNode" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
__meta__ = {
|
||||||
|
"haxe_script": "res://scripts/RootNode.hx"
|
||||||
|
}
|
||||||
|
|
||||||
[node name="PlaygroundTabContainer" type="TabContainer" parent="."]
|
[node name="PlaygroundTabContainer" type="TabContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -14,8 +19,12 @@ margin_right = 8.0
|
|||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
|
|
||||||
[node name="PlaygroundScrollContainer" type="ScrollContainer" parent="PlaygroundTabContainer"]
|
[node name="PlaygroundScrollContainer" type="ScrollContainer" parent="PlaygroundTabContainer"]
|
||||||
margin_right = -8.0
|
anchor_right = 1.0
|
||||||
margin_bottom = -36.0
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 4.0
|
||||||
|
margin_top = 32.0
|
||||||
|
margin_right = -4.0
|
||||||
|
margin_bottom = -4.0
|
||||||
rect_min_size = Vector2( 1280, 720 )
|
rect_min_size = Vector2( 1280, 720 )
|
||||||
|
|
||||||
[node name="Playground" type="Control" parent="PlaygroundTabContainer/PlaygroundScrollContainer"]
|
[node name="Playground" type="Control" parent="PlaygroundTabContainer/PlaygroundScrollContainer"]
|
||||||
@@ -37,5 +46,5 @@ margin_right = 192.0
|
|||||||
margin_bottom = 27.0
|
margin_bottom = 27.0
|
||||||
text = "Hello NAT Godot Playground!"
|
text = "Hello NAT Godot Playground!"
|
||||||
|
|
||||||
[connection signal="mouse_entered" from="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" to="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" method="_on_EntryControl_mouse_entered"]
|
[connection signal="mouse_entered" from="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" to="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" method="_on_EntryContainer_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" to="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" method="_on_EntryControl_mouse_exited"]
|
[connection signal="mouse_exited" from="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" to="PlaygroundTabContainer/PlaygroundScrollContainer/Playground/EntryContainer" method="_on_EntryContainer_mouse_exited"]
|
||||||
|
12
projects/nat-godot-playground/build.hxml
Normal file
12
projects/nat-godot-playground/build.hxml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--cs build
|
||||||
|
--define net-ver=50
|
||||||
|
--define no-compilation
|
||||||
|
--define analyzer-optimize
|
||||||
|
--class-path scripts
|
||||||
|
--library hxcs
|
||||||
|
--library godot
|
||||||
|
--library kiss
|
||||||
|
--library kiss-tools
|
||||||
|
--library nat-archive-tool
|
||||||
|
--macro godot.Godot.buildProject()
|
||||||
|
--dce full
|
@@ -1,6 +1,11 @@
|
|||||||
<Project Sdk="Godot.NET.Sdk/3.3.0">
|
<Project Sdk="Godot.NET.Sdk/3.3.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net472</TargetFramework>
|
|
||||||
<RootNamespace>natgodotplayground</RootNamespace>
|
<RootNamespace>natgodotplayground</RootNamespace>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -8,16 +8,60 @@
|
|||||||
|
|
||||||
config_version=4
|
config_version=4
|
||||||
|
|
||||||
|
_global_script_classes=[ {
|
||||||
|
"base": "Control",
|
||||||
|
"class": "Building",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/haxe/scripts/building.gd"
|
||||||
|
}, {
|
||||||
|
"base": "EditorPlugin",
|
||||||
|
"class": "HaxePlugin",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/haxe/scripts/haxe.gd"
|
||||||
|
}, {
|
||||||
|
"base": "Reference",
|
||||||
|
"class": "HaxePluginConstants",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/haxe/scripts/constants.gd"
|
||||||
|
}, {
|
||||||
|
"base": "EditorProperty",
|
||||||
|
"class": "HaxePluginEditorProperty",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/haxe/scripts/editor_property.gd"
|
||||||
|
}, {
|
||||||
|
"base": "EditorInspectorPlugin",
|
||||||
|
"class": "HaxePluginInspectorPlugin",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/haxe/scripts/inspector_plugin.gd"
|
||||||
|
} ]
|
||||||
|
_global_script_class_icons={
|
||||||
|
"Building": "",
|
||||||
|
"HaxePlugin": "",
|
||||||
|
"HaxePluginConstants": "",
|
||||||
|
"HaxePluginEditorProperty": "",
|
||||||
|
"HaxePluginInspectorPlugin": ""
|
||||||
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="nat-godot-playground"
|
config/name="nat-godot-playground"
|
||||||
run/main_scene="res://Main.tscn"
|
run/main_scene="res://Main.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[editor_plugins]
|
||||||
|
|
||||||
|
enabled=PoolStringArray( "res://addons/haxe/plugin.cfg" )
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
|
|
||||||
common/drop_mouse_on_gui_input_disabled=true
|
common/drop_mouse_on_gui_input_disabled=true
|
||||||
|
|
||||||
|
[haxe]
|
||||||
|
|
||||||
|
hide_native_script_field=true
|
||||||
|
external_editor="VSCode"
|
||||||
|
build_on_play=false
|
||||||
|
|
||||||
[mono]
|
[mono]
|
||||||
|
|
||||||
project/assembly_name="nat-godot-playground"
|
project/assembly_name="nat-godot-playground"
|
||||||
|
@@ -16,13 +16,13 @@ func _ready():
|
|||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
func _on_EntryControl_mouse_entered():
|
func _on_EntryContainer_mouse_entered():
|
||||||
var current_focus_z = get_parent().current_focus_z
|
var current_focus_z = get_parent().current_focus_z
|
||||||
if is_nan(current_focus_z) or current_focus_z <= self.z:
|
if is_nan(current_focus_z) or current_focus_z <= self.z:
|
||||||
get_parent().current_focus = self
|
get_parent().current_focus = self
|
||||||
get_parent().current_focus_z = self.z
|
get_parent().current_focus_z = self.z
|
||||||
|
|
||||||
func _on_EntryControl_mouse_exited():
|
func _on_EntryContainer_mouse_exited():
|
||||||
if get_parent().current_focus == self:
|
if get_parent().current_focus == self:
|
||||||
get_parent().current_focus = null
|
get_parent().current_focus = null
|
||||||
get_parent().current_focus_z = NAN
|
get_parent().current_focus_z = NAN
|
7
projects/nat-godot-playground/scripts/GodotUI.hx
Normal file
7
projects/nat-godot-playground/scripts/GodotUI.hx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package;
|
||||||
|
|
||||||
|
import kiss.Prelude;
|
||||||
|
import kiss_tools.KeyShortcutHandler;
|
||||||
|
|
||||||
|
@:build(kiss.Kiss.build())
|
||||||
|
class GodotUI implements ArchiveUI {}
|
18
projects/nat-godot-playground/scripts/GodotUI.kiss
Normal file
18
projects/nat-godot-playground/scripts/GodotUI.kiss
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
(prop &mut :ArchiveController controller (property default default))
|
||||||
|
(prop &mut :Null<KeyShortcutHandler<Entry>> shortcutHandler (property default null))
|
||||||
|
(method :Void showPrefixMap [:Map<String,String> map] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void hidePrefixMap [] (throw "TODO Not implemented!"))
|
||||||
|
(method :Null<PlaygroundSystem> playgroundSystem [] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void enterText [:String prompt :String->Void resolve :Float maxLength] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void enterNumber [:String prompt :Float->Void resolve :Float min :Float max &opt :Null<Float> inStepsOf &opt :Null<Bool> allowNaN] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void chooseEntry [:String prompt :Archive archive :Entry->Void resolve] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void chooseEntries [:String prompt :Archive archive :Array<Entry>->Void resolve :Int min :Float max] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void handleChanges [:Archive archive :ChangeSet changeSet] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void displayMessage [:String message] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void reportError [:String error] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void onSelectionChanged [:Array<Entry> selectedEntries :Array<Entry> lastSelectedEntries] (throw "TODO Not implemented!"))
|
||||||
|
(method :Void choosePosition [:String prompt :Position->Void resolve] (throw "TODO Not implemented!"))
|
||||||
|
(method :Option<Position> cursorPosition [] (throw "TODO Not implemented!"))(method :Void chooseBetweenStrings [:String prompt :Array<String> choices :String->Void resolve] (throw "TODO Not implemented!"))
|
||||||
|
|
||||||
|
(defNew [&prop :Archive archive
|
||||||
|
&prop :Node rootNode])
|
6
projects/nat-godot-playground/scripts/RootNode.hx
Normal file
6
projects/nat-godot-playground/scripts/RootNode.hx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package;
|
||||||
|
|
||||||
|
import kiss.Prelude;
|
||||||
|
|
||||||
|
@:build(kiss.Kiss.build())
|
||||||
|
class RootNode extends Control {}
|
9
projects/nat-godot-playground/scripts/RootNode.kiss
Normal file
9
projects/nat-godot-playground/scripts/RootNode.kiss
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
(method &override &public :Void _Ready []
|
||||||
|
// TODO find a better way to pass the archiveDir to a Godot game
|
||||||
|
(let [archiveDir
|
||||||
|
(or (Sys.getEnv "NAT_DIR") (throw "NAT_DIR environment variable must be set"))
|
||||||
|
archive
|
||||||
|
(new Archive archiveDir)
|
||||||
|
ui (new GodotUI archive this)
|
||||||
|
controller (new ArchiveController archive ui)]
|
||||||
|
(set ui.controller controller)))
|
15
projects/nat-godot-playground/scripts/import.hx
Normal file
15
projects/nat-godot-playground/scripts/import.hx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import godot.*;
|
||||||
|
import godot.GD.*;
|
||||||
|
|
||||||
|
// using godot.Utils;
|
||||||
|
|
||||||
|
import nat.Archive;
|
||||||
|
import nat.ArchiveUI;
|
||||||
|
import nat.ArchiveController;
|
||||||
|
import nat.Lib;
|
||||||
|
import nat.Entry;
|
||||||
|
import nat.System;
|
||||||
|
import nat.systems.*;
|
||||||
|
import nat.components.*;
|
||||||
|
|
||||||
|
import haxe.ds.Option;
|
Reference in New Issue
Block a user