generated from outfrost/godot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into main
- Loading branch information
Showing
7 changed files
with
259 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://art_assets/ui/logoCupAmericano.png" type="Texture" id=1] | ||
[ext_resource path="res://art_assets/ui/wordbubble.png" type="Texture" id=2] | ||
|
||
[node name="Control_SpeechBubble" type="Control"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
rect_min_size = Vector2( 20, 20 ) | ||
input_pass_on_modal_close_click = false | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="CenterContainer" type="CenterContainer" parent="."] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = 3.96844 | ||
margin_top = -9.52441 | ||
margin_right = 3.96851 | ||
margin_bottom = -9.52441 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="MarginContainer1" type="MarginContainer" parent="CenterContainer"] | ||
margin_left = 522.0 | ||
margin_top = 325.0 | ||
margin_right = 758.0 | ||
margin_bottom = 395.0 | ||
custom_constants/margin_right = 20 | ||
custom_constants/margin_top = 0 | ||
custom_constants/margin_left = 20 | ||
|
||
[node name="NinePatchRect" type="NinePatchRect" parent="CenterContainer/MarginContainer1"] | ||
self_modulate = Color( 1, 1, 1, 0.537255 ) | ||
margin_left = 20.0 | ||
margin_right = 216.0 | ||
margin_bottom = 70.0 | ||
texture = ExtResource( 2 ) | ||
patch_margin_left = 20 | ||
patch_margin_top = 20 | ||
patch_margin_right = 20 | ||
patch_margin_bottom = 50 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="MarginContainer2" type="MarginContainer" parent="CenterContainer/MarginContainer1"] | ||
margin_left = 20.0 | ||
margin_right = 216.0 | ||
margin_bottom = 70.0 | ||
custom_constants/margin_right = 10 | ||
custom_constants/margin_left = 10 | ||
|
||
[node name="CenterContainer" type="CenterContainer" parent="CenterContainer/MarginContainer1/MarginContainer2"] | ||
margin_left = 10.0 | ||
margin_right = 186.0 | ||
margin_bottom = 70.0 | ||
|
||
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer"] | ||
margin_top = 19.0 | ||
margin_right = 176.0 | ||
margin_bottom = 51.0 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="TextureRect" type="TextureRect" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer"] | ||
margin_right = 32.0 | ||
margin_bottom = 32.0 | ||
rect_min_size = Vector2( 32, 32 ) | ||
size_flags_vertical = 0 | ||
texture = ExtResource( 1 ) | ||
expand = true | ||
|
||
[node name="TextureRect2" type="TextureRect" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer"] | ||
margin_left = 36.0 | ||
margin_right = 68.0 | ||
margin_bottom = 32.0 | ||
rect_min_size = Vector2( 32, 32 ) | ||
size_flags_vertical = 0 | ||
texture = ExtResource( 1 ) | ||
expand = true | ||
stretch_mode = 6 | ||
|
||
[node name="TextureRect3" type="TextureRect" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer"] | ||
margin_left = 72.0 | ||
margin_right = 104.0 | ||
margin_bottom = 32.0 | ||
rect_min_size = Vector2( 32, 32 ) | ||
size_flags_vertical = 0 | ||
texture = ExtResource( 1 ) | ||
expand = true | ||
stretch_mode = 6 | ||
|
||
[node name="TextureRect4" type="TextureRect" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer"] | ||
margin_left = 108.0 | ||
margin_right = 140.0 | ||
margin_bottom = 32.0 | ||
rect_min_size = Vector2( 32, 32 ) | ||
size_flags_vertical = 0 | ||
texture = ExtResource( 1 ) | ||
expand = true | ||
stretch_mode = 6 | ||
|
||
[node name="TextureRect5" type="TextureRect" parent="CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer"] | ||
margin_left = 144.0 | ||
margin_right = 176.0 | ||
margin_bottom = 32.0 | ||
rect_min_size = Vector2( 32, 32 ) | ||
size_flags_vertical = 0 | ||
texture = ExtResource( 1 ) | ||
expand = true | ||
stretch_mode = 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
extends Spatial | ||
|
||
|
||
onready var hbox = $SpatialLabelSprite/Viewport/Control_SpeechBubble/CenterContainer/MarginContainer1/MarginContainer2/CenterContainer/HBoxContainer | ||
onready var speechbubble = $SpatialLabelSprite/Viewport/Control_SpeechBubble | ||
|
||
export (Array, Texture) var order_textures | ||
|
||
var visibility_transition:bool = false | ||
var show:bool = false | ||
|
||
#noderef:order_item | ||
var sprites:Dictionary = { | ||
|
||
} | ||
|
||
|
||
func add_item(sprite:Texture, order_id:int)->bool: | ||
if sprite in sprites: | ||
return false | ||
if order_id > len(order_textures): | ||
printerr("Order id is greater than the amount of images for the orders ", get_stack()) | ||
return false | ||
sprites[sprite] = order_id | ||
var texture:TextureRect = TextureRect.new() | ||
texture.expand = true | ||
texture.stretch_mode = TextureRect.STRETCH_SCALE_ON_EXPAND | ||
texture.rect_min_size = Vector2(32,32) | ||
texture.rect_size = texture.rect_min_size | ||
texture.size_flags_vertical = false | ||
hbox.add_child(texture) | ||
texture.texture = order_textures[order_id] | ||
return true | ||
|
||
func remove_item(order_id:int)->bool: | ||
for key in sprites: | ||
if sprites[key] == order_id: | ||
sprites.erase(key) | ||
key.queue_free() | ||
return true | ||
return false | ||
|
||
func reset()->void: | ||
for key in sprites: | ||
sprites.erase(key) | ||
key.queue_free() | ||
|
||
func render_orders(order_array:Array): | ||
reset() | ||
var childs = hbox.get_children() | ||
for i in childs: | ||
if not (i in sprites): | ||
i.queue_free() | ||
for order in order_array: | ||
var texture:Texture = OrderRepository.order_textures[order] | ||
add_item(texture, order) | ||
|
||
|
||
func show_bubble(): | ||
var current:Color = speechbubble.modulate | ||
var tween = $Tween | ||
tween.interpolate_property(speechbubble, "modulate", | ||
current, Color.white, 2, | ||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) | ||
tween.start() | ||
|
||
pass | ||
speechbubble.modulate.a | ||
|
||
func hide_bubble(): | ||
var current:Color = speechbubble.modulate | ||
var tween = $Tween | ||
tween.interpolate_property(speechbubble, "modulate", | ||
current, Color.transparent, 2, | ||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) | ||
tween.start() | ||
|
||
func _ready(): | ||
speechbubble.modulate = Color.transparent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[gd_scene load_steps=8 format=2] | ||
|
||
[ext_resource path="res://game/customer/speech_bubble/SpatialSpeechBubble.gd" type="Script" id=1] | ||
[ext_resource path="res://art_assets/ui/logoCupEspresso.png" type="Texture" id=2] | ||
[ext_resource path="res://art_assets/ui/logoCupCappuccino.png" type="Texture" id=3] | ||
[ext_resource path="res://art_assets/ui/logoCupLatte.png" type="Texture" id=4] | ||
[ext_resource path="res://art_assets/ui/logoCupAmericano.png" type="Texture" id=5] | ||
[ext_resource path="res://game/customer/speech_bubble/Control_SpeechBubble.tscn" type="PackedScene" id=6] | ||
|
||
[sub_resource type="ViewportTexture" id=1] | ||
flags = 4 | ||
viewport_path = NodePath("SpatialLabelSprite/Viewport") | ||
|
||
[node name="SpatialHbox" type="Spatial"] | ||
script = ExtResource( 1 ) | ||
order_textures = [ ExtResource( 5 ), ExtResource( 2 ), ExtResource( 4 ), ExtResource( 3 ) ] | ||
|
||
[node name="SpatialLabelSprite" type="Spatial" parent="."] | ||
|
||
[node name="Viewport" type="Viewport" parent="SpatialLabelSprite"] | ||
size = Vector2( 640, 640 ) | ||
transparent_bg = true | ||
handle_input_locally = false | ||
hdr = false | ||
usage = 0 | ||
render_target_v_flip = true | ||
gui_disable_input = true | ||
|
||
[node name="Control_SpeechBubble" parent="SpatialLabelSprite/Viewport" instance=ExtResource( 6 )] | ||
|
||
[node name="Sprite3D" type="Sprite3D" parent="SpatialLabelSprite"] | ||
cast_shadow = 0 | ||
generate_lightmap = false | ||
billboard = 1 | ||
texture = SubResource( 1 ) | ||
|
||
[node name="Tween" type="Tween" parent="."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters