Add more methods to entrypoint.gd
This commit is contained in:
parent
79e7da1afd
commit
36492503be
3 changed files with 31 additions and 2 deletions
|
@ -21,5 +21,8 @@ var core: Core
|
|||
var logger: CoreLoggerInstance
|
||||
|
||||
# Required methods
|
||||
func load_resources() -> void: core.logger.crash("PresencodeEntrypoint", "Method load_resources was not overriden")
|
||||
func initialize() -> void: core.logger.crash("PresencodeEntrypoint", "Method initialize was not overriden")
|
||||
func switch_to_slide(_slide: int) -> void: core.logger.crash("PresencodeEntrypoint", "Method switch_to_slide was not overriden")
|
||||
|
||||
# Optional methods
|
||||
func play_animation(_type: PresencodeTypes.AnimationStage, _old_slide: int, _new_slide: int) -> void: pass
|
||||
|
|
20
src/classes/types.gd
Normal file
20
src/classes/types.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
# PRESENCODE SOURCE FILE
|
||||
# Copyright (c) 2024 JeremyStarTM & Contributors
|
||||
# Licensed under the GNU Affero General Public License v3
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
extends Node
|
||||
class_name PresencodeTypes
|
||||
|
||||
enum AnimationStage { BEFORE, AFTER }
|
|
@ -232,9 +232,15 @@ func inject_entrypoint() -> void:
|
|||
|
||||
# Instantiate new PresencodeEntrypoint
|
||||
var entrypoint_node: PresencodeEntrypoint = PresencodeEntrypoint.new()
|
||||
# Give the new node a name and the entrypoint script
|
||||
entrypoint_node.name = "Entrypoint"
|
||||
entrypoint_node.set_script(entrypoint)
|
||||
|
||||
# Update variables
|
||||
entrypoint_node.core = core
|
||||
entrypoint_node.logger = communication.get_source_path("src/" + manifest["entrypoint"])
|
||||
|
||||
# Add to SceneTree
|
||||
get_tree().root.add_child(entrypoint_node)
|
||||
|
||||
# Execute initialize()
|
||||
await entrypoint_node.initialize()
|
||||
|
|
Loading…
Reference in a new issue