First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
|
@ -0,0 +1,80 @@
|
|||
@tool
|
||||
extends "res://addons/popochiu/editor/popups/create_object/create_object.gd"
|
||||
## Creates a new [PopochiuCharacter].
|
||||
##
|
||||
## It creates all the necessary files to make a [PopochiuCharacter] to work and to
|
||||
## store its state:
|
||||
## - character_xxx.tscn
|
||||
## - character_xxx.gd
|
||||
## - character_xxx.tres
|
||||
## - character_xxx_state.gd
|
||||
|
||||
var _new_character_name := ""
|
||||
var _factory: PopochiuCharacterFactory
|
||||
var _show_set_as_pc := false : set = set_show_set_as_pc
|
||||
|
||||
@onready var set_as_pc_panel: PanelContainer = %SetAsPCPanel
|
||||
@onready var rtl_is_pc: RichTextLabel = %RtlIsPC
|
||||
@onready var btn_is_pc: CheckBox = %BtnIsPC
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
_info_files = _info_files.replace("&t", "character")
|
||||
|
||||
super()
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Virtual ####################################################################################
|
||||
func _create() -> Object:
|
||||
if _new_character_name.is_empty():
|
||||
error_feedback.show()
|
||||
return null
|
||||
|
||||
# Setup the prop helper and use it to create the prop ------------------------------------------
|
||||
_factory = PopochiuCharacterFactory.new()
|
||||
if _factory.create(_new_character_name, btn_is_pc.button_pressed) != ResultCodes.SUCCESS:
|
||||
# TODO: show a message in the popup!
|
||||
return null
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
|
||||
return _factory.get_obj_scene()
|
||||
|
||||
|
||||
func _on_about_to_popup() -> void:
|
||||
PopochiuEditorHelper.override_font(rtl_is_pc, "normal_font", "main")
|
||||
PopochiuEditorHelper.override_font(rtl_is_pc, "bold_font", "bold")
|
||||
PopochiuEditorHelper.override_font(rtl_is_pc, "italics_font", "doc_italic")
|
||||
|
||||
_check_if_has_pc()
|
||||
info.hide()
|
||||
|
||||
|
||||
func _set_info_text() -> void:
|
||||
_new_character_name = _name.to_snake_case()
|
||||
_target_folder = PopochiuResources.CHARACTERS_PATH.path_join(_new_character_name)
|
||||
|
||||
info.text = (_info_text % _target_folder).replace("&n", _new_character_name)
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetGet #####################################################################################
|
||||
func set_show_set_as_pc(value: bool) -> void:
|
||||
_show_set_as_pc = value
|
||||
|
||||
if is_instance_valid(set_as_pc_panel):
|
||||
set_as_pc_panel.visible = _show_set_as_pc
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _check_if_has_pc() -> void:
|
||||
# Display the checkbox if the game's PC has not been defined yet
|
||||
_show_set_as_pc = PopochiuResources.get_data_value("setup", "pc", "").is_empty()
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://dgy4in4sknc82
|
|
@ -0,0 +1,36 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://q0mx8fu63d03"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c1pfl2gwjjot5" path="res://addons/popochiu/editor/popups/create_object/create_object.tscn" id="1_dtng2"]
|
||||
[ext_resource type="Script" path="res://addons/popochiu/editor/popups/create_object/create_character/create_character.gd" id="2_8yo43"]
|
||||
|
||||
[node name="CreateCharacterConfirmation" instance=ExtResource("1_dtng2")]
|
||||
script = ExtResource("2_8yo43")
|
||||
|
||||
[node name="Label" parent="PanelContainer/VBoxContainer/InputContainer" index="0"]
|
||||
text = "Character name:"
|
||||
|
||||
[node name="Guide" parent="PanelContainer/VBoxContainer" index="3"]
|
||||
text = "Use a descriptive name in PascalCase (e.g. Glottis, MannyCalavera, HectorLeMans)."
|
||||
|
||||
[node name="SetAsPCPanel" type="PanelContainer" parent="PanelContainer/VBoxContainer" index="4"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/SetAsPCPanel" index="0"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="RtlIsPC" type="RichTextLabel" parent="PanelContainer/VBoxContainer/SetAsPCPanel/HBoxContainer" index="0"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
bbcode_enabled = true
|
||||
text = "You don't have a Player-controlled Character ([b]PC[/b]) yet. Do you want this character to become the [b]PC[/b]?
|
||||
|
||||
[i]You can change this later in the context menu for each character or by code during runtime.[/i]"
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
|
||||
[node name="BtnIsPC" type="CheckBox" parent="PanelContainer/VBoxContainer/SetAsPCPanel/HBoxContainer" index="1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
Loading…
Add table
Add a link
Reference in a new issue