Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/.godot
/.import
/principal/saves/save.tres
/addons

20 changes: 20 additions & 0 deletions addons/microgame-testing/microgame-testing.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@tool
class_name MicrogameTestingUtil extends EditorPlugin

const CONFIG_PATH: StringName = "user://microgame-testing.cfg"

# Initialization of the plugin goes here.
func _enter_tree() -> void:
pass

func _exit_tree() -> void:
# Clean-up of the plugin goes here.
pass

func _enable_plugin() -> void:
# Add autoloads here.
add_autoload_singleton("TestOverlayRunner", "res://addons/microgame-testing/scripts/autoloads/overlay-runner.gd")

func _disable_plugin() -> void:
# Remove autoloads here.
remove_autoload_singleton("TestOverlayRunner")
1 change: 1 addition & 0 deletions addons/microgame-testing/microgame-testing.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://crxn7jj34pwma
7 changes: 7 additions & 0 deletions addons/microgame-testing/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="GamutoWare Microgame Testing Utils"
description="Set of editor tools that simplify microgame testing"
author="https://github.com/grandeisa"
version=""
script="microgame-testing.gd"
48 changes: 48 additions & 0 deletions addons/microgame-testing/scripts/autoloads/overlay-runner.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
extends Node

const DEFAULT_MICROGAME_PATH: String = "res://microjogos"
const MICROGAME_OVERLAY_PATH = "res://principal/cenas/Jogo.tscn"

var current_microgame: MicrogameAsset = null

func _ready() -> void:
verify_microgame_main(get_tree().current_scene)

func verify_microgame_main(scene: Node) -> void:
var path = scene.scene_file_path

# False if node path is not in default microgame path
if not String(path).begins_with(DEFAULT_MICROGAME_PATH):
push_warning("Scene path (%s) does not begin with default microgame path (%s)" % [path, DEFAULT_MICROGAME_PATH])
return

# Attempt to find microgame in folder or parent
var microgame: MicrogameAsset = get_microgame_resource(path)
if not microgame:
push_warning("No microgame found at %s" % path)
return

add_display_with_microgame(microgame)

## Attempts to find a microgame resource file in the specified path folder or parenting folders
func get_microgame_resource(path: StringName) -> MicrogameAsset:
var dir_array: PackedStringArray = String(path).split("/")
var dir_path: String = "/".join(dir_array)

while dir_path.begins_with(DEFAULT_MICROGAME_PATH):
for file in DirAccess.get_files_at(dir_path):
var file_path = dir_path + "/" + file
if not file_path.ends_with(".tres"):
continue
if ResourceLoader.exists(file_path, "MicrogameAsset"):
var asset = ResourceLoader.load(file_path, "MicrogameAsset")
if asset is MicrogameAsset:
return asset

dir_array = dir_array.slice(0, len(dir_array) - 1)
dir_path = "/".join(dir_array)

return null

func add_display_with_microgame(microgame: MicrogameAsset) -> void:
Global.goto_scene_and_call(MICROGAME_OVERLAY_PATH, "setup_arcade_mode", [[microgame]])
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://bi65u8xgbv7lt
24 changes: 11 additions & 13 deletions microjogos/2023S1/mail_cleaner/cenas/main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bwf53xp28gd35"]
[gd_scene format=3 uid="uid://bwf53xp28gd35"]

[ext_resource type="Script" uid="uid://c6l0ax4frv2ul" path="res://microjogos/2023S1/mail_cleaner/cenas/scripts/main.gd" id="1_kyp7x"]
[ext_resource type="PackedScene" uid="uid://dsxm54jv86dym" path="res://microjogos/2023S1/mail_cleaner/cenas/phone.tscn" id="2_mtjul"]
Expand Down Expand Up @@ -118,45 +118,43 @@ _data = {
&"background_movement": SubResource("Animation_gt1yq")
}

[node name="Main" type="Node2D"]
[node name="Main" type="Node2D" unique_id=315166068]
script = ExtResource("1_kyp7x")

[node name="Background" type="Sprite2D" parent="."]
[node name="Background" type="Sprite2D" parent="." unique_id=470889655]
modulate = Color(0.580392, 0.580392, 0.580392, 1)
texture_filter = 2
position = Vector2(980, 570)
rotation = -0.0566683
scale = Vector2(18, 18)
texture = ExtResource("2_ti7tx")

[node name="AnimationPlayer" type="AnimationPlayer" parent="Background"]
[node name="AnimationPlayer" type="AnimationPlayer" parent="Background" unique_id=1720170152]
libraries/ = SubResource("AnimationLibrary_vn30i")
speed_scale = 0.25
libraries = {
"": SubResource("AnimationLibrary_vn30i")
}

[node name="Phone" parent="." instance=ExtResource("2_mtjul")]
[node name="Phone" parent="." unique_id=154284354 instance=ExtResource("2_mtjul")]
position = Vector2(726, 121)

[node name="Right" type="Sprite2D" parent="."]
[node name="Right" type="Sprite2D" parent="." unique_id=160343912]
texture_filter = 1
position = Vector2(350, 540)
scale = Vector2(10, 10)
texture = ExtResource("4_vmscg")

[node name="Wrong" type="Sprite2D" parent="."]
[node name="Wrong" type="Sprite2D" parent="." unique_id=1743275317]
texture_filter = 1
position = Vector2(1580, 540)
scale = Vector2(10, 10)
texture = ExtResource("5_6vicc")

[node name="Music" type="AudioStreamPlayer" parent="."]
[node name="Music" type="AudioStreamPlayer" parent="." unique_id=1280436315]
stream = ExtResource("6_cxdmi")
autoplay = true

[node name="Scratch" type="AudioStreamPlayer" parent="."]
[node name="Scratch" type="AudioStreamPlayer" parent="." unique_id=1342274063]
stream = ExtResource("7_7gcfo")

[node name="Hit" type="AudioStreamPlayer" parent="."]
[node name="Hit" type="AudioStreamPlayer" parent="." unique_id=173311625]
stream = ExtResource("8_thm37")
volume_db = -2.0
9 changes: 9 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

config_version=5

[animation]

compatibility/default_parent_skeleton_in_mesh_instance_3d=true

[application]

config/name="GamutoWare"
Expand All @@ -23,6 +27,7 @@ Global="*res://principal/cenas/autoloads/Global.tscn"
SoundController="*res://principal/cenas/autoloads/SoundController.tscn"
TranslationManager="*res://principal/cenas/autoloads/TranslationManager.tscn"
Minigames="*res://principal/recursos/data/Minigames.gd"
TestOverlayRunner="*res://addons/microgame-testing/scripts/autoloads/overlay-runner.gd"

[display]

Expand All @@ -34,6 +39,10 @@ window/size/window_height_override=540
window/stretch/mode="viewport"
window/size/fullscreen=true

[editor_plugins]

enabled=PackedStringArray()

[filesystem]

import/blender/enabled=false
Expand Down