This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0597561
commit a440861
Showing
21 changed files
with
350 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,82 @@ | ||
@tool extends MarginContainer | ||
|
||
@onready var namespace_selector: OptionButton = %DeployNamespaceSelector | ||
@onready var manage_versions_button: Button = %ManageVersionButton | ||
@onready var build_deploy_button: Button = %BuildDeployButton | ||
@onready var manage_versions_button: Button = %ManageVersionButton | ||
@onready var logs_button: Button = %LogsButton | ||
@onready var lobbies_button: Button = %LobbiesButton | ||
|
||
func _ready() -> void: | ||
manage_versions_button.pressed.connect(_on_manage_versions_button_pressed) | ||
build_deploy_button.pressed.connect(_on_build_deploy_button_pressed) | ||
build_deploy_button.pressed.connect(_on_build_deploy_button_pressed) | ||
manage_versions_button.pressed.connect(_on_manage_versions_button_pressed) | ||
logs_button.pressed.connect(_on_logs_button_pressed) | ||
lobbies_button.pressed.connect(_on_lobbies_button_pressed) | ||
|
||
func _on_manage_versions_button_pressed() -> void: | ||
_all_actions_set_disabled(true) | ||
|
||
var result = await RivetPluginBridge.get_plugin().cli.run_command(["sidekick", "get-version", "--namespace", namespace_selector.current_value.namespace_id]) | ||
if result.exit_code != 0 or !("Ok" in result.output): | ||
RivetPluginBridge.display_cli_error(self, result) | ||
_all_actions_set_disabled(true) | ||
|
||
var result = await RivetPluginBridge.get_plugin().cli.run_and_wait(["sidekick", "get-version", "--namespace", namespace_selector.current_value.namespace_id]) | ||
if result.exit_code != 0 or !("Ok" in result.output): | ||
RivetPluginBridge.display_cli_error(self, result) | ||
|
||
OS.shell_open(result.output["Ok"]["output"]) | ||
_all_actions_set_disabled(false) | ||
|
||
func _on_logs_button_pressed() -> void: | ||
_all_actions_set_disabled(true) | ||
|
||
var result = await RivetPluginBridge.get_plugin().cli.run_and_wait(["sidekick", "get-logs", "--namespace", namespace_selector.current_value.namespace_id]) | ||
if result.exit_code != 0 or !("Ok" in result.output): | ||
RivetPluginBridge.display_cli_error(self, result) | ||
|
||
OS.shell_open(result.output["Ok"]["output"]) | ||
_all_actions_set_disabled(false) | ||
|
||
func _on_lobbies_button_pressed() -> void: | ||
_all_actions_set_disabled(true) | ||
|
||
OS.shell_open(result.output["Ok"]["output"]) | ||
_all_actions_set_disabled(false) | ||
var result = await RivetPluginBridge.get_plugin().cli.run_and_wait(["sidekick", "get-lobbies", "--namespace", namespace_selector.current_value.namespace_id]) | ||
if result.exit_code != 0 or !("Ok" in result.output): | ||
RivetPluginBridge.display_cli_error(self, result) | ||
|
||
OS.shell_open(result.output["Ok"]["output"]) | ||
_all_actions_set_disabled(false) | ||
|
||
func _on_build_deploy_button_pressed() -> void: | ||
_all_actions_set_disabled(true) | ||
# First, ask the user if they want to save their scenes | ||
var dialog = ConfirmationDialog.new() | ||
dialog.dialog_text = "Would you like to save before building and deploying?" | ||
dialog.connect("confirmed", save_before_build_and_deploy) | ||
dialog.get_cancel_button().pressed.connect(build_and_deploy) | ||
dialog.cancel_button_text = "No, just build and deploy" | ||
self.add_child(dialog) | ||
dialog.popup_centered() | ||
|
||
|
||
func save_before_build_and_deploy() -> void: | ||
# Save all | ||
EditorInterface.save_all_scenes() | ||
EditorInterface.get_script_editor().save_all_scripts() | ||
|
||
# Now, build and deploy | ||
build_and_deploy() | ||
|
||
|
||
func build_and_deploy() -> void: | ||
_all_actions_set_disabled(true) | ||
|
||
var result = await RivetPluginBridge.get_plugin().cli.run_and_wait(["sidekick", "--show-terminal", "deploy", "--namespace", namespace_selector.current_value.name_id]) | ||
if result.exit_code != 0: | ||
RivetPluginBridge.display_cli_error(self, result) | ||
|
||
var result = await RivetPluginBridge.get_plugin().cli.run_command(["sidekick", "--show-terminal", "deploy", "--namespace", namespace_selector.current_value.name_id]) | ||
if result.exit_code != 0: | ||
RivetPluginBridge.display_cli_error(self, result) | ||
# Update the namespaces list | ||
RivetPluginBridge.instance.bootstrap() | ||
|
||
_all_actions_set_disabled(false) | ||
_all_actions_set_disabled(false) | ||
func _all_actions_set_disabled(disabled: bool) -> void: | ||
namespace_selector.disabled = disabled | ||
manage_versions_button.disabled = disabled | ||
build_deploy_button.disabled = disabled | ||
namespace_selector.disabled = disabled | ||
manage_versions_button.disabled = disabled | ||
build_deploy_button.disabled = disabled | ||
logs_button.disabled = disabled | ||
lobbies_button.disabled = disabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
godot/bomber/addons/rivet/devtools/dock/elements/rivet_rich_text_label.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@tool extends RichTextLabel | ||
|
||
var _spinner_tween: Tween | ||
|
||
func _ready(): | ||
add_theme_stylebox_override(&"normal", get_theme_stylebox(&"bg", &"AssetLib")) | ||
add_theme_font_override(&"mono_font", get_theme_font(&"output_source_mono", &"EditorFonts")) | ||
add_theme_font_override(&"bold_font", get_theme_font(&"bold", &"EditorFonts")) | ||
|
||
meta_clicked.connect(func(meta): OS.shell_open(str(meta))) | ||
|
||
func _exit_tree() -> void: | ||
if _spinner_tween: | ||
_spinner_tween.kill() | ||
|
||
func append_spinner(): | ||
if _spinner_tween: | ||
_spinner_tween.kill() | ||
add_image(get_theme_icon(&"Progress1", &"EditorIcons"), 0, 0, Color(1, 1, 1, 1), 5, Rect2(0,0,0,0), "loading") | ||
_spinner_tween = get_tree().create_tween() | ||
_spinner_tween.tween_method(_on_spinner_tween_method, 1, 8, 1).set_delay(0.1) | ||
_spinner_tween.set_loops() | ||
|
||
func _on_spinner_tween_method(frame: int): | ||
update_image("loading", ImageUpdateMask.UPDATE_TEXTURE, get_theme_icon("Progress" + str(frame), "EditorIcons")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
godot/bomber/addons/rivet/devtools/dock/linking_pending.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@tool extends VBoxContainer | ||
|
||
@onready var link_line_edit: LineEdit = %LinkLineEdit | ||
@onready var link_instructions: RichTextLabel = %LinkInstructions | ||
|
||
var _on_cancel: Callable | ||
|
||
func _ready() -> void: | ||
%CancelButton.pressed.connect(_on_cancel_button_pressed) | ||
|
||
func prepare(args: Dictionary) -> void: | ||
if 'link' in args: | ||
link_line_edit.text = args['link'] | ||
link_instructions.clear() | ||
link_instructions.push_paragraph(HORIZONTAL_ALIGNMENT_CENTER) | ||
link_instructions.append_spinner() | ||
link_instructions.append_text(" Linking game in browser...\n\n") | ||
link_instructions.append_text("If your browser does not open, click [url={link}]here[/url], or use link below.".format({"link": args['link']})) | ||
link_instructions.pop() | ||
if 'on_cancel' in args: | ||
_on_cancel = args['on_cancel'] | ||
|
||
func _on_cancel_button_pressed() -> void: | ||
if _on_cancel.is_valid(): | ||
_on_cancel.call() |
Oops, something went wrong.