Merge pull request 'feature/sounds' (#53) from feature/sounds into dev

Reviewed-on: Athena/game-source#53
This commit is contained in:
darknight
2021-05-25 14:16:46 +02:00
34 changed files with 360 additions and 126 deletions
+5
View File
@@ -8,3 +8,8 @@ See log android :
```
adb logcat -s godot
```
## Resources
* [ambient-sound-level-warcraft.mp3](https://cchound.com/audio/tavern-loop-one/)
* [object sounds](https://lasonotheque.org/)
Binary file not shown.
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/ambient-sound-level-warcraft.ogg-eca793b67538fcb6a049f7f31dff337d.oggstr"
[deps]
source_file="res://assets/sounds/ambient-sound-level-warcraft.ogg"
dest_files=[ "res://.import/ambient-sound-level-warcraft.ogg-eca793b67538fcb6a049f7f31dff337d.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/click-button.ogg-80b2cbbc4fed369d32c5a684038e7942.oggstr"
[deps]
source_file="res://assets/sounds/click-button.ogg"
dest_files=[ "res://.import/click-button.ogg-80b2cbbc4fed369d32c5a684038e7942.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Apple.ogg-f89120a96b14173404c312d1b4ef368e.oggstr"
[deps]
source_file="res://assets/sounds/objects/Apple.ogg"
dest_files=[ "res://.import/Apple.ogg-f89120a96b14173404c312d1b4ef368e.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Beer.ogg-0e6bc95a6b45b804996f580a1be3aee0.oggstr"
[deps]
source_file="res://assets/sounds/objects/Beer.ogg"
dest_files=[ "res://.import/Beer.ogg-0e6bc95a6b45b804996f580a1be3aee0.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Coins.ogg-f9cdd1d56965eda212616a29dbbeb095.oggstr"
[deps]
source_file="res://assets/sounds/objects/Coins.ogg"
dest_files=[ "res://.import/Coins.ogg-f9cdd1d56965eda212616a29dbbeb095.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Dagger.ogg-178fe92ff6535d2fb657b61a6eac19d3.oggstr"
[deps]
source_file="res://assets/sounds/objects/Dagger.ogg"
dest_files=[ "res://.import/Dagger.ogg-178fe92ff6535d2fb657b61a6eac19d3.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Fiole.ogg-1906e95d5cfcc7fb30df4ed47d615be2.oggstr"
[deps]
source_file="res://assets/sounds/objects/Fiole.ogg"
dest_files=[ "res://.import/Fiole.ogg-1906e95d5cfcc7fb30df4ed47d615be2.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Spyglass.ogg-ba1068305c94ce71d19393b8c494b13c.oggstr"
[deps]
source_file="res://assets/sounds/objects/Spyglass.ogg"
dest_files=[ "res://.import/Spyglass.ogg-ba1068305c94ce71d19393b8c494b13c.oggstr" ]
[params]
loop=true
loop_offset=0
Binary file not shown.
@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/Weapon Gun.ogg-6fb518cb7a9f877d5716e766285221ac.oggstr"
[deps]
source_file="res://assets/sounds/objects/Weapon Gun.ogg"
dest_files=[ "res://.import/Weapon Gun.ogg-6fb518cb7a9f877d5716e766285221ac.oggstr" ]
[params]
loop=true
loop_offset=0
+1 -1
View File
@@ -1,4 +1,4 @@
extends Object
extends Node
var table = null
+5
View File
@@ -67,6 +67,11 @@ func value():
func set_value(value):
m_value["value"] = _set_data(value, m_value["id"], gddb_types.e_prop_type_float)
func audio_sound():
var stream = load("res://assets/sounds/objects/" + label() + ".ogg")
stream.set_loop(false)
return stream
## PRIVATE
func _get_value(datas):
return _get_data(datas, 0) as float
+45
View File
@@ -0,0 +1,45 @@
extends "res://db/MBase.gd"
var m_langue = { "id": null, "value": null }
var m_gyroscope = { "id": null, "value": null }
var m_ambient_sound = { "id": null, "value": null }
const ROW = 0
func _init():
table = Global.database.get_table_by_name("settings")
var datas = table.get_data_at_row_idx(ROW)
m_langue = _get_data_info(datas, 0)
m_gyroscope = _get_data_info(datas, 1)
m_ambient_sound = _get_data_info(datas, 2)
func _get_data_info(datas, id):
return {
"id": id,
"value": _get_data(datas, id)
}
func get_langue():
return m_langue["value"]
func get_gyroscope():
return int(m_gyroscope["value"]) as bool
func get_ambient_sound():
return int(m_ambient_sound["value"]) as bool
func set_langue(value):
m_langue["value"] = _set_data(value, m_langue["id"], gddb_types.e_prop_type_string)
return get_langue()
func set_gyroscope(value):
m_gyroscope["value"] = _set_data(value, m_gyroscope["id"], gddb_types.e_prop_type_bool)
return get_gyroscope()
func set_ambient_sound(value):
m_ambient_sound["value"] = _set_data(value, m_ambient_sound["id"], gddb_types.e_prop_type_bool)
return get_ambient_sound()
+6 -4
View File
@@ -6,9 +6,10 @@
"table_name":"settings",
"props":[
{"name":"langue","type":"3","auto_increment":"0"},
{"name":"gyroscope","type":"0","auto_increment":"0"}
{"name":"gyroscope","type":"0","auto_increment":"0"},
{"name":"ambiant_sound","type":"0","auto_increment":"0"}
],
"data":["fr","0"]
"data":["fr","0","0"]
},
{
"table_name":"levels",
@@ -27,9 +28,10 @@
{"name":"tick_reference","type":"1","auto_increment":"0"},
{"name":"key","type":"3","auto_increment":"0"},
{"name":"level","type":"table","table_name":"levels","auto_increment":"0"},
{"name":"mesh","type":"3","auto_increment":"0"}
{"name":"mesh","type":"3","auto_increment":"0"},
{"name":"label_id","type":"1","auto_increment":"0"}
],
"data":["0.0","True","Dagger","0","dagger","0","dagger","0.0","0","Fiole","14006","fiole1","0","fioles/fiole1","1.45","0","Fiole","0","fiole2","0","fioles/fiole2","0.0","0","Fiole","0","fiole3","0","fioles/fiole_socle/fiole3","0.0","0","Spyglass","0","spyglass","0","spyglass","0.0","0","Coins","0","coin1","0","golds/coin1","0.0","0","Coins","0","coin2","0","golds/coin2","0.0","0","Coins","0","coin3","0","golds/coin3","0.0","0","Weapon Gun","0","weapon","0","weapon","0.0","0","Apple","0","apple1","0","apples/apple1","0.0","0","Apple","0","apple2","0","apples/apple2","0.0","0","Apple","0","apple3","0","apples/apple3","0.0","0","Apple","0","apple4","0","apples/apple4","0.0","0","Beer","0","beer","0","beer","0.0","0","SuperDager","0","gadder","1","sm_super_dager"]
"data":["0.0","True","Dagger","0","dagger","0","dagger","0","0.0","0","Fiole","197246","fiole1","0","fioles/fiole1","1","0.97","0","Fiole","0","fiole2","0","fioles/fiole2","1","0.0","0","Fiole","0","fiole3","0","fioles/fiole_socle/fiole3","1","0.0","0","Spyglass","0","spyglass","0","spyglass","2","0.0","0","Coins","0","coin1","0","golds/coin1","3","0.0","0","Coins","0","coin2","0","golds/coin2","3","0.0","0","Coins","0","coin3","0","golds/coin3","3","0.0","0","Weapon Gun","0","weapon","0","weapon","4","0.0","0","Apple","0","apple1","0","apples/apple1","5","0.0","0","Apple","0","apple2","0","apples/apple2","5","0.0","0","Apple","0","apple3","0","apples/apple3","5","0.0","0","Apple","0","apple4","0","apples/apple4","5","0.0","0","Beer","0","beer","0","beer","6","0.0","0","SuperDagger","0","gadder","1","sm_super_dager","0"]
}
]
}
+3 -3
View File
@@ -207,8 +207,8 @@ config/quit_on_go_back=false
[autoload]
Global="*res://scenes/Global.gd"
Loading="*res://scenes/UI/loading/Loading.tscn"
Global="*res://scenes/Global.gd"
gddb_constants="*res://addons/godot_db_manager/core/GDDBConstants.gd"
gddb_types="*res://addons/godot_db_manager/core/GDDBTypes.gd"
gddb_globals="*res://addons/godot_db_manager/core/GDDBGlobals.gd"
@@ -219,8 +219,8 @@ settings/stdout/print_fps=true
[display]
window/size/width=1440
window/size/height=900
window/size/width=1280
window/size/height=720
window/dpi/allow_hidpi=true
window/handheld/orientation="sensor_landscape"
window/stretch/mode="2d"
+26 -26
View File
@@ -7,14 +7,20 @@ onready var current_scene_int = null
onready var loader = null
onready var wait_frames = 1
onready var database = null
onready var table_settings = null
onready var data_settings = null
onready var table_levels = null
var msetting = preload("res://db/MSetting.gd")
var setting = null
func _ready():
print("[global#_ready]")
_initialize_current_scene()
_initialize_database()
_initialize_setting()
_initialize_current_scene()
func _initialize_setting():
print("global#_initialize_setting")
setting = msetting.new()
func goto_scene(path):
print("[global#goto_scene]")
@@ -28,11 +34,23 @@ func goto_scene(path):
wait_frames = 1
Loading.get_node("VBoxContainer/ProgressBar").set_max(loader.get_stage_count())
func gyroscope_enabled():
if _gyroscope_enabled():
return true
else:
return false
func get_setting_language():
return setting.get_langue()
func set_setting_language(value):
setting.set_langue(value)
func get_setting_gyrosocpe():
return setting.get_gyroscope()
func set_setting_gyroscope(value):
setting.set_gyroscope(value)
func get_setting_ambient_sound():
return setting.get_ambient_sound()
func set_setting_ambient_sound(value):
setting.set_ambient_sound(value)
func _process(_delta):
print("[global#_process]")
@@ -81,31 +99,13 @@ func _initialize_database():
OS.set_exit_code(1)
database = database_manager.get_db_by_id(db_id)
table_settings = database.get_table_by_name("settings")
data_settings = table_settings.get_data_at_row_idx(0)
table_levels = database.get_table_by_name("levels")
func _get_settings_data(name, index, table, datas):
var data = null
if table.get_prop_at(index).get_prop_name() == name:
data = datas[index].get_data()
return data
func _gyroscope_enabled():
for index in range(0, table_settings.get_props_count()):
_get_settings_data("gyroscope", index, table_settings, data_settings)
func _update_progress():
print("[global#update_progress]")
Loading.visible = true
Loading.get_node("VBoxContainer/ProgressBar").set_value(loader.get_stage())
func _set_new_scene():
print("[global#set_new_scene]")
var resource = loader.get_resource()
loader = null
current_scene = resource.instance()
+19 -17
View File
@@ -177,7 +177,7 @@ __meta__ = {
[node name="PanelWood" type="Panel" parent="."]
material = SubResource( 17 )
margin_right = 350.0
margin_bottom = 900.0
margin_bottom = 720.0
rect_min_size = Vector2( 350, 0 )
size_flags_vertical = 3
@@ -194,15 +194,15 @@ __meta__ = {
[node name="CenterContainer" type="CenterContainer" parent="PanelWood/VBoxContainer"]
margin_right = 350.0
margin_bottom = 237.0
margin_bottom = 147.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="TextureRect" type="TextureButton" parent="PanelWood/VBoxContainer/CenterContainer"]
margin_left = 111.0
margin_top = 54.0
margin_top = 9.0
margin_right = 239.0
margin_bottom = 182.0
margin_bottom = 137.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
size_flags_vertical = 4
@@ -212,9 +212,9 @@ texture_focused = ExtResource( 6 )
stretch_mode = 3
[node name="ButtonPuzzle" type="TextureButton" parent="PanelWood/VBoxContainer"]
margin_top = 267.0
margin_top = 177.0
margin_right = 350.0
margin_bottom = 344.0
margin_bottom = 254.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 0
@@ -241,9 +241,9 @@ __meta__ = {
}
[node name="ButtonSetting" type="TextureButton" parent="PanelWood/VBoxContainer"]
margin_top = 374.0
margin_top = 284.0
margin_right = 350.0
margin_bottom = 451.0
margin_bottom = 361.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 0
@@ -270,15 +270,15 @@ __meta__ = {
}
[node name="MarginContainer" type="MarginContainer" parent="PanelWood/VBoxContainer"]
margin_top = 481.0
margin_top = 391.0
margin_right = 350.0
margin_bottom = 719.0
margin_bottom = 539.0
size_flags_vertical = 3
[node name="ButtonQuit" type="TextureButton" parent="PanelWood/VBoxContainer"]
margin_top = 749.0
margin_top = 569.0
margin_right = 350.0
margin_bottom = 826.0
margin_bottom = 646.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 0
@@ -304,23 +304,23 @@ __meta__ = {
}
[node name="LabelVersion" type="Label" parent="PanelWood/VBoxContainer"]
margin_top = 856.0
margin_top = 676.0
margin_right = 350.0
margin_bottom = 870.0
margin_bottom = 690.0
size_flags_vertical = 0
text = "v XX.XX"
align = 2
[node name="MarginContainerBottom" type="MarginContainer" parent="PanelWood/VBoxContainer"]
margin_top = 900.0
margin_top = 720.0
margin_right = 350.0
margin_bottom = 900.0
margin_bottom = 720.0
size_flags_stretch_ratio = 0.2
[node name="TextureRect" type="TextureRect" parent="."]
margin_left = 350.0
margin_right = 446.0
margin_bottom = 900.0
margin_bottom = 720.0
rect_clip_content = true
size_flags_horizontal = 11
size_flags_vertical = 3
@@ -329,3 +329,5 @@ stretch_mode = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ClickButton" type="AudioStreamPlayer" parent="."]
+15 -28
View File
@@ -1,43 +1,30 @@
extends Node
onready var language_id = null
onready var gyroscope_id = null
func _ready():
print("[Settings#_ready]")
_translation()
_apply_settings()
_apply_settings_language()
_apply_settings_gyroscope()
_apply_settings_sound_ambient()
## PRIVATE
func _translation():
print("[Settings#_translation]")
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
func _apply_settings():
print("[Settings#_apply_settings]")
var lang = _get_settings_data("langue", Global.table_settings, Global.data_settings)
var gyro = _get_settings_data("gyroscope", Global.table_settings, Global.data_settings)
func _apply_settings_language():
$VBoxContainer/Langue/HBoxContainer/data.set_text(Global.get_setting_language())
$VBoxContainer/Langue/HBoxContainer/data.set_text(lang)
$VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(int(gyro) as bool)
func _apply_settings_gyroscope():
$VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Global.get_setting_gyrosocpe())
func _get_settings_data(name, table, datas):
for index in range(0, Global.table_settings.get_props_count()):
if table.get_prop_at(index).get_prop_name() == name:
_save_id(name, table.get_prop_at(index).get_prop_id())
return datas[index].get_data()
func _save_id(name, id):
if name == "langue":
language_id = id
if name == "gyroscope":
gyroscope_id = id
func _apply_settings_sound_ambient():
$VBoxContainer/ambient_sound/HBoxContainer/data.set_pressed(Global.get_setting_ambient_sound())
func _on_gyroscope_pressed():
print("[Settings#_on_gyroscop_toggled] change value to database ...........")
Global.table_settings.edit_data(gyroscope_id,
gddb_types.e_prop_type_bool,
int($CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.pressed) as String)
Global.database.save_db()
print("[Settings#_on_gyroscope_pressed] change value to database ...........")
Global.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed))
func _on_ambient_sound_pressed():
print("[Settings#_on_ambient_sound_pressed] change value to database ...........")
Global.set_setting_ambient_sound(int($VBoxContainer/ambient_sound/HBoxContainer/data.pressed))
+33 -9
View File
@@ -5,25 +5,27 @@
[node name="Settings" type="CenterContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -1.12244
margin_right = -1.12244
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 643.0
margin_top = 421.0
margin_right = 796.0
margin_bottom = 479.0
margin_left = 547.0
margin_top = 309.0
margin_right = 732.0
margin_bottom = 411.0
alignment = 1
[node name="Langue" type="CenterContainer" parent="VBoxContainer"]
margin_right = 153.0
margin_right = 185.0
margin_bottom = 14.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Langue"]
margin_left = 42.0
margin_right = 111.0
margin_left = 58.0
margin_right = 127.0
margin_bottom = 14.0
[node name="Label" type="Label" parent="VBoxContainer/Langue/HBoxContainer"]
@@ -42,11 +44,12 @@ __meta__ = {
[node name="gyroscope" type="CenterContainer" parent="VBoxContainer"]
margin_top = 18.0
margin_right = 153.0
margin_right = 185.0
margin_bottom = 58.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/gyroscope"]
margin_right = 153.0
margin_left = 16.0
margin_right = 169.0
margin_bottom = 40.0
[node name="Label" type="Label" parent="VBoxContainer/gyroscope/HBoxContainer"]
@@ -61,4 +64,25 @@ margin_right = 153.0
margin_bottom = 40.0
align = 1
[node name="ambient_sound" type="CenterContainer" parent="VBoxContainer"]
margin_top = 62.0
margin_right = 185.0
margin_bottom = 102.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ambient_sound"]
margin_right = 185.0
margin_bottom = 40.0
[node name="Label" type="Label" parent="VBoxContainer/ambient_sound/HBoxContainer"]
margin_top = 13.0
margin_right = 105.0
margin_bottom = 27.0
text = "Ambiant sound :"
[node name="data" type="CheckButton" parent="VBoxContainer/ambient_sound/HBoxContainer"]
margin_left = 109.0
margin_right = 185.0
margin_bottom = 40.0
[connection signal="pressed" from="VBoxContainer/gyroscope/HBoxContainer/data" to="." method="_on_gyroscope_pressed"]
[connection signal="pressed" from="VBoxContainer/ambient_sound/HBoxContainer/data" to="." method="_on_ambient_sound_pressed"]
+4 -4
View File
@@ -11,8 +11,8 @@ __meta__ = {
}
[node name="TextureRect" type="TextureRect" parent="."]
margin_left = 385.0
margin_top = 372.0
margin_right = 1054.0
margin_bottom = 528.0
margin_left = 305.0
margin_top = 282.0
margin_right = 974.0
margin_bottom = 438.0
texture = ExtResource( 1 )
+14 -14
View File
@@ -71,7 +71,7 @@ func _action_pressed(action):
return Input.is_action_pressed(action)
func _action_gyroscope(action, gyroscope):
if Global.gyroscope_enabled():
if Global.get_setting_gyrosocpe():
var expression = Expression.new()
expression.parse("_gyroscope_changed_"+action+"(gyroscope)", ["gyroscope"])
@@ -106,6 +106,8 @@ func _gyroscope_changed_up(gyroscope):
func _start_dissolve(key):
if meshes[key].lock() == false:
meshes[key].set_lock(true)
$ObjectFind.stream = meshes[key].audio_sound()
$ObjectFind.play()
## PRIVATE
func _load_translations():
@@ -119,15 +121,10 @@ func _load_meshes():
if scene_detail.key() != null:
meshes[scene_detail.key()] = scene_detail
# _display_label(scene_detail)
for key in meshes:
meshes[key].search_keys()
"""
func _display_label(scene):
print("[meshes#key] : "+scene.label())
$ListObjects/ListContainer/TextureButton.set_text(scene.label())
"""
func _input(event):
if event is InputEventMouseButton or event is InputEventScreenTouch:
var camera = $"Main Camera"
@@ -137,10 +134,13 @@ func _input(event):
func _physics_process(_delta):
var space_state = get_world().direct_space_state
if from != null and to != null:
var result = space_state.intersect_ray(from, to, [], 1, false, true)
from = null
to = null
if result.has("collider"):
var node = result["collider"].get_parent()
if node != null:
_start_dissolve(node.name)
_check_collider(space_state)
func _check_collider(space_state):
var result = space_state.intersect_ray(from, to, [], 1, false, true)
from = null
to = null
if result.has("collider"):
var node = result["collider"].get_parent()
if node != null:
_start_dissolve(node.name)
+16 -9
View File
@@ -4,42 +4,49 @@ export (PackedScene) var object_first = load("res://scenes/UI/list_ho/ObjectList
export (PackedScene) var object_std = load("res://scenes/UI/list_ho/ObjectListStd.tscn")
export (PackedScene) var object_last = load("res://scenes/UI/list_ho/ObjectListLast.tscn")
onready var label_id = null
onready var last_btn = null
func _ready():
print(meshes)
_display_hud_menu()
_play_ambient_sound()
func _display_hud_menu():
var counter = 0
var scene = null
var label_id = null
for key in meshes:
scene = meshes[key]
_create_button_info(scene, counter)
_create_button_info(scene, counter, label_id)
label_id = scene.label_id()
counter = +1
# Back to main scene
func _on_TextureButton_pressed():
print("[levels#_on_TextureButton_pressed] quit to menu")
Global.goto_scene("res://scenes/main.tscn")
func _create_button_info(scene, counter):
func _create_button_info(scene, counter, label_id):
var btn = null
if counter == 0:
print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
btn = object_first.instance()
#print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
elif counter == meshes.size() - 1:
btn = object_last.instance()
print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
#print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
else:
btn = object_std.instance()
print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
#print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
if label_id != null and label_id == scene.label_id():
# $ListObjects/ListContainer.add_child(btn)
last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " X")
else:
$ListObjects/ListContainer.add_child(btn)
btn.get_node("Label").set_text(scene.label())
last_btn = btn
func _play_ambient_sound():
if Global.get_setting_ambient_sound():
$AmbientSound.play()
$AmbientSound.stream_paused = false
+8
View File
@@ -44,6 +44,7 @@
[ext_resource path="res://scenes/UI/list_ho/UI_list_ho.tscn" type="PackedScene" id=44]
[ext_resource path="res://scenes/UI/UI_back.tscn" type="PackedScene" id=45]
[ext_resource path="res://assets/props/book/sm_book.tscn" type="PackedScene" id=46]
[ext_resource path="res://assets/sounds/ambient-sound-level-warcraft.ogg" type="AudioStream" id=46]
[sub_resource type="PanoramaSky" id=1]
panorama = ExtResource( 11 )
@@ -732,6 +733,13 @@ shape = SubResource( 17 )
[node name="Quit" parent="." instance=ExtResource( 45 )]
[node name="ObjectFind" type="AudioStreamPlayer" parent="."]
[node name="AmbientSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 46 )
volume_db = -15.0
stream_paused = true
[connection signal="pressed" from="Quit/TextureButton" to="." method="_on_TextureButton_pressed"]
[editable path="ListObjects"]
+13
View File
@@ -4,11 +4,17 @@ export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn
export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
onready var current_scene = "title"
onready var stream_button= preload("res://assets/sounds/click-button.ogg")
func _ready():
_translation()
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect.grab_focus()
_apply_scene("Title")
_configure_sound()
func _configure_sound():
stream_button.set_loop(false)
$MarginContainer/HBoxContainer/UI_summary/ClickButton.stream = stream_button
## PRIVATE
func _translation():
@@ -28,16 +34,23 @@ func _apply_scene(actual_scene):
# Load scene for select game
func _on_ButtonPuzzle_pressed():
_sound_button()
_apply_scene("ChooseScene")
# Load scene settings
func _on_ButtonSetting_pressed():
_sound_button()
_apply_scene("Settings")
# Click to icon game
func _on_TextureRect_pressed():
_sound_button()
_apply_scene("Title")
# Quit the game
func _on_ButtonQuit_pressed():
_sound_button()
get_tree().quit(0)
func _sound_button():
$MarginContainer/HBoxContainer/UI_summary/ClickButton.play()
+12 -11
View File
@@ -82,35 +82,36 @@ __meta__ = {
}
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
margin_right = 1440.0
margin_bottom = 900.0
margin_right = 1280.0
margin_bottom = 720.0
[node name="UI_summary" parent="MarginContainer/HBoxContainer" instance=ExtResource( 8 )]
anchor_bottom = 0.0
margin_right = 446.0
margin_bottom = 900.0
margin_bottom = 720.0
size_flags_horizontal = 0
size_flags_vertical = 3
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"]
margin_left = 450.0
margin_right = 1440.0
margin_bottom = 900.0
margin_right = 1280.0
margin_bottom = 720.0
size_flags_horizontal = 7
size_flags_vertical = 3
[node name="Title" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 990.0
margin_bottom = 900.0
margin_right = 830.0
margin_bottom = 720.0
[node name="Settings" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 4 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 990.0
margin_bottom = 900.0
margin_left = 0.0
margin_right = 830.0
margin_bottom = 720.0
[node name="ChooseScene" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 3 )]
visible = false
@@ -118,8 +119,8 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 0.0
margin_right = 990.0
margin_bottom = 900.0
margin_right = 830.0
margin_bottom = 720.0
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect" to="." method="_on_TextureRect_pressed"]
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonPuzzle" to="." method="_on_ButtonPuzzle_pressed"]