Skip to content

Commit

Permalink
GUI templates and game commands
Browse files Browse the repository at this point in the history
Progress on refactoring the GI

Progress on working with 9 verbs

First draft of the Sierra GUI implementation

Created the `g.gd` script to test an approach for accessing the commands
defined for the graphic interface.
Moved the Toolbar folder to the popochiu template folder since that
component will be part of that GUI only.
Added a function to "replace" the default cursor. This still needs
improvements or a complete refactor.

GUI template selection in Setup popup

Refactorization of GUI template commands

This fixes a dependency generated when having the commands of the current GUI in the g.gd singleton. Now each GUI has its own commands Resource class.
Selecting the GUI template in the Setup popup is now working without bugs.

Changed Popochiu GUI template name to BASS

Usability improvements in 9 verb interface

Sound settings script moved to BASS' toolbar folder

History popup working again in BASS template

upd: Lines in History to RichTextLabel so one can uses colors to
highlight characters, commands and props.
fea: Improved the way BASS handles mouse positioning to open/close the
inventory and the settings.
upd: Renamed scene and script filenames from Toolbar to SettingsBar.

PopochiuPopup are now used by History, Save and Load and Sound settings.

upd: Updated the Settings popup for the 9 verb interface. Now it allows to
Save, Load, open the History, and update sound volumes.
upd: New appearance for Sound volumes sliders.
upd: Created Sound volumes component, so devs can use the sliders
without having to use a popup.
fea: Created Settings icon for settings button in 9 verb interface.
upd: Created cursor for UI elements in 9 verb interface.
fix: Opening the SaveAndLoad popup when saving no longer requires to
pass a String as a parameter.

upd: new style for 9 verb interface

Now it get closer to the style used in Thimbleweed Park.
fea: created icons for GUI templates in the Setup window.
fea: added option to 9 verb settings popup to choose between classic and
modern sentences.
fea: created sprites and style for CheckButton.

Sierra theme styles updated

This is for PanelContainers and Buttons.
Created inventory popup for Sierra GUI.
Created USE cursor for Sierra GUI.
Created top bar (hover text + score) panel for Sierra GUI.
Fixed some bugs in the Sierra GUI.
Working on making the inventory popup to work properly in Sierra GUI.

SystemText working again.

fix: showing the SystemText blocks interactions until players click
anywhere to close the panel.
upd: `G.display` changed to `G.show_system_text`.
fea: basic inventory functionality working in Sierra GUI. Players can
inspect items and select them for use. Once used, the item disappears
from the inventory grid.

First approach on having varios dialog text types

Devs can choose between Above character, Portrait and Caption.
The implementation is still hardcoded in various parts. Improvements
will come soon.

Fix: cursor behavior in Sierra inventory popup.

fix: the error related to set_name.call_deferred is now solved.
Working on fix for C singleton.

Fallback for commands improved

Code refactor and improvements for DialogText.

upd: Now the now supports the three display modes (Above character, Portrait
and Caption) by itself.
fix: #79 .
fix: Recognizing emotions in dialog lines for `E.queue` was not working.
upd: Added support for avatars with emotions in PopochiuCharacter.
upd: Portrait mode displays the avatar of the talking character (with
its corresponding emotion).

Improved CAPTION text style rendering.

Fixes and minor improvements in DialogText rendering.
Updated properties in scaling and layout for PopochiuInventoryItem.

9 verb inventory scroll working

It takes into account the size of each slot, the size of the gaps
between rows and the number of rows.
This inventory panel adds items to the i_inventory based on what the
scene tree has.
NEXT >> Make this as a component that can work in a popup (i.e. in the
Sierra inventory popup).

Progress on 9 verb inventory functionality

Can trigger commands on inventory items.
Can use inventory items with popochiu clickable and other inventory
items.

fea: Make suggested command to work

This applies for PopochiuClickable and PopochiuInventoryItem (which
suggested verb will be always LOOK AT).
fea: Try calling the left click version of a command before triggering
its fallback (this applies to PopochiuClickable and
PopochiuInventoryItem).

