From 6a806cc55ae75e73e1c8b740d33a30c89b5e8886 Mon Sep 17 00:00:00 2001 From: Anthony Wilcox <35226681+tomiscw@users.noreply.github.com> Date: Tue, 1 Jan 2019 09:51:46 -0500 Subject: [PATCH] "Shell" interface - Created a new hidden "shell" interface. This was initially created for testing the new localization settings but can easily be extended for other purposes. --- project/{MainScreen.tscn => GameScreen.tscn} | 32 +++--- project/Shell.tscn | 103 +++++++++++++++++++ project/project.godot | 8 +- project/src/GameScreen.gd | 20 ++++ 4 files changed, 150 insertions(+), 13 deletions(-) rename project/{MainScreen.tscn => GameScreen.tscn} (51%) create mode 100644 project/Shell.tscn create mode 100644 project/src/GameScreen.gd diff --git a/project/MainScreen.tscn b/project/GameScreen.tscn similarity index 51% rename from project/MainScreen.tscn rename to project/GameScreen.tscn index 7a55a1b..4c13b34 100644 --- a/project/MainScreen.tscn +++ b/project/GameScreen.tscn @@ -1,17 +1,21 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=8 format=2] -[ext_resource path="res://assets/dress up bg.png" type="Texture" id=1] -[ext_resource path="res://assets/zack.png" type="Texture" id=2] -[ext_resource path="res://assets/lights.png" type="Texture" id=3] -[ext_resource path="res://Clothes.tscn" type="PackedScene" id=4] -[ext_resource path="res://Interface.tscn" type="PackedScene" id=5] +[ext_resource path="res://src/GameScreen.gd" type="Script" id=1] +[ext_resource path="res://assets/dress up bg.png" type="Texture" id=2] +[ext_resource path="res://assets/zack.png" type="Texture" id=3] +[ext_resource path="res://assets/lights.png" type="Texture" id=4] +[ext_resource path="res://Clothes.tscn" type="PackedScene" id=5] +[ext_resource path="res://Shell.tscn" type="PackedScene" id=6] +[ext_resource path="res://Interface.tscn" type="PackedScene" id=7] -[node name="MainScreen" type="Node2D" index="0"] +[node name="GameScreen" type="Node2D" index="0"] + +script = ExtResource( 1 ) [node name="Background" type="Sprite" parent="." index="0"] position = Vector2( 400, 277 ) -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) __meta__ = { "_edit_lock_": true } @@ -19,7 +23,7 @@ __meta__ = { [node name="Zack" type="Sprite" parent="." index="1"] position = Vector2( 85, 352 ) -texture = ExtResource( 2 ) +texture = ExtResource( 3 ) __meta__ = { "_edit_lock_": true } @@ -27,14 +31,18 @@ __meta__ = { [node name="Lights" type="Sprite" parent="." index="2"] position = Vector2( 477.823, 100.811 ) -texture = ExtResource( 3 ) +texture = ExtResource( 4 ) _sections_unfolded = [ "Z Index" ] __meta__ = { "_edit_lock_": true } -[node name="Clothes" parent="." index="3" instance=ExtResource( 4 )] +[node name="Clothes" parent="." index="3" instance=ExtResource( 5 )] -[node name="Interface" parent="." index="4" instance=ExtResource( 5 )] +[node name="Shell" parent="." index="4" instance=ExtResource( 6 )] + +visible = false + +[node name="Interface" parent="." index="5" instance=ExtResource( 7 )] diff --git a/project/Shell.tscn b/project/Shell.tscn new file mode 100644 index 0000000..d2096f8 --- /dev/null +++ b/project/Shell.tscn @@ -0,0 +1,103 @@ +[gd_scene format=2] + +[node name="Shell" type="Control"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 40.0 +margin_bottom = 40.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 + +[node name="RefRect" type="ReferenceRect" parent="." index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 498.0 +margin_top = 6.0 +margin_right = 791.0 +margin_bottom = 42.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 + +[node name="HSplit" type="HSplitContainer" parent="RefRect" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 6.0 +margin_top = 6.0 +margin_right = 288.0 +margin_bottom = 30.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +split_offset = 165 +collapsed = false +dragger_visibility = 0 + +[node name="CmdLine" type="LineEdit" parent="RefRect/HSplit" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 223.0 +margin_bottom = 24.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 1 +size_flags_horizontal = 1 +size_flags_vertical = 1 +max_length = 30 +focus_mode = 2 +context_menu_enabled = true +placeholder_alpha = 0.6 +caret_blink = true +caret_blink_speed = 0.65 +caret_position = 0 +_sections_unfolded = [ "Caret" ] + +[node name="ExitBtn" type="Button" parent="RefRect/HSplit" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 235.0 +margin_right = 282.0 +margin_bottom = 24.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Close" +flat = false +align = 1 + + diff --git a/project/project.godot b/project/project.godot index be686e6..db371a3 100644 --- a/project/project.godot +++ b/project/project.godot @@ -11,9 +11,10 @@ config_version=3 [application] config/name="Zack's Dress Up 1½" -run/main_scene="res://MainScreen.tscn" +run/main_scene="res://GameScreen.tscn" boot_splash/image="res://assets/game splash.png" config/icon="res://icon.png" +name_sv="Zacks klä upp 1½" [display] @@ -21,6 +22,11 @@ window/size/width=800 window/size/height=554 window/size/resizable=false +[input] + +ui_test=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":16777255,"unicode":0,"echo":false,"script":null) + ] + [locale] locale_filter=[ 1, [ "en", "sv" ] ] diff --git a/project/src/GameScreen.gd b/project/src/GameScreen.gd new file mode 100644 index 0000000..ecdc406 --- /dev/null +++ b/project/src/GameScreen.gd @@ -0,0 +1,20 @@ +extends Node2D + +onready var shell = $Shell +onready var cmdl = $Shell/RefRect/HSplit/CmdLine +onready var cmdl_exit_btn = $Shell/RefRect/HSplit/ExitBtn + +func _process(delta): + cmd_interface() + +func cmd_interface(): + if Input.is_action_pressed("ui_test"): + shell.show() + + if cmdl_exit_btn.pressed: + shell.hide() + + if cmdl.text == "lang sv" and Input.is_key_pressed(KEY_ENTER): + TranslationServer.set_locale("sv") + elif cmdl.text == "lang en" and Input.is_key_pressed(KEY_ENTER): + TranslationServer.set_locale("en")