Compare commits
3 Commits
legacy
...
diklor/mai
Author | SHA1 | Date | |
---|---|---|---|
|
91ec3293c1 | ||
|
852e3b09ea | ||
|
0d25a45a57 |
@@ -26,8 +26,7 @@ func _enable_plugin() -> void:
|
||||
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-rpc-gd/bin/.gdignore"):
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-rpc-gd/bin/.gdignore")
|
||||
add_autoload_singleton("DiscordRPCLoader","res://addons/discord-rpc-gd/nodes/discord_autoload.gd")
|
||||
restart_window.connect("confirmed", save_no_restart)
|
||||
restart_window.connect("canceled", save_and_restart)
|
||||
restart_window.connect("confirmed", save_and_restart)
|
||||
get_editor_interface().popup_dialog_centered(restart_window)
|
||||
print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
|
||||
|
||||
@@ -41,9 +40,6 @@ func _disable_plugin() -> void:
|
||||
func save_and_restart() -> void:
|
||||
get_editor_interface().restart_editor(true)
|
||||
|
||||
func save_no_restart() -> void:
|
||||
get_editor_interface().restart_editor(false)
|
||||
|
||||
var editor_presence: Node
|
||||
func _on_editor_settings_changed() -> void:
|
||||
plugin_cfg.set_value("Discord","editor_presence",get_editor_interface().get_editor_settings().get_setting("DiscordRPC/EditorPresence/enabled"))
|
||||
|
@@ -31,8 +31,8 @@ visible = true
|
||||
transient = false
|
||||
unresizable = true
|
||||
theme = SubResource("Theme_swwco")
|
||||
ok_button_text = "Restart"
|
||||
cancel_button_text = "Save and restart"
|
||||
ok_button_text = "Save and restart"
|
||||
cancel_button_text = "Later"
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
anchors_preset = 5
|
||||
|
@@ -43,13 +43,39 @@ void EditorPresence::_ready()
|
||||
|
||||
void EditorPresence::_process(double delta)
|
||||
{
|
||||
if (state_string.utf8() != activity.GetState())
|
||||
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||
|
||||
if (edited_scene_root != nullptr)
|
||||
{
|
||||
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||
activity.SetState(String("Editing: \"" + edited_scene_root->get_scene_file_path() + "\"").replace("res://", "").utf8());
|
||||
if (result == discord::Result::Ok)
|
||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||
godot::String scene_path = edited_scene_root->get_scene_file_path();
|
||||
|
||||
if (scene_path.is_empty())
|
||||
{
|
||||
state_string = "Editing: (not saved scene)";
|
||||
}
|
||||
else
|
||||
{
|
||||
state_string = "Editing: \"" + scene_path.replace("res://", "") + "\"";
|
||||
}
|
||||
|
||||
if (state_string.utf8() != activity.GetState())
|
||||
{
|
||||
activity.SetState(state_string.utf8());
|
||||
if (result == discord::Result::Ok)
|
||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
godot::String default_state = "No Scene Loaded";
|
||||
if (default_state.utf8() != activity.GetState())
|
||||
{
|
||||
activity.SetState(default_state.utf8());
|
||||
if (result == discord::Result::Ok)
|
||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||
}
|
||||
}
|
||||
|
||||
if (result == discord::Result::Ok)
|
||||
core->RunCallbacks();
|
||||
}
|
Reference in New Issue
Block a user