NEXT >> [9 verb] Make inventory container to re-arrange after removing an
inventory item.

fea: can remove items in 9 verb inventory

Removing the item also removes the slot it belongs to, which ensures the
container will re-arrange correctly. A new slot is created after
removing the item.

NEXT >> Allow to replace an item (useful for combining items).

fea: Adds method to replace an inventory item

The new inventory item replaces the one that calls the `replace` method
in the 9 verb interface.
fea: Cursor doesn't leave the screen when the mouse exits the game
window.

upd: Adjust styles and layout of 9 verb interface

upd: Inventory container component for Sierra GPI

Uses the component created for the 9 verb interface in the Inventory
popup of the Sierra template.

upd: Create scroll buttons for Sierra inventory.

upd: Work in Sierra inventory popup

Now players can select an inventory item (with the INTERACT command
active), close the popup, and use such item with clickables.

Create Settings popup for Sierra template.

Can change dialog style in Text options popup in Sierra template.
Can change dialog text speed with a slider in Text options popup in
Sierra template.
Create Sound options popup.

Create Sierra settings option to toggle auto-continue

Update style of text continue icon for Sierra template.
Create texture for QUIT button in Sierra template.
Sierra template now has buttons to quit the game.
Improvements in dialog_text component behavior and anchors setup.

Add function to E for registering commands

The 9 verb and Sierra commands' scripts now register their commands
using the created method.
PopochiuClickable and PopochiuInventoryItem now store the mouse button
index used in the last click.
Started to prepare everything to freeze the development of the 9 verb and Sierra templates.

NEXT >> Cursor refactor or Verb coin template creation.

Dialog menu working in 9 verb and Sierra templates

Change G.freed to G.unblocked.
DialogText no longer affects the Cursor. Now it triggers a signal so the
graphic interface decides what to do while a dialog line is played.
Create signal in D to know when a dialog starts.

Refactors Dialog menu

Now it works in 9 verb and Sierra templates.
It is a bit easier to modify the appearance of the Dialog menu.
Added more signals to PopochiuGraphicInterface in order to allow devs to
customize how to handle more interactions.

Remove G.continue_clicked

Connect to G.dialog_line_finished in PopochiuCharacter.say()
Create signal for listening when the system text is hidden.
Behavior improvements in 9 verb GUI.

Update in BASS GUI for setting the cursor

Set "popochiu_gui_component" group to GI components in order to start
building the UI tab in the dock.

Rename methods

Create InventoryGrid component

This is the type of inventory used by 9 verbs and Sierra templates.
upd: change `Cursor.set_cursor(int)` by `Cursor.show_cursor(String)`.

Create inventory grid component for 9 Verb template

Ready to start freezing development for PR creation.

Updated command handling

Both in PopochiuClickable and PopochiuInventoryItem. They will call
`_on_click` if not custom method is present in the object. Method
fallback should be manually called with `E.command_fallback()`.
Added script_name property to PopochiuCommands class. This can be used
to know which set of commands is the current one.

BASS template working with new commands approach

Fix various issues in the BASS template regarding cursor animations and
behavior with PopochiuClickable and PopochiuInventoryItem.
The reference to the current commands class is now in E.
Updated InventoryBar so it can react to the I.item_replaced signal.

Restore cursor property

Both in PopochiuClickable and PopochiuInventory Item.
Now variations for voices are defined by an array of AudioCueSound.

Fix and update in Setup popup

Now it shows a description of the selected template so devs can know a
bit more about each one.
If the selected template is the same that is currently active after
closing the Setup popup, no action is performed.
Add Popsy as a character to test a bug reported related to z-index.
Add GUI cursor to BASS cursors.

Improve GUI template change with confirmation popup

Created templates for GUI commands types.

Create script copies when selecting GUI template

A copy of the template scripts for the graphic interface and the
commands linked to it is created and placed in
res://popochiu/graphic_interface.
This makes sure devs can play with those scripts instead of modifying
those in the addons folder.

fea: Create a commands template script for the Empty template.

First draft of UI tab working.

