Updated UI

This commit is contained in:
Segey Lapin
2019-08-08 03:33:29 +03:00
parent aa3acca100
commit 9a7c40bf7b
10 changed files with 226 additions and 21 deletions

Binary file not shown.

View File

@@ -39,6 +39,11 @@ func _process(delta):
dst = ndst
closest = k
emit_signal("action1", closest)
if Input.is_action_just_pressed("screenshot"):
var img = get_viewport().get_texture().get_data()
img.flip_y()
img.save_png("user://screenshot.png")
print("screenshot saved to ", OS.get_user_data_dir(), "/screenshot.png")
var act_obj = null
var act_dist = -1.0
var opos = master_node.global_transform.origin
@@ -62,12 +67,14 @@ func _process(delta):
monitored_objects.push_back(act_obj)
if act_obj.is_in_group("characters"):
mon_labels[act_obj] = talk_icon.instance()
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.head_node.global_transform.origin) + Vector2(-40.0, -80.0)
else:
mon_labels[act_obj] = Button.new()
mon_labels[act_obj].text = act_obj.get_act()
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
mon_labels[act_obj].connect("pressed", self, "emit_signal", ["action1", act_obj])
add_child(mon_labels[act_obj])
mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
# mon_labels[act_obj].rect_position = camera.unproject_position(act_obj.global_transform.origin)
for k in monitored_objects:
var epos = k.global_transform.origin
var new_dist = opos.distance_squared_to(epos)
@@ -77,7 +84,11 @@ func _process(delta):
mon_labels.erase(k)
break
else:
mon_labels[k].rect_position = camera.unproject_position(k.global_transform.origin)
if k.is_in_group("characters"):
mon_labels[k].rect_position = camera.unproject_position(k.head_node.global_transform.origin)
mon_labels[k].rect_position += Vector2(-40.0, -80.0)
else:
mon_labels[k].rect_position = camera.unproject_position(k.global_transform.origin)
var click2d: Vector2 = Vector2()

View File

@@ -7,6 +7,7 @@ var aplay: AnimationPlayer
const GRAVITY = Vector3(0, -9.8, 0)
var ball_carry: Node
var item_right_hand: Node
var head_node: Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
@@ -36,6 +37,9 @@ func _ready():
add_to_group("characters")
add_to_group("activatable")
ball_carry = get_children()[0].get_children()[0].get_node("item_carry/ball_carry")
head_node = BoneAttachment.new()
skel.add_child(head_node)
head_node.bone_name = "head"
func get_act():
return "Talk"

File diff suppressed because one or more lines are too long

View File

@@ -91,3 +91,8 @@ action1={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
]
}
screenshot={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
]
}

View File

@@ -21,7 +21,8 @@ bg_color = Color( 0.6, 0.6, 0.6, 0 )
[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 8, 945, 92, 80 )
region = Rect2( 15, 0, 48, 50 )
margin = Rect2( 0, 0, 0, 4 )
[node name="act_talk" type="Button"]
margin_right = 96.0

View File

@@ -0,0 +1,8 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://ui/icons.png" type="Texture" id=1]
[resource]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 111, 0, 32, 60 )

View File

@@ -0,0 +1,8 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://ui/icons.png" type="Texture" id=1]
[resource]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 79, 0, 32, 60 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,6 +1,8 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ui/interaction.gd" type="Script" id=1]
[ext_resource path="res://ui/hire_team_icon.tres" type="Texture" id=2]
[ext_resource path="res://ui/hire_cheer_icon.tres" type="Texture" id=3]
[node name="interaction" type="Control"]
anchor_right = 1.0
@@ -24,18 +26,19 @@ __meta__ = {
margin_right = 64.0
margin_bottom = 64.0
rect_min_size = Vector2( 64, 64 )
[node name="Polygon2D" type="Polygon2D" parent="h/hire_team"]
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )
texture_normal = ExtResource( 2 )
texture_pressed = ExtResource( 2 )
texture_hover = ExtResource( 2 )
[node name="hire_cheer_team" type="TextureButton" parent="h"]
margin_left = 68.0
margin_right = 132.0
margin_bottom = 64.0
rect_min_size = Vector2( 64, 64 )
texture_normal = ExtResource( 3 )
texture_pressed = ExtResource( 3 )
texture_hover = ExtResource( 3 )
texture_focused = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Polygon2D2" type="Polygon2D" parent="h/hire_cheer_team"]
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )