Merge branch '3-dans-le-jeux-avoir-acces-au-menu' into 'develop'

Dans le jeux, avoir accès au menu globale

See merge request khaganat/mmorpg_khanat/khanat-client!5
This commit is contained in:
aleajactaest 2021-09-23 21:03:20 +00:00
commit 2a88506f85
16 changed files with 317 additions and 23 deletions

View file

@ -34,3 +34,6 @@
9) A l'ouverture du JukeBox, il retaille la fenetre afin de ne pas avoir du scrolling (si possible)
10) Ajout d'une scene simple (damier + personnage avec annimation, et ajout d'autre créature)
11) Ajout du menu (quand on presse Escape) pendant la scene pour voir les options/quitter/...

View file

@ -1,4 +1,61 @@
VERSION GODOT : 3.3.3
https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_x11.64.zip
# Khanat
## Launch Game
### Download Version Godot
We use version GODOT : 3.3.3
wget https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_x11.64.zip
unzip Godot_v3.3.3-stable_x11.64.zip
### Clone our project
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client.git
(cd khanat-client;git checkout develop)
### Launch Godot
./Godot_v3.3.3-stable_x11.64 khanat-client/project.godot
## Add/update your language
Welcome to help us to improve our translation.
We need clone our project.
### Create a new language
* On Linux :
Edit file : khanat-client/locale/locale.sh
(You need add in section [# LIST LANGUAGE] your locale)
After launch this script : bash khanat-client/locale/locale.sh
### Edit your local
khanat-client/locale/<your locale].po
keyword msgid is Id used in khanat, and msgstr is translation (if you have some doubt, don't hesitate to see other translation)
* msgid "MAIN_MENU_PLAY"
* msgstr "Jouer"
### Activate your language
Two option to activate (just use one)
1/ Use godot editor
in Parameter, localization, add your file
2/ Edit project.godot
Edit line :
translations=PoolStringArray( "res://locale/fr.po", "res://locale/en.po", "res//locale/<your language>.po" )
### Push your update
To send your update, could you please create a branch and send us this branch?

View file

@ -22,7 +22,7 @@ func get_plus_texture():
func _ready():
self.add_child( preload( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() )
self.add_child( load( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() )
$kh_h_slider/minus.connect( "pressed", self, "_on_minus_pressed" )
$kh_h_slider/value.connect( "changed", self, "_on_value_changed" )

View file

@ -2,7 +2,7 @@ tool
extends EditorPlugin
func _enter_tree():
add_custom_type("KhHSlider", "HBoxContainer", preload("kh_h_slider.gd"), preload("kh_h_slider.png"))
add_custom_type("KhHSlider", "HBoxContainer", load("kh_h_slider.gd"), load("kh_h_slider.png"))
func _exit_tree():
remove_custom_type("KhHSlider")

View file

@ -4,7 +4,7 @@ extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here
# Add the new type with a name, a parent type, a script and an icon
add_custom_type("kh_window", "MarginContainer", preload("res://addons/kh_window/kh_window.gd"), preload("res://addons/kh_window/icon.png"))
add_custom_type("kh_window", "MarginContainer", load("res://addons/kh_window/kh_window.gd"), load("res://addons/kh_window/icon.png"))
func _exit_tree():
# Clean-up of the plugin goes here

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -16,6 +16,12 @@ function generate_locale()
}
ORIGIN=$PWD
cd $WORKDIR
#######################
# LIST LANGUAGE : START
#######################
generate_locale fr
generate_locale en
######################
# LIST LANGUAGE : END
######################
cd $ORIGIN

View file

@ -70,10 +70,18 @@ func _ready():
self.add_creature("RA_3", "res://scenes/player/creature_raference.tscn", Vector3( 1.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 ))
self.add_creature("Arche_1", "res://scenes/player/creature_arche.tscn", Vector3( -2.0, 0.01, 2.0 ), Vector3( 0.0, -3.141592, 0.0 ))
self.add_creature("Isidor_1", "res://scenes/player/creature_isidor.tscn", Vector3( -2.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 ))
pass # Replace with function body.
$player.connect("menu_options_pressed", self, "_on_menu_options")
func _on_menu_options():
Config.msg_info("Received menu options")
if $menu_options.is_visible():
$menu_options.hide()
else:
$menu_options.show()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
Config.msg_info("update Map")
#Config.msg_info("update Map")
pass

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/interfaces/menu_options/menu_options.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/game/alpha.gd" type="Script" id=5]
[ext_resource path="res://scenes/player/playerB.tscn" type="PackedScene" id=8]
@ -12,3 +13,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0 )
[node name="map" type="Spatial" parent="."]
[node name="creatures" type="Spatial" parent="."]
[node name="menu_options" parent="." instance=ExtResource( 1 )]
visible = false

View file

@ -0,0 +1,56 @@
extends Control
signal quit_pressed
signal mute_pressed
func _ready():
#get_node("option_settings").connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("mute_pressed", self, "_on_signal_mute_pressed")
MusicManager.connect_ext_func( "mute_pressed", self , "_on_signal_mute_pressed")
$option_settings.connect( "mute_pressed", self, "_on_signal_mute_pressed" )
$option_settings.connect_ext_func( "mute_pressed", self, "_on_signal_mute_pressed" )
update_sound_button()
func _on_signal_mute_pressed():
Config.msg_debug("<Option> Received Signal mute")
update_sound_button()
func update_sound_button():
Config.msg_debug("<Option> update_sound_button")
if Config.mute:
$g/g/font/menu/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button.png")
$g/g/font/menu/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button-hover.png")
else:
$g/g/font/menu/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-button.png")
$g/g/font/menu/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-button-hover.png")
func _on_language_button_pressed():
$option_language/window_dialog.show()
func _on_sound_button_pressed():
Config.msg_debug("Option mute")
MusicManager.set_sound_mute(not Config.mute)
emit_signal( "mute_pressed" )
update_sound_button()
func _on_jukebox_button_pressed():
MusicManager.open()
func _on_settings_button_pressed():
$option_settings/window_dialog.show()
func _on_help_button_pressed():
$option_info/window_dialog.show()
func _on_quit_button_pressed():
get_tree().quit()

View file

@ -0,0 +1,158 @@
[gd_scene load_steps=18 format=2]
[ext_resource path="res://assets/interfaces/background-menu-options.png" type="Texture" id=1]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button.png" type="Texture" id=2]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button.png" type="Texture" id=3]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button-hover.png" type="Texture" id=4]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button.png" type="Texture" id=5]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button.png" type="Texture" id=6]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button.png" type="Texture" id=7]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button-hover.png" type="Texture" id=8]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button-hover.png" type="Texture" id=9]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button-hover.png" type="Texture" id=10]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button-hover.png" type="Texture" id=11]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button-hover.png" type="Texture" id=12]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button.png" type="Texture" id=13]
[ext_resource path="res://scenes/interfaces/menu_options/menu_options.gd" type="Script" id=14]
[ext_resource path="res://scenes/interfaces/options/option_language.tscn" type="PackedScene" id=15]
[ext_resource path="res://scenes/interfaces/options/option_info.tscn" type="PackedScene" id=16]
[ext_resource path="res://scenes/interfaces/options/option_settings.tscn" type="PackedScene" id=17]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 14 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="g" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="g" type="HBoxContainer" parent="g"]
margin_right = 1280.0
margin_bottom = 720.0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 2
[node name="font" type="TextureRect" parent="g/g"]
margin_left = 290.0
margin_top = 325.0
margin_right = 990.0
margin_bottom = 394.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 1 )
[node name="menu" type="HBoxContainer" parent="g/g/font"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_bottom = -1.0
size_flags_horizontal = 7
size_flags_vertical = 7
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="language_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 29.0
margin_top = 3.0
margin_right = 83.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 10 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="sound_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 146.0
margin_top = 3.0
margin_right = 200.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 2 )
texture_hover = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="jukebox_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 264.0
margin_top = 3.0
margin_right = 318.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 13 )
texture_hover = ExtResource( 12 )
[node name="settings_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 381.0
margin_top = 3.0
margin_right = 435.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 6 )
texture_hover = ExtResource( 9 )
[node name="help_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 498.0
margin_top = 3.0
margin_right = 552.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 7 )
texture_hover = ExtResource( 4 )
[node name="quit_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 616.0
margin_top = 3.0
margin_right = 670.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 5 )
texture_hover = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="option_language" parent="." instance=ExtResource( 15 )]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -640.0
margin_top = -34.5
margin_right = 640.0
margin_bottom = 34.5
[node name="option_info" parent="." instance=ExtResource( 16 )]
visible = false
[node name="option_settings" parent="." instance=ExtResource( 17 )]
visible = false
[connection signal="pressed" from="g/g/font/menu/language_button" to="." method="_on_language_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/sound_button" to="." method="_on_sound_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/jukebox_button" to="." method="_on_jukebox_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/settings_button" to="." method="_on_settings_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/help_button" to="." method="_on_help_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/quit_button" to="." method="_on_quit_button_pressed"]