It allows to add GUI components to the graphic interface scene.
Buttons in the UI panel show enable when the component they represent is
deleted from the graphic interface scene.

Change to Godot 4.1.2 and removed game scenes

Add buttons to open graphic interface script and commands script

upd: use PopochiuGroup for base components and popups in UI tab.

Change BASS template to SimpleClick template

Fix "Start with it" for inventory items.

fix: Devs can select items to start with in the Main tab.
fix: Setting an inventory item as active with `add_as_active` makes the
cursor take the appearance of the item.
fix: Text color changes when character talks in the Caption dialog
style.
fix: PopochiuInventoryItem.add was not showing InventoryBar.
fea: Added `is_pixel_art_game` property to ProjectSettings.
upd: When selecting Pixel in Game type (setup popup) the default texture
filter is set to TEXTURE_FILTER_NEAREST for props, characters and
inventory items.

Progress on improving code before merge

Better positioning of avatars in Portrait dialog style

Adressed all comments and sugestions made by @stickgrinder
  • Loading branch information
mapedorr committed Nov 11, 2023
1 parent 7b21c31 commit eaf3d09
Show file tree
Hide file tree
Showing 320 changed files with 8,701 additions and 3,366 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Addons other than Popochiu
# (we use some for development)
addons/**
!addons/popochiu/**
# addons/**
# !addons/popochiu/**/**

# Godot-specific ignores
.import/
Expand Down
15 changes: 13 additions & 2 deletions addons/popochiu/editor/main_dock/popochiu_dock.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var _rows_paths := []
@onready var _tab_container: TabContainer = find_child('TabContainer')
@onready var _tab_room: VBoxContainer = _tab_container.get_node('Room')
@onready var _tab_audio: VBoxContainer = _tab_container.get_node('Audio')
@onready var tab_ui: VBoxContainer = %UI
# ▨▨▨▨ FOOTER ▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨▨
@onready var _btn_docs: Button = find_child('BtnDocs')
@onready var _btn_settings: Button = find_child('BtnSettings')
Expand Down Expand Up @@ -90,6 +91,7 @@ func _ready() -> void:
_tab_room.main_dock = self
_tab_room.object_row = _object_row
_tab_audio.main_dock = self
tab_ui.main_dock = self

_tab_container.tab_changed.connect(_on_tab_changed)
_btn_docs.pressed.connect(OS.shell_open.bind(Constants.WIKI))
Expand Down Expand Up @@ -199,6 +201,14 @@ func add_to_list(type: int, name_to_add: String) -> PopochiuObjectRow:
func scene_changed(scene_root: Node) -> void:
if not is_instance_valid(_tab_room): return
_tab_room.scene_changed(scene_root)

if not is_instance_valid(tab_ui): return
tab_ui.on_scene_changed(scene_root)

if not scene_root is PopochiuRoom or not scene_root is PopochiuGraphicInterface:
# Open the Popochiu Main tab if the opened scene in the Editor2D is not
# a PopochiuRoom nor a PopochiuGraphicInterface
_tab_container.current_tab = 0


func scene_closed(filepath: String) -> void:
Expand Down Expand Up @@ -294,6 +304,9 @@ func _on_tab_changed(tab: int) -> void:
# Try to load the Main tab data in case they couldn't be loaded while
# opening the engine
fill_data()

if tab == tab_ui.get_index():
tab_ui.open_gui_scene()


func _select_object(por: PopochiuObjectRow) -> void:
Expand All @@ -311,5 +324,3 @@ func _check_node(node: Node) -> void:
if node is PopochiuCharacter and node.get_parent() is Node2D:
# The node is a PopochiuCharacter in a room
node.set_name.call_deferred('Character%s *' % node.script_name)
# TODO: Show something in the Inspector to alert devs about editing this
# node.
22 changes: 20 additions & 2 deletions addons/popochiu/editor/main_dock/popochiu_dock.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=3 uid="uid://bardo4kb80rvg"]
[gd_scene load_steps=30 format=3 uid="uid://bardo4kb80rvg"]

