mirror of
https://port.numenaute.org/aleajactaest/khanat-client.git
synced 2024-12-13 05:24:48 +00:00
correct some issue
This commit is contained in:
parent
db3cb83817
commit
70f3ae38c6
33 changed files with 1913 additions and 1898 deletions
|
@ -6,40 +6,40 @@ signal value_changed( value )
|
|||
|
||||
export( Texture ) var minus_texture setget set_minus_texture, get_minus_texture
|
||||
func set_minus_texture( value ):
|
||||
minus_texture = value
|
||||
if self.has_node( "kh_h_slider/minus" ):
|
||||
$kh_h_slider/minus.texture_normal = minus_texture
|
||||
minus_texture = value
|
||||
if self.has_node( "kh_h_slider/minus" ):
|
||||
$kh_h_slider/minus.texture_normal = minus_texture
|
||||
func get_minus_texture():
|
||||
return minus_texture
|
||||
|
||||
return minus_texture
|
||||
|
||||
export( Texture ) var plus_texture setget set_plus_texture, get_plus_texture
|
||||
func set_plus_texture( value ):
|
||||
plus_texture = value
|
||||
if self.has_node( "kh_h_slider/plus" ):
|
||||
$kh_h_slider/plus.texture_normal = plus_texture
|
||||
plus_texture = value
|
||||
if self.has_node( "kh_h_slider/plus" ):
|
||||
$kh_h_slider/plus.texture_normal = plus_texture
|
||||
func get_plus_texture():
|
||||
return plus_texture
|
||||
return plus_texture
|
||||
|
||||
|
||||
func _ready():
|
||||
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/value.connect( "changed", self, "_on_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/minus.texture_normal = minus_texture
|
||||
$kh_h_slider/plus.texture_normal = plus_texture
|
||||
|
||||
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/value.connect( "changed", self, "_on_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/minus.texture_normal = minus_texture
|
||||
$kh_h_slider/plus.texture_normal = plus_texture
|
||||
|
||||
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():
|
||||
$kh_h_slider/value.value += $kh_h_slider/value.step
|
||||
|
||||
$kh_h_slider/value.value += $kh_h_slider/value.step
|
||||
|
||||
func _on_value_changed():
|
||||
emit_signal( "changed" )
|
||||
|
||||
emit_signal( "changed" )
|
||||
|
||||
|
||||
func _on_value_value_changed( value ):
|
||||
emit_signal( "value_changed", value )
|
||||
emit_signal( "value_changed", value )
|
||||
|
|
|
@ -2,7 +2,7 @@ tool
|
|||
extends EditorPlugin
|
||||
|
||||
func _enter_tree():
|
||||
add_custom_type("KhHSlider", "HBoxContainer", preload("kh_h_slider.gd"), preload("kh_h_slider.png"))
|
||||
add_custom_type("KhHSlider", "HBoxContainer", preload("kh_h_slider.gd"), preload("kh_h_slider.png"))
|
||||
|
||||
func _exit_tree():
|
||||
remove_custom_type("KhHSlider")
|
||||
remove_custom_type("KhHSlider")
|
||||
|
|
|
@ -31,63 +31,63 @@ var size_changed = true
|
|||
|
||||
|
||||
func add_child_to_content( node):
|
||||
if self.get_content():
|
||||
self.get_content().add_child(node)
|
||||
if self.get_content():
|
||||
self.get_content().add_child(node)
|
||||
|
||||
|
||||
func add_window_part( node ):
|
||||
add_child( node )
|
||||
add_child( node )
|
||||
|
||||
func set_mouse_pass_to_children( node ):
|
||||
for child in node.get_children():
|
||||
set_mouse_pass_to_children( child )
|
||||
if node is Control:
|
||||
node.mouse_filter = MOUSE_FILTER_PASS
|
||||
for child in node.get_children():
|
||||
set_mouse_pass_to_children( child )
|
||||
if node is Control:
|
||||
node.mouse_filter = MOUSE_FILTER_PASS
|
||||
|
||||
#func _ready():
|
||||
func _enter_tree():
|
||||
########
|
||||
#### Window's part création.
|
||||
# The internal elements structure is:
|
||||
# self - MarginContainer
|
||||
# background - NinePatchRect
|
||||
# parts - VBoxContainer
|
||||
# header_box - MarginContainer
|
||||
# header - HBoxContainer
|
||||
# quit - TextureButton
|
||||
# close - TextureButton
|
||||
# open - TextureButton
|
||||
# label - Label
|
||||
# content_box - MarginContainer
|
||||
# scroll_container - Scrollcontainer
|
||||
# content - VBoxContainer
|
||||
# footer_box - MarginContainer
|
||||
# footer - HBoxContainer
|
||||
# contextual_help - Label
|
||||
# resize - TextureButton
|
||||
########
|
||||
#### Window's part création.
|
||||
# The internal elements structure is:
|
||||
# self - MarginContainer
|
||||
# background - NinePatchRect
|
||||
# parts - VBoxContainer
|
||||
# header_box - MarginContainer
|
||||
# header - HBoxContainer
|
||||
# quit - TextureButton
|
||||
# close - TextureButton
|
||||
# open - TextureButton
|
||||
# label - Label
|
||||
# content_box - MarginContainer
|
||||
# scroll_container - Scrollcontainer
|
||||
# content - VBoxContainer
|
||||
# footer_box - MarginContainer
|
||||
# footer - HBoxContainer
|
||||
# contextual_help - Label
|
||||
# resize - TextureButton
|
||||
|
||||
###
|
||||
# self
|
||||
self.size_flags_horizontal = SIZE_EXPAND
|
||||
self.size_flags_vertical = SIZE_EXPAND
|
||||
###
|
||||
# self
|
||||
self.size_flags_horizontal = SIZE_EXPAND
|
||||
self.size_flags_vertical = SIZE_EXPAND
|
||||
|
||||
self.set( "custom_constants/margin_right", 0)
|
||||
self.set( "custom_constants/margin_top", 0)
|
||||
self.set( "custom_constants/margin_left", 0)
|
||||
self.set( "custom_constants/margin_bottom", 0)
|
||||
self.set( "custom_constants/margin_right", 0)
|
||||
self.set( "custom_constants/margin_top", 0)
|
||||
self.set( "custom_constants/margin_left", 0)
|
||||
self.set( "custom_constants/margin_bottom", 0)
|
||||
|
||||
|
||||
self.connect ( "gui_input", self, "_on_window_gui_input" )
|
||||
if is_movable and not self.is_dragged_by_header_only:
|
||||
self.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
###
|
||||
###
|
||||
# background
|
||||
var background
|
||||
if not self.has_node( "background" ):
|
||||
background = NinePatchRect.new()
|
||||
background.name = "background"
|
||||
if not background_texture:
|
||||
self.connect ( "gui_input", self, "_on_window_gui_input" )
|
||||
if is_movable and not self.is_dragged_by_header_only:
|
||||
self.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
###
|
||||
###
|
||||
# background
|
||||
var background
|
||||
if not self.has_node( "background" ):
|
||||
background = NinePatchRect.new()
|
||||
background.name = "background"
|
||||
if not background_texture:
|
||||
# var background_image = Image.new()
|
||||
# var stream_texture = load('res://addons/ui_window/background_default.jpg')
|
||||
# if not stream_texture :
|
||||
|
@ -97,435 +97,435 @@ func _enter_tree():
|
|||
# background.texture = ImageTexture.new()
|
||||
# background.texture.create_from_image( background_image )
|
||||
# background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
|
||||
pass
|
||||
else:
|
||||
background.texture = background_texture
|
||||
background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
|
||||
|
||||
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
pass
|
||||
else:
|
||||
background.texture = background_texture
|
||||
background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
|
||||
|
||||
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
|
||||
background.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
background.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
background.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
background.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
|
||||
background.region_rect = Rect2( 0, 0, 0, 0 )
|
||||
background.patch_margin_left = 4
|
||||
background.patch_margin_top = 32
|
||||
background.patch_margin_right = 4
|
||||
background.patch_margin_bottom = 4
|
||||
background.region_rect = Rect2( 0, 0, 0, 0 )
|
||||
background.patch_margin_left = 4
|
||||
background.patch_margin_top = 32
|
||||
background.patch_margin_right = 4
|
||||
background.patch_margin_bottom = 4
|
||||
|
||||
background.self_modulate = background_color
|
||||
self.add_window_part( background )
|
||||
background.self_modulate = background_color
|
||||
self.add_window_part( background )
|
||||
# background.set_owner( self )
|
||||
###
|
||||
###
|
||||
# parts
|
||||
var parts
|
||||
if not self.has_node( "parts" ):
|
||||
parts = VBoxContainer.new()
|
||||
parts.name = "parts"
|
||||
parts.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
parts.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
self.add_window_part( parts )
|
||||
###
|
||||
###
|
||||
# parts
|
||||
var parts
|
||||
if not self.has_node( "parts" ):
|
||||
parts = VBoxContainer.new()
|
||||
parts.name = "parts"
|
||||
parts.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
parts.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
self.add_window_part( parts )
|
||||
# parts.set_owner( self )
|
||||
###
|
||||
###
|
||||
# header_box
|
||||
var header_box
|
||||
if not parts.has_node( "header_box" ):
|
||||
header_box = MarginContainer.new()
|
||||
header_box.name = "header_box"
|
||||
header_box.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
header_box.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
###
|
||||
###
|
||||
# header_box
|
||||
var header_box
|
||||
if not parts.has_node( "header_box" ):
|
||||
header_box = MarginContainer.new()
|
||||
header_box.name = "header_box"
|
||||
header_box.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
header_box.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
header_box.set( "custom_constants/margin_right", 4)
|
||||
header_box.set( "custom_constants/margin_top", 4)
|
||||
header_box.set( "custom_constants/margin_left", 4)
|
||||
header_box.set( "custom_constants/margin_bottom", 4)
|
||||
header_box.set( "custom_constants/margin_right", 4)
|
||||
header_box.set( "custom_constants/margin_top", 4)
|
||||
header_box.set( "custom_constants/margin_left", 4)
|
||||
header_box.set( "custom_constants/margin_bottom", 4)
|
||||
|
||||
if is_movable:
|
||||
header_box.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
parts.add_child( header_box )
|
||||
if is_movable:
|
||||
header_box.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
parts.add_child( header_box )
|
||||
# header_box.set_owner( parts )
|
||||
header_box.connect ( "gui_input", self, "_on_Header_gui_input" )
|
||||
###
|
||||
###
|
||||
# header
|
||||
var header
|
||||
if not header_box.has_node( "header" ):
|
||||
header = HBoxContainer.new()
|
||||
header.name = "header"
|
||||
header.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
header.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER
|
||||
if is_movable:
|
||||
header.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header_box.add_child( header )
|
||||
header_box.connect ( "gui_input", self, "_on_Header_gui_input" )
|
||||
###
|
||||
###
|
||||
# header
|
||||
var header
|
||||
if not header_box.has_node( "header" ):
|
||||
header = HBoxContainer.new()
|
||||
header.name = "header"
|
||||
header.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
header.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER
|
||||
if is_movable:
|
||||
header.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header_box.add_child( header )
|
||||
# header.set_owner( header_box )
|
||||
###
|
||||
###
|
||||
# quit
|
||||
var quit_button
|
||||
if not header.has_node( "quit" ):
|
||||
quit_button = TextureButton.new()
|
||||
quit_button.name = "quit"
|
||||
quit_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
quit_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
###
|
||||
###
|
||||
# quit
|
||||
var quit_button
|
||||
if not header.has_node( "quit" ):
|
||||
quit_button = TextureButton.new()
|
||||
quit_button.name = "quit"
|
||||
quit_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
quit_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
var tex_quit = ImageTexture.new()
|
||||
var img_quit = Image.new()
|
||||
var stream_texture = load( "res://addons/kh_window/button_quit.png")
|
||||
img_quit = stream_texture.get_data()
|
||||
tex_quit.create_from_image( img_quit )
|
||||
quit_button.texture_normal = tex_quit
|
||||
var tex_quit = ImageTexture.new()
|
||||
var img_quit = Image.new()
|
||||
var stream_texture = load( "res://addons/kh_window/button_quit.png")
|
||||
img_quit = stream_texture.get_data()
|
||||
tex_quit.create_from_image( img_quit )
|
||||
quit_button.texture_normal = tex_quit
|
||||
|
||||
header.add_child( quit_button )
|
||||
header.add_child( quit_button )
|
||||
# quit_button.set_owner( header )
|
||||
quit_button.connect ( "pressed", self, "_on_Quit_pressed" )
|
||||
###
|
||||
# close
|
||||
var close_button = TextureButton.new()
|
||||
if not header.has_node( "close" ):
|
||||
close_button = TextureButton.new()
|
||||
close_button.name = "close"
|
||||
close_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
close_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
quit_button.connect ( "pressed", self, "_on_Quit_pressed" )
|
||||
###
|
||||
# close
|
||||
var close_button = TextureButton.new()
|
||||
if not header.has_node( "close" ):
|
||||
close_button = TextureButton.new()
|
||||
close_button.name = "close"
|
||||
close_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
close_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
var tex_close = ImageTexture.new()
|
||||
var img_close = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_close.png")
|
||||
img_close = stream_texture.get_data()
|
||||
tex_close.create_from_image( img_close )
|
||||
close_button.texture_normal = tex_close
|
||||
var tex_close = ImageTexture.new()
|
||||
var img_close = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_close.png")
|
||||
img_close = stream_texture.get_data()
|
||||
tex_close.create_from_image( img_close )
|
||||
close_button.texture_normal = tex_close
|
||||
|
||||
header.add_child( close_button )
|
||||
header.add_child( close_button )
|
||||
# close_button.set_owner( header )
|
||||
close_button.connect ( "pressed", self, "_on_Close_pressed" )
|
||||
###
|
||||
# open
|
||||
var open_button
|
||||
if not header.has_node( "open" ):
|
||||
open_button = TextureButton.new()
|
||||
open_button.name = "open"
|
||||
open_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
open_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
close_button.connect ( "pressed", self, "_on_Close_pressed" )
|
||||
###
|
||||
# open
|
||||
var open_button
|
||||
if not header.has_node( "open" ):
|
||||
open_button = TextureButton.new()
|
||||
open_button.name = "open"
|
||||
open_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
open_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
var tex_open = ImageTexture.new()
|
||||
var img_open = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_open.png")
|
||||
img_open = stream_texture.get_data()
|
||||
tex_open.create_from_image( img_open )
|
||||
open_button.texture_normal = tex_open
|
||||
open_button.visible = false
|
||||
header.add_child( open_button )
|
||||
var tex_open = ImageTexture.new()
|
||||
var img_open = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_open.png")
|
||||
img_open = stream_texture.get_data()
|
||||
tex_open.create_from_image( img_open )
|
||||
open_button.texture_normal = tex_open
|
||||
open_button.visible = false
|
||||
header.add_child( open_button )
|
||||
# open_button.set_owner( header )
|
||||
open_button.connect ( "pressed", self, "_on_Open_pressed" )
|
||||
###
|
||||
###
|
||||
# Title Label
|
||||
var title_label
|
||||
if not header.has_node( "label" ):
|
||||
title_label = Label.new()
|
||||
title_label.name = "label"
|
||||
title_label.text = title
|
||||
title_label.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
title_label.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
if is_movable:
|
||||
title_label.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header.add_child( title_label )
|
||||
open_button.connect ( "pressed", self, "_on_Open_pressed" )
|
||||
###
|
||||
###
|
||||
# Title Label
|
||||
var title_label
|
||||
if not header.has_node( "label" ):
|
||||
title_label = Label.new()
|
||||
title_label.name = "label"
|
||||
title_label.text = title
|
||||
title_label.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
title_label.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
if is_movable:
|
||||
title_label.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header.add_child( title_label )
|
||||
# title_label.set_owner( header )
|
||||
###
|
||||
###
|
||||
# Content
|
||||
var content_box
|
||||
if not parts.has_node( "content_box" ):
|
||||
content_box = MarginContainer.new()
|
||||
content_box.name = "content_box"
|
||||
content_box.size_flags_horizontal = 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_top", 8)
|
||||
content_box.set( "custom_constants/margin_left", 8)
|
||||
content_box.set( "custom_constants/margin_bottom", 8)
|
||||
parts.add_child( content_box )
|
||||
###
|
||||
###
|
||||
# Content
|
||||
var content_box
|
||||
if not parts.has_node( "content_box" ):
|
||||
content_box = MarginContainer.new()
|
||||
content_box.name = "content_box"
|
||||
content_box.size_flags_horizontal = 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_top", 8)
|
||||
content_box.set( "custom_constants/margin_left", 8)
|
||||
content_box.set( "custom_constants/margin_bottom", 8)
|
||||
parts.add_child( content_box )
|
||||
# content_box.set_owner( parts )
|
||||
###
|
||||
###
|
||||
if self.has_scrollbar:
|
||||
# content_box/scroll_container
|
||||
var content_scroll_container
|
||||
if not content_box.has_node( "scroll_container" ):
|
||||
content_scroll_container = ScrollContainer.new()
|
||||
content_scroll_container.name = "scroll_container"
|
||||
content_scroll_container.size_flags_horizontal = SIZE_FILL
|
||||
content_scroll_container.size_flags_vertical = SIZE_FILL
|
||||
content_scroll_container.scroll_deadzone = 0
|
||||
content_box.add_child( content_scroll_container )
|
||||
# content_scroll_container.set_owner( content_box )
|
||||
###
|
||||
###
|
||||
# content
|
||||
var content
|
||||
if not content_scroll_container.has_node( "content" ):
|
||||
content = MarginContainer.new()
|
||||
content.name = "content"
|
||||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
content.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
content_scroll_container.add_child( content )
|
||||
# content.set_owner( content_scroll_container )
|
||||
###
|
||||
else:
|
||||
var content
|
||||
if not content_box.has_node( "content" ):
|
||||
content = MarginContainer.new()
|
||||
content.name = "content"
|
||||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
content.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
content_box.add_child( content )
|
||||
###
|
||||
###
|
||||
if self.has_scrollbar:
|
||||
# content_box/scroll_container
|
||||
var content_scroll_container
|
||||
if not content_box.has_node( "scroll_container" ):
|
||||
content_scroll_container = ScrollContainer.new()
|
||||
content_scroll_container.name = "scroll_container"
|
||||
content_scroll_container.size_flags_horizontal = SIZE_FILL
|
||||
content_scroll_container.size_flags_vertical = SIZE_FILL
|
||||
content_scroll_container.scroll_deadzone = 0
|
||||
content_box.add_child( content_scroll_container )
|
||||
# content_scroll_container.set_owner( content_box )
|
||||
###
|
||||
###
|
||||
# content
|
||||
var content
|
||||
if not content_scroll_container.has_node( "content" ):
|
||||
content = MarginContainer.new()
|
||||
content.name = "content"
|
||||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
content.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
content_scroll_container.add_child( content )
|
||||
# content.set_owner( content_scroll_container )
|
||||
###
|
||||
else:
|
||||
var content
|
||||
if not content_box.has_node( "content" ):
|
||||
content = MarginContainer.new()
|
||||
content.name = "content"
|
||||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
content.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
content_box.add_child( content )
|
||||
|
||||
|
||||
###
|
||||
# Footer
|
||||
var footer_box
|
||||
if not parts.has_node( "footer_box" ):
|
||||
footer_box = MarginContainer.new()
|
||||
footer_box.name = "footer_box"
|
||||
footer_box.size_flags_horizontal = 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_top", content_margin.size.x)
|
||||
footer_box.set( "custom_constants/margin_left", content_margin.position.x)
|
||||
footer_box.set( "custom_constants/margin_bottom", content_margin.size.y)
|
||||
parts.add_child( footer_box )
|
||||
###
|
||||
# Footer
|
||||
var footer_box
|
||||
if not parts.has_node( "footer_box" ):
|
||||
footer_box = MarginContainer.new()
|
||||
footer_box.name = "footer_box"
|
||||
footer_box.size_flags_horizontal = 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_top", content_margin.size.x)
|
||||
footer_box.set( "custom_constants/margin_left", content_margin.position.x)
|
||||
footer_box.set( "custom_constants/margin_bottom", content_margin.size.y)
|
||||
parts.add_child( footer_box )
|
||||
# footer_box.set_owner( parts )
|
||||
###
|
||||
###
|
||||
# footer_box/footer
|
||||
var footer
|
||||
if not footer_box.has_node( "footer" ):
|
||||
footer = HBoxContainer.new()
|
||||
footer.name = "footer"
|
||||
footer.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
footer.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
footer_box.add_child( footer )
|
||||
###
|
||||
###
|
||||
# footer_box/footer
|
||||
var footer
|
||||
if not footer_box.has_node( "footer" ):
|
||||
footer = HBoxContainer.new()
|
||||
footer.name = "footer"
|
||||
footer.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
footer.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
footer_box.add_child( footer )
|
||||
# footer.set_owner( footer_box )
|
||||
###
|
||||
###
|
||||
# footer_label
|
||||
var footer_label
|
||||
if not footer.has_node( "footer_label" ):
|
||||
footer_label = Label.new()
|
||||
footer_label.name = "footer_label"
|
||||
footer_label.size_flags_horizontal = SIZE_EXPAND
|
||||
footer_label.size_flags_vertical = SIZE_EXPAND
|
||||
###
|
||||
###
|
||||
# footer_label
|
||||
var footer_label
|
||||
if not footer.has_node( "footer_label" ):
|
||||
footer_label = Label.new()
|
||||
footer_label.name = "footer_label"
|
||||
footer_label.size_flags_horizontal = SIZE_EXPAND
|
||||
footer_label.size_flags_vertical = SIZE_EXPAND
|
||||
|
||||
footer.add_child( footer_label )
|
||||
footer.add_child( footer_label )
|
||||
|
||||
###
|
||||
# resize
|
||||
var resize_button
|
||||
if not footer.has_node( "resize" ):
|
||||
resize_button = TextureButton.new()
|
||||
resize_button.name = "resize"
|
||||
resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END
|
||||
resize_button.size_flags_vertical = SIZE_SHRINK_END
|
||||
###
|
||||
# resize
|
||||
var resize_button
|
||||
if not footer.has_node( "resize" ):
|
||||
resize_button = TextureButton.new()
|
||||
resize_button.name = "resize"
|
||||
resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END
|
||||
resize_button.size_flags_vertical = SIZE_SHRINK_END
|
||||
|
||||
var tex_resize = ImageTexture.new()
|
||||
var img_resize = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_resize.png")
|
||||
img_resize = stream_texture.get_data()
|
||||
tex_resize.create_from_image( img_resize )
|
||||
resize_button.texture_normal = tex_resize
|
||||
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
|
||||
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
|
||||
var tex_resize = ImageTexture.new()
|
||||
var img_resize = Image.new()
|
||||
var stream_texture = load("res://addons/kh_window/button_resize.png")
|
||||
img_resize = stream_texture.get_data()
|
||||
tex_resize.create_from_image( img_resize )
|
||||
resize_button.texture_normal = tex_resize
|
||||
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
|
||||
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
|
||||
# resize_button.mouse_filter = MOUSE_FILTER_STOP
|
||||
footer.add_child( resize_button )
|
||||
footer.add_child( resize_button )
|
||||
# resize_button.set_owner( footer )
|
||||
resize_button.connect ( "button_down", self, "_on_Resize_pressed" )
|
||||
###er_label.set_owner( footer )
|
||||
###
|
||||
resize_button.connect ( "button_down", self, "_on_Resize_pressed" )
|
||||
###er_label.set_owner( footer )
|
||||
###
|
||||
|
||||
current_rect_size = self.rect_min_size
|
||||
current_rect_size = self.rect_min_size
|
||||
|
||||
if is_borderless:
|
||||
$background.region_rect = Rect2( $background.patch_margin_left-1
|
||||
, $background.patch_margin_top-1
|
||||
, 256-($background.patch_margin_left+$background.patch_margin_right)+2
|
||||
, 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
|
||||
$background.patch_margin_left = 1
|
||||
$background.patch_margin_top = 1
|
||||
$background.patch_margin_right = 1
|
||||
$background.patch_margin_bottom = 1
|
||||
header_box.rect_min_size.y = 1
|
||||
close_button.visible = false
|
||||
open_button.visible = false
|
||||
quit_button.visible = false
|
||||
title_label.visible = false
|
||||
if is_borderless:
|
||||
$background.region_rect = Rect2( $background.patch_margin_left-1
|
||||
, $background.patch_margin_top-1
|
||||
, 256-($background.patch_margin_left+$background.patch_margin_right)+2
|
||||
, 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
|
||||
$background.patch_margin_left = 1
|
||||
$background.patch_margin_top = 1
|
||||
$background.patch_margin_right = 1
|
||||
$background.patch_margin_bottom = 1
|
||||
header_box.rect_min_size.y = 1
|
||||
close_button.visible = false
|
||||
open_button.visible = false
|
||||
quit_button.visible = false
|
||||
title_label.visible = false
|
||||
|
||||
|
||||
|
||||
|
||||
if not is_resizable:
|
||||
if not has_footer:
|
||||
footer_box.visible = false
|
||||
else:
|
||||
footer_box.get_node( "footer/resize" ).visible = false
|
||||
if not is_resizable:
|
||||
if not has_footer:
|
||||
footer_box.visible = false
|
||||
else:
|
||||
footer_box.get_node( "footer/resize" ).visible = false
|
||||
|
||||
func _ready():
|
||||
# On déplace les enfants ajouter via l'editeur sous content.
|
||||
for child in self.get_children():
|
||||
if not child.name =="parts" and not child.name =="background":
|
||||
if child.name.begins_with( "footer_" ):
|
||||
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") )
|
||||
# On déplace les enfants ajouter via l'editeur sous content.
|
||||
for child in self.get_children():
|
||||
if not child.name =="parts" and not child.name =="background":
|
||||
if child.name.begins_with( "footer_" ):
|
||||
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") )
|
||||
|
||||
self.remove_child( child )
|
||||
get_footer().add_child( child )
|
||||
get_footer().move_child( child, 0 )
|
||||
else:
|
||||
self.remove_child( child )
|
||||
get_content().add_child( child )
|
||||
self.remove_child( child )
|
||||
get_footer().add_child( child )
|
||||
get_footer().move_child( child, 0 )
|
||||
else:
|
||||
self.remove_child( child )
|
||||
get_content().add_child( child )
|
||||
|
||||
set_mouse_pass_to_children( self )
|
||||
set_mouse_pass_to_children( self )
|
||||
|
||||
func _process(delta):
|
||||
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 ) )
|
||||
size_changed = false
|
||||
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 ) )
|
||||
size_changed = false
|
||||
|
||||
func _on_Window_mouse_entered():
|
||||
print("mouse_entered")
|
||||
print("mouse_entered")
|
||||
|
||||
|
||||
func _on_Window_focus_entered():
|
||||
print("focus_entered")
|
||||
print("focus_entered")
|
||||
|
||||
|
||||
func _on_Quit_pressed():
|
||||
self.visible = false
|
||||
self.visible = false
|
||||
|
||||
func get_content_child( p_node ):
|
||||
return get_content().get_node( p_node )
|
||||
return get_content().get_node( p_node )
|
||||
|
||||
func get_content():
|
||||
if self.has_scrollbar:
|
||||
return content_box.get_node( "scroll_container/content" )
|
||||
else:
|
||||
return content_box.get_node( "content" )
|
||||
|
||||
if self.has_scrollbar:
|
||||
return content_box.get_node( "scroll_container/content" )
|
||||
else:
|
||||
return content_box.get_node( "content" )
|
||||
|
||||
func get_footer():
|
||||
return footer_box.get_node( "footer" )
|
||||
return footer_box.get_node( "footer" )
|
||||
|
||||
|
||||
func close():
|
||||
if not self.is_borderless:
|
||||
self.header_box.get_node( "header/close" ).visible = false
|
||||
self.header_box.get_node( "header/open" ).visible = true
|
||||
self.content_box.visible = false
|
||||
self.footer_box.visible = false
|
||||
self.current_rect_size = self.rect_size
|
||||
self.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_min_size = Vector2( 0, 0 )
|
||||
else:
|
||||
self.header_box.get_node( "header/close" ).visible = false
|
||||
self.header_box.get_node( "header/open" ).visible = false
|
||||
self.content_box.visible = false
|
||||
self.footer_box.visible = false
|
||||
self.current_rect_size = self.rect_size
|
||||
self.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_min_size = Vector2( 0, 0 )
|
||||
if not self.is_borderless:
|
||||
self.header_box.get_node( "header/close" ).visible = false
|
||||
self.header_box.get_node( "header/open" ).visible = true
|
||||
self.content_box.visible = false
|
||||
self.footer_box.visible = false
|
||||
self.current_rect_size = self.rect_size
|
||||
self.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_min_size = Vector2( 0, 0 )
|
||||
else:
|
||||
self.header_box.get_node( "header/close" ).visible = false
|
||||
self.header_box.get_node( "header/open" ).visible = false
|
||||
self.content_box.visible = false
|
||||
self.footer_box.visible = false
|
||||
self.current_rect_size = self.rect_size
|
||||
self.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_size = Vector2( 0, 0 )
|
||||
$background.rect_min_size = Vector2( 0, 0 )
|
||||
|
||||
|
||||
func _on_Close_pressed():
|
||||
close()
|
||||
close()
|
||||
|
||||
func open():
|
||||
if not is_borderless:
|
||||
header_box.get_node( "header/close" ).visible = true
|
||||
header_box.get_node( "header/open" ).visible = false
|
||||
content_box.visible = true
|
||||
footer_box.visible = true
|
||||
self.rect_size = current_rect_size
|
||||
else:
|
||||
header_box.get_node( "header/close" ).visible = false
|
||||
header_box.get_node( "header/open" ).visible = false
|
||||
content_box.visible = true
|
||||
footer_box.visible = true
|
||||
self.rect_size = current_rect_size
|
||||
if not is_borderless:
|
||||
header_box.get_node( "header/close" ).visible = true
|
||||
header_box.get_node( "header/open" ).visible = false
|
||||
content_box.visible = true
|
||||
footer_box.visible = true
|
||||
self.rect_size = current_rect_size
|
||||
else:
|
||||
header_box.get_node( "header/close" ).visible = false
|
||||
header_box.get_node( "header/open" ).visible = false
|
||||
content_box.visible = true
|
||||
footer_box.visible = true
|
||||
self.rect_size = current_rect_size
|
||||
|
||||
func _on_Open_pressed():
|
||||
open()
|
||||
open()
|
||||
|
||||
func _on_Resize_pressed():
|
||||
is_resizing = true
|
||||
is_resizing = true
|
||||
|
||||
func _input( event ):
|
||||
if is_resizable:
|
||||
if is_resizing and event is InputEventMouseButton and not event.pressed:
|
||||
is_resizing = false
|
||||
if event is InputEventMouseMotion and is_resizing:
|
||||
var delta = event.relative
|
||||
self.rect_size += delta
|
||||
size_changed = true
|
||||
if is_resizable:
|
||||
if is_resizing and event is InputEventMouseButton and not event.pressed:
|
||||
is_resizing = false
|
||||
if event is InputEventMouseMotion and is_resizing:
|
||||
var delta = event.relative
|
||||
self.rect_size += delta
|
||||
size_changed = true
|
||||
|
||||
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 :
|
||||
emit_signal( "window_clicked", self )
|
||||
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 )
|
||||
|
||||
func _on_Header_gui_input( event ):
|
||||
|
||||
check_if_clicked( event )
|
||||
check_if_clicked( event )
|
||||
|
||||
if self.is_dragged_by_header_only:
|
||||
if is_movable:
|
||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||
is_moving = false
|
||||
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||
is_moving = true
|
||||
if event is InputEventMouseMotion and is_moving:
|
||||
var delta = event.relative
|
||||
self.rect_position += delta
|
||||
if self.is_dragged_by_header_only:
|
||||
if is_movable:
|
||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||
is_moving = false
|
||||
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||
is_moving = true
|
||||
if event is InputEventMouseMotion and is_moving:
|
||||
var delta = event.relative
|
||||
self.rect_position += delta
|
||||
|
||||
func _on_window_gui_input( event ):
|
||||
check_if_clicked( event )
|
||||
if not self.is_dragged_by_header_only:
|
||||
if is_movable:
|
||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||
is_moving = false
|
||||
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||
is_moving = true
|
||||
if event is InputEventMouseMotion and is_moving:
|
||||
var delta = event.relative
|
||||
self.rect_position += delta
|
||||
|
||||
check_if_clicked( event )
|
||||
if not self.is_dragged_by_header_only:
|
||||
if is_movable:
|
||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||
is_moving = false
|
||||
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||
is_moving = true
|
||||
if event is InputEventMouseMotion and is_moving:
|
||||
var delta = event.relative
|
||||
self.rect_position += delta
|
||||
|
||||
func load_from_file( config_file ):
|
||||
if config_file.has_section( self.name ):
|
||||
self.rect_position = config_file.get_value( self.name, "position" )
|
||||
self.rect_size = config_file.get_value( self.name, "size" )
|
||||
self.is_borderless = config_file.get_value( self.name, "borderless" )
|
||||
current_rect_position = self.rect_position
|
||||
current_rect_size = self.rect_size
|
||||
if config_file.get_value( self.name, "opened" ):
|
||||
open()
|
||||
else:
|
||||
close()
|
||||
if config_file.has_section( self.name ):
|
||||
self.rect_position = config_file.get_value( self.name, "position" )
|
||||
self.rect_size = config_file.get_value( self.name, "size" )
|
||||
self.is_borderless = config_file.get_value( self.name, "borderless" )
|
||||
current_rect_position = self.rect_position
|
||||
current_rect_size = self.rect_size
|
||||
if config_file.get_value( self.name, "opened" ):
|
||||
open()
|
||||
else:
|
||||
close()
|
||||
|
||||
|
||||
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:
|
||||
config_file.set_value(self.name, "size", current_rect_size)
|
||||
else:
|
||||
config_file.set_value(self.name, "size", self.rect_size)
|
||||
if not is_open:
|
||||
config_file.set_value(self.name, "size", current_rect_size)
|
||||
else:
|
||||
config_file.set_value(self.name, "size", self.rect_size)
|
||||
|
||||
if is_open:
|
||||
config_file.set_value(self.name, "opened", true)
|
||||
else:
|
||||
config_file.set_value(self.name, "opened", false)
|
||||
if is_open:
|
||||
config_file.set_value(self.name, "opened", true)
|
||||
else:
|
||||
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)
|
||||
|
|
BIN
assets/fonts/IMMORTAL.ttf
Normal file
BIN
assets/fonts/IMMORTAL.ttf
Normal file
Binary file not shown.
BIN
icon.png
BIN
icon.png
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 62 KiB |
|
@ -69,7 +69,7 @@ config/icon="res://icon.png"
|
|||
|
||||
[autoload]
|
||||
|
||||
Creatures="*res://ressources/scripts/creatures_old.gd"
|
||||
Creatures="*res://ressources/scripts/creatures.gd"
|
||||
MusicManager="*res://scenes/interfaces/music_manager/music_manager.tscn"
|
||||
Connection="*res://scenes/connection/connection.tscn"
|
||||
Globals="*res://ressources/scripts/global.gd"
|
||||
|
|
85
ressources/scripts/creatures.gd
Normal file
85
ressources/scripts/creatures.gd
Normal file
|
@ -0,0 +1,85 @@
|
|||
extends Node
|
||||
|
||||
class Creature_old2:
|
||||
|
||||
enum Sex { F, M, H, A, U }
|
||||
|
||||
var type
|
||||
var pseudonym
|
||||
|
||||
|
||||
func _init( p_pseudonym = "Créature" ):
|
||||
self.type = "creature"
|
||||
self.pseudonym = p_pseudonym
|
||||
|
||||
|
||||
class Ra_old2 extends Creature_old2:
|
||||
|
||||
|
||||
var sex = Creature_old2.Sex.F
|
||||
|
||||
var female_boobs = 0.0
|
||||
var female_hip = 0.0
|
||||
var male_pack = 0.0
|
||||
var male_throat = 0.0
|
||||
var female_pregnant = 0.0
|
||||
|
||||
var color = Color( 1.0, 1.0, 1.0 )
|
||||
|
||||
var douleur = 0.0
|
||||
var trauma = 0.0
|
||||
var oubli = 0.0
|
||||
|
||||
func _init( p_pseudonym = "Créature" ):
|
||||
self.type = "ra"
|
||||
self.pseudonym = p_pseudonym
|
||||
|
||||
func to_dictionary():
|
||||
|
||||
var dictionary = Dictionary()
|
||||
dictionary[ "type" ] = self.type
|
||||
dictionary[ "pseudonym" ] = self.pseudonym
|
||||
|
||||
dictionary[ "sex" ] = var2str( self.sex )
|
||||
dictionary[ "female_boobs" ] = var2str( self.female_boobs )
|
||||
dictionary[ "female_hip" ] = var2str( self.female_hip )
|
||||
dictionary[ "male_pack" ] = var2str( self.male_pack )
|
||||
dictionary[ "male_throat" ] = var2str( self.male_throat )
|
||||
dictionary[ "female_pregnant" ] = var2str( self.female_pregnant )
|
||||
|
||||
dictionary[ "color" ] = var2str( self.color )
|
||||
|
||||
|
||||
return dictionary
|
||||
|
||||
func from_dictionary( dictionary ):
|
||||
|
||||
self.pseudonym = dictionary.get( "pseudonym", self.pseudonym )
|
||||
|
||||
self.sex = dictionary.get( "sex", self.sex )
|
||||
self.female_boobs = dictionary.get( "female_boobs", self.female_boobs )
|
||||
self.female_hip = dictionary.get( "female_hip", self.female_hip )
|
||||
self.male_pack = dictionary.get( "male_pack", self.male_pack )
|
||||
self.male_throat = dictionary.get( "male_throat", self.male_throat )
|
||||
self.female_pregnant = dictionary.get( "female_pregnant", self.female_pregnant )
|
||||
|
||||
self.color = dictionary.get( "color", self.color )
|
||||
|
||||
func from_file( filename ):
|
||||
var file = File.new()
|
||||
if file.file_exists( "user://creatures/" + filename ):
|
||||
file.open( "user://creatures/" + filename, File.READ )
|
||||
var lines = ""
|
||||
while not file.eof_reached():
|
||||
var current_line = file.get_line()
|
||||
lines += current_line
|
||||
var json = JSON.parse( lines ).result
|
||||
var dict = {}
|
||||
for data in json:
|
||||
dict[ data ] = str2var( json[data] )
|
||||
|
||||
|
||||
self.from_dictionary( dict )
|
||||
|
||||
file.close()
|
||||
|
|
@ -5,5 +5,5 @@ class_name Creature_old
|
|||
|
||||
|
||||
func from_dict( datas ):
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
extends Node
|
||||
|
||||
class Creature_old2:
|
||||
|
||||
enum Sex { F, M, H, A, U }
|
||||
|
||||
var type
|
||||
var pseudonym
|
||||
|
||||
|
||||
func _init( p_pseudonym = "Créature" ):
|
||||
self.type = "creature"
|
||||
self.pseudonym = p_pseudonym
|
||||
|
||||
|
||||
class Ra_old2 extends Creature_old2:
|
||||
|
||||
|
||||
var sex = Creature_old2.Sex.F
|
||||
|
||||
var female_boobs = 0.0
|
||||
var female_hip = 0.0
|
||||
var male_pack = 0.0
|
||||
var male_throat = 0.0
|
||||
var female_pregnant = 0.0
|
||||
|
||||
var color = Color( 1.0, 1.0, 1.0 )
|
||||
|
||||
var douleur = 0.0
|
||||
var trauma = 0.0
|
||||
var oubli = 0.0
|
||||
|
||||
func _init( p_pseudonym = "Créature" ):
|
||||
self.type = "ra"
|
||||
self.pseudonym = p_pseudonym
|
||||
|
||||
func to_dictionary():
|
||||
|
||||
var dictionary = Dictionary()
|
||||
dictionary[ "type" ] = self.type
|
||||
dictionary[ "pseudonym" ] = self.pseudonym
|
||||
|
||||
dictionary[ "sex" ] = var2str( self.sex )
|
||||
dictionary[ "female_boobs" ] = var2str( self.female_boobs )
|
||||
dictionary[ "female_hip" ] = var2str( self.female_hip )
|
||||
dictionary[ "male_pack" ] = var2str( self.male_pack )
|
||||
dictionary[ "male_throat" ] = var2str( self.male_throat )
|
||||
dictionary[ "female_pregnant" ] = var2str( self.female_pregnant )
|
||||
|
||||
dictionary[ "color" ] = var2str( self.color )
|
||||
|
||||
|
||||
return dictionary
|
||||
|
||||
func from_dictionary( dictionary ):
|
||||
|
||||
self.pseudonym = dictionary.get( "pseudonym", self.pseudonym )
|
||||
|
||||
self.sex = dictionary.get( "sex", self.sex )
|
||||
self.female_boobs = dictionary.get( "female_boobs", self.female_boobs )
|
||||
self.female_hip = dictionary.get( "female_hip", self.female_hip )
|
||||
self.male_pack = dictionary.get( "male_pack", self.male_pack )
|
||||
self.male_throat = dictionary.get( "male_throat", self.male_throat )
|
||||
self.female_pregnant = dictionary.get( "female_pregnant", self.female_pregnant )
|
||||
|
||||
self.color = dictionary.get( "color", self.color )
|
||||
|
||||
func from_file( filename ):
|
||||
var file = File.new()
|
||||
if file.file_exists( "user://creatures/" + filename ):
|
||||
file.open( "user://creatures/" + filename, File.READ )
|
||||
var lines = ""
|
||||
while not file.eof_reached():
|
||||
var current_line = file.get_line()
|
||||
lines += current_line
|
||||
var json = JSON.parse( lines ).result
|
||||
var dict = {}
|
||||
for data in json:
|
||||
dict[ data ] = str2var( json[data] )
|
||||
|
||||
|
||||
self.from_dictionary( dict )
|
||||
|
||||
file.close()
|
||||
|
|
@ -7,29 +7,29 @@ var player_name = null
|
|||
var ressource_queue = preload("res://ressources/scripts/resource_queue.gd").new()
|
||||
|
||||
enum RACE {
|
||||
human
|
||||
human
|
||||
}
|
||||
var race_label = [ "Humain" ]
|
||||
func get_race_id( p_label ):
|
||||
return race_label.find( p_label )
|
||||
|
||||
return race_label.find( p_label )
|
||||
|
||||
enum SEX {
|
||||
female,
|
||||
male
|
||||
female,
|
||||
male
|
||||
}
|
||||
var sex_label = [ "Femme", "Homme" ]
|
||||
func get_sex_id( p_label ):
|
||||
return race_label.find( p_label )
|
||||
return race_label.find( p_label )
|
||||
|
||||
enum CREATURES_EDITOR_MODE {
|
||||
player,
|
||||
npc
|
||||
player,
|
||||
npc
|
||||
}
|
||||
var creatures_editor_mode = CREATURES_EDITOR_MODE.player
|
||||
|
||||
|
||||
|
||||
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 )
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
class nel_login_message:
|
||||
var _cmd;
|
||||
var _login;
|
||||
var _password;
|
||||
var _clientApplication;
|
||||
var _cp;
|
||||
var _lg;
|
||||
var _cmd;
|
||||
var _login;
|
||||
var _password;
|
||||
var _clientApplication;
|
||||
var _cp;
|
||||
var _lg;
|
||||
|
||||
func _init(cmd, login, password, clientApplication, cp, lg):
|
||||
self._cmd = cmd;
|
||||
self._login = login;
|
||||
self._password = password;
|
||||
self._clientApplication = clientApplication;
|
||||
self._cp = cp;
|
||||
self._lg = lg;
|
||||
func _init(cmd, login, password, clientApplication, cp, lg):
|
||||
self._cmd = cmd;
|
||||
self._login = login;
|
||||
self._password = password;
|
||||
self._clientApplication = clientApplication;
|
||||
self._cp = cp;
|
||||
self._lg = lg;
|
||||
|
||||
func get_request_string():
|
||||
var request_string = "cmd=" + self._cmd;
|
||||
if self._login != "":
|
||||
request_string += "&login=" + self._login;
|
||||
if self._password != "":
|
||||
request_string += "&password=" + self._password;
|
||||
if self._clientApplication != "":
|
||||
request_string += "&clientApplication=" + self._clientApplication;
|
||||
if self._cp != "":
|
||||
request_string += "&cp=" + self._cp;
|
||||
if self._lg != "":
|
||||
request_string += "&lg=" + self._lg;
|
||||
func get_request_string():
|
||||
var request_string = "cmd=" + self._cmd;
|
||||
if self._login != "":
|
||||
request_string += "&login=" + self._login;
|
||||
if self._password != "":
|
||||
request_string += "&password=" + self._password;
|
||||
if self._clientApplication != "":
|
||||
request_string += "&clientApplication=" + self._clientApplication;
|
||||
if self._cp != "":
|
||||
request_string += "&cp=" + self._cp;
|
||||
if self._lg != "":
|
||||
request_string += "&lg=" + self._lg;
|
||||
|
||||
return request_string;
|
||||
return request_string;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
class nel_server_info:
|
||||
var _cookie;
|
||||
var _shardIp;
|
||||
var _ringStartAdress;
|
||||
var _ringAddress;
|
||||
var _patchVersion
|
||||
var _backupPatchUrls;
|
||||
var _patchUrls;
|
||||
var _cookie;
|
||||
var _shardIp;
|
||||
var _ringStartAdress;
|
||||
var _ringAddress;
|
||||
var _patchVersion
|
||||
var _backupPatchUrls;
|
||||
var _patchUrls;
|
||||
|
||||
func _init(connexionResultString):
|
||||
var params = connexionResultString.split('#');
|
||||
var temp = params[4].split('\n')
|
||||
self._cookie = params[1];
|
||||
self._shardIp = params[2];
|
||||
self._ringStartAdress = params[3];
|
||||
self._ringAddress = temp[0];
|
||||
self._patchVersion = temp[1];
|
||||
self._backupPatchUrls = params[5];
|
||||
self._patchUrls = params[6];
|
||||
func _init(connexionResultString):
|
||||
var params = connexionResultString.split('#');
|
||||
var temp = params[4].split('\n')
|
||||
self._cookie = params[1];
|
||||
self._shardIp = params[2];
|
||||
self._ringStartAdress = params[3];
|
||||
self._ringAddress = temp[0];
|
||||
self._patchVersion = temp[1];
|
||||
self._backupPatchUrls = params[5];
|
||||
self._patchUrls = params[6];
|
||||
|
|
|
@ -8,138 +8,138 @@ var queue = []
|
|||
var pending = {}
|
||||
|
||||
func _lock(_caller):
|
||||
mutex.lock()
|
||||
mutex.lock()
|
||||
|
||||
|
||||
func _unlock(_caller):
|
||||
mutex.unlock()
|
||||
mutex.unlock()
|
||||
|
||||
|
||||
func _post(_caller):
|
||||
sem.post()
|
||||
sem.post()
|
||||
|
||||
|
||||
func _wait(_caller):
|
||||
sem.wait()
|
||||
sem.wait()
|
||||
|
||||
|
||||
func queue_resource(path, p_in_front = false):
|
||||
_lock("queue_resource")
|
||||
if path in pending:
|
||||
_unlock("queue_resource")
|
||||
return
|
||||
elif ResourceLoader.has_cached(path):
|
||||
var res = ResourceLoader.load(path)
|
||||
pending[path] = res
|
||||
_unlock("queue_resource")
|
||||
return
|
||||
else:
|
||||
var res = ResourceLoader.load_interactive(path)
|
||||
res.set_meta("path", path)
|
||||
if p_in_front:
|
||||
queue.insert(0, res)
|
||||
else:
|
||||
queue.push_back(res)
|
||||
pending[path] = res
|
||||
_post("queue_resource")
|
||||
_unlock("queue_resource")
|
||||
return
|
||||
_lock("queue_resource")
|
||||
if path in pending:
|
||||
_unlock("queue_resource")
|
||||
return
|
||||
elif ResourceLoader.has_cached(path):
|
||||
var res = ResourceLoader.load(path)
|
||||
pending[path] = res
|
||||