update 1st page - adding option to update/configure video/sound, show information and locale (fr & en)

This commit is contained in:
AleaJactaEst 2021-05-27 23:56:16 +02:00
parent db3cb83817
commit 7d44d8132b
64 changed files with 3276 additions and 1307 deletions

6
AUTHORS Normal file
View file

@ -0,0 +1,6 @@
Yannk
Zatalyz
Deed
Lyne
Osquallo
AleaJactaEst

1
NEWS Normal file
View file

@ -0,0 +1 @@
# What's new on khanat?

28
NEWS_fr Normal file
View file

@ -0,0 +1,28 @@
# Quels sont les dernières nouvelles ?
1) Configuration de l'internationalisation (fr & en)
2) Dans la page principale, ajout d'un menu, en haut à droite, afin d'avoir d'accessible les actions rapides suivantes:
* les nouvelles
* configuration de la langue
* activer le son
* l'aide
* configuration
* sortir
3) Ajout d'un A propos
a) Auteur
b) License
4) Ajout d'un image pour les icons OPTIONS afin de savoir lequel est actif (fond jaune au lieu de blanc)
5) Ajout de l'option paramètres
I) Paramétrage vidéo
a) Plein écran
b) Fenêtre redimensionnable
c) Orientation de l'écran (à vérifier)
d) Fenêtre sans bord
e) Choisir l'écran
f) Garder la fenêtre dessus
II) Paramétrage son

View file

@ -6,40 +6,40 @@ signal value_changed( value )
export( Texture ) var minus_texture setget set_minus_texture, get_minus_texture export( Texture ) var minus_texture setget set_minus_texture, get_minus_texture
func set_minus_texture( value ): func set_minus_texture( value ):
minus_texture = value minus_texture = value
if self.has_node( "kh_h_slider/minus" ): if self.has_node( "kh_h_slider/minus" ):
$kh_h_slider/minus.texture_normal = minus_texture $kh_h_slider/minus.texture_normal = minus_texture
func get_minus_texture(): func get_minus_texture():
return minus_texture return minus_texture
export( Texture ) var plus_texture setget set_plus_texture, get_plus_texture export( Texture ) var plus_texture setget set_plus_texture, get_plus_texture
func set_plus_texture( value ): func set_plus_texture( value ):
plus_texture = value plus_texture = value
if self.has_node( "kh_h_slider/plus" ): if self.has_node( "kh_h_slider/plus" ):
$kh_h_slider/plus.texture_normal = plus_texture $kh_h_slider/plus.texture_normal = plus_texture
func get_plus_texture(): func get_plus_texture():
return plus_texture return plus_texture
func _ready(): func _ready():
self.add_child( preload( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() ) self.add_child( preload( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() )
$kh_h_slider/minus.connect( "pressed", self, "_on_minus_pressed" ) $kh_h_slider/minus.connect( "pressed", self, "_on_minus_pressed" )
$kh_h_slider/value.connect( "changed", self, "_on_value_changed" ) $kh_h_slider/value.connect( "changed", self, "_on_value_changed" )
$kh_h_slider/value.connect( "value_changed", self, "_on_value_value_changed" ) $kh_h_slider/value.connect( "value_changed", self, "_on_value_value_changed" )
$kh_h_slider/plus.connect( "pressed", self, "_on_plus_pressed" ) $kh_h_slider/plus.connect( "pressed", self, "_on_plus_pressed" )
$kh_h_slider/minus.texture_normal = minus_texture $kh_h_slider/minus.texture_normal = minus_texture
$kh_h_slider/plus.texture_normal = plus_texture $kh_h_slider/plus.texture_normal = plus_texture
func _on_minus_pressed(): func _on_minus_pressed():
$kh_h_slider/value.value -= $kh_h_slider/value.step $kh_h_slider/value.value -= $kh_h_slider/value.step
func _on_plus_pressed(): func _on_plus_pressed():
$kh_h_slider/value.value += $kh_h_slider/value.step $kh_h_slider/value.value += $kh_h_slider/value.step
func _on_value_changed(): func _on_value_changed():
emit_signal( "changed" ) emit_signal( "changed" )
func _on_value_value_changed( value ): func _on_value_value_changed( value ):
emit_signal( "value_changed", value ) emit_signal( "value_changed", value )

View file

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

View file

@ -31,63 +31,63 @@ var size_changed = true
func add_child_to_content( node): func add_child_to_content( node):
if self.get_content(): if self.get_content():
self.get_content().add_child(node) self.get_content().add_child(node)
func add_window_part( node ): func add_window_part( node ):
add_child( node ) add_child( node )
func set_mouse_pass_to_children( node ): func set_mouse_pass_to_children( node ):
for child in node.get_children(): for child in node.get_children():
set_mouse_pass_to_children( child ) set_mouse_pass_to_children( child )
if node is Control: if node is Control:
node.mouse_filter = MOUSE_FILTER_PASS node.mouse_filter = MOUSE_FILTER_PASS
#func _ready(): #func _ready():
func _enter_tree(): func _enter_tree():
######## ########
#### Window's part création. #### Window's part création.
# The internal elements structure is: # The internal elements structure is:
# self - MarginContainer # self - MarginContainer
# background - NinePatchRect # background - NinePatchRect
# parts - VBoxContainer # parts - VBoxContainer
# header_box - MarginContainer # header_box - MarginContainer
# header - HBoxContainer # header - HBoxContainer
# quit - TextureButton # quit - TextureButton
# close - TextureButton # close - TextureButton
# open - TextureButton # open - TextureButton
# label - Label # label - Label
# content_box - MarginContainer # content_box - MarginContainer
# scroll_container - Scrollcontainer # scroll_container - Scrollcontainer
# content - VBoxContainer # content - VBoxContainer
# footer_box - MarginContainer # footer_box - MarginContainer
# footer - HBoxContainer # footer - HBoxContainer
# contextual_help - Label # contextual_help - Label
# resize - TextureButton # resize - TextureButton
### ###
# self # self
self.size_flags_horizontal = SIZE_EXPAND self.size_flags_horizontal = SIZE_EXPAND
self.size_flags_vertical = SIZE_EXPAND self.size_flags_vertical = SIZE_EXPAND
self.set( "custom_constants/margin_right", 0) self.set( "custom_constants/margin_right", 0)
self.set( "custom_constants/margin_top", 0) self.set( "custom_constants/margin_top", 0)
self.set( "custom_constants/margin_left", 0) self.set( "custom_constants/margin_left", 0)
self.set( "custom_constants/margin_bottom", 0) self.set( "custom_constants/margin_bottom", 0)
self.connect ( "gui_input", self, "_on_window_gui_input" ) self.connect ( "gui_input", self, "_on_window_gui_input" )
if is_movable and not self.is_dragged_by_header_only: if is_movable and not self.is_dragged_by_header_only:
self.mouse_default_cursor_shape = CURSOR_MOVE self.mouse_default_cursor_shape = CURSOR_MOVE
### ###
### ###
# background # background
var background var background
if not self.has_node( "background" ): if not self.has_node( "background" ):
background = NinePatchRect.new() background = NinePatchRect.new()
background.name = "background" background.name = "background"
if not background_texture: if not background_texture:
# var background_image = Image.new() # var background_image = Image.new()
# var stream_texture = load('res://addons/ui_window/background_default.jpg') # var stream_texture = load('res://addons/ui_window/background_default.jpg')
# if not stream_texture : # if not stream_texture :
@ -97,435 +97,436 @@ func _enter_tree():
# background.texture = ImageTexture.new() # background.texture = ImageTexture.new()
# background.texture.create_from_image( background_image ) # background.texture.create_from_image( background_image )
# background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT # background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
pass pass
else: else:
background.texture = background_texture background.texture = background_texture
background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
background.size_flags_horizontal = SIZE_EXPAND_FILL background.size_flags_horizontal = SIZE_EXPAND_FILL
background.size_flags_vertical = SIZE_EXPAND_FILL background.size_flags_vertical = SIZE_EXPAND_FILL
background.region_rect = Rect2( 0, 0, 0, 0 ) background.region_rect = Rect2( 0, 0, 0, 0 )
background.patch_margin_left = 4 background.patch_margin_left = 4
background.patch_margin_top = 32 background.patch_margin_top = 32
background.patch_margin_right = 4 background.patch_margin_right = 4
background.patch_margin_bottom = 4 background.patch_margin_bottom = 4
background.self_modulate = background_color background.self_modulate = background_color
self.add_window_part( background ) self.add_window_part( background )
# background.set_owner( self ) # background.set_owner( self )
### ###
### ###
# parts # parts
var parts var parts
if not self.has_node( "parts" ): if not self.has_node( "parts" ):
parts = VBoxContainer.new() parts = VBoxContainer.new()
parts.name = "parts" parts.name = "parts"
parts.size_flags_horizontal = SIZE_EXPAND_FILL parts.size_flags_horizontal = SIZE_EXPAND_FILL
parts.size_flags_vertical = SIZE_EXPAND_FILL parts.size_flags_vertical = SIZE_EXPAND_FILL
self.add_window_part( parts ) self.add_window_part( parts )
# parts.set_owner( self ) # parts.set_owner( self )
### ###
### ###
# header_box # header_box
var header_box var header_box
if not parts.has_node( "header_box" ): if not parts.has_node( "header_box" ):
header_box = MarginContainer.new() header_box = MarginContainer.new()
header_box.name = "header_box" header_box.name = "header_box"
header_box.size_flags_horizontal = SIZE_EXPAND_FILL header_box.size_flags_horizontal = SIZE_EXPAND_FILL
header_box.size_flags_vertical = SIZE_SHRINK_CENTER header_box.size_flags_vertical = SIZE_SHRINK_CENTER
header_box.set( "custom_constants/margin_right", 4) header_box.set( "custom_constants/margin_right", 4)
header_box.set( "custom_constants/margin_top", 4) header_box.set( "custom_constants/margin_top", 4)
header_box.set( "custom_constants/margin_left", 4) header_box.set( "custom_constants/margin_left", 4)
header_box.set( "custom_constants/margin_bottom", 4) header_box.set( "custom_constants/margin_bottom", 4)
if is_movable: if is_movable:
header_box.mouse_default_cursor_shape = CURSOR_MOVE header_box.mouse_default_cursor_shape = CURSOR_MOVE
parts.add_child( header_box ) parts.add_child( header_box )
# header_box.set_owner( parts ) # header_box.set_owner( parts )
header_box.connect ( "gui_input", self, "_on_Header_gui_input" ) header_box.connect ( "gui_input", self, "_on_Header_gui_input" )
### ###
### ###
# header # header
var header var header
if not header_box.has_node( "header" ): if not header_box.has_node( "header" ):
header = HBoxContainer.new() header = HBoxContainer.new()
header.name = "header" header.name = "header"
header.size_flags_horizontal = SIZE_EXPAND_FILL header.size_flags_horizontal = SIZE_EXPAND_FILL
header.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER header.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER
if is_movable: if is_movable:
header.mouse_default_cursor_shape = CURSOR_MOVE header.mouse_default_cursor_shape = CURSOR_MOVE
header_box.add_child( header ) header_box.add_child( header )
# header.set_owner( header_box ) # header.set_owner( header_box )
### ###
### ###
# quit # quit
var quit_button var quit_button
if not header.has_node( "quit" ): if not header.has_node( "quit" ):
quit_button = TextureButton.new() quit_button = TextureButton.new()
quit_button.name = "quit" quit_button.name = "quit"
quit_button.size_flags_horizontal = SIZE_SHRINK_END quit_button.size_flags_horizontal = SIZE_SHRINK_END
quit_button.size_flags_vertical = SIZE_SHRINK_CENTER quit_button.size_flags_vertical = SIZE_SHRINK_CENTER
var tex_quit = ImageTexture.new() var tex_quit = ImageTexture.new()
var img_quit = Image.new() var img_quit = Image.new()
var stream_texture = load( "res://addons/kh_window/button_quit.png") var stream_texture = load( "res://addons/kh_window/button_quit.png")
img_quit = stream_texture.get_data() img_quit = stream_texture.get_data()
tex_quit.create_from_image( img_quit ) tex_quit.create_from_image( img_quit )
quit_button.texture_normal = tex_quit quit_button.texture_normal = tex_quit
header.add_child( quit_button ) header.add_child( quit_button )
# quit_button.set_owner( header ) # quit_button.set_owner( header )
quit_button.connect ( "pressed", self, "_on_Quit_pressed" ) quit_button.connect ( "pressed", self, "_on_Quit_pressed" )
### ###
# close # close
var close_button = TextureButton.new() var close_button = TextureButton.new()
if not header.has_node( "close" ): if not header.has_node( "close" ):
close_button = TextureButton.new() close_button = TextureButton.new()
close_button.name = "close" close_button.name = "close"
close_button.size_flags_horizontal = SIZE_SHRINK_END close_button.size_flags_horizontal = SIZE_SHRINK_END
close_button.size_flags_vertical = SIZE_SHRINK_CENTER close_button.size_flags_vertical = SIZE_SHRINK_CENTER
var tex_close = ImageTexture.new() var tex_close = ImageTexture.new()
var img_close = Image.new() var img_close = Image.new()
var stream_texture = load("res://addons/kh_window/button_close.png") var stream_texture = load("res://addons/kh_window/button_close.png")
img_close = stream_texture.get_data() img_close = stream_texture.get_data()
tex_close.create_from_image( img_close ) tex_close.create_from_image( img_close )
close_button.texture_normal = tex_close close_button.texture_normal = tex_close
header.add_child( close_button ) header.add_child( close_button )
# close_button.set_owner( header ) # close_button.set_owner( header )
close_button.connect ( "pressed", self, "_on_Close_pressed" ) close_button.connect ( "pressed", self, "_on_Close_pressed" )
### ###
# open # open
var open_button var open_button
if not header.has_node( "open" ): if not header.has_node( "open" ):
open_button = TextureButton.new() open_button = TextureButton.new()
open_button.name = "open" open_button.name = "open"
open_button.size_flags_horizontal = SIZE_SHRINK_END open_button.size_flags_horizontal = SIZE_SHRINK_END
open_button.size_flags_vertical = SIZE_SHRINK_CENTER open_button.size_flags_vertical = SIZE_SHRINK_CENTER
var tex_open = ImageTexture.new() var tex_open = ImageTexture.new()
var img_open = Image.new() var img_open = Image.new()
var stream_texture = load("res://addons/kh_window/button_open.png") var stream_texture = load("res://addons/kh_window/button_open.png")
img_open = stream_texture.get_data() img_open = stream_texture.get_data()
tex_open.create_from_image( img_open ) tex_open.create_from_image( img_open )
open_button.texture_normal = tex_open open_button.texture_normal = tex_open
open_button.visible = false open_button.visible = false
header.add_child( open_button ) header.add_child( open_button )
# open_button.set_owner( header ) # open_button.set_owner( header )
open_button.connect ( "pressed", self, "_on_Open_pressed" ) open_button.connect ( "pressed", self, "_on_Open_pressed" )
### ###
### ###
# Title Label # Title Label
var title_label var title_label
if not header.has_node( "label" ): if not header.has_node( "label" ):
title_label = Label.new() title_label = Label.new()
title_label.name = "label" title_label.name = "label"
title_label.text = title title_label.text = title
title_label.size_flags_horizontal = SIZE_EXPAND_FILL title_label.size_flags_horizontal = SIZE_EXPAND_FILL
title_label.size_flags_vertical = SIZE_SHRINK_CENTER title_label.size_flags_vertical = SIZE_SHRINK_CENTER
if is_movable: if is_movable:
title_label.mouse_default_cursor_shape = CURSOR_MOVE title_label.mouse_default_cursor_shape = CURSOR_MOVE
header.add_child( title_label ) header.add_child( title_label )
# title_label.set_owner( header ) # title_label.set_owner( header )
### ###
### ###
# Content # Content
var content_box var content_box
if not parts.has_node( "content_box" ): if not parts.has_node( "content_box" ):
content_box = MarginContainer.new() content_box = MarginContainer.new()
content_box.name = "content_box" content_box.name = "content_box"
content_box.size_flags_horizontal = SIZE_EXPAND_FILL content_box.size_flags_horizontal = SIZE_EXPAND_FILL
content_box.size_flags_vertical = SIZE_EXPAND_FILL content_box.size_flags_vertical = SIZE_EXPAND_FILL
content_box.set( "custom_constants/margin_right", 8) content_box.set( "custom_constants/margin_right", 8)
content_box.set( "custom_constants/margin_top", 8) content_box.set( "custom_constants/margin_top", 8)
content_box.set( "custom_constants/margin_left", 8) content_box.set( "custom_constants/margin_left", 8)
content_box.set( "custom_constants/margin_bottom", 8) content_box.set( "custom_constants/margin_bottom", 8)
parts.add_child( content_box ) parts.add_child( content_box )
# content_box.set_owner( parts ) # content_box.set_owner( parts )
### ###
### ###
if self.has_scrollbar: if self.has_scrollbar:
# content_box/scroll_container # content_box/scroll_container
var content_scroll_container var content_scroll_container
if not content_box.has_node( "scroll_container" ): if not content_box.has_node( "scroll_container" ):
content_scroll_container = ScrollContainer.new() content_scroll_container = ScrollContainer.new()
content_scroll_container.name = "scroll_container" content_scroll_container.name = "scroll_container"
content_scroll_container.size_flags_horizontal = SIZE_FILL content_scroll_container.size_flags_horizontal = SIZE_FILL
content_scroll_container.size_flags_vertical = SIZE_FILL content_scroll_container.size_flags_vertical = SIZE_FILL
content_scroll_container.scroll_deadzone = 0 content_scroll_container.scroll_deadzone = 0
content_box.add_child( content_scroll_container ) content_box.add_child( content_scroll_container )
# content_scroll_container.set_owner( content_box ) # content_scroll_container.set_owner( content_box )
### ###
### ###
# content # content
var content var content
if not content_scroll_container.has_node( "content" ): if not content_scroll_container.has_node( "content" ):
content = MarginContainer.new() content = MarginContainer.new()
content.name = "content" content.name = "content"
content.size_flags_horizontal = SIZE_EXPAND_FILL content.size_flags_horizontal = SIZE_EXPAND_FILL
content.size_flags_vertical = SIZE_EXPAND_FILL content.size_flags_vertical = SIZE_EXPAND_FILL
content_scroll_container.add_child( content ) content_scroll_container.add_child( content )
# content.set_owner( content_scroll_container ) # content.set_owner( content_scroll_container )
### ###
else: else:
var content var content
if not content_box.has_node( "content" ): if not content_box.has_node( "content" ):
content = MarginContainer.new() content = MarginContainer.new()
content.name = "content" content.name = "content"
content.size_flags_horizontal = SIZE_EXPAND_FILL content.size_flags_horizontal = SIZE_EXPAND_FILL
content.size_flags_vertical = SIZE_EXPAND_FILL content.size_flags_vertical = SIZE_EXPAND_FILL
content_box.add_child( content ) content_box.add_child( content )
### ###
# Footer # Footer
var footer_box var footer_box
if not parts.has_node( "footer_box" ): if not parts.has_node( "footer_box" ):
footer_box = MarginContainer.new() footer_box = MarginContainer.new()
footer_box.name = "footer_box" footer_box.name = "footer_box"
footer_box.size_flags_horizontal = SIZE_FILL footer_box.size_flags_horizontal = SIZE_FILL
footer_box.size_flags_vertical = SIZE_FILL footer_box.size_flags_vertical = SIZE_FILL
footer_box.set( "custom_constants/margin_right", content_margin.position.y) footer_box.set( "custom_constants/margin_right", content_margin.position.y)
footer_box.set( "custom_constants/margin_top", content_margin.size.x) footer_box.set( "custom_constants/margin_top", content_margin.size.x)
footer_box.set( "custom_constants/margin_left", content_margin.position.x) footer_box.set( "custom_constants/margin_left", content_margin.position.x)
footer_box.set( "custom_constants/margin_bottom", content_margin.size.y) footer_box.set( "custom_constants/margin_bottom", content_margin.size.y)
parts.add_child( footer_box ) parts.add_child( footer_box )
# footer_box.set_owner( parts ) # footer_box.set_owner( parts )
### ###
### ###
# footer_box/footer # footer_box/footer
var footer var footer
if not footer_box.has_node( "footer" ): if not footer_box.has_node( "footer" ):
footer = HBoxContainer.new() footer = HBoxContainer.new()
footer.name = "footer" footer.name = "footer"
footer.size_flags_horizontal = SIZE_EXPAND_FILL footer.size_flags_horizontal = SIZE_EXPAND_FILL
footer.size_flags_vertical = SIZE_EXPAND_FILL footer.size_flags_vertical = SIZE_EXPAND_FILL
footer_box.add_child( footer ) footer_box.add_child( footer )
# footer.set_owner( footer_box ) # footer.set_owner( footer_box )
### ###
### ###
# footer_label # footer_label
var footer_label var footer_label
if not footer.has_node( "footer_label" ): if not footer.has_node( "footer_label" ):
footer_label = Label.new() footer_label = Label.new()
footer_label.name = "footer_label" footer_label.name = "footer_label"
footer_label.size_flags_horizontal = SIZE_EXPAND footer_label.size_flags_horizontal = SIZE_EXPAND
footer_label.size_flags_vertical = SIZE_EXPAND footer_label.size_flags_vertical = SIZE_EXPAND
footer.add_child( footer_label ) footer.add_child( footer_label )
### ###
# resize # resize
var resize_button var resize_button
if not footer.has_node( "resize" ): if not footer.has_node( "resize" ):
resize_button = TextureButton.new() resize_button = TextureButton.new()
resize_button.name = "resize" resize_button.name = "resize"
resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END
resize_button.size_flags_vertical = SIZE_SHRINK_END resize_button.size_flags_vertical = SIZE_SHRINK_END
var tex_resize = ImageTexture.new() var tex_resize = ImageTexture.new()
var img_resize = Image.new() var img_resize = Image.new()
var stream_texture = load("res://addons/kh_window/button_resize.png") var stream_texture = load("res://addons/kh_window/button_resize.png")
img_resize = stream_texture.get_data() img_resize = stream_texture.get_data()
tex_resize.create_from_image( img_resize ) tex_resize.create_from_image( img_resize )
resize_button.texture_normal = tex_resize resize_button.texture_normal = tex_resize
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
# resize_button.mouse_filter = MOUSE_FILTER_STOP # resize_button.mouse_filter = MOUSE_FILTER_STOP
footer.add_child( resize_button ) footer.add_child( resize_button )
# resize_button.set_owner( footer ) # resize_button.set_owner( footer )
resize_button.connect ( "button_down", self, "_on_Resize_pressed" ) resize_button.connect ( "button_down", self, "_on_Resize_pressed" )
###er_label.set_owner( footer ) ###er_label.set_owner( footer )
### ###
current_rect_size = self.rect_min_size current_rect_size = self.rect_min_size
if is_borderless: if is_borderless:
$background.region_rect = Rect2( $background.patch_margin_left-1 $background.region_rect = Rect2( $background.patch_margin_left-1
, $background.patch_margin_top-1 , $background.patch_margin_top-1
, 256-($background.patch_margin_left+$background.patch_margin_right)+2 , 256-($background.patch_margin_left+$background.patch_margin_right)+2
, 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 ) , 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
$background.patch_margin_left = 1 $background.patch_margin_left = 1
$background.patch_margin_top = 1 $background.patch_margin_top = 1
$background.patch_margin_right = 1 $background.patch_margin_right = 1
$background.patch_margin_bottom = 1 $background.patch_margin_bottom = 1
header_box.rect_min_size.y = 1 header_box.rect_min_size.y = 1
close_button.visible = false close_button.visible = false
open_button.visible = false open_button.visible = false
quit_button.visible = false quit_button.visible = false
title_label.visible = false title_label.visible = false
if not is_resizable: if not is_resizable:
if not has_footer: if not has_footer:
footer_box.visible = false footer_box.visible = false
else: else:
footer_box.get_node( "footer/resize" ).visible = false footer_box.get_node( "footer/resize" ).visible = false
func _ready(): func _ready():
# On déplace les enfants ajouter via l'editeur sous content. # On déplace les enfants ajouter via l'editeur sous content.
for child in self.get_children(): for child in self.get_children():
if not child.name =="parts" and not child.name =="background": if not child.name =="parts" and not child.name =="background":
if child.name.begins_with( "footer_" ): if child.name.begins_with( "footer_" ):
if footer_box.get_node("footer").has_node("footer_label"): if footer_box.get_node("footer").has_node("footer_label"):
footer_box.get_node("footer").remove_child( footer_box.get_node("footer").get_node("footer_label") ) footer_box.get_node("footer").remove_child( footer_box.get_node("footer").get_node("footer_label") )
self.remove_child( child ) self.remove_child( child )
get_footer().add_child( child ) get_footer().add_child( child )
get_footer().move_child( child, 0 ) get_footer().move_child( child, 0 )
else: else:
self.remove_child( child ) self.remove_child( child )
get_content().add_child( child ) get_content().add_child( child )
set_mouse_pass_to_children( self ) set_mouse_pass_to_children( self )
func _process(delta): func _process(delta):
if size_changed: if size_changed:
self.rect_size = Vector2( clamp( self.rect_size.x, min_size.x, self.rect_size.x ), clamp( self.rect_size.y, min_size.y, self.rect_size.y ) ) self.rect_size = Vector2( clamp( self.rect_size.x, min_size.x, self.rect_size.x ), clamp( self.rect_size.y, min_size.y, self.rect_size.y ) )
size_changed = false size_changed = false
func _on_Window_mouse_entered(): func _on_Window_mouse_entered():
print("mouse_entered") print("mouse_entered")
func _on_Window_focus_entered(): func _on_Window_focus_entered():
print("focus_entered") print("focus_entered")
func _on_Quit_pressed(): func _on_Quit_pressed():
self.visible = false self.visible = false
func get_content_child( p_node ): func get_content_child( p_node ):
return get_content().get_node( p_node ) return get_content().get_node( p_node )
func get_content(): func get_content():
if self.has_scrollbar: if self.has_scrollbar:
return content_box.get_node( "scroll_container/content" ) return content_box.get_node( "scroll_container/content" )
else: else:
return content_box.get_node( "content" ) return content_box.get_node( "content" )
func get_footer(): func get_footer():
return footer_box.get_node( "footer" ) return footer_box.get_node( "footer" )
func close(): func close():
if not self.is_borderless: if not self.is_borderless:
self.header_box.get_node( "header/close" ).visible = false self.header_box.get_node( "header/close" ).visible = false
self.header_box.get_node( "header/open" ).visible = true self.header_box.get_node( "header/open" ).visible = true
self.content_box.visible = false self.content_box.visible = false
self.footer_box.visible = false self.footer_box.visible = false
self.current_rect_size = self.rect_size self.current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 ) self.rect_size = Vector2( 0, 0 )
$background.rect_size = Vector2( 0, 0 ) $background.rect_size = Vector2( 0, 0 )
$background.rect_min_size = Vector2( 0, 0 ) $background.rect_min_size = Vector2( 0, 0 )
else: else:
self.header_box.get_node( "header/close" ).visible = false self.header_box.get_node( "header/close" ).visible = false
self.header_box.get_node( "header/open" ).visible = false self.header_box.get_node( "header/open" ).visible = false
self.content_box.visible = false self.content_box.visible = false
self.footer_box.visible = false self.footer_box.visible = false
self.current_rect_size = self.rect_size self.current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 ) self.rect_size = Vector2( 0, 0 )
$background.rect_size = Vector2( 0, 0 ) $background.rect_size = Vector2( 0, 0 )
$background.rect_min_size = Vector2( 0, 0 ) $background.rect_min_size = Vector2( 0, 0 )
func _on_Close_pressed(): func _on_Close_pressed():
close() close()
func open(): func open():
if not is_borderless: if not is_borderless:
header_box.get_node( "header/close" ).visible = true header_box.get_node( "header/close" ).visible = true
header_box.get_node( "header/open" ).visible = false header_box.get_node( "header/open" ).visible = false
content_box.visible = true content_box.visible = true
footer_box.visible = true footer_box.visible = true
self.rect_size = current_rect_size self.rect_size = current_rect_size
else: else:
header_box.get_node( "header/close" ).visible = false header_box.get_node( "header/close" ).visible = false
header_box.get_node( "header/open" ).visible = false header_box.get_node( "header/open" ).visible = false
content_box.visible = true content_box.visible = true
footer_box.visible = true footer_box.visible = true
self.rect_size = current_rect_size self.rect_size = current_rect_size
func _on_Open_pressed(): func _on_Open_pressed():
open() open()
func _on_Resize_pressed(): func _on_Resize_pressed():
is_resizing = true is_resizing = true
func _input( event ): func _input( event ):
if is_resizable: if is_resizable:
if is_resizing and event is InputEventMouseButton and not event.pressed: if is_resizing and event is InputEventMouseButton and not event.pressed:
is_resizing = false is_resizing = false
if event is InputEventMouseMotion and is_resizing: if event is InputEventMouseMotion and is_resizing:
var delta = event.relative var delta = event.relative
self.rect_size += delta self.rect_size += delta
size_changed = true size_changed = true
func check_if_clicked( event ): func check_if_clicked( event ):
if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 : if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 :
emit_signal( "window_clicked", self ) emit_signal( "window_clicked", self )
func _on_Header_gui_input( event ): func _on_Header_gui_input( event ):
check_if_clicked( event ) check_if_clicked( event )
if self.is_dragged_by_header_only: if self.is_dragged_by_header_only:
if is_movable: if is_movable:
if is_moving and event is InputEventMouseButton and not event.pressed: if is_moving and event is InputEventMouseButton and not event.pressed:
is_moving = false is_moving = false
elif not is_moving and event is InputEventMouseButton and event.pressed: elif not is_moving and event is InputEventMouseButton and event.pressed:
is_moving = true is_moving = true
if event is InputEventMouseMotion and is_moving: if event is InputEventMouseMotion and is_moving:
var delta = event.relative var delta = event.relative
self.rect_position += delta self.rect_position += delta
func _on_window_gui_input( event ): func _on_window_gui_input( event ):
check_if_clicked( event ) check_if_clicked( event )
if not self.is_dragged_by_header_only: if not self.is_dragged_by_header_only:
if is_movable: if is_movable:
if is_moving and event is InputEventMouseButton and not event.pressed: if is_moving and event is InputEventMouseButton and not event.pressed:
is_moving = false is_moving = false
elif not is_moving and event is InputEventMouseButton and event.pressed: elif not is_moving and event is InputEventMouseButton and event.pressed:
is_moving = true is_moving = true
if event is InputEventMouseMotion and is_moving: if event is InputEventMouseMotion and is_moving:
var delta = event.relative var delta = event.relative
self.rect_position += delta self.rect_position += delta
func load_from_file( config_file ): func load_from_file( config_file ):
if config_file.has_section( self.name ): print("[res://addons/kh_window/kh_window.gd] load_from_file")
self.rect_position = config_file.get_value( self.name, "position" ) if config_file.has_section( self.name ):
self.rect_size = config_file.get_value( self.name, "size" ) self.rect_position = config_file.get_value( self.name, "position" )
self.is_borderless = config_file.get_value( self.name, "borderless" ) self.rect_size = config_file.get_value( self.name, "size" )
current_rect_position = self.rect_position self.is_borderless = config_file.get_value( self.name, "borderless" )
current_rect_size = self.rect_size current_rect_position = self.rect_position
if config_file.get_value( self.name, "opened" ): current_rect_size = self.rect_size
open() if config_file.get_value( self.name, "opened" ):
else: open()
close() else:
close()
func save_to_file( config_file ): func save_to_file( config_file ):
var is_open = content_box.visible var is_open = content_box.visible
config_file.set_value(self.name, "position", self.rect_position) config_file.set_value(self.name, "position", self.rect_position)
if not is_open: if not is_open:
config_file.set_value(self.name, "size", current_rect_size) config_file.set_value(self.name, "size", current_rect_size)
else: else:
config_file.set_value(self.name, "size", self.rect_size) config_file.set_value(self.name, "size", self.rect_size)
if is_open: if is_open:
config_file.set_value(self.name, "opened", true) config_file.set_value(self.name, "opened", true)
else: else:
config_file.set_value(self.name, "opened", false) config_file.set_value(self.name, "opened", false)
config_file.set_value(self.name, "borderless", is_borderless) config_file.set_value(self.name, "borderless", is_borderless)

View file

@ -2,11 +2,11 @@ tool
extends EditorPlugin extends EditorPlugin
func _enter_tree(): func _enter_tree():
# Initialization of the plugin goes here # Initialization of the plugin goes here
# Add the new type with a name, a parent type, a script and an icon # Add the new type with a name, a parent type, a script and an icon
add_custom_type("kh_window", "MarginContainer", preload("kh_window.gd"), preload("icon.png")) add_custom_type("kh_window", "MarginContainer", preload("kh_window.gd"), preload("icon.png"))
func _exit_tree(): func _exit_tree():
# Clean-up of the plugin goes here # Clean-up of the plugin goes here
# Always remember to remove it from the engine when deactivated # Always remember to remove it from the engine when deactivated
remove_custom_type("kh_window") remove_custom_type("kh_window")

BIN
assets/fonts/IMMORTAL.ttf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

3
default_bus_layout.tres Normal file
View file

@ -0,0 +1,3 @@
[gd_resource type="AudioBusLayout" format=2]
[resource]

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 62 KiB

120
locale/en.po Normal file
View file

@ -0,0 +1,120 @@
# Don't remove the two lines below, they're required for gettext to work correctly.
msgid ""
msgstr ""
"Project-Id-Version: khanat-client 1\n"
"PO-Revision-Date: 1\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "MAIN_MENU_PLAY"
msgstr "Play"
msgid "MAIN_MENU_USERNAME"
msgstr "Username"
msgid "MAIN_MENU_PASSWORD"
msgstr "Password"
msgid "MAIN_MENU_QUIT"
msgstr "Quit"
msgid "Select"
msgstr "Select"
msgid "Remove"
msgstr "Remove"
msgid "New creature"
msgstr "New creature"
msgid "Cancel"
msgstr "Cancel"
msgid "OPTION_LANGUAGE_SELECT_YOUR_LANGUAGE"
msgstr "Select your language"
msgid "OPTION_LANGUAGE_EXIT"
msgstr "Ok"
msgid "OPTION_NEWS_TITLE"
msgstr "News"
msgid "OPTION_INFO_TITLE"
msgstr "About"
msgid "OPTION_INFO_AUTHORS"
msgstr "Authors"
msgid "OPTION_INFO_LICENSE"
msgstr "License"
msgid "OPTION_NEWS_EXIT"
msgstr "OK"
msgid "OPTION_INFO_EXIT"
msgstr "OK"
msgid "OPTION_SETTINGS_EXIT"
msgstr "OK"
msgid "OPTION_SETTINGS_VIDEO"
msgstr "Video"
msgid "OPTION_SETTINGS_SOUND"
msgstr "Sound"
msgid "OPTION_SETTINGS_VIDEO_FULLSCREEN"
msgstr "Fullscreen"
msgid "OPTION_SETTINGS_VIDEO_RESIZABLE"
msgstr "Resizable"
msgid "OPTION_SETTINGS_VIDEO_SCREEN_ORIENTATION"
msgstr "Screen orientation"
msgid "OPTION_SETTINGS_VIDEO_BORDERLESS"
msgstr "Borderless"
msgid "OPTION_SETTINGS_VIDEO_SCREEN"
msgstr "Screen"
msgid "OPTION_SETTINGS_VIDEO_WINDOW_ALWAYS_ON_TOP"
msgstr "Window always on top"
msgid "OPTION_SETTINGS_VIDEO_WINDOW_MAXIMIZED"
msgstr "window maximized"
msgid "OPTION_SETTINGS_VIDEO_DEFAULT"
msgstr "Default configuration"
msgid "OPTION_SETTINGS_VIDEO_SIZE_FONT"
msgstr "font size"
msgid "OPTION_SETTINGS_SOUND_MUTE"
msgstr "Mute"
msgid "OPTION_SETTINGS_SOUND_LEVEL_GLOBAL"
msgstr "Global"
msgid "OPTION_SETTINGS_SOUND_LEVEL_MUSIC"
msgstr "Music"
msgid "OPTION_SETTINGS_SOUND_LEVEL_EFFECT"
msgstr "Effect"
msgid "OPTION_SETTINGS_SOUND_YOUR_MUSIC"
msgstr "Launch your music"
msgid "OPTION_SETTINGS_SOUND_YOUR_SELECTION"
msgstr "Your music"
msgid "OPTION_SETTINGS_SOUND_SELECTION_ADD"
msgstr "Add"
msgid "OPTION_SETTINGS_SOUND_SELECTION_DELETE"
msgstr "Del"

120
locale/fr.po Normal file
View file

@ -0,0 +1,120 @@
# Don't remove the two lines below, they're required for gettext to work correctly.
msgid ""
msgstr ""
"Project-Id-Version: khanat-client 1\n"
"PO-Revision-Date: 1\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "MAIN_MENU_PLAY"
msgstr "Jouer"
msgid "MAIN_MENU_USERNAME"
msgstr "Identifiant"
msgid "MAIN_MENU_PASSWORD"
msgstr "Mot de passe"
msgid "MAIN_MENU_QUIT"
msgstr "Quitter"
msgid "Select"
msgstr "Sélectionner"
msgid "Remove"
msgstr "Supprimer"
msgid "New creature"
msgstr "Créer une nouvel créature"
msgid "Cancel"
msgstr "Annuler"
msgid "OPTION_LANGUAGE_SELECT_YOUR_LANGUAGE"
msgstr "Sélectionner votre langue"
msgid "OPTION_LANGUAGE_EXIT"
msgstr "Ok"
msgid "OPTION_NEWS_TITLE"
msgstr "Nouveauté"
msgid "OPTION_INFO_TITLE"
msgstr "À propos"
msgid "OPTION_INFO_AUTHORS"
msgstr "Auteurs"
msgid "OPTION_INFO_LICENSE"
msgstr "Licence"
msgid "OPTION_NEWS_EXIT"
msgstr "OK"
msgid "OPTION_INFO_EXIT"
msgstr "OK"
msgid "OPTION_SETTINGS_EXIT"
msgstr "OK"
msgid "OPTION_SETTINGS_VIDEO"
msgstr "Vidéo"
msgid "OPTION_SETTINGS_SOUND"
msgstr "Son"
msgid "OPTION_SETTINGS_VIDEO_FULLSCREEN"
msgstr "Plein écran"
msgid "OPTION_SETTINGS_VIDEO_RESIZABLE"
msgstr "Fenêtre redimensionnable"
msgid "OPTION_SETTINGS_VIDEO_SCREEN_ORIENTATION"
msgstr "Orientation de l'écran"
msgid "OPTION_SETTINGS_VIDEO_BORDERLESS"
msgstr "Fenêtre sans bord"
msgid "OPTION_SETTINGS_VIDEO_SCREEN"
msgstr "Écran"
msgid "OPTION_SETTINGS_VIDEO_WINDOW_ALWAYS_ON_TOP"
msgstr "Garder la fenêtre dessus"
msgid "OPTION_SETTINGS_VIDEO_WINDOW_MAXIMIZED"
msgstr "Fenêtre prend tout l'écran"
msgid "OPTION_SETTINGS_VIDEO_DEFAULT"
msgstr "Configuration par défaut"
msgid "OPTION_SETTINGS_VIDEO_SIZE_FONT"
msgstr "Taille de la police"
msgid "OPTION_SETTINGS_SOUND_MUTE"
msgstr "Mute"
msgid "OPTION_SETTINGS_SOUND_LEVEL_GLOBAL"
msgstr "Niveau global"
msgid "OPTION_SETTINGS_SOUND_LEVEL_MUSIC"
msgstr "Niveau musique"
msgid "OPTION_SETTINGS_SOUND_LEVEL_EFFECT"
msgstr "Niveau effet"
msgid "OPTION_SETTINGS_SOUND_YOUR_MUSIC"
msgstr "Jouer votre musique"
msgid "OPTION_SETTINGS_SOUND_YOUR_SELECTION"
msgstr "Votre musique"
msgid "OPTION_SETTINGS_SOUND_SELECTION_ADD"
msgstr "Ajouter"
msgid "OPTION_SETTINGS_SOUND_SELECTION_DELETE"
msgstr "Supprimer"

21
locale/locale.sh Executable file
View file

@ -0,0 +1,21 @@
*#!/bin/bash
WORKDIR="$(dirname $(readlink -f $0))"
function generate_locale()
{
echo "--- Begin : $1"
if [ -f $1.po ]
then
msgmerge --update --backup=none $1.po messages.pot
else
msginit --no-translator --input=messages.pot --locale=$1
fi
echo "--- Check : $1"
msgfmt $1.po --check
echo "--- End : $1"
}
ORIGIN=$PWD
cd $WORKDIR
generate_locale fr
generate_locale en
cd $ORIGIN

BIN
locale/messages.mo Normal file

Binary file not shown.

112
locale/messages.pot Normal file
View file

@ -0,0 +1,112 @@
# Don't remove the two lines below, they're required for gettext to work correctly.
msgid ""
msgstr ""
msgid "MAIN_MENU_PLAY"
msgstr ""
msgid "MAIN_MENU_USERNAME"
msgstr ""
msgid "MAIN_MENU_PASSWORD"
msgstr ""
msgid "MAIN_MENU_QUIT"
msgstr ""
msgid "Select"
msgstr ""
msgid "Remove"
msgstr ""
msgid "New creature"
msgstr ""
msgid "Cancel"
msgstr ""
msgid "OPTION_LANGUAGE_SELECT_YOUR_LANGUAGE"
msgstr ""
msgid "OPTION_LANGUAGE_EXIT"
msgstr ""
msgid "OPTION_NEWS_TITLE"
msgstr ""
msgid "OPTION_INFO_TITLE"
msgstr ""
msgid "OPTION_INFO_AUTHORS"
msgstr ""
msgid "OPTION_INFO_LICENSE"
msgstr ""
msgid "OPTION_NEWS_EXIT"
msgstr ""
msgid "OPTION_INFO_EXIT"
msgstr ""
msgid "OPTION_SETTINGS_EXIT"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO"
msgstr ""
msgid "OPTION_SETTINGS_SOUND"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_FULLSCREEN"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_RESIZABLE"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_SCREEN_ORIENTATION"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_BORDERLESS"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_SCREEN"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_WINDOW_ALWAYS_ON_TOP"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_WINDOW_MAXIMIZED"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_DEFAULT"
msgstr ""
msgid "OPTION_SETTINGS_VIDEO_SIZE_FONT"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_MUTE"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_LEVEL_GLOBAL"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_LEVEL_MUSIC"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_LEVEL_EFFECT"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_YOUR_MUSIC"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_YOUR_SELECTION"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_SELECTION_ADD"
msgstr ""
msgid "OPTION_SETTINGS_SOUND_SELECTION_DELETE"
msgstr ""

View file

@ -67,8 +67,13 @@ run/main_scene="res://scenes/main/main.tscn"
boot_splash/image="res://assets/interfaces/new_launcher_bg_0-1.png" boot_splash/image="res://assets/interfaces/new_launcher_bg_0-1.png"
config/icon="res://icon.png" config/icon="res://icon.png"
[audio]
enable_audio_input=true
[autoload] [autoload]
Config="*res://ressources/scripts/config/config.gd"
Creatures="*res://ressources/scripts/creatures_old.gd" Creatures="*res://ressources/scripts/creatures_old.gd"
MusicManager="*res://scenes/interfaces/music_manager/music_manager.tscn" MusicManager="*res://scenes/interfaces/music_manager/music_manager.tscn"
Connection="*res://scenes/connection/connection.tscn" Connection="*res://scenes/connection/connection.tscn"
@ -85,10 +90,11 @@ gdscript/warnings/return_value_discarded=false
window/size/width=1280 window/size/width=1280
window/size/height=720 window/size/height=720
window/size/always_on_top=true
[editor_plugins] [editor_plugins]
enabled=PoolStringArray( "kh_slider", "kh_window" ) enabled=PoolStringArray( "res://addons/kh_slider/plugin.cfg", "res://addons/kh_window/plugin.cfg" )
[input] [input]
@ -222,6 +228,11 @@ camera_switch={
debug_mode=true debug_mode=true
[locale]
locale_filter=[ 0, [ ] ]
translations=PoolStringArray( "res://locale/fr.po", "res://locale/en.po" )
[node] [node]
name_num_separator=2 name_num_separator=2

View file

@ -0,0 +1,205 @@
extends Node
# Localization configuration on linux
# $HOME/.local/share/godot/app_userdata/Khanat
var font_size = 14
var SettingsFile = "user://settings.cfg"
var screen_number = 0
var screen_orientation = 0
var window_maximized:bool = false
var video_default:bool = true
var window_fullscreen:bool = true
var window_borderless:bool = false
var window_resizable:bool = true
var window_size_x = 0
var window_size_y = 0
var window_always_on_top:bool = true
var debug:bool = true
var sound_lvl_music = 50
var sound_lvl_effect = 50
var sound_lvl_global = 50
var mute:bool = false
func msg_debug(text):
if debug:
var frame = get_stack()[1]
print("DEBUG [%s:%d] %s" % [frame.source, frame.line, text] )
func msg_info(text):
var frame = get_stack()[1]
print("INFO [%s:%d] %s" % [frame.source, frame.line, text] )
func msg_error(text):
var frame = get_stack()[1]
print("ERROR [%s:%d] %s" % [frame.source, frame.line, text] )
# Called when the node enters the scene tree for the first time.
func _ready():
load_config()
msg_debug("load end")
func set_window_fullscreen(value: bool):
#if ProjectSettings.has_setting( "display/window/size/fullscreen" ):
# ProjectSettings.set_setting("display/window/size/fullscreen", value)
window_fullscreen = value
if video_default == false:
OS.window_fullscreen = window_fullscreen
func set_window_borderless(value: bool):
#if ProjectSettings.has_setting( "display/window/size/borderless" ):
# ProjectSettings.set_setting("display/window/size/borderless", value)
window_borderless = value
if video_default == false:
OS.window_borderless = window_borderless
func set_window_resizable(value: bool):
#if ProjectSettings.has_setting( "display/window/size/resizable" ):
# ProjectSettings.set_setting("display/window/size/resizable", value)
window_resizable = true
if video_default == false:
OS.window_resizable = window_resizable
func set_window_width(value: int):
#if ProjectSettings.has_setting( "display/window/size/width" ):
# ProjectSettings.set_setting("display/window/size/width", value)
window_size_x = value
if video_default == false:
OS.window_size.x = window_size_x
#OS.window_fullscreen = ProjectSettings.get_setting("display/window/size/width")
func set_window_height(value: int):
#if ProjectSettings.has_setting( "display/window/size/height" ):
# ProjectSettings.set_setting("display/window/size/height", value)
window_size_y = value
if video_default == false:
OS.window_size.y = window_size_y
#OS.window_fullscreen = ProjectSettings.get_setting("display/window/size/height")
func set_font_size(value: int):
font_size = value
if video_default == false:
pass
func set_video_default(value):
video_default = value
func set_window_always_on_top(value: bool):
window_always_on_top = value
if video_default == false:
OS.set_window_always_on_top(window_always_on_top)
func set_current_screen(value: int):
screen_number = int(value)
if video_default == false:
OS.current_screen = screen_number
func set_screen_orientation(value: int):
if video_default == false:
screen_orientation = int(value)
OS.set_screen_orientation(screen_orientation)
func set_window_maximized(value: bool):
if value:
window_maximized = true
else:
window_maximized = false
if not video_default:
OS.set_window_maximized(window_maximized)
func enable_window_default():
# display/window/handheld/orientation
if ProjectSettings.has_setting( "display/window/handheld/orientation" ):
var num = 0
var default_orientation = ProjectSettings.get_setting("display/window/handheld/orientation")
match default_orientation:
"landscape":
num = 0
"portrait":
num = 1
"reverse_landscape":
num = 2
"reverse_portrait":
num = 3
"sensor_landscape":
num = 4
"sensor_portrait":
num = 5
"sensor":
num = 6
_:
num = 6
OS.set_screen_orientation(num)
OS.set_window_maximized(window_maximized)
OS.current_screen = screen_number
# display/window/size/always_on_top
if ProjectSettings.has_setting( "display/window/size/always_on_top" ):
OS.set_window_always_on_top( ProjectSettings.get_setting( "display/window/size/always_on_top" ) )
#OS.window_size.x = window_size_x
#OS.window_size.y = window_size_y
if ProjectSettings.has_setting( "display/window/size/fullscreen" ):
OS.window_fullscreen = ProjectSettings.get_setting( "display/window/size/fullscreen" )
if ProjectSettings.has_setting( "display/window/size/borderless" ):
OS.window_borderless = ProjectSettings.get_setting( "display/window/size/borderless" )
if ProjectSettings.has_setting( "display/window/size/resizable" ):
OS.window_resizable = ProjectSettings.get_setting( "display/window/size/resizable" )
func disable_window_default():
OS.set_screen_orientation(screen_orientation)
OS.set_window_maximized(window_maximized)
OS.current_screen = screen_number
OS.set_window_always_on_top(window_always_on_top)
#OS.window_size.x = window_size_x
#OS.window_size.y = window_size_y
OS.window_fullscreen = window_fullscreen
OS.window_borderless = window_borderless
OS.window_resizable = window_resizable
func set_sound_mute(value: bool):
Config.msg_debug("mute:" + str(value))
mute = value
func save_config():
var config_file = ConfigFile.new()
config_file.set_value( "theme", "font_size", 14 )
config_file.set_value( "display", "default", video_default )
config_file.set_value( "display", "fullscreen", OS.window_fullscreen )
config_file.set_value( "display", "borderless", OS.window_borderless )
config_file.set_value( "display", "resizable", OS.window_resizable )
#config_file.set_value( "display", "width", int( OS.window_size.x ) )
#config_file.set_value( "display", "height", int( OS.window_size.y ) )
config_file.set_value( "display", "window_always_on_top", OS.keep_screen_on )
config_file.set_value( "display", "screen_orientation", OS.get_screen_orientation() )
config_file.set_value( "display", "current_screen", screen_number )
config_file.set_value( "display", "window_maximized", window_maximized )
config_file.set_value( "sound", "global_level", sound_lvl_global )
config_file.set_value( "sound", "music_level", sound_lvl_music )
config_file.set_value( "sound", "effect_level", sound_lvl_effect )
config_file.set_value( "sound", "mute", mute )
config_file.save( SettingsFile )
#print("[res://ressources/scripts/config/config.gd] save_config")
func load_config():
var config_file = ConfigFile.new()
var err = config_file.load( SettingsFile )
if err == ERR_CANT_OPEN or err == ERR_FILE_NOT_FOUND:
# On suppose que le fichier n'existe pas encore, donc on le crée.
#print("[res://ressources/scripts/config/config.gd] Error to read, recreate config")
save_config()
elif not err == OK:
print("[res://ressources/scripts/config/config.gd] Error code when loading user://settings.cfg file: ", err)
font_size = config_file.get_value("theme", "font_size", false)
video_default = config_file.get_value("display", "default", true)
set_window_fullscreen(config_file.get_value("display", "fullscreen", true))
set_window_borderless(config_file.get_value("display", "borderless", false))
set_window_resizable(config_file.get_value("display", "resizable", true))
set_window_always_on_top(config_file.get_value("display", "window_always_on_top", true))
set_screen_orientation(config_file.get_value("display", "screen_orientation", 0))
set_current_screen(config_file.get_value("display", "current_screen", 0))
#set_window_width(config_file.get_value("display", "width", OS.window_size.x))
#set_window_height(config_file.get_value("display", "height", OS.window_size.y))
set_window_maximized(config_file.get_value("display", "window_maximized", OS.window_maximized))
sound_lvl_global = config_file.get_value("sound", "global_level", 100)
sound_lvl_music = config_file.get_value("sound", "music_level", 100)
sound_lvl_effect = config_file.get_value("sound", "effect_level", 100)
mute = config_file.get_value("sound", "mute", false)

View file

@ -7,29 +7,29 @@ var player_name = null
var ressource_queue = preload("res://ressources/scripts/resource_queue.gd").new() var ressource_queue = preload("res://ressources/scripts/resource_queue.gd").new()
enum RACE { enum RACE {
human human
} }
var race_label = [ "Humain" ] var race_label = [ "Humain" ]
func get_race_id( p_label ): func get_race_id( p_label ):
return race_label.find( p_label ) return race_label.find( p_label )
enum SEX { enum SEX {
female, female,
male male
} }
var sex_label = [ "Femme", "Homme" ] var sex_label = [ "Femme", "Homme" ]
func get_sex_id( p_label ): func get_sex_id( p_label ):
return race_label.find( p_label ) return race_label.find( p_label )
enum CREATURES_EDITOR_MODE { enum CREATURES_EDITOR_MODE {
player, player,
npc npc
} }
var creatures_editor_mode = CREATURES_EDITOR_MODE.player var creatures_editor_mode = CREATURES_EDITOR_MODE.player
func goto_scene( path ): func goto_scene( path ):
self.get_tree().get_root().get_node("main").goto_scene( path ) self.get_tree().get_root().get_node("main").goto_scene( path )

View file

@ -8,138 +8,138 @@ var queue = []
var pending = {} var pending = {}
func _lock(_caller): func _lock(_caller):
mutex.lock() mutex.lock()
func _unlock(_caller): func _unlock(_caller):
mutex.unlock() mutex.unlock()
func _post(_caller): func _post(_caller):
sem.post() sem.post()
func _wait(_caller): func _wait(_caller):
sem.wait() sem.wait()
func queue_resource(path, p_in_front = false): func queue_resource(path, p_in_front = false):
_lock("queue_resource") _lock("queue_resource")
if path in pending: if path in pending:
_unlock("queue_resource") _unlock("queue_resource")
return return
elif ResourceLoader.has_cached(path): elif ResourceLoader.has_cached(path):
var res = ResourceLoader.load(path) var res = ResourceLoader.load(path)
pending[path] = res pending[path] = res
_unlock("queue_resource") _unlock("queue_resource")
return return
else: else:
var res = ResourceLoader.load_interactive(path) var res = ResourceLoader.load_interactive(path)
res.set_meta("path", path) res.set_meta("path", path)
if p_in_front: if p_in_front:
queue.insert(0, res) queue.insert(0, res)
else: else:
queue.push_back(res) queue.push_back(res)
pending[path] = res pending[path] = res
_post("queue_resource") _post("queue_resource")
_unlock("queue_resource") _unlock("queue_resource")
return return
func cancel_resource(path): func cancel_resource(path):
_lock("cancel_resource") _lock("cancel_resource")
if path in pending: if path in pending:
if pending[path] is ResourceInteractiveLoader: if pending[path] is ResourceInteractiveLoader:
queue.erase(pending[path]) queue.erase(pending[path])
pending.erase(path) pending.erase(path)
_unlock("cancel_resource") _unlock("cancel_resource")
func get_progress(path): func get_progress(path):
_lock("get_progress") _lock("get_progress")
var ret = -1 var ret = -1
if path in pending: if path in pending:
if pending[path] is ResourceInteractiveLoader: if pending[path] is ResourceInteractiveLoader:
ret = float(pending[path].get_stage()) / float(pending[path].get_stage_count()) ret = float(pending[path].get_stage()) / float(pending[path].get_stage_count())
else: else:
ret = 1.0 ret = 1.0
_unlock("get_progress") _unlock("get_progress")
return ret return ret
func is_ready(path): func is_ready(path):
var ret var ret
_lock("is_ready") _lock("is_ready")
if path in pending: if path in pending:
ret = !(pending[path] is ResourceInteractiveLoader) ret = !(pending[path] is ResourceInteractiveLoader)
else: else:
ret = false ret = false
_unlock("is_ready") _unlock("is_ready")
return ret return ret
func _wait_for_resource(res, path): func _wait_for_resource(res, path):
_unlock("wait_for_resource") _unlock("wait_for_resource")
while true: while true:
VisualServer.sync() VisualServer.sync()
OS.delay_usec(16000) # Wait approximately 1 frame. OS.delay_usec(16000) # Wait approximately 1 frame.
_lock("wait_for_resource") _lock("wait_for_resource")
if queue.size() == 0 || queue[0] != res: if queue.size() == 0 || queue[0] != res:
return pending[path] return pending[path]
_unlock("wait_for_resource") _unlock("wait_for_resource")
func get_resource(path): func get_resource(path):
_lock("get_resource") _lock("get_resource")
if path in pending: if path in pending:
if pending[path] is ResourceInteractiveLoader: if pending[path] is ResourceInteractiveLoader:
var res = pending[path] var res = pending[path]
if res != queue[0]: if res != queue[0]:
var pos = queue.find(res) var pos = queue.find(res)
queue.remove(pos) queue.remove(pos)
queue.insert(0, res) queue.insert(0, res)
res = _wait_for_resource(res, path) res = _wait_for_resource(res, path)
pending.erase(path) pending.erase(path)
_unlock("return") _unlock("return")
return res return res
else: else:
var res = pending[path] var res = pending[path]
pending.erase(path) pending.erase(path)
_unlock("return") _unlock("return")
return res return res
else: else:
_unlock("return") _unlock("return")
return ResourceLoader.load(path) return ResourceLoader.load(path)
func thread_process(): func thread_process():
_wait("thread_process") _wait("thread_process")
_lock("process") _lock("process")
while queue.size() > 0: while queue.size() > 0:
var res = queue[0] var res = queue[0]
_unlock("process_poll") _unlock("process_poll")
var ret = res.poll() var ret = res.poll()
_lock("process_check_queue") _lock("process_check_queue")
if ret == ERR_FILE_EOF || ret != OK: if ret == ERR_FILE_EOF || ret != OK:
var path = res.get_meta("path") var path = res.get_meta("path")
if path in pending: # Else, it was already retrieved. if path in pending: # Else, it was already retrieved.
pending[res.get_meta("path")] = res.get_resource() pending[res.get_meta("path")] = res.get_resource()
# Something might have been put at the front of the queue while # Something might have been put at the front of the queue while
# we polled, so use erase instead of remove. # we polled, so use erase instead of remove.
queue.erase(res) queue.erase(res)
_unlock("process") _unlock("process")
func thread_func(_u): func thread_func(_u):
while true: while true:
thread_process() thread_process()
func start(): func start():
mutex = Mutex.new() mutex = Mutex.new()
sem = Semaphore.new() sem = Semaphore.new()
thread = Thread.new() thread = Thread.new()
thread.start(self, "thread_func", 0) thread.start(self, "thread_func", 0)

View file

@ -17,219 +17,219 @@ onready var sex_popup = $margin_box/window_box/content_box/tabs_box/definition/s
var max_caracteristiques_points = 5*5 + 5 var max_caracteristiques_points = 5*5 + 5
func _ready(): func _ready():
# Race. # Race.
race_popup.add_item( Globals.race_label[ Globals.RACE.human ] ) race_popup.add_item( Globals.race_label[ Globals.RACE.human ] )
race_popup.connect("id_pressed", self, "_on_race_id_pressed") race_popup.connect("id_pressed", self, "_on_race_id_pressed")
# Sex. # Sex.
sex_popup.add_item( Globals.sex_label[ Globals.SEX.female ] ) sex_popup.add_item( Globals.sex_label[ Globals.SEX.female ] )
sex_popup.add_item( Globals.sex_label[ Globals.SEX.male ] ) sex_popup.add_item( Globals.sex_label[ Globals.SEX.male ] )
sex_popup.connect("id_pressed", self, "_on_sex_id_pressed") sex_popup.connect("id_pressed", self, "_on_sex_id_pressed")
func _on_race_id_pressed( ID ): func _on_race_id_pressed( ID ):
$margin_box/window_box/content_box/tabs_box/definition/race/value.text = race_popup.get_item_text( ID ) $margin_box/window_box/content_box/tabs_box/definition/race/value.text = race_popup.get_item_text( ID )
emit_signal( "updated", "race", ID ) emit_signal( "updated", "race", ID )
func _on_sex_id_pressed( ID ): func _on_sex_id_pressed( ID ):
$margin_box/window_box/content_box/tabs_box/definition/sex/value.text = sex_popup.get_item_text( ID ) $margin_box/window_box/content_box/tabs_box/definition/sex/value.text = sex_popup.get_item_text( ID )
emit_signal( "updated", "sex", ID ) emit_signal( "updated", "sex", ID )
if ID == Globals.SEX.male: if ID == Globals.SEX.male:
$margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.hide() $margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.hide()
$margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.hide() $margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.hide()
$margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.hide() $margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.hide()
else: else:
$margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.show() $margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.show()
$margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.show() $margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.show()
$margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.show() $margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.show()
func update_sliders( p_creature ): func update_sliders( p_creature ):
var race = p_creature.get_data( "race", Globals.RACE.human ) var race = p_creature.get_data( "race", Globals.RACE.human )
self._on_race_id_pressed( race ) self._on_race_id_pressed( race )
var sex = p_creature.get_data( "sex", Globals.SEX.female ) var sex = p_creature.get_data( "sex", Globals.SEX.female )
self._on_sex_id_pressed( sex ) self._on_sex_id_pressed( sex )
for child in $margin_box/window_box/content_box/tabs_box/Corps/aspect.get_children(): for child in $margin_box/window_box/content_box/tabs_box/Corps/aspect.get_children():
if not child is Label: if not child is Label:
if child.get_node( "value" ) is ColorPickerButton: if child.get_node( "value" ) is ColorPickerButton:
child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white ) child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white )
else: else:
child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 ) child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 )
for child in self.get_node( "margin_box/window_box/content_box/tabs_box/Tête/aspect" ).get_children(): for child in self.get_node( "margin_box/window_box/content_box/tabs_box/Tête/aspect" ).get_children():
if not child is Label: if not child is Label:
if child.get_node( "value" ) is ColorPickerButton: if child.get_node( "value" ) is ColorPickerButton:
child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white ) child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white )
else: else:
child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 ) child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 )
func update_caracteristique( p_name, p_value ): func update_caracteristique( p_name, p_value ):
var total_points = 0 var total_points = 0
for caracteristique in $margin_box/window_box/content_box/tabs_box/caracteristiques.get_children(): for caracteristique in $margin_box/window_box/content_box/tabs_box/caracteristiques.get_children():
if not caracteristique.name == "lasting_points": if not caracteristique.name == "lasting_points":
total_points += caracteristique.get_node( "value" ).value total_points += caracteristique.get_node( "value" ).value
$margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = str(self.max_caracteristiques_points - total_points) $margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = str(self.max_caracteristiques_points - total_points)
if int($margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text) < 0: if int($margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text) < 0:
var other_points = total_points - p_value var other_points = total_points - p_value
var other_lasting_points = self.max_caracteristiques_points - other_points var other_lasting_points = self.max_caracteristiques_points - other_points
self.get_node( "margin_box/window_box/content_box/tabs_box/caracteristiques/"+p_name+"/value" ).value = other_lasting_points self.get_node( "margin_box/window_box/content_box/tabs_box/caracteristiques/"+p_name+"/value" ).value = other_lasting_points
$margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = "0" $margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = "0"
func _on_first_name_text_entered(new_text): func _on_first_name_text_entered(new_text):
emit_signal( "updated", "first_name", new_text ) emit_signal( "updated", "first_name", new_text )
func _on_last_name_text_entered(new_text): func _on_last_name_text_entered(new_text):
emit_signal( "updated", "last_name", new_text ) emit_signal( "updated", "last_name", new_text )
func _on_size_value_changed(value): func _on_size_value_changed(value):
emit_signal( "updated", "size", value ) emit_signal( "updated", "size", value )
func _on_fat_value_changed(value): func _on_fat_value_changed(value):
emit_signal( "updated", "fat", value ) emit_signal( "updated", "fat", value )
func _on_muscle_value_changed(value): func _on_muscle_value_changed(value):
emit_signal( "updated", "muscles", value ) emit_signal( "updated", "muscles", value )
func _on_breast_value_changed(value): func _on_breast_value_changed(value):
emit_signal( "updated", "breast", value ) emit_signal( "updated", "breast", value )
func _on_pregnancy_value_changed(value): func _on_pregnancy_value_changed(value):
emit_signal( "updated", "pregnancy", value ) emit_signal( "updated", "pregnancy", value )
func _on_skin_tone_value_changed(value): func _on_skin_tone_value_changed(value):
emit_signal( "updated", "skin_tone", value ) emit_signal( "updated", "skin_tone", value )
func _on_hair_value_changed(value): func _on_hair_value_changed(value):
emit_signal( "updated", "hair", value ) emit_signal( "updated", "hair", value )
func _on_hair_color_color_changed( color ): func _on_hair_color_color_changed( color ):
emit_signal( "updated", "hair_color", color ) emit_signal( "updated", "hair_color", color )
func _on_caucasian_value_changed(value): func _on_caucasian_value_changed(value):
emit_signal( "updated", "caucasian", value ) emit_signal( "updated", "caucasian", value )
func _on_african_value_changed(value): func _on_african_value_changed(value):
emit_signal( "updated", "african", value ) emit_signal( "updated", "african", value )
func _on_asian_value_changed(value): func _on_asian_value_changed(value):
emit_signal( "updated", "asian", value ) emit_signal( "updated", "asian", value )
func _on_first_name_text_changed(new_text): func _on_first_name_text_changed(new_text):
emit_signal( "updated", "first_name", new_text ) emit_signal( "updated", "first_name", new_text )
func _on_last_name_text_changed(new_text): func _on_last_name_text_changed(new_text):
emit_signal( "updated", "last_name", new_text ) emit_signal( "updated", "last_name", new_text )
func _on_proportion_value_changed(value): func _on_proportion_value_changed(value):
emit_signal( "updated", "proportion", value ) emit_signal( "updated", "proportion", value )
func _on_strength_value_changed(value): func _on_strength_value_changed(value):
self.update_caracteristique( "strength", value ) self.update_caracteristique( "strength", value )
func _on_perception_value_changed(value): func _on_perception_value_changed(value):
self.update_caracteristique( "perception", value ) self.update_caracteristique( "perception", value )
func _on_endurance_value_changed(value): func _on_endurance_value_changed(value):
self.update_caracteristique( "endurance", value ) self.update_caracteristique( "endurance", value )
func _on_constitution_value_changed(value): func _on_constitution_value_changed(value):
self.update_caracteristique( "constitution", value ) self.update_caracteristique( "constitution", value )
func _on_agility_value_changed(value): func _on_agility_value_changed(value):
self.update_caracteristique( "agility", value ) self.update_caracteristique( "agility", value )
func _on_cleft_chin_value_changed(value): func _on_cleft_chin_value_changed(value):
emit_signal( "updated", "cleft_chin", value ) emit_signal( "updated", "cleft_chin", value )
func _on_chin_angle_value_changed(value): func _on_chin_angle_value_changed(value):
emit_signal( "updated", "chin_angle", value ) emit_signal( "updated", "chin_angle", value )
func _on_mouth_horiz_value_changed(value): func _on_mouth_horiz_value_changed(value):
emit_signal( "updated", "mouth_horiz", value ) emit_signal( "updated", "mouth_horiz", value )
func _on_mouth_vert_value_changed(value): func _on_mouth_vert_value_changed(value):
emit_signal( "updated", "mouth_vert", value ) emit_signal( "updated", "mouth_vert", value )
func _on_nose_galbe_value_changed(value): func _on_nose_galbe_value_changed(value):
emit_signal( "updated", "nose_galbe", value ) emit_signal( "updated", "nose_galbe", value )
func _on_nose_grec_value_changed(value): func _on_nose_grec_value_changed(value):
emit_signal( "updated", "nose_grec", value ) emit_signal( "updated", "nose_grec", value )
func _on_nose_horiz_value_changed(value): func _on_nose_horiz_value_changed(value):
emit_signal( "updated", "nose_horiz", value ) emit_signal( "updated", "nose_horiz", value )
func _on_nose_depth_value_changed(value): func _on_nose_depth_value_changed(value):
emit_signal( "updated", "nose_depth", value ) emit_signal( "updated", "nose_depth", value )
func _on_eyes_color_value_changed(value): func _on_eyes_color_value_changed(value):
emit_signal( "updated", "eyes_color", value ) emit_signal( "updated", "eyes_color", value )
func _on_eyes_vert_value_changed(value): func _on_eyes_vert_value_changed(value):
emit_signal( "updated", "eyes_vert", value ) emit_signal( "updated", "eyes_vert", value )
func _on_eyes_gap_value_changed(value): func _on_eyes_gap_value_changed(value):
emit_signal( "updated", "eyes_gap", value ) emit_signal( "updated", "eyes_gap", value )
func _on_earlobes_value_changed(value): func _on_earlobes_value_changed(value):
emit_signal( "updated", "earlobes", value ) emit_signal( "updated", "earlobes", value )
func _on_ears_wing_value_changed(value): func _on_ears_wing_value_changed(value):
emit_signal( "updated", "ears_wing", value ) emit_signal( "updated", "ears_wing", value )
func _on_lips_up_shape_value_changed(value): func _on_lips_up_shape_value_changed(value):
emit_signal( "updated", "lips_up_shape", value ) emit_signal( "updated", "lips_up_shape", value )
func _on_lips_up_shape_2_value_changed(value): func _on_lips_up_shape_2_value_changed(value):
emit_signal( "updated", "lips_up_shape_2", value ) emit_signal( "updated", "lips_up_shape_2", value )
func _on_skin_value_changed(value): func _on_skin_value_changed(value):
emit_signal( "updated", "skin", value ) emit_signal( "updated", "skin", value )
func _on_load_pressed(): func _on_load_pressed():
emit_signal( "load_pressed" ) emit_signal( "load_pressed" )
func _on_save_pressed(): func _on_save_pressed():
emit_signal( "save_pressed" ) emit_signal( "save_pressed" )
func _on_choose_pressed(): func _on_choose_pressed():
emit_signal( "choose_pressed" ) emit_signal( "choose_pressed" )
func _on_quit_pressed(): func _on_quit_pressed():
emit_signal( "quit_pressed" ) emit_signal( "quit_pressed" )
func _on_creature_creation_menu_mouse_entered(): func _on_creature_creation_menu_mouse_entered():
emit_signal( "mouse_exited_ui") emit_signal( "mouse_exited_ui")
func _on_creature_creation_menu_mouse_exited(): func _on_creature_creation_menu_mouse_exited():
emit_signal( "mouse_entered_ui") emit_signal( "mouse_entered_ui")
func _on_cloths_button_toggled(button_pressed): func _on_cloths_button_toggled(button_pressed):
emit_signal( "cloths_button_toggled", button_pressed ) emit_signal( "cloths_button_toggled", button_pressed )
if button_pressed: if button_pressed:
$margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 1.0 $margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 1.0
else: else:
$margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 0.5 $margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 0.5
func _on_underwear_button_toggled(button_pressed): func _on_underwear_button_toggled(button_pressed):
emit_signal( "underwear_button_toggled", button_pressed ) emit_signal( "underwear_button_toggled", button_pressed )
if button_pressed: if button_pressed:
$margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 1.0 $margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 1.0
else: else:
$margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 0.5 $margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 0.5
func _on_zoom_head_button_toggled(button_pressed): func _on_zoom_head_button_toggled(button_pressed):
emit_signal( "zoom_head_button_toggled", button_pressed ) emit_signal( "zoom_head_button_toggled", button_pressed )

View file

@ -7,8 +7,6 @@
[ext_resource path="res://assets/interfaces/cloth_on_icon.png" type="Texture" id=5] [ext_resource path="res://assets/interfaces/cloth_on_icon.png" type="Texture" id=5]
[ext_resource path="res://assets/interfaces/zoom_head_icon.png" type="Texture" id=6] [ext_resource path="res://assets/interfaces/zoom_head_icon.png" type="Texture" id=6]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 32 size = 32
outline_size = 1 outline_size = 1
@ -44,11 +42,11 @@ __meta__ = {
} }
[node name="window_box" type="VBoxContainer" parent="margin_box"] [node name="window_box" type="VBoxContainer" parent="margin_box"]
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 600.0 margin_bottom = 720.0
[node name="title" type="Label" parent="margin_box/window_box"] [node name="title" type="Label" parent="margin_box/window_box"]
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 64.0 margin_bottom = 64.0
rect_min_size = Vector2( 0, 64 ) rect_min_size = Vector2( 0, 64 )
size_flags_vertical = 0 size_flags_vertical = 0
@ -59,104 +57,101 @@ valign = 1
[node name="content_box" type="HBoxContainer" parent="margin_box/window_box"] [node name="content_box" type="HBoxContainer" parent="margin_box/window_box"]
margin_top = 68.0 margin_top = 68.0
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 552.0 margin_bottom = 666.0
size_flags_horizontal = 7 size_flags_horizontal = 7
size_flags_vertical = 3 size_flags_vertical = 3
[node name="tabs_box" type="TabContainer" parent="margin_box/window_box/content_box"] [node name="tabs_box" type="TabContainer" parent="margin_box/window_box/content_box"]
margin_right = 510.0 margin_right = 638.0
margin_bottom = 484.0 margin_bottom = 598.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="definition" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box"] [node name="definition" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_top = 25.0
margin_top = 39.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 6 size_flags_vertical = 6
[node name="race" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"] [node name="race" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"]
margin_right = 502.0 margin_right = 638.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 7 size_flags_horizontal = 7
alignment = 1 alignment = 1
[node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/race"] [node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/race"]
margin_top = 3.0 margin_top = 8.0
margin_right = 249.0 margin_right = 317.0
margin_bottom = 24.0 margin_bottom = 25.0
size_flags_horizontal = 11 size_flags_horizontal = 11
text = "race" text = "race"
align = 2 align = 2
[node name="value" type="MenuButton" parent="margin_box/window_box/content_box/tabs_box/definition/race"] [node name="value" type="MenuButton" parent="margin_box/window_box/content_box/tabs_box/definition/race"]
margin_left = 253.0 margin_left = 321.0
margin_right = 502.0 margin_right = 638.0
margin_bottom = 27.0 margin_bottom = 33.0
rect_min_size = Vector2( 164, 0 ) rect_min_size = Vector2( 164, 0 )
size_flags_horizontal = 3 size_flags_horizontal = 3
flat = false flat = false
[node name="sex" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"] [node name="sex" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"]
margin_top = 31.0 margin_top = 37.0
margin_right = 502.0 margin_right = 638.0
margin_bottom = 58.0 margin_bottom = 70.0
size_flags_horizontal = 7 size_flags_horizontal = 7
alignment = 1 alignment = 1
[node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/sex"] [node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/sex"]
margin_top = 3.0 margin_top = 8.0
margin_right = 249.0 margin_right = 317.0
margin_bottom = 24.0 margin_bottom = 25.0
size_flags_horizontal = 11 size_flags_horizontal = 11
text = "Sexe" text = "Sexe"
align = 2 align = 2
[node name="value" type="MenuButton" parent="margin_box/window_box/content_box/tabs_box/definition/sex"] [node name="value" type="MenuButton" parent="margin_box/window_box/content_box/tabs_box/definition/sex"]
margin_left = 253.0 margin_left = 321.0
margin_right = 502.0 margin_right = 638.0
margin_bottom = 27.0 margin_bottom = 33.0
rect_min_size = Vector2( 164, 0 ) rect_min_size = Vector2( 164, 0 )
size_flags_horizontal = 3 size_flags_horizontal = 3
flat = false flat = false
[node name="name" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"] [node name="name" type="HBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition"]
margin_top = 62.0 margin_top = 74.0
margin_right = 502.0 margin_right = 638.0
margin_bottom = 128.0 margin_bottom = 144.0
size_flags_horizontal = 7 size_flags_horizontal = 7
alignment = 1 alignment = 1
[node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/name"] [node name="label" type="Label" parent="margin_box/window_box/content_box/tabs_box/definition/name"]
margin_top = 22.0 margin_top = 26.0
margin_right = 249.0 margin_right = 317.0
margin_bottom = 43.0 margin_bottom = 43.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Nom" text = "Nom"
align = 2 align = 2
[node name="value" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition/name"] [node name="value" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/definition/name"]
margin_left = 253.0 margin_left = 321.0
margin_right = 502.0 margin_right = 638.0
margin_bottom = 66.0 margin_bottom = 70.0
rect_min_size = Vector2( 164, 0 ) rect_min_size = Vector2( 164, 0 )
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="first_name" type="LineEdit" parent="margin_box/window_box/content_box/tabs_box/definition/name/value"] [node name="first_name" type="LineEdit" parent="margin_box/window_box/content_box/tabs_box/definition/name/value"]
margin_right = 249.0 margin_right = 317.0
margin_bottom = 31.0 margin_bottom = 33.0
hint_tooltip = "Caractères interdits: : / \\ ? * \" | % < >" hint_tooltip = "Caractères interdits: : / \\ ? * \" | % < >"
size_flags_horizontal = 3 size_flags_horizontal = 3
placeholder_text = "First name" placeholder_text = "First name"
[node name="last_name" type="LineEdit" parent="margin_box/window_box/content_box/tabs_box/definition/name/value"] [node name="last_name" type="LineEdit" parent="margin_box/window_box/content_box/tabs_box/definition/name/value"]
margin_top = 35.0 margin_top = 37.0
margin_right = 249.0 margin_right = 317.0
margin_bottom = 66.0 margin_bottom = 70.0
hint_tooltip = "Caractères interdits: : / \\ ? * \" | % < >" hint_tooltip = "Caractères interdits: : / \\ ? * \" | % < >"
size_flags_horizontal = 3 size_flags_horizontal = 3
placeholder_text = "Last name" placeholder_text = "Last name"
@ -165,16 +160,13 @@ placeholder_text = "Last name"
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_top = 25.0
margin_top = 39.0
margin_right = -4.0
margin_bottom = -4.0
[node name="aspect" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/Corps"] [node name="aspect" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/Corps"]
margin_left = 125.0 margin_left = 194.0
margin_top = 22.0 margin_top = 120.0
margin_right = 376.0 margin_right = 443.0
margin_bottom = 418.0 margin_bottom = 452.0
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 6 size_flags_vertical = 6
@ -485,15 +477,13 @@ step = 0.1
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_top = 25.0
margin_top = 39.0
margin_right = -4.0
margin_bottom = -4.0
[node name="aspect" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/Tête"] [node name="aspect" type="VBoxContainer" parent="margin_box/window_box/content_box/tabs_box/Tête"]
margin_left = 100.0 margin_left = 166.0
margin_right = 402.0 margin_top = 47.0
margin_bottom = 577.0 margin_right = 472.0
margin_bottom = 526.0
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 6 size_flags_vertical = 6
@ -959,10 +949,7 @@ step = 0.1
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_top = 25.0
margin_top = 39.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 6 size_flags_vertical = 6
@ -1100,18 +1087,18 @@ value = 5.0
align = 1 align = 1
[node name="preview_box" type="VBoxContainer" parent="margin_box/window_box/content_box"] [node name="preview_box" type="VBoxContainer" parent="margin_box/window_box/content_box"]
margin_left = 514.0 margin_left = 642.0
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 484.0 margin_bottom = 598.0
size_flags_horizontal = 11 size_flags_horizontal = 11
size_flags_vertical = 3 size_flags_vertical = 3
alignment = 1 alignment = 1
[node name="v_box_container" type="VBoxContainer" parent="margin_box/window_box/content_box/preview_box"] [node name="v_box_container" type="VBoxContainer" parent="margin_box/window_box/content_box/preview_box"]
margin_left = 446.0 margin_left = 574.0
margin_top = 210.0 margin_top = 267.0
margin_right = 510.0 margin_right = 638.0
margin_bottom = 274.0 margin_bottom = 331.0
size_flags_horizontal = 10 size_flags_horizontal = 10
size_flags_vertical = 5 size_flags_vertical = 5
@ -1152,18 +1139,18 @@ icon = ExtResource( 1 )
expand_icon = true expand_icon = true
[node name="tools_box" type="HBoxContainer" parent="margin_box/window_box"] [node name="tools_box" type="HBoxContainer" parent="margin_box/window_box"]
margin_top = 556.0 margin_top = 670.0
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 583.0 margin_bottom = 703.0
[node name="buttons_box" type="HBoxContainer" parent="margin_box/window_box/tools_box"] [node name="buttons_box" type="HBoxContainer" parent="margin_box/window_box/tools_box"]
margin_right = 510.0 margin_right = 638.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="load" type="Button" parent="margin_box/window_box/tools_box/buttons_box"] [node name="load" type="Button" parent="margin_box/window_box/tools_box/buttons_box"]
margin_right = 66.0 margin_right = 74.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 4 size_flags_horizontal = 4
custom_styles/focus = SubResource( 4 ) custom_styles/focus = SubResource( 4 )
custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 ) custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 )
@ -1173,9 +1160,9 @@ custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Charger" text = "Charger"
[node name="save" type="Button" parent="margin_box/window_box/tools_box/buttons_box"] [node name="save" type="Button" parent="margin_box/window_box/tools_box/buttons_box"]
margin_left = 70.0 margin_left = 78.0
margin_right = 159.0 margin_right = 173.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 4 size_flags_horizontal = 4
custom_styles/focus = SubResource( 4 ) custom_styles/focus = SubResource( 4 )
custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 ) custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 )
@ -1185,9 +1172,9 @@ custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Enregistrer" text = "Enregistrer"
[node name="choose" type="Button" parent="margin_box/window_box/tools_box/buttons_box"] [node name="choose" type="Button" parent="margin_box/window_box/tools_box/buttons_box"]
margin_left = 163.0 margin_left = 177.0
margin_right = 223.0 margin_right = 242.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 4 size_flags_horizontal = 4
custom_styles/focus = SubResource( 4 ) custom_styles/focus = SubResource( 4 )
custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 ) custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 )
@ -1197,9 +1184,9 @@ custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Choisir" text = "Choisir"
[node name="quit" type="Button" parent="margin_box/window_box/tools_box/buttons_box"] [node name="quit" type="Button" parent="margin_box/window_box/tools_box/buttons_box"]
margin_left = 448.0 margin_left = 573.0
margin_right = 510.0 margin_right = 638.0
margin_bottom = 27.0 margin_bottom = 33.0
size_flags_horizontal = 10 size_flags_horizontal = 10
custom_styles/focus = SubResource( 4 ) custom_styles/focus = SubResource( 4 )
custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 ) custom_colors/font_color_disabled = Color( 0, 0, 0, 0.501961 )
@ -1209,22 +1196,23 @@ custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Quitter" text = "Quitter"
[node name="spacer" type="Label" parent="margin_box/window_box/tools_box"] [node name="spacer" type="Label" parent="margin_box/window_box/tools_box"]
margin_left = 514.0 margin_left = 642.0
margin_top = 3.0 margin_top = 8.0
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 24.0 margin_bottom = 25.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="tooltips" type="Label" parent="margin_box/window_box"] [node name="tooltips" type="Label" parent="margin_box/window_box"]
margin_top = 587.0 margin_top = 707.0
margin_right = 1024.0 margin_right = 1280.0
margin_bottom = 600.0 margin_bottom = 720.0
size_flags_vertical = 8 size_flags_vertical = 8
custom_fonts/font = SubResource( 5 ) custom_fonts/font = SubResource( 5 )
custom_colors/font_color = Color( 1, 1, 1, 0.501961 ) custom_colors/font_color = Color( 1, 1, 1, 0.501961 )
text = "Menu de création de créatures." text = "Menu de création de créatures."
align = 1 align = 1
valign = 1 valign = 1
[connection signal="mouse_entered" from="." to="." method="_on_creature_creation_menu_mouse_entered"] [connection signal="mouse_entered" from="." to="." method="_on_creature_creation_menu_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_creature_creation_menu_mouse_exited"] [connection signal="mouse_exited" from="." to="." method="_on_creature_creation_menu_mouse_exited"]
[connection signal="text_changed" from="margin_box/window_box/content_box/tabs_box/definition/name/value/first_name" to="." method="_on_first_name_text_changed"] [connection signal="text_changed" from="margin_box/window_box/content_box/tabs_box/definition/name/value/first_name" to="." method="_on_first_name_text_changed"]