View file

@ -58,9 +58,9 @@ func _ready():
music_player.connect("finished", self, "_on_stream_finished", [])
func connect_ext( signal_name, target ):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + "_on_signal_" + signal_name + "]")
target.connect( signal_name, self, "_on_signal_" + signal_name )
func connect_ext_func( signal_name, target , function_target):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + function_target + "]")
target.connect( signal_name, self, function_target )
func _on_stream_finished():

View file

@ -79,13 +79,13 @@ func _ready():
MusicManager.connect("musicplayer_pressed", self, "_on_signal_musicplayer_pressed")
#$option.connect("mute_pressed", self, "update_mute")
MusicManager.connect("mute_pressed", self, "_on_signal_mute_pressed")
MusicManager.connect_ext("musicplayer_pressed", self )
MusicManager.connect_ext("mute_pressed", self )
MusicManager.connect_ext_func("musicplayer_pressed", self, "_on_signal_musicplayer_pressed")
MusicManager.connect_ext_func("mute_pressed", self, "_on_signal_mute_pressed" )
func connect_ext( signal_name, target):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + "_on_signal_" + signal_name + "]")
target.connect( signal_name, self, "_on_signal_" + signal_name )
func connect_ext_func( signal_name, target , function_target):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + function_target + "]")
target.connect( signal_name, self, function_target )
func update_mute():

