reprogram this to be git only
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.7.0-dev.2">
|
||||
<Project Sdk="Godot.NET.Sdk/4.7.0-dev.3">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||
|
||||
@@ -15,7 +15,6 @@ public partial class GitIntegration:Node{
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
commit_button.Pressed += Commit_changes;
|
||||
pull_button.Pressed += pull;
|
||||
Button edit = (Button)options_window.Get("clone_repo_button");
|
||||
if (edit != null){
|
||||
|
||||
+13
-16
@@ -4,25 +4,24 @@ class_name mainNode extends Control
|
||||
@export var PunishContainer:Control
|
||||
@export var punish_scene:PackedScene
|
||||
@export var new_punish_btn:Button
|
||||
@export var file_opener:FileDialog
|
||||
@export var open_btn:Button
|
||||
@export var new_btn:Button
|
||||
@export var save_btn:Button
|
||||
@export var exporter:BanListExporter
|
||||
@export var file_label:Label
|
||||
@export var save_file_parser:SaveFileParser
|
||||
@export var quit_confirmation:ConfirmationDialog
|
||||
@export var ban_counter: Label
|
||||
@export var save_label: Label
|
||||
@export var plus: CPUParticles2D
|
||||
@export var minus: CPUParticles2D
|
||||
@export var more_btn: Button
|
||||
@export var options_window: MoreOptionsWindow
|
||||
@export var git: Node
|
||||
@export var commit: Button
|
||||
@export var save_label:Label
|
||||
|
||||
var current_path:String
|
||||
var unsaved:bool
|
||||
|
||||
func _ready() -> void:
|
||||
print(ProjectSettings.globalize_path("user://repo/"))
|
||||
more_btn.pressed.connect(options_window.show)
|
||||
edit_window.changed.connect(update_ban_counter) # use as update
|
||||
|
||||
@@ -31,11 +30,8 @@ func _ready() -> void:
|
||||
quit_confirmation.confirmed.connect(save_and_exit)
|
||||
get_tree().auto_accept_quit = false
|
||||
get_tree().root.close_requested.connect(close_request)
|
||||
set_file(save_file.get("FILE",""))
|
||||
file_opener.file_selected.connect(set_file)
|
||||
open_btn.pressed.connect(file_opener.show)
|
||||
new_btn.pressed.connect(new_punishment)
|
||||
save_btn.pressed.connect(save)
|
||||
commit.pressed.connect(save)
|
||||
options_window.remove_dupes.connect(remove_dupes)
|
||||
options_window.save_v_one.connect(savevone)
|
||||
|
||||
@@ -50,9 +46,12 @@ func _ready() -> void:
|
||||
options_window.name_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.key_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.use_old.pressed.connect(unsave)
|
||||
if options_window.repo_edit.text:
|
||||
if git.has_method("Clone"):
|
||||
git.Clone()
|
||||
|
||||
func unsave():
|
||||
save_label.show()
|
||||
save()
|
||||
unsaved = true
|
||||
|
||||
func savevone():
|
||||
@@ -62,10 +61,6 @@ func savevone():
|
||||
Punishments.append(child.punishment)
|
||||
exporter.Exportv1(Punishments,current_path.rstrip(".txt")+" v1.txt")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("save"):
|
||||
save()
|
||||
|
||||
var last_alts:int = 0
|
||||
func remove_dupes():
|
||||
unsaved = true
|
||||
@@ -140,12 +135,13 @@ func save():
|
||||
if child is PunishShowcase:
|
||||
Punishments.append(child.punishment)
|
||||
update_ban_counter()
|
||||
save_file_parser.save(current_path)
|
||||
save_file_parser.save()
|
||||
if options_window.use_old.button_pressed:
|
||||
exporter.Exportv1(Punishments,current_path)
|
||||
else:
|
||||
exporter.Export(Punishments,current_path)
|
||||
unsaved = false
|
||||
git.Commit_changes()
|
||||
|
||||
func new_punishment() -> void:
|
||||
unsaved = true
|
||||
@@ -190,16 +186,17 @@ func set_file(path:String):
|
||||
clear_children()
|
||||
print("buh")
|
||||
current_path = path
|
||||
file_label.text = path
|
||||
add_punishments(path)
|
||||
update_ban_counter.call_deferred()
|
||||
|
||||
func close_request():
|
||||
if !unsaved:
|
||||
git.delete_recursive("user://repo/")
|
||||
get_tree().quit()
|
||||
else:
|
||||
quit_confirmation.show()
|
||||
|
||||
func save_and_exit():
|
||||
save()
|
||||
git.Commit_changes()
|
||||
get_tree().quit()
|
||||
|
||||
@@ -11,13 +11,12 @@ func read() -> Dictionary:
|
||||
var Dict:Dictionary = file.get_var()
|
||||
return Dict
|
||||
|
||||
func save(current_file:String) -> void:
|
||||
func save() -> void:
|
||||
var file = FileAccess.open(savloc,FileAccess.WRITE)
|
||||
if !file:
|
||||
push_error("cant write savefile")
|
||||
return
|
||||
var Dict:Dictionary[String,Variant] = {
|
||||
"FILE":current_file,
|
||||
"REPO":options_window.repo_edit.text,
|
||||
"EMAIL":options_window.email_edit.text,
|
||||
"NAME":options_window.name_edit.text,
|
||||
|
||||
+5
-31
@@ -42,7 +42,7 @@ corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[node name="Control" type="Control" unique_id=2276929 node_paths=PackedStringArray("edit_window", "punish_list_parser", "PunishContainer", "new_punish_btn", "file_opener", "open_btn", "new_btn", "save_btn", "exporter", "file_label", "save_file_parser", "quit_confirmation", "ban_counter", "save_label", "plus", "minus", "more_btn", "options_window")]
|
||||
[node name="Control" type="Control" unique_id=2276929 node_paths=PackedStringArray("edit_window", "punish_list_parser", "PunishContainer", "new_punish_btn", "new_btn", "exporter", "save_file_parser", "quit_confirmation", "ban_counter", "plus", "minus", "more_btn", "options_window", "git", "commit", "save_label")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -55,20 +55,18 @@ punish_list_parser = NodePath("BanListParser")
|
||||
PunishContainer = NodePath("MarginContainer/VBoxContainer/ScrollContainer/Tree")
|
||||
punish_scene = ExtResource("2_qmy6f")
|
||||
new_punish_btn = NodePath("MarginContainer/VBoxContainer/HBoxContainer/Punish")
|
||||
file_opener = NodePath("OpenFile")
|
||||
open_btn = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/OpenFileBtn")
|
||||
new_btn = NodePath("MarginContainer/VBoxContainer/HBoxContainer/Punish")
|
||||
save_btn = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/SaveBtn")
|
||||
exporter = NodePath("BanListExporter")
|
||||
file_label = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/CurrentFile")
|
||||
save_file_parser = NodePath("SaveFileParser")
|
||||
quit_confirmation = NodePath("ConfirmationDialog")
|
||||
ban_counter = NodePath("MarginContainer/VBoxContainer/HBoxContainer/BanCounter")
|
||||
save_label = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/SaveLabel")
|
||||
plus = NodePath("MarginContainer/VBoxContainer/HBoxContainer/BanCounter/Plus")
|
||||
minus = NodePath("MarginContainer/VBoxContainer/HBoxContainer/BanCounter/Minus")
|
||||
more_btn = NodePath("MarginContainer/VBoxContainer/HBoxContainer/More")
|
||||
options_window = NodePath("OptionsWindow")
|
||||
git = NodePath("Git")
|
||||
commit = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/Commit")
|
||||
save_label = NodePath("MarginContainer/VBoxContainer/HBoxContainer2/Label")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=1516457942]
|
||||
modulate = Color(0.74558026, 0.7455802, 0.7455802, 1)
|
||||
@@ -214,26 +212,11 @@ layout_mode = 2
|
||||
alignment = 2
|
||||
last_wrap_alignment = 2
|
||||
|
||||
[node name="OpenFileBtn" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1707347790]
|
||||
layout_mode = 2
|
||||
text = "Open file"
|
||||
|
||||
[node name="CurrentFile" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1158273656]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "no file selected"
|
||||
clip_text = true
|
||||
text_overrun_behavior = 1
|
||||
|
||||
[node name="SaveLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1042352785]
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1462249568]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "*"
|
||||
|
||||
[node name="SaveBtn" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1041770707]
|
||||
layout_mode = 2
|
||||
text = "Save changes"
|
||||
|
||||
[node name="Commit" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=533267664]
|
||||
layout_mode = 2
|
||||
tooltip_text = "Send your changes to github, make sure you have saved your changes before doing this!"
|
||||
@@ -316,15 +299,6 @@ name_check = NodePath("../MarginContainer/VBoxContainer/HBoxContainer3/NameCheck
|
||||
uid_check = NodePath("../MarginContainer/VBoxContainer/HBoxContainer3/UIDCheck")
|
||||
description_check = NodePath("../MarginContainer/VBoxContainer/HBoxContainer3/DescriptionCheck")
|
||||
|
||||
[node name="OpenFile" type="FileDialog" parent="." unique_id=1378168421]
|
||||
oversampling_override = 1.0
|
||||
title = "Open a File"
|
||||
size = Vector2i(807, 360)
|
||||
file_mode = 0
|
||||
access = 2
|
||||
filters = PackedStringArray("*.txt", "*.dat")
|
||||
use_native_dialog = true
|
||||
|
||||
[node name="SaveFileParser" type="Node" parent="." unique_id=930223611 node_paths=PackedStringArray("options_window")]
|
||||
script = ExtResource("12_ebg2g")
|
||||
options_window = NodePath("../OptionsWindow")
|
||||
|
||||
@@ -82,6 +82,7 @@ tooltip_text = "Removes duplicate entires(same uid and name)"
|
||||
text = "Clear Dupes"
|
||||
|
||||
[node name="SaveV1Button" type="Button" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1718864258]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
tooltip_text = "Save a version of the banlist in the legacy format"
|
||||
text = "save duplicate v1 file"
|
||||
|
||||
Reference in New Issue
Block a user