View file

@ -5,161 +5,161 @@ var is_over_ui = false
func _ready(): func _ready():
$creature_creation_menu._on_race_id_pressed( 0 ) $creature_creation_menu._on_race_id_pressed( 0 )
$creature_creation_menu._on_sex_id_pressed( 0 ) $creature_creation_menu._on_sex_id_pressed( 0 )
if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.player: if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.player:
$creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race.hide() $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race.hide()
elif Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc: elif Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
$creature_creation_menu.max_caracteristiques_points = 999 $creature_creation_menu.max_caracteristiques_points = 999
$creature_creation_menu/margin_box/window_box/tools_box/buttons_box/choose.hide() $creature_creation_menu/margin_box/window_box/tools_box/buttons_box/choose.hide()
func _input( event ): func _input( event ):
if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 1 ): if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 1 ):
if self.character and not self.is_over_ui: if self.character and not self.is_over_ui:
self.character.rotate_y( event.relative.x *0.01 ) self.character.rotate_y( event.relative.x *0.01 )
if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 3 ): if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 3 ):
if not self.is_over_ui: if not self.is_over_ui:
if $camera.current: if $camera.current:
$camera.translation.x -= event.relative.x *0.001 $camera.translation.x -= event.relative.x *0.001
$camera.translation.y += event.relative.y *0.001 $camera.translation.y += event.relative.y *0.001
elif $camera_head.current: elif $camera_head.current:
$camera_head.translation.x -= event.relative.x *0.001 $camera_head.translation.x -= event.relative.x *0.001
$camera_head.translation.y += event.relative.y *0.001 $camera_head.translation.y += event.relative.y *0.001
if event.is_action_pressed( "camera_zoom_in" ) and not self.is_over_ui: if event.is_action_pressed( "camera_zoom_in" ) and not self.is_over_ui:
if $camera.current: if $camera.current:
$camera.size -= 0.1 $camera.size -= 0.1
elif $camera_head.current: elif $camera_head.current:
$camera_head.size -= 0.1 $camera_head.size -= 0.1
elif event.is_action_pressed( "camera_zoom_out" ) and not self.is_over_ui: elif event.is_action_pressed( "camera_zoom_out" ) and not self.is_over_ui:
if $camera.current: if $camera.current:
$camera.size += 0.1 $camera.size += 0.1
elif $camera_head.current: elif $camera_head.current:
$camera_head.size += 0.1 $camera_head.size += 0.1
func _on_creature_creation_menu_updated(value_name, value): func _on_creature_creation_menu_updated(value_name, value):
var need_model_change = false var need_model_change = false
if value_name == "race": if value_name == "race":
need_model_change = true need_model_change = true
elif value_name == "sex": elif value_name == "sex":
need_model_change = true need_model_change = true
var need_creature_update =false var need_creature_update =false
if self.character: if self.character:
self.character.get_node( "creature" ).creature.set_data( value_name, value ) self.character.get_node( "creature" ).creature.set_data( value_name, value )
need_creature_update = true need_creature_update = true
if need_model_change: if need_model_change:
var old_creature_datas = null var old_creature_datas = null
if self.character: if self.character:
old_creature_datas = self.character.get_node( "creature" ).creature old_creature_datas = self.character.get_node( "creature" ).creature
var race = old_creature_datas.get_data( "race" ) var race = old_creature_datas.get_data( "race" )
var sex = old_creature_datas.get_data( "sex" ) var sex = old_creature_datas.get_data( "sex" )
if race == Globals.RACE.human and sex == Globals.SEX.female: if race == Globals.RACE.human and sex == Globals.SEX.female:
self.character.show() self.character.show()
self.character.change_creature( "res://scenes/creatures/human/human_female.tscn" ) self.character.change_creature( "res://scenes/creatures/human/human_female.tscn" )
need_creature_update = true need_creature_update = true
elif race == Globals.RACE.human and sex == Globals.SEX.male: elif race == Globals.RACE.human and sex == Globals.SEX.male:
self.character.show() self.character.show()
self.character.change_creature( "res://scenes/creatures/human/human_male.tscn" ) self.character.change_creature( "res://scenes/creatures/human/human_male.tscn" )
need_creature_update = true need_creature_update = true
if self.character and old_creature_datas: if self.character and old_creature_datas:
self.character.get_node( "creature" ).creature = old_creature_datas self.character.get_node( "creature" ).creature = old_creature_datas
if need_creature_update: if need_creature_update:
if self.character: if self.character:
self.character.get_node( "creature" ).update() self.character.get_node( "creature" ).update()
func save_creature(): func save_creature():
if self.character: if self.character:
var emplacement = "pc" var emplacement = "pc"
if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc: if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
emplacement = "res" emplacement = "res"
self.character.get_node( "creature" ).creature.save( emplacement ) self.character.get_node( "creature" ).creature.save( emplacement )
$creature_creation_menu/margin_box/window_box/tooltips.text = "Créature enregistrée." $creature_creation_menu/margin_box/window_box/tooltips.text = "Créature enregistrée."
$creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.green ) $creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.green )
func load_creature( p_name = null ): func load_creature( p_name = null ):
var creature = null var creature = null
var race = Globals.get_race_id( $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race/value.text ) var race = Globals.get_race_id( $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race/value.text )
if race == Globals.RACE.human: if race == Globals.RACE.human:
creature = Datas.Human.new() creature = Datas.Human.new()
else: else:
creature = Datas.Creature.new() creature = Datas.Creature.new()
var filename = $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/first_name.text + "_" + $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/last_name.text+".creature" var filename = $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/first_name.text + "_" + $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/last_name.text+".creature"
if p_name: if p_name:
filename = p_name + ".creature" filename = p_name + ".creature"
if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc: if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
creature.load( "res://ressources/files/creatures/"+filename ) creature.load( "res://ressources/files/creatures/"+filename )
else: else:
creature.load( "user://saves/save_temp/ressources/files/creatures/pc/"+filename ) creature.load( "user://saves/save_temp/ressources/files/creatures/pc/"+filename )
if creature.get_filename() == "unknow.creature": if creature.get_filename() == "unknow.creature":
$creature_creation_menu/margin_box/window_box/tooltips.text = "Echec du chargement de la créature." $creature_creation_menu/margin_box/window_box/tooltips.text = "Echec du chargement de la créature."
$creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.red ) $creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.red )
else: else:
$creature_creation_menu/margin_box/window_box/tooltips.text = "Créature chargée avec succès." $creature_creation_menu/margin_box/window_box/tooltips.text = "Créature chargée avec succès."
$creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.green ) $creature_creation_menu/margin_box/window_box/tooltips.set( "custom_colors/font_color", Color.green )
$creature_creation_menu.update_sliders( creature ) $creature_creation_menu.update_sliders( creature )
func _on_creature_creation_menu_mouse_entered_ui(): func _on_creature_creation_menu_mouse_entered_ui():
self.is_over_ui = true self.is_over_ui = true
func _on_creature_creation_menu_mouse_exited_ui(): func _on_creature_creation_menu_mouse_exited_ui():
self.is_over_ui = false self.is_over_ui = false
func _on_creature_creation_menu_load_pressed(): func _on_creature_creation_menu_load_pressed():
self.load_creature() self.load_creature()
func _on_creature_creation_menu_save_pressed(): func _on_creature_creation_menu_save_pressed():
self.save_creature() self.save_creature()
func _on_creature_creation_menu_choose_pressed(): func _on_creature_creation_menu_choose_pressed():
self.save_creature() self.save_creature()
Globals.player_name = $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/first_name.text + "_" + $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/last_name.text Globals.player_name = $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/first_name.text + "_" + $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/last_name.text
Globals.goto_scene( "res://scenes/game/game.tscn" ) Globals.goto_scene( "res://scenes/game/game.tscn" )
func _on_creature_creation_menu_quit_pressed(): func _on_creature_creation_menu_quit_pressed():
Globals.goto_scene( "res://scenes/main/main.tscn" ) Globals.goto_scene( "res://scenes/main/main.tscn" )
func _on_creature_creation_menu_cloths_button_toggled(button_pressed): func _on_creature_creation_menu_cloths_button_toggled(button_pressed):
if $character/creature.creature.get_data( "sex" ) == Globals.SEX.female: if $character/creature.creature.get_data( "sex" ) == Globals.SEX.female:
if button_pressed: if button_pressed:
$character/creature/cloths/mh_human_female_tshirt.show() $character/creature/cloths/mh_human_female_tshirt.show()
$character/creature/cloths/mh_human_female_pant.show() $character/creature/cloths/mh_human_female_pant.show()
$character/creature/cloths/mh_human_female_shoes.show() $character/creature/cloths/mh_human_female_shoes.show()
else: else:
$character/creature/cloths/mh_human_female_tshirt.hide() $character/creature/cloths/mh_human_female_tshirt.hide()
$character/creature/cloths/mh_human_female_pant.hide() $character/creature/cloths/mh_human_female_pant.hide()
$character/creature/cloths/mh_human_female_shoes.hide() $character/creature/cloths/mh_human_female_shoes.hide()
elif $character/creature.creature.get_data( "sex" ) == Globals.SEX.male: elif $character/creature.creature.get_data( "sex" ) == Globals.SEX.male:
if button_pressed: if button_pressed:
$character/creature/cloths/mh_human_male_tshirt.show() $character/creature/cloths/mh_human_male_tshirt.show()
$character/creature/cloths/mh_human_male_pant.show() $character/creature/cloths/mh_human_male_pant.show()
$character/creature/cloths/mh_human_male_shoes.show() $character/creature/cloths/mh_human_male_shoes.show()
else: else:
$character/creature/cloths/mh_human_male_tshirt.hide() $character/creature/cloths/mh_human_male_tshirt.hide()
$character/creature/cloths/mh_human_male_pant.hide() $character/creature/cloths/mh_human_male_pant.hide()
$character/creature/cloths/mh_human_male_shoes.hide() $character/creature/cloths/mh_human_male_shoes.hide()
func _on_creature_creation_menu_underwear_button_toggled(button_pressed): func _on_creature_creation_menu_underwear_button_toggled(button_pressed):
pass pass
# if button_pressed: # if button_pressed:
# $character/creature/cloths/mh_human_female_underwear_top.show() # $character/creature/cloths/mh_human_female_underwear_top.show()
# $character/creature/cloths/mh_human_female_underwear_bottom.show() # $character/creature/cloths/mh_human_female_underwear_bottom.show()
@ -169,7 +169,7 @@ func _on_creature_creation_menu_underwear_button_toggled(button_pressed):
func _on_creature_creation_menu_zoom_head_button_toggled(button_pressed): func _on_creature_creation_menu_zoom_head_button_toggled(button_pressed):
if button_pressed: if button_pressed:
$camera_head.make_current() $camera_head.make_current()
else: else:
$camera.make_current() $camera.make_current()