View file

@ -9,9 +9,9 @@ func _ready():
#get_node("option_settings").connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("musicplayer_pressed", self, "_on_control_musicplayer_pressed")
MusicManager.connect_ext( "mute_pressed", self )
MusicManager.connect_ext_func( "mute_pressed", self, "_on_signal_mute_pressed" )
$option_settings.connect( "mute_pressed", self, "_on_control_mute_pressed" )
$option_settings.connect_ext( "mute_pressed", self )
$option_settings.connect_ext_func( "mute_pressed", self, "_on_signal_mute_pressed" )
update_sound_button()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/interfaces/loading_screen/loading_screen.tscn" type="PackedScene" id=2]

View file

@ -1,5 +1,7 @@
extends Spatial
signal menu_options_pressed
var animation_object:AnimationPlayer = null
var rotation_speed_factor = 0.01
var orientation = 0.0
@ -138,11 +140,9 @@ func _process( delta ):
# Movement
velocity = self.calculate_velocity(velocity, move_direction, delta)
# Config.msg_info("move_direction X:" + str(move_direction.x) + " Y:" + str(move_direction.y) + " Z:" + str(move_direction.z))
# Config.msg_info("velocity X:" + str(velocity.x) + " Y:" + str(velocity.y) + " Z:" + str(velocity.z))
velocity = $creature.move_and_slide(velocity, Vector3.UP, true)
var pos : Vector3 = $creature.get_global_transform().origin
Config.msg_info("pos X:" + str(pos.x) + " Y:" + str(pos.y) + " Z:" + str(pos.z) + " run:" + str(Input.get_action_strength("move_run")) + str(Input.get_action_strength("move_toggle_run")) )
#Config.msg_info("pos X:" + str(pos.x) + " Y:" + str(pos.y) + " Z:" + str(pos.z) + " run:" + str(Input.get_action_strength("move_run")) + str(Input.get_action_strength("move_toggle_run")) )
if input_direction:
if not input_direction.z == 0.0:
if input_direction.z < 0.0:
@ -209,4 +209,6 @@ func _input( event ):
else:
$creature/camera_tps.make_current()
elif event.is_action_pressed("menu"):
get_tree().quit()
#get_tree().quit()
Config.msg_info("Received menu options")
emit_signal("menu_options_pressed")