[ext_resource type="PackedScene" uid="uid://byxufkqv2sncb" path="res://addons/popochiu/editor/popups/create_character/create_character.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://rvbosisbkiob" path="res://addons/popochiu/editor/popups/create_dialog/create_dialog.tscn" id="2"]
Expand All @@ -12,13 +12,14 @@
[ext_resource type="PackedScene" uid="uid://b4xgqqfpot7cc" path="res://addons/popochiu/editor/popups/create_inventory_item/create_inventory_item.tscn" id="6"]
[ext_resource type="Texture2D" uid="uid://bb53j2q1cm45l" path="res://addons/popochiu/icons/dialog.png" id="6_evjo7"]
[ext_resource type="Script" path="res://addons/popochiu/editor/main_dock/popochiu_dock.gd" id="7"]
[ext_resource type="PackedScene" uid="uid://4etgd0rwjgct" path="res://addons/popochiu/editor/main_dock/tab_ui/tab_ui.tscn" id="10_82goo"]
[ext_resource type="PackedScene" uid="uid://q1bjkxavt2ay" path="res://addons/popochiu/editor/main_dock/tab_room.tscn" id="12"]
[ext_resource type="PackedScene" uid="uid://bpj8jlet25coy" path="res://addons/popochiu/editor/main_dock/tab_audio.tscn" id="13"]
[ext_resource type="PackedScene" uid="uid://yybwvwbsf7en" path="res://addons/popochiu/editor/popups/create_hotspot/create_hotspot.tscn" id="14"]
[ext_resource type="PackedScene" uid="uid://chnpxfme1xmpb" path="res://addons/popochiu/editor/popups/create_region/create_region.tscn" id="15"]
[ext_resource type="PackedScene" path="res://addons/popochiu/editor/popups/loading/loading.tscn" id="16"]
[ext_resource type="PackedScene" uid="uid://bcb865akap0mt" path="res://addons/popochiu/editor/popups/delete_confirmation/delete_confirmation.tscn" id="17"]
[ext_resource type="PackedScene" uid="uid://dbqppogchdate" path="res://addons/popochiu/editor/popups/setup/setup.tscn" id="18"]
[ext_resource type="PackedScene" uid="uid://c3r8juwutb1gr" path="res://addons/popochiu/editor/popups/setup/setup.tscn" id="18"]
[ext_resource type="PackedScene" uid="uid://c054k1ux04waq" path="res://addons/popochiu/editor/popups/create_walkable_area/create_walkable_area.tscn" id="19"]

[sub_resource type="Image" id="Image_uchp8"]
Expand Down Expand Up @@ -73,6 +74,18 @@ border_width_right = 2
border_width_bottom = 2
border_color = Color(0.556863, 0.235294, 0.592157, 0.74902)

[sub_resource type="Image" id="Image_cpqpn"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}

[sub_resource type="ImageTexture" id="ImageTexture_cg4n0"]
image = SubResource("Image_cpqpn")

[node name="Popochiu" type="Panel"]
clip_contents = true
custom_minimum_size = Vector2(408, 0)
Expand Down Expand Up @@ -166,6 +179,11 @@ visible = false
layout_mode = 2
focus_mode = 2

[node name="UI" parent="MarginContainer/VBoxContainer/TabContainer" instance=ExtResource("10_82goo")]
unique_name_in_owner = true
visible = false
layout_mode = 2

[node name="FooterPanel" type="PanelContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func _ready() -> void:
'panel', get_theme_stylebox('panel').duplicate()
)
(get_theme_stylebox('panel') as StyleBoxFlat).border_color = color
_icon.texture = icon

if is_instance_valid(icon):
_icon.texture = icon

_lbl_title.text = title
_btn_create.icon = get_theme_icon('Add', 'EditorIcons')
_btn_create.text = create_text
Expand Down Expand Up @@ -152,7 +155,6 @@ func _set_icon(value: Texture2D) -> void:

if is_instance_valid(_icon):
_icon.texture = value
notify_property_list_changed()


func _update_child_count() -> void:
Expand Down
Loading

0 comments on commit eaf3d09

Please sign in to comment.