View file

@ -26,6 +26,7 @@ gravity = 0.0
[node name="directional_light" type="DirectionalLight" parent="."] [node name="directional_light" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.98872, 2.59328 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.98872, 2.59328 )
light_specular = 0.1 light_specular = 0.1
[connection signal="choose_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_choose_pressed"] [connection signal="choose_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_choose_pressed"]
[connection signal="cloths_button_toggled" from="creature_creation_menu" to="." method="_on_creature_creation_menu_cloths_button_toggled"] [connection signal="cloths_button_toggled" from="creature_creation_menu" to="." method="_on_creature_creation_menu_cloths_button_toggled"]
[connection signal="load_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_load_pressed"] [connection signal="load_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_load_pressed"]

View file

@ -15,28 +15,28 @@ var heightmap = null
var is_on_ui = false var is_on_ui = false
func _ready(): func _ready():
var player_ra = Ra.new() var player_ra = Ra.new()
var file = File.new() var file = File.new()
if file.open("res://ressources/files/creatures/test.creature", File.READ) == OK: if file.open("res://ressources/files/creatures/test.creature", File.READ) == OK:
player_ra.from_dict( JSON.parse( file.get_as_text() ).result ) player_ra.from_dict( JSON.parse( file.get_as_text() ).result )
$game_ui/inventory_window.get_content_child( "content_box/inventory_box" ).set_inventory( player_ra.inventory ) $game_ui/inventory_window.get_content_child( "content_box/inventory_box" ).set_inventory( player_ra.inventory )
func _input( event ): func _input( event ):
# if event.is_action_released( "menu_pause" ): # if event.is_action_released( "menu_pause" ):
# Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
# $screen_box/windows/inventory_window.hide() # $screen_box/windows/inventory_window.hide()
# $screen_box/pause_menu.show() # $screen_box/pause_menu.show()
# self.get_tree().paused = true # self.get_tree().paused = true
if event.is_action_pressed( "ui_show_head_infos" ): if event.is_action_pressed( "ui_show_head_infos" ):
$creatures/player/character/head_infos_frame.visible = not $player/character/head_infos_frame.visible $creatures/player/character/head_infos_frame.visible = not $player/character/head_infos_frame.visible
for npc in $creatures/npcs.get_children(): for npc in $creatures/npcs.get_children():
npc.get_node( "head_infos_frame" ).visible = not npc.get_node( "head_infos_frame" ).visible npc.get_node( "head_infos_frame" ).visible = not npc.get_node( "head_infos_frame" ).visible
# #
@ -88,9 +88,9 @@ func _input( event ):
# else: # else:
# $game_ui/inventory_window.hide() # $game_ui/inventory_window.hide()
# #
func _process( delta ): func _process( delta ):
# $creatures/player.rotate_camera_arm( Vector3( 0.0, 1.0, 0.0 ), deg2rad( self.mouse_delta.x ) ) # $creatures/player.rotate_camera_arm( Vector3( 0.0, 1.0, 0.0 ), deg2rad( self.mouse_delta.x ) )
# #
# $creatures/player.move_camera( Vector3( 0.0, 0.0, camera_zoom ) ) # $creatures/player.move_camera( Vector3( 0.0, 0.0, camera_zoom ) )
@ -99,44 +99,44 @@ func _process( delta ):
# self.camera_zoom = 0.0 # self.camera_zoom = 0.0
# self.mouse_delta = Vector2( 0.0, 0.0 ) # self.mouse_delta = Vector2( 0.0, 0.0 )
# Water fx. # Water fx.
if $creatures/player/character.global_transform.origin.y <= ($level/demo/water.translation.y-2.5): if $creatures/player/character.global_transform.origin.y <= ($level/demo/water.translation.y-2.5):
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 1.0 ) $water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 1.0 )
else: else:
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 0.0 ) $water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 0.0 )
var trauma_value = ($game_ui/stats_window.get_content_child( "trauma" ).value / 6.0) var trauma_value = ($game_ui/stats_window.get_content_child( "trauma" ).value / 6.0)
$trauma_fx.get_surface_material( 0 ).set_shader_param( "mist_level", trauma_value ) $trauma_fx.get_surface_material( 0 ).set_shader_param( "mist_level", trauma_value )
$sky/viewport/sky.day_time_hours += delta*((6.0/24.0)/3600.0) $sky/viewport/sky.day_time_hours += delta*((6.0/24.0)/3600.0)
if $sky/viewport/sky.day_time_hours >= 24.0: if $sky/viewport/sky.day_time_hours >= 24.0:
$sky/viewport/sky.day_time_hours = $sky/viewport/sky.day_time_hours-24.0 $sky/viewport/sky.day_time_hours = $sky/viewport/sky.day_time_hours-24.0
func load_player( filename ): func load_player( filename ):
$creatures/player.load_creature( filename ) $creatures/player.load_creature( filename )
func _on_debug_window_time_of_day_changed(value): func _on_debug_window_time_of_day_changed(value):
$sky/viewport/sky.set_day_time_hours(( value )) $sky/viewport/sky.set_day_time_hours(( value ))
func _on_debug_window_mist_level_changed(value): func _on_debug_window_mist_level_changed(value):
$mist_fx.get_surface_material( 0 ).set_shader_param( "mist_level", value ) $mist_fx.get_surface_material( 0 ).set_shader_param( "mist_level", value )
func _on_debug_window_douleur_minus_pressed(): func _on_debug_window_douleur_minus_pressed():
$game_ui.change_douleur( -1 ) $game_ui.change_douleur( -1 )
func _on_debug_window_douleur_plus_pressed(): func _on_debug_window_douleur_plus_pressed():
$game_ui.change_douleur( 1 ) $game_ui.change_douleur( 1 )
func _on_debug_window_oubli_minus_pressed(): func _on_debug_window_oubli_minus_pressed():
$game_ui.change_oubli( -1 ) $game_ui.change_oubli( -1 )
func _on_debug_window_oubli_plus_pressed(): func _on_debug_window_oubli_plus_pressed():
$game_ui.change_oubli( 1 ) $game_ui.change_oubli( 1 )

View file

@ -22,95 +22,95 @@ var ra = Creatures.Ra_old.new()
var slot = null var slot = null
func _ready(): func _ready():
$viewport/spring_arm/camera.make_current() $viewport/spring_arm/camera.make_current()
func _input( event ): func _input( event ):
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.is_action_pressed( "creatures_editor_rotate_view_y" ): if event.is_action_pressed( "creatures_editor_rotate_view_y" ):
self.mouse_old_position = event.position self.mouse_old_position = event.position
elif event.is_action_released( "creatures_editor_rotate_view_y" ): elif event.is_action_released( "creatures_editor_rotate_view_y" ):
self.mouse_old_position = null self.mouse_old_position = null
self.mouse_delta = null self.mouse_delta = null
if event.is_action( "creatures_editor_zoom_in" ): if event.is_action( "creatures_editor_zoom_in" ):
self.camera_zoom += self.camera_zoom_speed self.camera_zoom += self.camera_zoom_speed
elif event.is_action( "creatures_editor_zoom_out" ): elif event.is_action( "creatures_editor_zoom_out" ):
self.camera_zoom -= self.camera_zoom_speed self.camera_zoom -= self.camera_zoom_speed
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
if not mouse_old_position == null: if not mouse_old_position == null:
self.mouse_delta = mouse_old_position - event.position self.mouse_delta = mouse_old_position - event.position
self.mouse_old_position = event.position self.mouse_old_position = event.position
func _process( delta ): func _process( delta ):
if self.mouse_delta: if self.mouse_delta:
$viewport/model/ra.rotate( Vector3( 0.0, 1.0, 0.0 ), deg2rad( -self.mouse_delta.x ) ) $viewport/model/ra.rotate( Vector3( 0.0, 1.0, 0.0 ), deg2rad( -self.mouse_delta.x ) )
self.mouse_delta = Vector2( 0.0, 0.0 ) self.mouse_delta = Vector2( 0.0, 0.0 )
if self.camera_zoom: if self.camera_zoom:
$viewport/spring_arm/camera.size += self.camera_zoom $viewport/spring_arm/camera.size += self.camera_zoom
self.camera_zoom = 0.0 self.camera_zoom = 0.0
func set_creature( p_creature ): func set_creature( p_creature ):
if p_creature is Creatures.Ra: if p_creature is Creatures.Ra:
self.ra = p_creature self.ra = p_creature
$screen_box/tools_box/boobs/value.value = p_creature.female_boobs $screen_box/tools_box/boobs/value.value = p_creature.female_boobs
$screen_box/tools_box/hip/value.value = p_creature.female_hip $screen_box/tools_box/hip/value.value = p_creature.female_hip
$screen_box/tools_box/male_scrotch/value.value = p_creature.male_pack $screen_box/tools_box/male_scrotch/value.value = p_creature.male_pack
$screen_box/tools_box/male_throat/value.value = p_creature.male_throat $screen_box/tools_box/male_throat/value.value = p_creature.male_throat
$screen_box/tools_box/pregnant/value.value = p_creature.female_pregnant $screen_box/tools_box/pregnant/value.value = p_creature.female_pregnant
$screen_box/tools_box/color/value.value = p_creature.color $screen_box/tools_box/color/value.value = p_creature.color
func _on_name_text_changed( new_text ): func _on_name_text_changed( new_text ):
self.ra.pseudonym = new_text self.ra.pseudonym = new_text
func _on_boobs_value_changed( value ): func _on_boobs_value_changed( value ):
$viewport/model/ra/model/body.set( "blend_shapes/Boobs", value ) $viewport/model/ra/model/body.set( "blend_shapes/Boobs", value )
self.ra.female_boobs = value self.ra.female_boobs = value
func _on_hip_value_changed(value): func _on_hip_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Female_hip", value ) $viewport/model/ra/model/body.set( "blend_shapes/Female_hip", value )
self.ra.female_hip = value self.ra.female_hip = value
func _on_male_scrotch_value_changed(value): func _on_male_scrotch_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Male_Pack", value ) $viewport/model/ra/model/body.set( "blend_shapes/Male_Pack", value )
self.ra.male_pack = value self.ra.male_pack = value
func _on_male_throat_value_changed(value): func _on_male_throat_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Male_Throat", value ) $viewport/model/ra/model/body.set( "blend_shapes/Male_Throat", value )
self.ra.male_throat = value self.ra.male_throat = value
func _on_pregnant_value_changed(value): func _on_pregnant_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Pregnant", value ) $viewport/model/ra/model/body.set( "blend_shapes/Pregnant", value )
self.ra.female_pregnant = value self.ra.female_pregnant = value
func _on_valid_pressed(): func _on_valid_pressed():
if not self.slot == null: if not self.slot == null:
var directory = Directory.new() var directory = Directory.new()
if not directory.dir_exists( "user://creatures/" ): if not directory.dir_exists( "user://creatures/" ):
directory.make_dir_recursive( "user://creatures/" ) directory.make_dir_recursive( "user://creatures/" )
var creature_file = File.new() var creature_file = File.new()
creature_file.open("user://creatures/slot_"+str(self.slot)+".creature", File.WRITE) creature_file.open("user://creatures/slot_"+str(self.slot)+".creature", File.WRITE)
creature_file.store_line(to_json(self.ra.to_dictionary())) creature_file.store_line(to_json(self.ra.to_dictionary()))
creature_file.close() creature_file.close()
emit_signal( "valid_pressed" ) emit_signal( "valid_pressed" )
func _on_cancel_pressed(): func _on_cancel_pressed():
emit_signal( "cancel_pressed" ) emit_signal( "cancel_pressed" )
func _on_color_changed(color): func _on_color_changed(color):
$viewport/model/ra/model/body.get_surface_material( 0 ).set_shader_param( "albedo", color ) $viewport/model/ra/model/body.get_surface_material( 0 ).set_shader_param( "albedo", color )
self.ra.color = color self.ra.color = color

View file

@ -8,7 +8,6 @@
[ext_resource path="res://assets/interfaces/slider_minus.png" type="Texture" id=6] [ext_resource path="res://assets/interfaces/slider_minus.png" type="Texture" id=6]
[ext_resource path="res://scenes/creatures/ra/ra.tscn" type="PackedScene" id=7] [ext_resource path="res://scenes/creatures/ra/ra.tscn" type="PackedScene" id=7]
[sub_resource type="ViewportTexture" id=1] [sub_resource type="ViewportTexture" id=1]
viewport_path = NodePath("viewport") viewport_path = NodePath("viewport")
@ -243,6 +242,7 @@ size = 2.0
[node name="model" type="Spatial" parent="viewport"] [node name="model" type="Spatial" parent="viewport"]
[node name="ra" parent="viewport/model" instance=ExtResource( 7 )] [node name="ra" parent="viewport/model" instance=ExtResource( 7 )]
[connection signal="text_changed" from="screen_box/tools_box/name/value" to="." method="_on_name_text_changed"] [connection signal="text_changed" from="screen_box/tools_box/name/value" to="." method="_on_name_text_changed"]
[connection signal="color_changed" from="screen_box/tools_box/color/value" to="." method="_on_color_changed"] [connection signal="color_changed" from="screen_box/tools_box/color/value" to="." method="_on_color_changed"]
[connection signal="value_changed" from="screen_box/tools_box/boobs/value" to="." method="_on_boobs_value_changed"] [connection signal="value_changed" from="screen_box/tools_box/boobs/value" to="." method="_on_boobs_value_changed"]

View file

@ -7,8 +7,8 @@ var slot = null
var creature_filename = null var creature_filename = null
func _on_select_pressed(): func _on_select_pressed():
emit_signal( "select_pressed", self.slot ) emit_signal( "select_pressed", self.slot )
func _on_delete_pressed(): func _on_delete_pressed():
emit_signal( "delete_pressed", self.slot ) emit_signal( "delete_pressed", self.slot )

View file

@ -12,30 +12,31 @@ __meta__ = {
} }
[node name="label" type="Label" parent="."] [node name="label" type="Label" parent="."]
margin_left = 547.0 margin_left = 549.0
margin_top = 353.0 margin_top = 353.0
margin_right = 608.0 margin_right = 610.0
margin_bottom = 367.0 margin_bottom = 367.0
size_flags_horizontal = 10 size_flags_horizontal = 10
custom_colors/font_color = Color( 0.0627451, 0.0313726, 0.45098, 1 ) custom_colors/font_color = Color( 0.0627451, 0.0313726, 0.45098, 1 )
text = "Anonyme" text = "Anonyme"
[node name="select" type="Button" parent="."] [node name="select" type="Button" parent="."]
margin_left = 612.0 margin_left = 614.0
margin_top = 350.0 margin_top = 350.0
margin_right = 668.0 margin_right = 665.0
margin_bottom = 370.0 margin_bottom = 370.0
size_flags_horizontal = 0 size_flags_horizontal = 0
size_flags_vertical = 6 size_flags_vertical = 6
text = "Choisir" text = "Select"
[node name="delete" type="Button" parent="."] [node name="delete" type="Button" parent="."]
margin_left = 672.0 margin_left = 669.0
margin_top = 350.0 margin_top = 350.0
margin_right = 726.0 margin_right = 733.0
margin_bottom = 370.0 margin_bottom = 370.0
size_flags_horizontal = 2 size_flags_horizontal = 2
size_flags_vertical = 6 size_flags_vertical = 6
text = "Effacer" text = "Remove"
[connection signal="pressed" from="select" to="." method="_on_select_pressed"] [connection signal="pressed" from="select" to="." method="_on_select_pressed"]
[connection signal="pressed" from="delete" to="." method="_on_delete_pressed"] [connection signal="pressed" from="delete" to="." method="_on_delete_pressed"]

View file

