Clean project uid generation
This commit is contained in:
@@ -197,13 +197,13 @@ motion_scale = Vector2(0.1, 0.1)
|
||||
material = SubResource("CanvasItemMaterial_ey6av")
|
||||
position = Vector2(1280, 900)
|
||||
amount = 256
|
||||
process_material = SubResource("ParticleProcessMaterial_m12rm")
|
||||
texture = ExtResource("3_xbvhu")
|
||||
lifetime = 5.0
|
||||
preprocess = 5.0
|
||||
randomness = 0.5
|
||||
visibility_rect = Rect2(-12800, -900, 25600, 1800)
|
||||
local_coords = true
|
||||
process_material = SubResource("ParticleProcessMaterial_m12rm")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 1
|
||||
@@ -247,8 +247,8 @@ z_index = 1
|
||||
material = SubResource("CanvasItemMaterial_13bcn")
|
||||
position = Vector2(59.5, 51)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
process_material = SubResource("ParticleProcessMaterial_3eofo")
|
||||
texture = ExtResource("25_00sy7")
|
||||
process_material = SubResource("ParticleProcessMaterial_3eofo")
|
||||
|
||||
[node name="LineAudioStreamPlayer" type="AudioStreamPlayer2D" parent="ScrollContainer/UnlockedLine/LineParticles"]
|
||||
unique_name_in_owner = true
|
||||
@@ -431,8 +431,8 @@ material = SubResource("CanvasItemMaterial_5003s")
|
||||
position = Vector2(192, 192)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
emitting = false
|
||||
process_material = SubResource("ParticleProcessMaterial_4gqpn")
|
||||
texture = ExtResource("25_00sy7")
|
||||
process_material = SubResource("ParticleProcessMaterial_4gqpn")
|
||||
|
||||
[node name="MinigameBackground" type="TextureRect" parent="CanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cgwun1jhj53bi" path="res://assets/menus/main/play_button.png" id="7_lr7j4"]
|
||||
[ext_resource type="Script" uid="uid://ci68l5p7n77ym" path="res://sources/menus/main/kalulu.gd" id="8_cxg8l"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnuny6200v5b0" path="res://sources/kalulu.tscn" id="10_icqmp"]
|
||||
[ext_resource type="Script" uid="uid://c8yjncc0n0sbu" path="res://sources/menus/main/login.gd" id="12_6bu7q"]
|
||||
[ext_resource type="Script" uid="uid://hxlda8qtegc1" path="res://sources/menus/main/login.gd" id="12_6bu7q"]
|
||||
[ext_resource type="PackedScene" uid="uid://cr4q0ywceoasx" path="res://sources/utils/keyboard_spacer.tscn" id="13_6pvxs"]
|
||||
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="13_j3nb7"]
|
||||
[ext_resource type="Script" uid="uid://dugl3xh4di2a5" path="res://sources/menus/main/language_field.gd" id="13_rs3hd"]
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
extends Label
|
||||
class_name DynamicFontSizeLabel
|
||||
|
||||
@export var autosize_on: bool = true
|
||||
@export var font_size_override: int = -1
|
||||
@export var font_size_min: int = 8
|
||||
@export var font_size_max: int = 100
|
||||
@export var font_size_width_percent: float = 0.9
|
||||
|
||||
var _current_font_size: int
|
||||
var _default_font_size: int
|
||||
|
||||
func _ready():
|
||||
resized.connect(_on_resized)
|
||||
_initialize_default_font_size()
|
||||
_update_font_size()
|
||||
|
||||
func _initialize_default_font_size():
|
||||
_default_font_size = get_theme_font_size("font_size")
|
||||
|
||||
func _on_resized():
|
||||
_update_font_size()
|
||||
|
||||
func _update_font_size():
|
||||
if not autosize_on:
|
||||
return
|
||||
|
||||
if font_size_override >= 0:
|
||||
_current_font_size = font_size_override
|
||||
else:
|
||||
_current_font_size = _calculate_best_font_size()
|
||||
|
||||
add_theme_font_size_override("font_size", _current_font_size)
|
||||
|
||||
# Recherche binaire de la taille de police optimale
|
||||
func _calculate_best_font_size() -> int:
|
||||
var available_width = size.x * font_size_width_percent
|
||||
var available_height = size.y
|
||||
|
||||
var font = get_theme_font("font")
|
||||
var low = font_size_min
|
||||
var high = font_size_max
|
||||
var best_size = low
|
||||
|
||||
while low <= high:
|
||||
var mid = int((low + high) / 2)
|
||||
var text_size = font.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, mid)
|
||||
|
||||
# Si le texte rentre, on essaie de l'augmenter
|
||||
if text_size.x <= available_width and text_size.y <= available_height:
|
||||
best_size = mid
|
||||
low = mid + 1 # On essaie une taille plus grande
|
||||
else:
|
||||
high = mid - 1 # On essaie une taille plus petite
|
||||
|
||||
return best_size
|
||||
@@ -0,0 +1 @@
|
||||
uid://cxcm0iaf8wc3s
|
||||
Reference in New Issue
Block a user