@ -8,47 +8,47 @@ var slots_number = 0
var slots = {} var slots = {}
func _ready(): func _ready():
var files = [] var files = []
var directory = Directory.new() var directory = Directory.new()
if directory.dir_exists( "user://creatures/" ): if directory.dir_exists( "user://creatures/" ):
directory.open( "user://creatures/" ) directory.open( "user://creatures/" )
directory.list_dir_begin() directory.list_dir_begin()
while true: while true:
var file = directory.get_next() var file = directory.get_next()
if file == "": if file == "":
break break
elif not file.begins_with( "." ) and not directory.current_is_dir(): elif not file.begins_with( "." ) and not directory.current_is_dir():
files.append( file ) files.append( file )
directory.list_dir_end() directory.list_dir_end()
for file in files: for file in files:
var creature_box = preload( "res://scenes/interfaces/creatures_menu/creature_box.tscn" ).instance() var creature_box = preload( "res://scenes/interfaces/creatures_menu/creature_box.tscn" ).instance()
creature_box.get_node( "label" ).text = file creature_box.get_node( "label" ).text = file
creature_box.slot = self.slots_number creature_box.slot = self.slots_number
creature_box.creature_filename = file creature_box.creature_filename = file
creature_box.connect( "select_pressed", self, "_on_creature_box_select_pressed" ) creature_box.connect( "select_pressed", self, "_on_creature_box_select_pressed" )
creature_box.connect( "delete_pressed", self, "_on_creature_box_delete_pressed" ) creature_box.connect( "delete_pressed", self, "_on_creature_box_delete_pressed" )
$screen_box/scroll_container/v_box_container/creatures_box.add_child( creature_box ) $screen_box/scroll_container/v_box_container/creatures_box.add_child( creature_box )
self.slots[ self.slots_number ] = creature_box self.slots[ self.slots_number ] = creature_box
self.slots_number += 1 self.slots_number += 1
var creature = Creatures.Ra_old2.new() var creature = Creatures.Ra_old2.new()
creature.from_file( file ) creature.from_file( file )
creature_box.get_node( "label" ).text = creature.pseudonym creature_box.get_node( "label" ).text = creature.pseudonym
func _on_new_pressed(): func _on_new_pressed():
emit_signal( "new_pressed", self.slots_number ) emit_signal( "new_pressed", self.slots_number )
func _on_cancel_pressed(): func _on_cancel_pressed():
emit_signal( "cancel_pressed" ) emit_signal( "cancel_pressed" )
func _on_creature_box_select_pressed( slot ): func _on_creature_box_select_pressed( slot ):
emit_signal( "select_pressed", self.slots[ slot ].creature_filename ) emit_signal( "select_pressed", self.slots[ slot ].creature_filename )
func _on_creature_box_delete_pressed( slot ): func _on_creature_box_delete_pressed( slot ):
if self.slots[ slot ].creature_filename: if self.slots[ slot ].creature_filename:
var dir = Directory.new() var dir = Directory.new()
dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename ) dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename )
self.slots[ slot ].queue_free() self.slots[ slot ].queue_free()

View file

@ -48,19 +48,20 @@ size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="new" type="Button" parent="screen_box/scroll_container/v_box_container"] [node name="new" type="Button" parent="screen_box/scroll_container/v_box_container"]
margin_left = 196.0 margin_left = 244.0
margin_top = 330.0 margin_top = 330.0
margin_right = 404.0 margin_right = 355.0
margin_bottom = 363.0 margin_bottom = 363.0
size_flags_horizontal = 4 size_flags_horizontal = 4
text = "Créer une nouvel créature." text = "New creature"
[node name="cancel" type="Button" parent="screen_box/scroll_container/v_box_container"] [node name="cancel" type="Button" parent="screen_box/scroll_container/v_box_container"]
margin_left = 268.0 margin_left = 267.0
margin_top = 367.0 margin_top = 367.0
margin_right = 332.0 margin_right = 332.0
margin_bottom = 400.0 margin_bottom = 400.0
size_flags_horizontal = 4 size_flags_horizontal = 4
text = "Retour" text = "Cancel"
[connection signal="pressed" from="screen_box/scroll_container/v_box_container/new" to="." method="_on_new_pressed"] [connection signal="pressed" from="screen_box/scroll_container/v_box_container/new" to="." method="_on_new_pressed"]
[connection signal="pressed" from="screen_box/scroll_container/v_box_container/cancel" to="." method="_on_cancel_pressed"] [connection signal="pressed" from="screen_box/scroll_container/v_box_container/cancel" to="." method="_on_cancel_pressed"]

View file

@ -2,46 +2,46 @@ extends Control
func change_douleur( value ): func change_douleur( value ):
$stats_window.get_content_child( "douleur" ).value += value $stats_window.get_content_child( "douleur" ).value += value
if value > 0.0: if value > 0.0:
$stats_window.get_content_child( "oubli" ).value -= value/2 $stats_window.get_content_child( "oubli" ).value -= value/2
func change_oubli( value ): func change_oubli( value ):
$stats_window.get_content_child( "oubli" ).value += value $stats_window.get_content_child( "oubli" ).value += value
if value > 0.0: if value > 0.0:
$stats_window.get_content_child( "douleur" ).value -= value/2 $stats_window.get_content_child( "douleur" ).value -= value/2
func change_trauma( value ): func change_trauma( value ):
$stats_window.get_content_child( "trauma" ).self_modulate.a += value/6.0 $stats_window.get_content_child( "trauma" ).self_modulate.a += value/6.0
func set_douleur( value ): func set_douleur( value ):
var delta = value - $stats_window.get_content_child( "douleur" ).value var delta = value - $stats_window.get_content_child( "douleur" ).value
$stats_window.get_content_child( "douleur" ).value = value $stats_window.get_content_child( "douleur" ).value = value
if delta > 0.0: if delta > 0.0:
$stats_window.get_content_child( "oubli" ).value -= delta/2 $stats_window.get_content_child( "oubli" ).value -= delta/2
func set_oubli( value ): func set_oubli( value ):
var delta = value - $stats_window.get_content_child( "oubli" ).value var delta = value - $stats_window.get_content_child( "oubli" ).value
$stats_window.get_content_child( "oubli" ).value = value $stats_window.get_content_child( "oubli" ).value = value
if delta > 0.0: if delta > 0.0:
$stats_window.get_content_child( "douleur" ).value -= delta/2 $stats_window.get_content_child( "douleur" ).value -= delta/2
func set_trauma( value ): func set_trauma( value ):
$stats_window.get_content_child( "trauma" ).self_modulate.a = value/6.0 $stats_window.get_content_child( "trauma" ).self_modulate.a = value/6.0
func update_trauma(): func update_trauma():
var trauma_value = (($stats_window.get_content_child( "oubli" ).value+$stats_window.get_content_child( "douleur" ).value)/2) var trauma_value = (($stats_window.get_content_child( "oubli" ).value+$stats_window.get_content_child( "douleur" ).value)/2)
$stats_window.get_content_child( "trauma" ).value = trauma_value $stats_window.get_content_child( "trauma" ).value = trauma_value
$stats_window.get_content_child( "trauma" ).self_modulate.a = trauma_value/6.0 $stats_window.get_content_child( "trauma" ).self_modulate.a = trauma_value/6.0
func _on_douleur_value_changed(value): func _on_douleur_value_changed(value):
$stats_window.get_content_child( "douleur" ).self_modulate.a = (value / 18.0) * (value / 18.0) $stats_window.get_content_child( "douleur" ).self_modulate.a = (value / 18.0) * (value / 18.0)
self.update_trauma() self.update_trauma()
func _on_oubli_value_changed(value): func _on_oubli_value_changed(value):
$stats_window.get_content_child( "oubli" ).self_modulate.a = (value / 18.0) * (value / 18.0) $stats_window.get_content_child( "oubli" ).self_modulate.a = (value / 18.0) * (value / 18.0)
self.update_trauma() self.update_trauma()
func _on_trauma_value_changed(value): func _on_trauma_value_changed(value):
$stats_window.get_content_child( "trauma" ).self_modulate.a = (value / 6.0) $stats_window.get_content_child( "trauma" ).self_modulate.a = (value / 6.0)

View file

@ -74,6 +74,7 @@ __meta__ = {
margin_left = 0.0 margin_left = 0.0
margin_right = 128.0 margin_right = 128.0
margin_bottom = 128.0 margin_bottom = 128.0
[connection signal="value_changed" from="stats_window/douleur" to="." method="_on_douleur_value_changed"] [connection signal="value_changed" from="stats_window/douleur" to="." method="_on_douleur_value_changed"]
[connection signal="value_changed" from="stats_window/oubli" to="." method="_on_oubli_value_changed"] [connection signal="value_changed" from="stats_window/oubli" to="." method="_on_oubli_value_changed"]
[connection signal="value_changed" from="stats_window/trauma" to="." method="_on_trauma_value_changed"] [connection signal="value_changed" from="stats_window/trauma" to="." method="_on_trauma_value_changed"]

View file

@ -5,11 +5,22 @@ signal play_pressed
signal quit_pressed signal quit_pressed
func close(): func close():
self.hide() self.hide()
func _on_play_pressed(): func _on_play_pressed():
emit_signal( "play_pressed" ) emit_signal( "play_pressed" )
func _on_quitter_pressed(): func _on_quitter_pressed():
emit_signal( "quit_pressed" ) emit_signal( "quit_pressed" )
func _on_control_quit_pressed():
emit_signal( "quit_pressed" )
func _on_control_mute_pressed():
#Config.msg_debug("")
#emit_signal( "mute_pressed" )
pass
#func _on_main_menu_mute_pressed():
# Config.msg_debug("_on_main_menu_mute_pressed")
# emit_signal( "mute_pressed" )

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/interfaces/Login-Khanat-background.png" type="Texture" id=1] [ext_resource path="res://assets/interfaces/Login-Khanat-background.png" type="Texture" id=1]
[ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=2] [ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=2]
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.gd" type="Script" id=3] [ext_resource path="res://scenes/interfaces/main_menu/main_menu.gd" type="Script" id=3]
[ext_resource path="res://scenes/interfaces/options/options.tscn" type="PackedScene" id=4]
[node name="main_menu" type="Control"] [node name="main_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -51,7 +52,7 @@ autowrap = true
margin_top = 21.0 margin_top = 21.0
margin_right = 256.0 margin_right = 256.0
margin_bottom = 54.0 margin_bottom = 54.0
text = "Jouer" text = "MAIN_MENU_PLAY"
[node name="username" type="LineEdit" parent="screen_box/login_box"] [node name="username" type="LineEdit" parent="screen_box/login_box"]
margin_top = 58.0 margin_top = 58.0
@ -59,7 +60,7 @@ margin_right = 256.0
margin_bottom = 91.0 margin_bottom = 91.0
rect_min_size = Vector2( 256, 0 ) rect_min_size = Vector2( 256, 0 )
align = 1 align = 1
placeholder_text = "Username" placeholder_text = "MAIN_MENU_USERNAME"
[node name="password" type="LineEdit" parent="screen_box/login_box"] [node name="password" type="LineEdit" parent="screen_box/login_box"]
margin_top = 95.0 margin_top = 95.0
@ -68,12 +69,21 @@ margin_bottom = 128.0
rect_min_size = Vector2( 256, 0 ) rect_min_size = Vector2( 256, 0 )
align = 1 align = 1
secret = true secret = true
placeholder_text = "Password" placeholder_text = "MAIN_MENU_PASSWORD"
[node name="quitter" type="Button" parent="screen_box/login_box"] [node name="quit" type="Button" parent="screen_box/login_box"]
margin_top = 132.0 margin_top = 132.0
margin_right = 256.0 margin_right = 256.0
margin_bottom = 165.0 margin_bottom = 165.0
text = "Quitter" text = "MAIN_MENU_QUIT"
[node name="control" parent="." instance=ExtResource( 4 )]
anchor_left = 1.0
anchor_bottom = 0.0
margin_bottom = 0.0
size_flags_horizontal = 8
size_flags_vertical = 2
[connection signal="pressed" from="screen_box/login_box/play" to="." method="_on_play_pressed"] [connection signal="pressed" from="screen_box/login_box/play" to="." method="_on_play_pressed"]
[connection signal="pressed" from="screen_box/login_box/quitter" to="." method="_on_quitter_pressed"] [connection signal="pressed" from="screen_box/login_box/quit" to="." method="_on_quitter_pressed"]
[connection signal="quit_pressed" from="control" to="." method="_on_control_quit_pressed"]

View file

@ -5,4 +5,4 @@ signal music_selected( filename )
var music_filename = "" var music_filename = ""
func _on_music_button_pressed(): func _on_music_button_pressed():
emit_signal( "music_selected", self.music_filename ) emit_signal( "music_selected", self.music_filename )

View file

@ -9,4 +9,5 @@ script = ExtResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[connection signal="pressed" from="." to="." method="_on_music_button_pressed"] [connection signal="pressed" from="." to="." method="_on_music_button_pressed"]

View file

@ -1,41 +1,117 @@
extends WindowDialog extends WindowDialog
onready var audio_player = $music
func load_external_music(filepath):
var stream = null
Config.msg_debug("")
var file = File.new()
file.open(filepath, file.READ)
var ext = filepath.split(".")[-1].to_lower()
var buffer = file.get_buffer(file.get_len())
Config.msg_debug(ext)
match ext:
"ogg":
stream = AudioStreamOGGVorbis.new()
"mp3":
stream = AudioStreamMP3.new()
#"wav":
# # We need decode message to get format
# stream = AudioStreamSample.new()
# stream.format = AudioStreamSample.FORMAT_16_BITS
# #stream.stereo = true
_:
Config.msg_error("Impossible to identify type of file (file:" + filepath + ", ext:" + ext + ")")
return
stream.data = buffer
audio_player.stream = stream
Config.msg_debug("")
func _ready(): func _ready():
var directory = Directory.new() var directory = Directory.new()
get_tree().paused = false
if not directory.dir_exists( "user://musics/" ): Config.msg_debug("")
directory.make_dir_recursive( "user://musics/" )
directory.open( "user://musics/" ) if not directory.dir_exists( "user://musics/" ):
directory.list_dir_begin() directory.make_dir_recursive( "user://musics/" )
var files = [] directory.open( "user://musics/" )
while true: directory.list_dir_begin()
var file = directory.get_next() var files = []
if file == "": while true:
break var file = directory.get_next()
elif not file.begins_with(".") and not directory.current_is_dir() and not file.ends_with( ".import" ): if file == "":
files.append(file) break
directory.list_dir_end() elif not file.begins_with(".") and not directory.current_is_dir() and not file.ends_with( ".import" ):
files.append(file)
for file in files: directory.list_dir_end()
var button = preload( "res://scenes/interfaces/music_manager/music_button.tscn" ).instance()
button.music_filename = file for file in files:
button.text = file var button = preload( "res://scenes/interfaces/music_manager/music_button.tscn" ).instance()
button.connect( "music_selected", self, "_on_music_pressed" ) button.music_filename = "res://assets/musics/" + file
$window_box/scroll_box/musics_box.add_child( button ) button.text = file
button.connect( "music_selected", self, "_on_music_pressed" )
$window_box/scroll_box/musics_box.add_child( button )
audio_player.stream = load( "res://assets/musics/sangakanat_ames_voyageuses.ogg" )
#add_music(audio_player)
#audio_player.set_volume_db(linear2db(0.5))
#audio_player.set_volume_db(1.0)
audio_player.play()
#audio_player.set_volume_db(1.0)
#audioPlayer.play()
update_volume_db()
Config.msg_debug("Load End")
func update_volume_db():
if Config.mute:
audio_player.set_volume_db(linear2db(0.0))
audio_player.set_pause_mode(true)
return
var lvl = Config.sound_lvl_global * Config.sound_lvl_music / 10000.0
audio_player.set_volume_db(linear2db(lvl))
audio_player.set_pause_mode(false)
func set_sound_mute(value: bool):
Config.set_sound_mute(value)
update_volume_db()
func set_level_global(value: int):
Config.sound_lvl_global = value
update_volume_db()
func set_level_music(value: int):
Config.sound_lvl_music = value
update_volume_db()
func set_level_effect(value: int):
Config.sound_lvl_effect = value
update_volume_db()
func add_music(file):
var button = preload( "res://scenes/interfaces/music_manager/music_button.tscn" ).instance()
button.music_filename = file
button.text = file
button.connect( "music_selected", self, "_on_music_pressed" )
$window_box/scroll_box/musics_box.add_child( button )
func open(): func open():
self.popup() self.popup()
func close(): func close():
self.hide() self.hide()
func toggle(): func toggle():
if self.visible: if self.visible:
self.close() self.close()
else: else:
self.open() self.open()
func _on_music_pressed( p_filename ): func _on_music_pressed( p_filename ):
$music.stream = load( "res://assets/musics/" + p_filename ) Config.msg_debug(p_filename)
$music.play() #audio_player.stream = load( p_filename )
#audio_player.set_volume_db(1.0)
#audio_player.play()
#$music.stream = load( p_filename )
#$music.play()

View file

@ -32,8 +32,8 @@ __meta__ = {
} }
[node name="controls_box" type="HBoxContainer" parent="window_box"] [node name="controls_box" type="HBoxContainer" parent="window_box"]
margin_left = 26.0 margin_left = 90.0
margin_right = 102.0 margin_right = 166.0
margin_bottom = 16.0 margin_bottom = 16.0
size_flags_horizontal = 6 size_flags_horizontal = 6
@ -62,14 +62,14 @@ texture_normal = ExtResource( 3 )
[node name="scroll_box" type="ScrollContainer" parent="window_box"] [node name="scroll_box" type="ScrollContainer" parent="window_box"]
margin_top = 20.0 margin_top = 20.0
margin_right = 128.0 margin_right = 256.0
margin_bottom = 128.0 margin_bottom = 128.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="musics_box" type="VBoxContainer" parent="window_box/scroll_box"] [node name="musics_box" type="VBoxContainer" parent="window_box/scroll_box"]
margin_left = 64.0 margin_left = 128.0
margin_right = 64.0 margin_right = 128.0
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 2 size_flags_vertical = 2

View file

@ -0,0 +1,72 @@
extends Control
func read_license(key):
var file = File.new()
var filenews = ""
if key.empty():
filenews = "res://LICENSE"
else:
filenews = "res://LICENSE_" + key
if file.file_exists(filenews):
#print(filenews + " exist ! ")
file.open(filenews, File.READ)
var content = file.get_as_text()
file.close()
$window_dialog/margin_container/v_box_container/tab_container/OPTION_INFO_LICENSE.text = content
return true
return false
func load_license():
var current_locale = TranslationServer.get_locale()
var root_language = current_locale.split('_')[0]
var file = File.new()
var filenews = ""
if read_license(current_locale):
pass
elif read_license(root_language):
pass
elif read_license(""):
pass
func read_authors(key):
var file = File.new()
var filenews = ""
if key.empty():
filenews = "res://AUTHORS"
else:
filenews = "res://AUTHORS_" + key
if file.file_exists(filenews):
#print(filenews + " exist ! ")
file.open(filenews, File.READ)
var content = file.get_as_text()
file.close()
$window_dialog/margin_container/v_box_container/tab_container/OPTION_INFO_AUTHORS.text = content
return true
return false
func load_authors():
var current_locale = TranslationServer.get_locale()
var root_language = current_locale.split('_')[0]
var file = File.new()
var filenews = ""
if read_authors(current_locale):
pass
elif read_authors(root_language):
pass
elif read_authors(""):
pass
# Called when the node enters the scene tree for the first time.
func _ready():
load_authors()
load_license()
func _on_button_pressed():
$window_dialog.hide()

View file

@ -0,0 +1,80 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/options/option_info.gd" type="Script" id=1]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="window_dialog" type="WindowDialog" parent="."]
visible = true
margin_left = 247.505
margin_top = 164.032
margin_right = 927.505
margin_bottom = 558.032
window_title = "OPTION_INFO_TITLE"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="margin_container" type="MarginContainer" parent="window_dialog"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="v_box_container" type="VBoxContainer" parent="window_dialog/margin_container"]
margin_left = 5.0
margin_top = 5.0
margin_right = 675.0
margin_bottom = 389.0
custom_constants/separation = 5
[node name="tab_container" type="TabContainer" parent="window_dialog/margin_container/v_box_container"]
margin_right = 670.0
margin_bottom = 359.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OPTION_INFO_AUTHORS" type="TextEdit" parent="window_dialog/margin_container/v_box_container/tab_container"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 3
size_flags_vertical = 3
readonly = true
[node name="OPTION_INFO_LICENSE" type="TextEdit" parent="window_dialog/margin_container/v_box_container/tab_container"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="button" type="Button" parent="window_dialog/margin_container/v_box_container"]
margin_top = 364.0
margin_right = 670.0
margin_bottom = 384.0
text = "OPTION_INFO_EXIT"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="window_dialog/margin_container/v_box_container/button" to="." method="_on_button_pressed"]

View file

@ -0,0 +1,46 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
$window_dialog/margin_container/v_box_container/option_button.clear()
var id = 0
var selected = -1
var near_selected = -1
var current_locale = TranslationServer.get_locale()
var root_language = current_locale.split('_')[0]
for key in TranslationServer.get_loaded_locales():
if key == TranslationServer.get_locale():
selected = id
else:
var tmp = key.split("_")
# print("tmp:" + tmp[0])
if tmp[0] == root_language:
if tmp.size() == 1:
near_selected = id
elif near_selected == -1:
near_selected = id
$window_dialog/margin_container/v_box_container/option_button.add_item(TranslationServer.get_locale_name(key) + " [" + key + "]", id)
id += 1
if selected == -1 and near_selected != -1:
selected = near_selected
if selected == -1:
# Your language not exist, create it just for the form
var key = TranslationServer.get_locale()
$window_dialog/margin_container/v_box_container/option_button.add_item(TranslationServer.get_locale_name(key) + " (" + key + " !)", id)
selected = id
$window_dialog/margin_container/v_box_container/option_button.select(selected)
func _on_option_button_item_selected(index):
var id = 0
for key in TranslationServer.get_loaded_locales():
if id == $window_dialog/margin_container/v_box_container/option_button.get_selected():
TranslationServer.set_locale(key)
return
id += 1
func _on_button_pressed():
$window_dialog.hide()

View file

@ -0,0 +1,66 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/options/option_language.gd" type="Script" id=1]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="window_dialog" type="WindowDialog" parent="."]
margin_left = 448.0
margin_top = 216.0
margin_right = 795.0
margin_bottom = 340.0
popup_exclusive = true
window_title = "OPTION_LANGUAGE_SELECT_YOUR_LANGUAGE"
resizable = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="margin_container" type="MarginContainer" parent="window_dialog"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="v_box_container" type="VBoxContainer" parent="window_dialog/margin_container"]
margin_left = 5.0
margin_top = 5.0
margin_right = 342.0
margin_bottom = 119.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 5
[node name="option_button" type="OptionButton" parent="window_dialog/margin_container/v_box_container"]
margin_right = 337.0
margin_bottom = 89.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="button" type="Button" parent="window_dialog/margin_container/v_box_container"]
margin_top = 94.0
margin_right = 337.0
margin_bottom = 114.0
text = "OPTION_LANGUAGE_EXIT"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="item_selected" from="window_dialog/margin_container/v_box_container/option_button" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="window_dialog/margin_container/v_box_container/button" to="." method="_on_button_pressed"]

View file

@ -0,0 +1,58 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func read_news(key):
var file = File.new()
var filenews = ""
if key.empty():
filenews = "res://NEWS"
else:
filenews = "res://NEWS_" + key
if file.file_exists(filenews):
#print(filenews + " exist ! ")
file.open(filenews, File.READ)
var content = file.get_as_text()
file.close()
#print(content)
#$accept_dialog.dialog_text = content
$window_dialog/margin_container/v_box_container/text_edit.text = content
return true
return false
func load_news():
var current_locale = TranslationServer.get_locale()
var root_language = current_locale.split('_')[0]
var file = File.new()
var filenews = ""
if read_news(current_locale):
pass
elif read_news(root_language):
pass
elif read_news(""):
pass
func _on_accept_dialog_visibility_changed():
if $accept_dialog.visible:
print("show")
load_news()
func _on_accept_dialog_hide():
$accept_dialog.dialog_text = ""
func _on_button_pressed():
$window_dialog.hide()
func _on_window_dialog_visibility_changed():
if $window_dialog.visible:
load_news()

View file

@ -0,0 +1,74 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/options/option_news.gd" type="Script" id=1]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 3.48987
margin_top = -2.90425
margin_right = 3.48987
margin_bottom = -2.90424
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="window_dialog" type="WindowDialog" parent="."]
visible = true
margin_left = 362.868
margin_top = 192.977
margin_right = 944.868
margin_bottom = 513.977
window_title = "OPTION_NEWS_TITLE"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="margin_container" type="MarginContainer" parent="window_dialog"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="v_box_container" type="VBoxContainer" parent="window_dialog/margin_container"]
margin_left = 5.0
margin_top = 5.0
margin_right = 577.0
margin_bottom = 316.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="text_edit" type="TextEdit" parent="window_dialog/margin_container/v_box_container"]
margin_right = 572.0
margin_bottom = 286.0
size_flags_horizontal = 3
size_flags_vertical = 3
readonly = true
syntax_highlighting = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="button" type="Button" parent="window_dialog/margin_container/v_box_container"]
margin_top = 291.0
margin_right = 572.0
margin_bottom = 311.0
text = "OPTION_NEWS_EXIT"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="visibility_changed" from="window_dialog" to="." method="_on_window_dialog_visibility_changed"]
[connection signal="pressed" from="window_dialog/margin_container/v_box_container/button" to="." method="_on_button_pressed"]

View file

@ -0,0 +1,185 @@
extends Control
signal mute_pressed
var slots_number = 0
var slots = {}
var firstime = false
# Called when the node enters the scene tree for the first time.
func _ready():
# default video configuration
if Config.video_default:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8/default.pressed = true
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video.visible = false
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8/default.pressed = false
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video.visible = true
# Font size
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_9/font.value = Config.font_size
# window fullscreen
if ProjectSettings.has_setting( "display/window/size/fullscreen" ):
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container/fullscreen.pressed = Config.window_fullscreen
# ProjectSettings.get_setting( "display/window/size/fullscreen" )
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container/fullscreen.disabled = false
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container/fullscreen.disabled = true
# window borderless
if ProjectSettings.has_setting( "display/window/size/borderless" ):
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2/borderless.pressed = Config.window_borderless
# ProjectSettings.get_setting( "display/window/size/borderless" )
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2/borderless.disabled = false
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2/borderless.disabled = true
# window resizable
if ProjectSettings.has_setting( "display/window/size/resizable" ):
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3/resizable.pressed = Config.window_resizable
# ProjectSettings.get_setting( "display/window/size/resizable" )
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3/resizable.disabled = false
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3/resizable.disabled = true
# Screen number
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4/screen.min_value = 0
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4/screen.max_value = OS.get_screen_count() - 1
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4/screen.value = OS.current_screen
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4/screen.editable = true
# Screen orientation
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_5/orientation.value = OS.get_screen_orientation()
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_5/orientation.editable = true
# always_on_top
if ProjectSettings.has_setting( "display/window/size/always_on_top" ):
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6/always_on_top.pressed = OS.is_keep_screen_on()
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6/always_on_top.disabled = false
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6/always_on_top.disabled = true
# window maximized
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_7/window_maximized.pressed = Config.window_maximized
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_7/window_maximized.disabled = false
# Level sound
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_3/sound_lvl_global.value = Config.sound_lvl_global
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_6/sound_lvl_music.value = Config.sound_lvl_music
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_4/sound_lvl_effect.value = Config.sound_lvl_effect
# Mute
#$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute
update_mute()
func update_mute():
Config.msg_debug("")
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute
func _on_fullscreen_toggled(button_pressed):
Config.set_window_fullscreen(button_pressed)
func _on_borderless_toggled(button_pressed):
Config.set_window_borderless(button_pressed)
func _on_resizable_toggled(button_pressed):
Config.set_window_resizable(button_pressed)
func _on_window_maximized_toggled(button_pressed):
Config.set_window_maximized(button_pressed)
func _on_screen_value_changed(value):
Config.set_current_screen(value)
# SCREEN_ORIENTATION_LANDSCAPE = 0 Landscape screen orientation.
# SCREEN_ORIENTATION_PORTRAIT = 1 Portrait screen orientation.
# SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 2 Reverse landscape screen orientation.
# SCREEN_ORIENTATION_REVERSE_PORTRAIT = 3 Reverse portrait screen orientation.
# SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 4 Uses landscape or reverse landscape based on the hardware sensor.
# SCREEN_ORIENTATION_SENSOR_PORTRAIT = 5 Uses portrait or reverse portrait based on the hardware sensor.
# SCREEN_ORIENTATION_SENSOR = 6 Uses most suitable orientation based on
func _on_orientation_value_changed(value):
# display/window/handheld/orientation
#print(OS.screen_orientation)
#print(ProjectSettings.get_setting("display/window/handheld/orientation"))
#if ProjectSettings.has_setting( "display/window/handheld/orientation" ):
# ProjectSettings.set_setting("display/window/handheld/orientation", value)
##OS.screen_orientation = value
#print(OS.get_screen_orientation())
Config.set_screen_orientation(value)
#OS.set_screen_orientation(value)
func _on_always_on_top_toggled(button_pressed):
Config.set_window_always_on_top(button_pressed)
func _on_add_music_pressed():
pass # Replace with function body.
$file_dialog.show()
func _on_file_dialog_files_selected(paths):
print("multi files")
for path in paths:
var found = false
for slot in self.slots:
if self.slots[slot].music_filename == path:
found = true
continue
if found:
continue
var music_box = preload( "res://scenes/interfaces/options/option_settings_music_box.tscn" ).instance()
music_box.get_node( "label" ).text = path
#music_box.enable.pressed = true
#music_box.zone = "All"
music_box.slot = self.slots_number
music_box.music_filename = path
#creature_box.connect( "select_pressed", self, "_on_creature_box_select_pressed" )
music_box.connect( "delete_pressed", self, "_on_music_box_delete_pressed" )
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/scroll_container/list_music.add_child(music_box)
MusicManager.add_music(path)
self.slots[ self.slots_number ] = music_box
self.slots_number += 1
func _on_music_box_delete_pressed( slot ):
if self.slots[ slot ].music_filename:
#var dir = Directory.new()
#dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename )
pass
self.slots[ slot ].queue_free()
func _on_default_toggled(button_pressed):
if button_pressed:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8/default.pressed = true
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video.visible = false
Config.enable_window_default()
else:
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8/default.pressed = false
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video.visible = true
Config.disable_window_default()
Config.set_video_default(button_pressed)
func _on_font_value_changed(value):
var valueint = int(value)
Config.set_font_size(value)
func _on_sound_lvl_global_value_changed(value):
MusicManager.set_level_global(int(value))
func _on_sound_lvl_music_value_changed(value):
MusicManager.set_level_music(int(value))
func _on_sound_lvl_effect_value_changed(value):
MusicManager.set_level_effect(int(value))
func _on_ok_pressed():
$file_dialog.hide()
$window_dialog.hide()
Config.save_config()
func _on_window_dialog_hide():
$file_dialog.hide()
if firstime:
Config.save_config()
func _on_window_dialog_draw():
firstime = true
func _on_mute_toggled(button_pressed):
Config.msg_debug("")
MusicManager.set_sound_mute(button_pressed)
emit_signal( "mute_pressed" )
#func _on_control_mute_pressed():
# update_mute()

View file

@ -0,0 +1,445 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/options/option_settings.gd" type="Script" id=1]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="window_dialog" type="WindowDialog" parent="."]
margin_left = 55.2183
margin_top = 62.4725
margin_right = 1231.22
margin_bottom = 674.473
__meta__ = {
"_edit_use_anchors_": false
}
[node name="margin_container" type="MarginContainer" parent="window_dialog"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="v_box_container" type="VBoxContainer" parent="window_dialog/margin_container"]
margin_left = 5.0
margin_top = 5.0
margin_right = 1171.0
margin_bottom = 607.0
custom_constants/separation = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="tab_container" type="TabContainer" parent="window_dialog/margin_container/v_box_container"]
margin_right = 1166.0
margin_bottom = 577.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/label_valign_fg = 0
custom_constants/hseparation = 0
custom_constants/label_valign_bg = 0
custom_constants/top_margin = 0
custom_constants/side_margin = 0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OPTION_SETTINGS_VIDEO" type="VBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="h_box_container_8" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO"]
margin_right = 1158.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8"]
margin_left = 349.0
margin_top = 5.0
margin_right = 577.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_DEFAULT"
[node name="default" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8"]
margin_left = 581.0
margin_right = 605.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_9" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO"]
margin_top = 28.0
margin_right = 1158.0
margin_bottom = 52.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_9"]
margin_left = 338.0
margin_top = 5.0
margin_right = 577.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_SIZE_FONT"
[node name="font" type="SpinBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_9"]
margin_left = 581.0
margin_right = 655.0
margin_bottom = 24.0
size_flags_horizontal = 2
min_value = 8.0
value = 8.0
[node name="settings_video" type="GridContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO"]
margin_top = 56.0
margin_right = 1158.0
margin_bottom = 158.0
custom_constants/vseparation = 2
custom_constants/hseparation = 0
columns = 2
[node name="h_box_container" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_right = 579.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container"]
margin_left = 38.0
margin_top = 5.0
margin_right = 287.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_FULLSCREEN"
[node name="fullscreen" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container"]
margin_left = 291.0
margin_right = 315.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_2" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_left = 579.0
margin_right = 1158.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2"]
margin_left = 35.0
margin_top = 5.0
margin_right = 287.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_BORDERLESS"
[node name="borderless" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2"]
margin_left = 291.0
margin_right = 315.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_7" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_top = 26.0
margin_right = 579.0
margin_bottom = 50.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_7"]
margin_top = 5.0
margin_right = 315.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_WINDOW_MAXIMIZED"
[node name="window_maximized" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_7"]
margin_left = 319.0
margin_right = 343.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_3" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_left = 579.0
margin_top = 26.0
margin_right = 1158.0
margin_bottom = 50.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3"]
margin_left = 49.0
margin_top = 5.0
margin_right = 287.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_RESIZABLE"
[node name="resizable" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3"]
margin_left = 291.0
margin_right = 315.0
margin_bottom = 24.0
size_flags_horizontal = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="h_box_container_4" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_top = 52.0
margin_right = 579.0
margin_bottom = 76.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4"]
margin_left = 69.0
margin_top = 5.0
margin_right = 287.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_SCREEN"
[node name="screen" type="SpinBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4"]
margin_left = 291.0
margin_right = 365.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_5" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_left = 579.0
margin_top = 52.0
margin_right = 1158.0
margin_bottom = 76.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_5"]
margin_top = 5.0
margin_right = 314.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_SCREEN_ORIENTATION"
[node name="orientation" type="SpinBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_5"]
margin_left = 318.0
margin_right = 392.0
margin_bottom = 24.0
size_flags_horizontal = 2
max_value = 6.0
[node name="h_box_container_6" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video"]
margin_top = 78.0
margin_right = 579.0
margin_bottom = 102.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6"]
margin_top = 5.0
margin_right = 350.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_VIDEO_WINDOW_ALWAYS_ON_TOP"
[node name="always_on_top" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6"]
margin_left = 354.0
margin_right = 579.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="OPTION_SETTINGS_SOUND" type="GridContainer" parent="window_dialog/margin_container/v_box_container/tab_container"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="h_box_container_2" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_right = 1158.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2"]
margin_left = 363.0
margin_top = 5.0
margin_right = 577.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_SOUND_MUTE"
[node name="mute" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2"]
margin_left = 581.0
margin_right = 605.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container_3" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 28.0
margin_right = 1158.0
margin_bottom = 42.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_3"]
margin_left = 304.0
margin_right = 577.0
margin_bottom = 14.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_SOUND_LEVEL_GLOBAL"
[node name="sound_lvl_global" type="HScrollBar" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_3"]
margin_left = 581.0
margin_right = 1158.0
margin_bottom = 12.0
size_flags_horizontal = 3
step = 1.0
rounded = true
custom_step = 10.0
[node name="h_box_container_6" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 46.0
margin_right = 1158.0
margin_bottom = 60.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_6"]
margin_left = 315.0
margin_right = 577.0
margin_bottom = 14.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_SOUND_LEVEL_MUSIC"
[node name="sound_lvl_music" type="HScrollBar" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_6"]
margin_left = 581.0
margin_right = 1158.0
margin_bottom = 12.0
size_flags_horizontal = 3
step = 1.0
[node name="h_box_container_4" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 64.0
margin_right = 1158.0
margin_bottom = 78.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_4"]
margin_left = 314.0
margin_right = 577.0
margin_bottom = 14.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_SOUND_LEVEL_EFFECT"
[node name="sound_lvl_effect" type="HScrollBar" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_4"]
margin_left = 581.0
margin_right = 1158.0
margin_bottom = 12.0
size_flags_horizontal = 3
[node name="h_box_container_5" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 82.0
margin_right = 1158.0
margin_bottom = 106.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_5"]
margin_left = 315.0
margin_top = 5.0
margin_right = 577.0
margin_bottom = 19.0
size_flags_horizontal = 10
text = "OPTION_SETTINGS_SOUND_YOUR_MUSIC"
[node name="mute" type="CheckBox" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_5"]
margin_left = 581.0
margin_right = 605.0
margin_bottom = 24.0
size_flags_horizontal = 2
[node name="h_box_container" type="HBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 110.0
margin_right = 1158.0
margin_bottom = 130.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container"]
margin_top = 3.0
margin_right = 289.0
margin_bottom = 17.0
text = "OPTION_SETTINGS_SOUND_YOUR_SELECTION"
[node name="add_music" type="Button" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container"]
margin_left = 293.0
margin_right = 587.0
margin_bottom = 20.0
text = "OPTION_SETTINGS_SOUND_SELECTION_ADD"
[node name="scroll_container" type="ScrollContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND"]
margin_top = 134.0
margin_right = 1158.0
margin_bottom = 541.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="list_music" type="VBoxContainer" parent="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/scroll_container"]
margin_right = 1158.0
margin_bottom = 407.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 4
[node name="ok" type="Button" parent="window_dialog/margin_container/v_box_container"]
margin_top = 582.0
margin_right = 1166.0
margin_bottom = 602.0
text = "OPTION_SETTINGS_EXIT"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="file_dialog" type="FileDialog" parent="."]
margin_left = 156.0
margin_top = 237.0
margin_right = 1102.0
margin_bottom = 586.0
popup_exclusive = true
window_title = "Ouvrir un ou plusieurs fichiers"
resizable = true
mode = 1
access = 2
filters = PoolStringArray( "*.mp3,*.ogg" )
show_hidden_files = true
current_dir = "/home/aleajactaest/Projets/khanat/khanat-client-new"
current_path = "/home/aleajactaest/Projets/khanat/khanat-client-new/"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="mute_pressed" from="." to="." method="_on_control_mute_pressed"]
[connection signal="draw" from="window_dialog" to="." method="_on_window_dialog_draw"]
[connection signal="hide" from="window_dialog" to="." method="_on_window_dialog_hide"]
[connection signal="modal_closed" from="window_dialog" to="." method="_on_window_dialog_modal_closed"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_8/default" to="." method="_on_default_toggled"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/h_box_container_9/font" to="." method="_on_font_value_changed"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container/fullscreen" to="." method="_on_fullscreen_toggled"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_2/borderless" to="." method="_on_borderless_toggled"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_7/window_maximized" to="." method="_on_window_maximized_toggled"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_3/resizable" to="." method="_on_resizable_toggled"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_4/screen" to="." method="_on_screen_value_changed"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_5/orientation" to="." method="_on_orientation_value_changed"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_VIDEO/settings_video/h_box_container_6/always_on_top" to="." method="_on_always_on_top_toggled"]
[connection signal="toggled" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute" to="." method="_on_mute_toggled"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_3/sound_lvl_global" to="." method="_on_sound_lvl_global_value_changed"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_6/sound_lvl_music" to="." method="_on_sound_lvl_music_value_changed"]
[connection signal="value_changed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_4/sound_lvl_effect" to="." method="_on_sound_lvl_effect_value_changed"]
[connection signal="pressed" from="window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container/add_music" to="." method="_on_add_music_pressed"]
[connection signal="pressed" from="window_dialog/margin_container/v_box_container/ok" to="." method="_on_ok_pressed"]
[connection signal="files_selected" from="file_dialog" to="." method="_on_file_dialog_files_selected"]

View file

@ -0,0 +1,13 @@
extends HBoxContainer
signal select_pressed( slot )
signal delete_pressed( slot )
var slot = null
var music_filename = null
func _on_select_pressed():
emit_signal( "select_pressed", self.slot )
func _on_delete_pressed():
emit_signal( "delete_pressed", self.slot )

View file

@ -0,0 +1,28 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/options/option_settings_music_box.gd" type="Script" id=1]
[node name="h_box_container" type="HBoxContainer"]
margin_right = 40.0
margin_bottom = 40.0
size_flags_horizontal = 3
custom_constants/separation = 0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="delete" type="Button" parent="."]
margin_right = 310.0
margin_bottom = 40.0
text = "OPTION_SETTINGS_SOUND_SELECTION_DELETE"
[node name="label" type="Label" parent="."]
margin_left = 310.0
margin_top = 13.0
margin_right = 330.0
margin_bottom = 27.0
size_flags_horizontal = 3
text = "file"
[connection signal="pressed" from="delete" to="." method="_on_delete_pressed"]

View file

@ -0,0 +1,51 @@
extends Control
signal quit_pressed
signal mute_pressed
func _ready():
get_node("option_settings").connect("mute_pressed", self, "_on_control_mute_pressed")
update_sound_button()
func _on_quit_button_pressed():
emit_signal( "quit_pressed" )
func _on_language_button_pressed():
$option_language/window_dialog.show()
func _on_news_button_pressed():
#$option_news/accept_dialog.show()
$option_news/window_dialog.show()
func _on_help_button_pressed():
$option_info/window_dialog.show()
func _on_settings_button_pressed():
$option_settings/window_dialog.show()
func update_sound_button():
Config.msg_debug("")
if Config.mute:
$options_reduce/h_box_container/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button.png")
$options_reduce/h_box_container/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button-hover.png")
else:
$options_reduce/h_box_container/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-button.png")
$options_reduce/h_box_container/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-button-hover.png")
func _on_sound_button_pressed():
Config.msg_debug("")
MusicManager.set_sound_mute(not Config.mute)
emit_signal( "mute_pressed" )
func _on_control_mute_pressed():
Config.msg_debug("received signal mute")
update_sound_button()
$option_settings/window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute

View file

@ -0,0 +1,122 @@
[gd_scene load_steps=19 format=2]
[ext_resource path="res://scenes/interfaces/options/options.gd" type="Script" id=1]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button.png" type="Texture" id=2]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button.png" type="Texture" id=3]
[ext_resource path="res://assets/interfaces/options.png" type="Texture" id=4]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button.png" type="Texture" id=5]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button.png" type="Texture" id=6]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button-hover.png" type="Texture" id=7]
[ext_resource path="res://assets/interfaces/Login-Khanat-news-button.png" type="Texture" id=8]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button.png" type="Texture" id=9]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button-hover.png" type="Texture" id=10]
[ext_resource path="res://scenes/interfaces/options/option_language.tscn" type="PackedScene" id=11]
[ext_resource path="res://scenes/interfaces/options/option_news.tscn" type="PackedScene" id=12]
[ext_resource path="res://scenes/interfaces/options/option_info.tscn" type="PackedScene" id=13]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button-hover.png" type="Texture" id=14]
[ext_resource path="res://assets/interfaces/Login-Khanat-news-button-hover.png" type="Texture" id=15]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button-hover.png" type="Texture" id=16]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button-hover.png" type="Texture" id=17]
[ext_resource path="res://scenes/interfaces/options/option_settings.tscn" type="PackedScene" id=18]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_bottom = -651.0
size_flags_horizontal = 9
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="options_reduce" type="TextureRect" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -416.0
margin_bottom = 69.0
mouse_default_cursor_shape = 5
texture = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="h_box_container" type="HBoxContainer" parent="options_reduce"]
margin_left = 30.0
margin_right = 396.0
margin_bottom = 64.0
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="news_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 22.0
margin_right = 76.0
margin_bottom = 64.0
texture_normal = ExtResource( 8 )
texture_hover = ExtResource( 15 )
[node name="language_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 80.0
margin_right = 134.0
margin_bottom = 64.0
texture_normal = ExtResource( 9 )
texture_hover = ExtResource( 16 )
[node name="sound_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 138.0
margin_right = 192.0
margin_bottom = 64.0
texture_normal = ExtResource( 6 )
texture_hover = ExtResource( 14 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="help_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 196.0
margin_right = 250.0
margin_bottom = 64.0
texture_normal = ExtResource( 2 )
texture_hover = ExtResource( 7 )
[node name="settings_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 254.0
margin_right = 308.0
margin_bottom = 64.0
texture_normal = ExtResource( 5 )
texture_hover = ExtResource( 17 )
[node name="quit_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 312.0
margin_right = 366.0
margin_bottom = 64.0
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 10 )
[node name="option_language" parent="." instance=ExtResource( 11 )]
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_news" parent="." instance=ExtResource( 12 )]
visible = false
[node name="option_info" parent="." instance=ExtResource( 13 )]
visible = false
[node name="option_settings" parent="." instance=ExtResource( 18 )]
[connection signal="mute_pressed" from="." to="." method="_on_control_mute_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/news_button" to="." method="_on_news_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/language_button" to="." method="_on_language_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/sound_button" to="." method="_on_sound_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/help_button" to="." method="_on_help_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/settings_button" to="." method="_on_settings_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/quit_button" to="." method="_on_quit_button_pressed"]

View file

@ -12,23 +12,23 @@ var creature_selected_slot = null
var creature_selected_filename = null var creature_selected_filename = null
func _ready(): func _ready():
Connection.connect( "connection_ok", self, "_on_connexion_ok" ) Connection.connect( "connection_ok", self, "_on_connexion_ok" )
Connection.connect( "connection_error", self, "_on_connection_error" ) Connection.connect( "connection_error", self, "_on_connection_error" )
Globals.ressource_queue.start() Globals.ressource_queue.start()
func _process(_time): func _process(_time):
if self.is_scene_loading: if self.is_scene_loading:
if Globals.ressource_queue.is_ready( self.current_scene_path ): if Globals.ressource_queue.is_ready( self.current_scene_path ):
print( "LOADING FINISHED") print( "LOADING FINISHED")
self.set_new_scene( Globals.ressource_queue.get_resource( self.current_scene_path ) ) self.set_new_scene( Globals.ressource_queue.get_resource( self.current_scene_path ) )
$loading_screen.hide() $loading_screen.hide()
else: else:
self.update_progress() self.update_progress()
$loading_screen.show() $loading_screen.show()
# if loader == null: # if loader == null:
# # no need to process anymore # # no need to process anymore
# set_process(false) # set_process(false)
@ -56,13 +56,13 @@ func _process(_time):
# printerr( "Loading errors." ) # printerr( "Loading errors." )
# loader = null # loader = null
# break # break
func _input( event ): func _input( event ):
if event.is_action_released( "music_manager" ): if event.is_action_released( "music_manager" ):
MusicManager.toggle() MusicManager.toggle()
#func load_scene( path ): #func load_scene( path ):
# self.loader = ResourceLoader.load_interactive( path ) # self.loader = ResourceLoader.load_interactive( path )
# if self.loader == null: # if self.loader == null:
@ -81,43 +81,43 @@ func _input( event ):
# self.wait_frames = 1 # self.wait_frames = 1
func set_new_scene( scene_resource ): func set_new_scene( scene_resource ):
if scene_resource: if scene_resource:
self.current_scene = scene_resource.instance() self.current_scene = scene_resource.instance()
self.get_node("scene").add_child(self.current_scene) self.get_node("scene").add_child(self.current_scene)
self.is_scene_loading = false self.is_scene_loading = false
$loading_screen.hide() $loading_screen.hide()
$main_menu.hide() $main_menu.hide()
if self.has_node( "scene/creatures_menu_ui" ): if self.has_node( "scene/creatures_menu_ui" ):
self.get_node( "scene/creatures_menu_ui" ).connect( "new_pressed", self, "_on_creatures_menu_ui_new_pressed" ) self.get_node( "scene/creatures_menu_ui" ).connect( "new_pressed", self, "_on_creatures_menu_ui_new_pressed" )
self.get_node( "scene/creatures_menu_ui" ).connect( "cancel_pressed", self, "_on_creatures_menu_ui_cancel_pressed" ) self.get_node( "scene/creatures_menu_ui" ).connect( "cancel_pressed", self, "_on_creatures_menu_ui_cancel_pressed" )
self.get_node( "scene/creatures_menu_ui" ).connect( "select_pressed", self, "_on_creatures_menu_ui_select_pressed" ) self.get_node( "scene/creatures_menu_ui" ).connect( "select_pressed", self, "_on_creatures_menu_ui_select_pressed" )
elif self.has_node( "scene/creatures_editor_ui" ): elif self.has_node( "scene/creatures_editor_ui" ):
self.get_node( "scene/creatures_editor_ui" ).connect( "valid_pressed", self, "_on_creature_editor_ui_valid_pressed" ) self.get_node( "scene/creatures_editor_ui" ).connect( "valid_pressed", self, "_on_creature_editor_ui_valid_pressed" )
self.get_node( "scene/creatures_editor_ui" ).connect( "cancel_pressed", self, "_on_creature_editor_ui_cencel_pressed" ) self.get_node( "scene/creatures_editor_ui" ).connect( "cancel_pressed", self, "_on_creature_editor_ui_cencel_pressed" )
print( "slot: " + str( self.creature_selected_slot ) ) print( "slot: " + str( self.creature_selected_slot ) )
self.get_node( "scene/creatures_editor_ui" ).slot = self.creature_selected_slot self.get_node( "scene/creatures_editor_ui" ).slot = self.creature_selected_slot
# elif self.has_node( "scene/game" ): # elif self.has_node( "scene/game" ):
# self.get_node( "scene/game" ).load_player( self.creature_selected_filename ) # self.get_node( "scene/game" ).load_player( self.creature_selected_filename )
func update_progress(): func update_progress():
var progress = float(Globals.ressource_queue.get_progress( self.current_scene_path )) var progress = float(Globals.ressource_queue.get_progress( self.current_scene_path ))
self.get_node("loading_screen/background_player").play("loading") self.get_node("loading_screen/background_player").play("loading")
self.get_node("loading_screen/background_player").stop() self.get_node("loading_screen/background_player").stop()
self.get_node("loading_screen/background_player").seek( (progress*13.0)/100.0 ) self.get_node("loading_screen/background_player").seek( (progress*13.0)/100.0 )
func goto_scene( p_path ): func goto_scene( p_path ):
# Clean old scene. # Clean old scene.
if self.current_scene: if self.current_scene:
Globals.ressource_queue.cancel_resource( self.current_scene_path ) Globals.ressource_queue.cancel_resource( self.current_scene_path )
self.current_scene.queue_free() self.current_scene.queue_free()
Globals.ressource_queue.queue_resource( p_path ) Globals.ressource_queue.queue_resource( p_path )
self.current_scene_path = p_path self.current_scene_path = p_path
self.is_scene_loading = true self.is_scene_loading = true
#func set_new_scene( scene_resource ): #func set_new_scene( scene_resource ):
@ -125,47 +125,55 @@ func goto_scene( p_path ):
# self.current_scene = scene_resource.instance() # self.current_scene = scene_resource.instance()
# self.get_node("scene").add_child(self.current_scene) # self.get_node("scene").add_child(self.current_scene)
# self.is_scene_loading = false # self.is_scene_loading = false
#func update_progress(): #func update_progress():
# self.get_node("loading_screen/progress_bar").value = Globals.ressource_queue.get_progress( self.current_scene_path ) # self.get_node("loading_screen/progress_bar").value = Globals.ressource_queue.get_progress( self.current_scene_path )
# #
func _on_main_menu_play_pressed(): func _on_main_menu_play_pressed():
var username = $main_menu/screen_box/login_box/username.text; var username = $main_menu/screen_box/login_box/username.text;
var password = $main_menu/screen_box/login_box/password.text; var password = $main_menu/screen_box/login_box/password.text;
if username != null and username != "" and password != null and password != "": if username != null and username != "" and password != null and password != "":
Connection.do_request(username, password) Connection.do_request(username, password)
else: else:
Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" ) Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_creatures_menu_ui_new_pressed( slot ): func _on_creatures_menu_ui_new_pressed( slot ):
self.creature_selected_slot = slot self.creature_selected_slot = slot
# Globals.goto_scene( "res://scenes/interfaces/creatures_editor/creatures_editor_ui.tscn" ) # Globals.goto_scene( "res://scenes/interfaces/creatures_editor/creatures_editor_ui.tscn" )
Globals.goto_scene( "res://scenes/creatures/creatures_creation.tscn" ) Globals.goto_scene( "res://scenes/creatures/creatures_creation.tscn" )
func _on_creatures_menu_ui_cancel_pressed(): func _on_creatures_menu_ui_cancel_pressed():
$main_menu.show() $main_menu.show()
func _on_creatures_menu_ui_select_pressed( filename ): func _on_creatures_menu_ui_select_pressed( filename ):
self.creature_selected_filename = filename self.creature_selected_filename = filename
Globals.goto_scene( "res://scenes/game/game.tscn" ) Globals.goto_scene( "res://scenes/game/game.tscn" )
func _on_creature_editor_ui_valid_pressed(): func _on_creature_editor_ui_valid_pressed():
Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" ) Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_creature_editor_ui_cencel_pressed(): func _on_creature_editor_ui_cencel_pressed():
Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" ) Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_main_menu_quit_pressed(): func _on_main_menu_quit_pressed():
get_tree().quit() get_tree().quit()
func _on_connexion_ok(): func _on_connexion_ok():
Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" ) Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_connection_error( message ): func _on_connection_error( message ):
$main_menu/screen_box/login_box/error.text = message $main_menu/screen_box/login_box/error.text = message
func _on_mute_pressed():
pass
# $main_menu/control/option_settings.update_sound_button()
func _on_main_menu_mute_pressed():
Config.msg_debug("_on_main_menu_mute_pressed")
$main_menu/control/option_settings.update_sound_button()

View file

@ -10,8 +10,11 @@ script = ExtResource( 3 )
[node name="scene" type="Spatial" parent="."] [node name="scene" type="Spatial" parent="."]
[node name="main_menu" parent="." instance=ExtResource( 1 )] [node name="main_menu" parent="." instance=ExtResource( 1 )]
margin_top = 1.49832
margin_bottom = 1.49829
[node name="loading_screen" parent="." instance=ExtResource( 2 )] [node name="loading_screen" parent="." instance=ExtResource( 2 )]
visible = false visible = false
[connection signal="play_pressed" from="main_menu" to="." method="_on_main_menu_play_pressed"] [connection signal="play_pressed" from="main_menu" to="." method="_on_main_menu_play_pressed"]
[connection signal="quit_pressed" from="main_menu" to="." method="_on_main_menu_quit_pressed"] [connection signal="quit_pressed" from="main_menu" to="." method="_on_main_menu_quit_pressed"]

View file

@ -17,53 +17,53 @@ var focused_object = null
var focus_index = 0 var focus_index = 0
static func get_input_direction() -> Vector3: static func get_input_direction() -> Vector3:
return Vector3( return Vector3(
Input.get_action_strength("move_strafe_right") - Input.get_action_strength("move_strafe_left"), Input.get_action_strength("move_strafe_right") - Input.get_action_strength("move_strafe_left"),
0, 0,
Input.get_action_strength("move_backward") - Input.get_action_strength("move_forward") Input.get_action_strength("move_backward") - Input.get_action_strength("move_forward")
) )
func _input( event ): func _input( event ):
# Run. # Run.
if event.is_action_pressed( "move_toggle_run" ): if event.is_action_pressed( "move_toggle_run" ):
$character.is_running = not $character.is_running $character.is_running = not $character.is_running
# Camera. # Camera.
if event.is_action( "camera_zoom_in" ): if event.is_action( "camera_zoom_in" ):
self.zoom_level += 1 self.zoom_level += 1
elif event.is_action( "camera_zoom_out" ): elif event.is_action( "camera_zoom_out" ):
self.zoom_level -= 1 self.zoom_level -= 1
if event.is_action_pressed( "camera_reset_view" ): if event.is_action_pressed( "camera_reset_view" ):
$character/spring_arm.rotation = Vector3.ZERO $character/spring_arm.rotation = Vector3.ZERO
self.zoom_level = 0 self.zoom_level = 0
if event.is_action_pressed( "camera_switch" ): if event.is_action_pressed( "camera_switch" ):
if self.camera_tps.current: if self.camera_tps.current:
self.camera_fps.make_current() self.camera_fps.make_current()
$character/spring_arm.rotation = Vector3.ZERO $character/spring_arm.rotation = Vector3.ZERO
# self.hide() # self.hide()
else: else:
self.camera_tps.make_current() self.camera_tps.make_current()
# self.show() # self.show()
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
self.mouse_delta = event.relative self.mouse_delta = event.relative
# Jump. # Jump.
if event.is_action_pressed( "move_jump" ) and not $character.is_falling: if event.is_action_pressed( "move_jump" ) and not $character.is_falling:
$character.is_jump_started = true $character.is_jump_started = true
if event.is_action_pressed( "interact" ): if event.is_action_pressed( "interact" ):
self.interact() self.interact()
if event.is_action_pressed( "focus_next" ): if event.is_action_pressed( "focus_next" ):
self.focus_next() self.focus_next()
# if not self.get_tree().get_root().get_node( "main/scene/game" ).is_on_ui: # if not self.get_tree().get_root().get_node( "main/scene/game" ).is_on_ui:
# if event.is_action_pressed( "action_ready_weapon" ): # if event.is_action_pressed( "action_ready_weapon" ):
# $character.is_readying_weapon = true # $character.is_readying_weapon = true
@ -73,23 +73,23 @@ func _input( event ):
# if $character.is_weapon_ready: # if $character.is_weapon_ready:
# if event.is_action_pressed( "action_attack" ): # if event.is_action_pressed( "action_attack" ):
# $character.attack() # $character.attack()
func _process( delta ): func _process( delta ):
$character.direction = self.get_input_direction() $character.direction = self.get_input_direction()
# Rotation. # Rotation.
if not Input.is_key_pressed( KEY_SHIFT ) and not $character.is_jump_started: if not Input.is_key_pressed( KEY_SHIFT ) and not $character.is_jump_started:
$character.orientation = (Input.get_action_strength("move_turn_left") - Input.get_action_strength("move_turn_right")) $character.orientation = (Input.get_action_strength("move_turn_left") - Input.get_action_strength("move_turn_right"))
else: else:
$character.orientation = 0.0 $character.orientation = 0.0
# Camera. # Camera.
if not self.mouse_delta == Vector2.ZERO and self.camera_tps.current: if not self.mouse_delta == Vector2.ZERO and self.camera_tps.current:
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
$character/spring_arm.rotate_y( -self.mouse_delta.x * 0.01 ) $character/spring_arm.rotate_y( -self.mouse_delta.x * 0.01 )
self.camera_tps.rotate_x( self.mouse_delta.y * 0.01 ) self.camera_tps.rotate_x( self.mouse_delta.y * 0.01 )
# if not $character.velocity.x == 0.0 or not $character.velocity.z == 0.0: # if not $character.velocity.x == 0.0 or not $character.velocity.z == 0.0:
# var velocity_without_gravity = $character.velocity # var velocity_without_gravity = $character.velocity
@ -100,125 +100,125 @@ func _process( delta ):
## $crosshair.material.set_shader_param( "spread", 1 ) ## $crosshair.material.set_shader_param( "spread", 1 )
# $character/target_spring_arm/crosshair.scale = Vector3( 1.0, 1.0, 1.0 ) # $character/target_spring_arm/crosshair.scale = Vector3( 1.0, 1.0, 1.0 )
if $character.is_weapon_ready: if $character.is_weapon_ready:
if $character.get_main_weapon_node(): if $character.get_main_weapon_node():
$character/crosshair.show() $character/crosshair.show()
# $character/target_spring_arm.global_transform.origin = $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.origin # $character/target_spring_arm.global_transform.origin = $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.origin
# $character/target_spring_arm.look_at_from_position( $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.origin, $character.get_main_weapon_node().get_node( "target" ).global_transform.origin, Vector3( 0.0, 0.0, -1.0 ) ) # $character/target_spring_arm.look_at_from_position( $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.origin, $character.get_main_weapon_node().get_node( "target" ).global_transform.origin, Vector3( 0.0, 0.0, -1.0 ) )
# $character/target_spring_arm.global_transform.basis.y = $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.basis.y # $character/target_spring_arm.global_transform.basis.y = $character.get_main_weapon_node().get_node( "bullet_exit" ).global_transform.basis.y
$character/crosshair.global_transform.origin = $character.get_main_weapon_node().get_node( "bullet_exit/target_spring_arm/target" ).global_transform.origin $character/crosshair.global_transform.origin = $character.get_main_weapon_node().get_node( "bullet_exit/target_spring_arm/target" ).global_transform.origin
else: else:
$character/target_spring_arm.hide() $character/target_spring_arm.hide()
# Values reset. # Values reset.
self.mouse_delta = Vector2.ZERO self.mouse_delta = Vector2.ZERO
# Debug. # Debug.
#var old_collider = null #var old_collider = null
func _physics_process(delta): func _physics_process(delta):
var space_state = get_world().direct_space_state var space_state = get_world().direct_space_state
# Camera. # Camera.
self.camera_position = Vector3( 0.0, 2 - 0.1*self.zoom_level, -2 + 0.1*self.zoom_level ) self.camera_position = Vector3( 0.0, 2 - 0.1*self.zoom_level, -2 + 0.1*self.zoom_level )
$character/spring_arm/camera_position.translation = self.camera_position $character/spring_arm/camera_position.translation = self.camera_position
var global_camera_position = $character/spring_arm/camera_position.global_transform.origin var global_camera_position = $character/spring_arm/camera_position.global_transform.origin
var result = space_state.intersect_ray($character/look_at.global_transform.origin, global_camera_position, [self]) var result = space_state.intersect_ray($character/look_at.global_transform.origin, global_camera_position, [self])
if result: if result:
self.camera_tps.global_transform.origin = result.position self.camera_tps.global_transform.origin = result.position
# self.camera_tps.look_at( $character/look_at.global_transform.origin, Vector3( 0.0, 1.0, 0.0) ) # self.camera_tps.look_at( $character/look_at.global_transform.origin, Vector3( 0.0, 1.0, 0.0) )
else: else:
self.camera_tps.translation = self.camera_position self.camera_tps.translation = self.camera_position
# self.camera_tps.look_at( $character/look_at.global_transform.origin, Vector3( 0.0, 1.0, 0.0) ) # self.camera_tps.look_at( $character/look_at.global_transform.origin, Vector3( 0.0, 1.0, 0.0) )
func interact( p_object = null ): func interact( p_object = null ):
if p_object and p_object.has_method( "interact" ): if p_object and p_object.has_method( "interact" ):
p_object.interact( $character/creature.creature ) p_object.interact( $character/creature.creature )
else: else:
if self.focused_object and self.focused_object.has_method( "interact" ): if self.focused_object and self.focused_object.has_method( "interact" ):
self.focused_object.interact( $character/creature.creature ) self.focused_object.interact( $character/creature.creature )
elif self.focused_object and self.focused_object.get_parent() and self.focused_object.get_parent().has_method( "interact" ): elif self.focused_object and self.focused_object.get_parent() and self.focused_object.get_parent().has_method( "interact" ):
self.focused_object.get_parent().interact( $character/creature.creature ) self.focused_object.get_parent().interact( $character/creature.creature )
if not self.focused_object: if not self.focused_object:
self.proximity_objects.erase( self.focused_object ) self.proximity_objects.erase( self.focused_object )
self.update_focused_object() self.update_focused_object()
func focus_next(): func focus_next():
self.focus_index += 1 self.focus_index += 1
if self.focus_index >= self.proximity_objects.size(): if self.focus_index >= self.proximity_objects.size():
self.focus_index = 0 self.focus_index = 0
self.update_focused_object() self.update_focused_object()
func set_focus_on( p_object, p_focus ): func set_focus_on( p_object, p_focus ):
if p_object and p_object.has_method( "set_focus" ): if p_object and p_object.has_method( "set_focus" ):
p_object.set_focus( p_focus ) p_object.set_focus( p_focus )
elif p_object and p_object.get_parent() and p_object.get_parent().has_method( "set_focus" ): elif p_object and p_object.get_parent() and p_object.get_parent().has_method( "set_focus" ):
p_object.get_parent().set_focus( p_focus ) p_object.get_parent().set_focus( p_focus )
func update_focused_object(): func update_focused_object():
if self.focus_index >= self.proximity_objects.size(): if self.focus_index >= self.proximity_objects.size():
self.focus_index = 0 self.focus_index = 0
var old_focused_object = self.focused_object var old_focused_object = self.focused_object
if self.proximity_objects.size() > 0: if self.proximity_objects.size() > 0:
self.focused_object = self.proximity_objects[ self.focus_index ] self.focused_object = self.proximity_objects[ self.focus_index ]
else: else:
self.focused_object = null self.focused_object = null
if old_focused_object: if old_focused_object:
self.set_focus_on( old_focused_object, false ) self.set_focus_on( old_focused_object, false )
if self.focused_object: if self.focused_object:
self.set_focus_on( self.focused_object, true ) self.set_focus_on( self.focused_object, true )
emit_signal( "new_focused_object", self.focused_object.name ) emit_signal( "new_focused_object", self.focused_object.name )
func _on_interact_area_body_entered(body): func _on_interact_area_body_entered(body):
if not body == $character: if not body == $character:
self.proximity_objects.push_back( body ) self.proximity_objects.push_back( body )
self.update_focused_object() self.update_focused_object()
func _on_interact_area_body_exited(body): func _on_interact_area_body_exited(body):
if not body == $character: if not body == $character:
self.proximity_objects.erase( body ) self.proximity_objects.erase( body )
self.update_focused_object() self.update_focused_object()
func _on_character_equip(p_slot, p_item): func _on_character_equip(p_slot, p_item):
emit_signal( "equip", p_slot, p_item ) emit_signal( "equip", p_slot, p_item )
var weapons = $character.get_weapons() var weapons = $character.get_weapons()
if weapons.size() > 0: if weapons.size() > 0:
var min_range = null var min_range = null
for weapon in weapons: for weapon in weapons:
if not min_range: if not min_range:
min_range = weapon.get_data( "range" ) min_range = weapon.get_data( "range" )
else: else:
min_range = min( min_range, weapon.get_data( "range" ) ) min_range = min( min_range, weapon.get_data( "range" ) )
$character.get_main_weapon_node().get_node( "bullet_exit/target_spring_arm" ).spring_length = min_range $character.get_main_weapon_node().get_node( "bullet_exit/target_spring_arm" ).spring_length = min_range
func _on_character_unequip(p_slot): func _on_character_unequip(p_slot):
emit_signal( "unequip", p_slot ) emit_signal( "unequip", p_slot )
func _on_crosshair_area_body_entered(body): func _on_crosshair_area_body_entered(body):
if not body == $character: if not body == $character:
if body is preload( "res://scenes/characters/character.gd" ): if body is preload( "res://scenes/characters/character.gd" ):
if body.player_relation == body.PLAYER_RELATION.ennemy: if body.player_relation == body.PLAYER_RELATION.ennemy:
$character/crosshair.get_surface_material( 0 ).albedo_color = Color.red $character/crosshair.get_surface_material( 0 ).albedo_color = Color.red
elif body.player_relation == body.PLAYER_RELATION.friend: elif body.player_relation == body.PLAYER_RELATION.friend:
$character/crosshair.get_surface_material( 0 ).albedo_color = Color.green $character/crosshair.get_surface_material( 0 ).albedo_color = Color.green
else: else:
$character/crosshair.get_surface_material( 0 ).albedo_color = Color.white $character/crosshair.get_surface_material( 0 ).albedo_color = Color.white
func _on_crosshair_area_body_exited(body): func _on_crosshair_area_body_exited(body):
if not body == $character: if not body == $character:
$character/target_spring_arm/crosshair.get_surface_material( 0 ).albedo_color = Color.white $character/target_spring_arm/crosshair.get_surface_material( 0 ).albedo_color = Color.white