diff --git a/BanListEditor.csproj b/BanListEditor.csproj new file mode 100644 index 0000000..9f4f6a3 --- /dev/null +++ b/BanListEditor.csproj @@ -0,0 +1,10 @@ + + + net8.0 + net9.0 + true + + + + + diff --git a/BanListEditor.sln b/BanListEditor.sln new file mode 100644 index 0000000..a4d4147 --- /dev/null +++ b/BanListEditor.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BanListEditor", "BanListEditor.csproj", "{57639E35-2F75-4AD8-8D4C-0582F08E0E24}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {57639E35-2F75-4AD8-8D4C-0582F08E0E24}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/Scripts/Csharp/GitIntigration.cs b/Scripts/Csharp/GitIntigration.cs new file mode 100644 index 0000000..179d389 --- /dev/null +++ b/Scripts/Csharp/GitIntigration.cs @@ -0,0 +1,189 @@ +using Godot; +using LibGit2Sharp; +using LibGit2Sharp.Handlers; +using System; +using System.IO; +using System.Linq; + +public partial class GitIntigration:Node{ + [Export] Button commit_button; + [Export] Window options_window; + [Export] Node Main; + [Export] Label Push_error; + [Export] Control Push_Base; + [Export] Button pull_button; + 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){ + edit.Pressed += Clone; + } + Button reset_button = (Button)options_window.Get("reset_repo_button"); + if (reset_button != null){ + reset_button.Pressed += reset; + } + } + + void delete_recursive(String path){ + Godot.DirAccess current_access = Godot.DirAccess.Open(path); + current_access.IncludeHidden = true; + foreach (String Dir in current_access.GetDirectories()){ + //GD.Print("found " + path.PathJoin(Dir)); + delete_recursive(path.PathJoin(Dir)); + } + foreach (String file in current_access.GetFiles()){ + //GD.Print("found file " + file); + current_access.Remove(file); + } + DirAccess.RemoveAbsolute(path); + } + + public void Clone(){ + Label edit = (Label)options_window.Get("clone_log"); + string path = ProjectSettings.GlobalizePath("user://repo/"); + if (Godot.DirAccess.DirExistsAbsolute(path)){ + GD.Print("ADAD"); + delete_recursive(path); + DirAccess.RemoveAbsolute(path); + } + try { + Repository.Clone(get_repo(), path); + } + catch(Exception e){ + GD.Print("Cloning failed, " + e.Message); + if (edit != null){ + edit.Text = "Cloning failed, " + e.Message; + } + return; + } + if (edit != null){ + edit.Text = "Success! Repo cloned at: " + path; + } + Main.CallDeferred("set_file",path+"blacklist.txt"); + } + + String get_repo(){ + LineEdit edit = (LineEdit)options_window.Get("repo_edit"); + if (edit != null){ + return edit.Text; + } + else{ + return null; + } + } + + String get_email(){ + LineEdit edit = (LineEdit)options_window.Get("email_edit"); + if (edit != null){ + return edit.Text; + } + else{ + return null; + } + } + + String get_name(){ + LineEdit edit = (LineEdit)options_window.Get("name_edit"); + if (edit != null){ + return edit.Text; + } + else{ + return null; + } + } + + String get_key(){ + LineEdit edit = (LineEdit)options_window.Get("key_edit"); + if (edit != null){ + return edit.Text; + } + else{ + return null; + } + } + + + + public void pull(){ + + string path = ProjectSettings.GlobalizePath("user://repo/"); + Repository repo = new Repository(path); + // Credential information to fetch + LibGit2Sharp.PullOptions options = new LibGit2Sharp.PullOptions(); + options.MergeOptions = new MergeOptions(); + options.MergeOptions.CommitOnSuccess = true; + options.MergeOptions.FileConflictStrategy = CheckoutFileConflictStrategy.Ours; + options.FetchOptions = new FetchOptions(); + options.FetchOptions.CredentialsProvider = new CredentialsHandler( + (url, usernameFromUrl, types) => + new UsernamePasswordCredentials() + { + Username = get_name(), + Password = get_key() + }); + + // User information to create a merge commit + var signature = new LibGit2Sharp.Signature( + new Identity(get_name(), get_email()), DateTimeOffset.Now); + + // Pull + try{ + Commands.Pull(repo, signature, options); + } + catch(Exception e){ + Push_error.Text = e.Message; + Push_Base.Show(); + return; + } + Main.CallDeferred("set_file",path+"blacklist.txt"); + } + + public void reset(){ + GD.Print("Reset"); + string path = ProjectSettings.GlobalizePath("user://repo/"); + Repository repo = new Repository(path); + Branch originMain = repo.Branches["origin/main"]; + repo.Reset(ResetMode.Hard, originMain.Tip); + Main.CallDeferred("set_file",path+"blacklist.txt"); + } + + public void Commit_changes(){ + string path = ProjectSettings.GlobalizePath("user://repo"); + GD.Print("Try commit"); + Repository repo = new Repository(path); + repo.Index.Add("blacklist.txt"); + repo.Index.Write(); + Signature author = new Signature(get_name(), get_email(), DateTime.Now); + Signature committer = author; + try{ + Commit commit = repo.Commit("Update Banlist", author, committer); + } + catch(Exception e){ + Push_error.Text = e.Message; + Push_Base.Show(); + return; + } + + LibGit2Sharp.PushOptions options = new LibGit2Sharp.PushOptions(); + options.CredentialsProvider = new CredentialsHandler( + (url, usernameFromUrl, types) => + new UsernamePasswordCredentials() + { + Username = get_name(), + Password = get_key() + }); + try{ + repo.Network.Push(repo.Branches["main"], options); + } + catch(Exception e){ + Push_error.Text = e.Message; + Push_Base.Show(); + return; + } + + //repo.Commit("Update banlist"); + } +} diff --git a/Scripts/Csharp/GitIntigration.cs.uid b/Scripts/Csharp/GitIntigration.cs.uid new file mode 100644 index 0000000..765393a --- /dev/null +++ b/Scripts/Csharp/GitIntigration.cs.uid @@ -0,0 +1 @@ +uid://dv74d87a31oyx diff --git a/AltShowcase.gd b/Scripts/Gdscript/AltShowcase.gd similarity index 100% rename from AltShowcase.gd rename to Scripts/Gdscript/AltShowcase.gd diff --git a/AltShowcase.gd.uid b/Scripts/Gdscript/AltShowcase.gd.uid similarity index 100% rename from AltShowcase.gd.uid rename to Scripts/Gdscript/AltShowcase.gd.uid diff --git a/Punishment.gd b/Scripts/Gdscript/Punishment.gd similarity index 100% rename from Punishment.gd rename to Scripts/Gdscript/Punishment.gd diff --git a/Punishment.gd.uid b/Scripts/Gdscript/Punishment.gd.uid similarity index 100% rename from Punishment.gd.uid rename to Scripts/Gdscript/Punishment.gd.uid diff --git a/ban_list_exporter.gd b/Scripts/Gdscript/ban_list_exporter.gd similarity index 100% rename from ban_list_exporter.gd rename to Scripts/Gdscript/ban_list_exporter.gd diff --git a/ban_list_exporter.gd.uid b/Scripts/Gdscript/ban_list_exporter.gd.uid similarity index 100% rename from ban_list_exporter.gd.uid rename to Scripts/Gdscript/ban_list_exporter.gd.uid diff --git a/main.gd b/Scripts/Gdscript/main.gd similarity index 85% rename from main.gd rename to Scripts/Gdscript/main.gd index ff8bef3..fa958a0 100644 --- a/main.gd +++ b/Scripts/Gdscript/main.gd @@ -26,17 +26,34 @@ func _ready() -> void: more_btn.pressed.connect(options_window.show) edit_window.changed.connect(update_ban_counter) # use as update + var save_file = save_file_parser.read() quit_confirmation.canceled.connect(get_tree().quit) 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_parser.read()) + 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) options_window.remove_dupes.connect(remove_dupes) options_window.save_v_one.connect(savevone) + + options_window.repo_edit.text = save_file.get("REPO","") + options_window.email_edit.text = save_file.get("EMAIL","") + options_window.name_edit.text = save_file.get("NAME","") + options_window.key_edit.text = save_file.get("KEY","") + options_window.use_old.button_pressed = save_file.get("USE_OLD",false) + + options_window.repo_edit.text_changed.connect(unsave.unbind(1)) + options_window.email_edit.text_changed.connect(unsave.unbind(1)) + 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) + +func unsave(): + save_label.show() + unsaved = true func savevone(): var Punishments:Array[Punishment] @@ -124,7 +141,10 @@ func save(): Punishments.append(child.punishment) update_ban_counter() save_file_parser.save(current_path) - exporter.Export(Punishments,current_path) + if options_window.use_old.button_pressed: + exporter.Exportv1(Punishments,current_path) + else: + exporter.Export(Punishments,current_path) unsaved = false func new_punishment() -> void: diff --git a/main.gd.uid b/Scripts/Gdscript/main.gd.uid similarity index 100% rename from main.gd.uid rename to Scripts/Gdscript/main.gd.uid diff --git a/punish_list_parser.gd b/Scripts/Gdscript/punish_list_parser.gd similarity index 81% rename from punish_list_parser.gd rename to Scripts/Gdscript/punish_list_parser.gd index bc7ce57..300ea8b 100644 --- a/punish_list_parser.gd +++ b/Scripts/Gdscript/punish_list_parser.gd @@ -10,9 +10,13 @@ func parse(file:String) -> Array[Punishment]: var raw:String = fileaccess.get_as_text() var lines:PackedStringArray = raw.split("\n") var punishments:Array[Punishment] + var formatting:bool = false for line in lines: - print("line ",line) var splits:PackedStringArray = line.split(": ") + if line.contains(":") and !line.contains(": "): + push_error("WARNING, INCORRECT FORMATTING") + formatting = true + splits = line.split(":") match splits[0]: "L!ListBegin": print("start") @@ -31,7 +35,8 @@ func parse(file:String) -> Array[Punishment]: punishments[-1].punish_end = splits[1].to_int() "L!ListEnd": break - + if formatting: + OS.alert("This file contains incorret formatting, things might not load correctly!") return punishments func punish_text_to_enum(text) -> Punishment.punishment_types: diff --git a/punish_list_parser.gd.uid b/Scripts/Gdscript/punish_list_parser.gd.uid similarity index 100% rename from punish_list_parser.gd.uid rename to Scripts/Gdscript/punish_list_parser.gd.uid diff --git a/Scripts/Gdscript/save_file_parser.gd b/Scripts/Gdscript/save_file_parser.gd new file mode 100644 index 0000000..41cf11d --- /dev/null +++ b/Scripts/Gdscript/save_file_parser.gd @@ -0,0 +1,27 @@ +class_name SaveFileParser extends Node +@export var options_window: MoreOptionsWindow + +const savloc = "user://save.dat" + +func read() -> Dictionary: + var file = FileAccess.open(savloc,FileAccess.READ) + if !file: + print("no savefile found") + return {} + var Dict:Dictionary = file.get_var() + return Dict + +func save(current_file:String) -> 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, + "KEY":options_window.key_edit.text, + "USE_OLD":options_window.use_old.button_pressed, + } + file.store_var(Dict) diff --git a/save_file_parser.gd.uid b/Scripts/Gdscript/save_file_parser.gd.uid similarity index 100% rename from save_file_parser.gd.uid rename to Scripts/Gdscript/save_file_parser.gd.uid diff --git a/Scripts/Gdscript/search.gd b/Scripts/Gdscript/search.gd new file mode 100644 index 0000000..f0da9c2 --- /dev/null +++ b/Scripts/Gdscript/search.gd @@ -0,0 +1,37 @@ +extends Node + +@export var search_bar:LineEdit +@export var punish_container:Node +@export var name_check: CheckButton +@export var uid_check: CheckButton +@export var description_check: CheckButton + +func _ready() -> void: + search_bar.text_changed.connect(update.unbind(1)) + name_check.toggled.connect(update.unbind(1)) + uid_check.toggled.connect(update.unbind(1)) + description_check.toggled.connect(update.unbind(1)) + +func update(): + var text = search_bar.text + print("ss") + if text: + for child in punish_container.get_children(): + child.hide() + var strings:PackedStringArray = text.split(";") + for child in punish_container.get_children(): + if child is PunishShowcase: + var valid:bool = true + for string in strings: + if string: + var in_name:bool = (string.to_lower() in child.name_label.text.to_lower()) if name_check.button_pressed else false + var in_uid:bool = (string.to_lower() in child.uid_label.text.to_lower()) if uid_check.button_pressed else false + var in_decsciption:bool = (string.to_lower() in child.punishment.punish_reason.to_lower()) if description_check.button_pressed else false + if !in_name and !in_uid and !in_decsciption: + valid = false + if valid: + child.show() + else: + for child in punish_container.get_children(): + if child is PunishShowcase: + child.show() diff --git a/search.gd.uid b/Scripts/Gdscript/search.gd.uid similarity index 100% rename from search.gd.uid rename to Scripts/Gdscript/search.gd.uid diff --git a/Textures/Close.svg b/Textures/Close.svg new file mode 100644 index 0000000..f52657f --- /dev/null +++ b/Textures/Close.svg @@ -0,0 +1 @@ + diff --git a/Textures/Close.svg.import b/Textures/Close.svg.import new file mode 100644 index 0000000..7b1e532 --- /dev/null +++ b/Textures/Close.svg.import @@ -0,0 +1,18 @@ +[remap] + +importer="svg" +type="DPITexture" +uid="uid://decrh4ixlnkgd" +path="res://.godot/imported/Close.svg-5f1d7568fbad006f18f69572107b3723.dpitex" + +[deps] + +source_file="res://Textures/Close.svg" +dest_files=["res://.godot/imported/Close.svg-5f1d7568fbad006f18f69572107b3723.dpitex"] + +[params] + +base_scale=1.0 +saturation=1.0 +color_map={} +compress=true diff --git a/Minus.png b/Textures/Minus.png similarity index 100% rename from Minus.png rename to Textures/Minus.png diff --git a/Minus.png.import b/Textures/Minus.png.import similarity index 78% rename from Minus.png.import rename to Textures/Minus.png.import index 36af7c0..db150f3 100644 --- a/Minus.png.import +++ b/Textures/Minus.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c7r26dxgqkklc" -path="res://.godot/imported/Minus.png-fdca73571ee1f51129171a53d22c475c.ctex" +path="res://.godot/imported/Minus.png-49777f5d1da0d7575a5bc8719899853e.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Minus.png" -dest_files=["res://.godot/imported/Minus.png-fdca73571ee1f51129171a53d22c475c.ctex"] +source_file="res://Textures/Minus.png" +dest_files=["res://.godot/imported/Minus.png-49777f5d1da0d7575a5bc8719899853e.ctex"] [params] diff --git a/Plus.png b/Textures/Plus.png similarity index 100% rename from Plus.png rename to Textures/Plus.png diff --git a/Plus.png.import b/Textures/Plus.png.import similarity index 78% rename from Plus.png.import rename to Textures/Plus.png.import index 6e6210d..faa0d39 100644 --- a/Plus.png.import +++ b/Textures/Plus.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dppihj7ptidog" -path="res://.godot/imported/Plus.png-7f0b6e62ef4c9053e1aaeef8ad93a0d8.ctex" +path="res://.godot/imported/Plus.png-43004a6412ae0456b1d59e9614262edb.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Plus.png" -dest_files=["res://.godot/imported/Plus.png-7f0b6e62ef4c9053e1aaeef8ad93a0d8.ctex"] +source_file="res://Textures/Plus.png" +dest_files=["res://.godot/imported/Plus.png-43004a6412ae0456b1d59e9614262edb.ctex"] [params] diff --git a/door.png b/Textures/door.png similarity index 100% rename from door.png rename to Textures/door.png diff --git a/door.png.import b/Textures/door.png.import similarity index 78% rename from door.png.import rename to Textures/door.png.import index e5a41fc..5327ecd 100644 --- a/door.png.import +++ b/Textures/door.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cinbmowbp2btd" -path="res://.godot/imported/door.png-4ad4ab0c545155655bbef277d86eb152.ctex" +path="res://.godot/imported/door.png-daa3ac81719220de09c55f3c384cdd74.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://door.png" -dest_files=["res://.godot/imported/door.png-4ad4ab0c545155655bbef277d86eb152.ctex"] +source_file="res://Textures/door.png" +dest_files=["res://.godot/imported/door.png-daa3ac81719220de09c55f3c384cdd74.ctex"] [params] diff --git a/icon.svg b/Textures/icon.svg similarity index 100% rename from icon.svg rename to Textures/icon.svg diff --git a/icon.svg.import b/Textures/icon.svg.import similarity index 80% rename from icon.svg.import rename to Textures/icon.svg.import index d8ce45d..3dc6ed0 100644 --- a/icon.svg.import +++ b/Textures/icon.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bf1hiirahdgrf" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +path="res://.godot/imported/icon.svg-f434aa81383d8e7efdc588f214c40953.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +source_file="res://Textures/icon.svg" +dest_files=["res://.godot/imported/icon.svg-f434aa81383d8e7efdc588f214c40953.ctex"] [params] diff --git a/speaker.png b/Textures/speaker.png similarity index 100% rename from speaker.png rename to Textures/speaker.png diff --git a/speaker.png.import b/Textures/speaker.png.import similarity index 77% rename from speaker.png.import rename to Textures/speaker.png.import index cacc797..45fb8e4 100644 --- a/speaker.png.import +++ b/Textures/speaker.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cbq650vxvsxw1" -path="res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.ctex" +path="res://.godot/imported/speaker.png-cc1161b42434472c8389ab1218658ff7.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://speaker.png" -dest_files=["res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.ctex"] +source_file="res://Textures/speaker.png" +dest_files=["res://.godot/imported/speaker.png-cc1161b42434472c8389ab1218658ff7.ctex"] [params] diff --git a/tf2logo.png b/Textures/tf2logo.png similarity index 100% rename from tf2logo.png rename to Textures/tf2logo.png diff --git a/tf2logo.png.import b/Textures/tf2logo.png.import similarity index 77% rename from tf2logo.png.import rename to Textures/tf2logo.png.import index e715de2..1679129 100644 --- a/tf2logo.png.import +++ b/Textures/tf2logo.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://o2sjogt3b0ht" -path="res://.godot/imported/tf2logo.png-5b6963627dd432a7b538e7f5c69f00b3.ctex" +path="res://.godot/imported/tf2logo.png-6d02051285f1875bf9b92f282b14ea28.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://tf2logo.png" -dest_files=["res://.godot/imported/tf2logo.png-5b6963627dd432a7b538e7f5c69f00b3.ctex"] +source_file="res://Textures/tf2logo.png" +dest_files=["res://.godot/imported/tf2logo.png-6d02051285f1875bf9b92f282b14ea28.ctex"] [params] diff --git a/project.godot b/project.godot index 85d70dc..63b47eb 100644 --- a/project.godot +++ b/project.godot @@ -12,8 +12,8 @@ config_version=5 config/name="BanListEditor" run/main_scene="uid://cxf3yenlgvupj" -config/features=PackedStringArray("4.7", "GL Compatibility") -config/icon="res://icon.svg" +config/features=PackedStringArray("4.7", "C#", "GL Compatibility") +config/icon="res://Textures/icon.svg" [dotnet] diff --git a/save_file_parser.gd b/save_file_parser.gd deleted file mode 100644 index 0248a4b..0000000 --- a/save_file_parser.gd +++ /dev/null @@ -1,18 +0,0 @@ -class_name SaveFileParser extends Node - -const savloc = "user://save.dat" - -func read() -> String: - var file = FileAccess.open(savloc,FileAccess.READ) - if !file: - print("no savefile found") - return "" - - return file.get_as_text() - -func save(current_file:String) -> void: - var file = FileAccess.open(savloc,FileAccess.WRITE) - if !file: - push_error("cant write savefile") - return - file.store_string(current_file) diff --git a/scenes/Main.tscn b/scenes/Main.tscn index 8984f11..b159f1f 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -1,17 +1,19 @@ [gd_scene format=3 uid="uid://cxf3yenlgvupj"] -[ext_resource type="Script" uid="uid://c57yqopmolu8o" path="res://main.gd" id="1_bjd11"] +[ext_resource type="Script" uid="uid://c57yqopmolu8o" path="res://Scripts/Gdscript/main.gd" id="1_bjd11"] [ext_resource type="PackedScene" uid="uid://bxpr2nb1hydpi" path="res://scenes/punish_showcase.tscn" id="2_qmy6f"] -[ext_resource type="Texture2D" uid="uid://o2sjogt3b0ht" path="res://tf2logo.png" id="3_mwfav"] -[ext_resource type="Texture2D" uid="uid://dppihj7ptidog" path="res://Plus.png" id="4_3p2gp"] -[ext_resource type="Texture2D" uid="uid://c7r26dxgqkklc" path="res://Minus.png" id="5_cvmbd"] -[ext_resource type="Script" uid="uid://c5ihhdkosauvw" path="res://punish_list_parser.gd" id="6_ft6cd"] -[ext_resource type="Script" uid="uid://caaljvxo8tja5" path="res://ban_list_exporter.gd" id="7_bb450"] +[ext_resource type="Texture2D" uid="uid://o2sjogt3b0ht" path="res://Textures/tf2logo.png" id="3_mwfav"] +[ext_resource type="Texture2D" uid="uid://dppihj7ptidog" path="res://Textures/Plus.png" id="4_3p2gp"] +[ext_resource type="Texture2D" uid="uid://c7r26dxgqkklc" path="res://Textures/Minus.png" id="5_cvmbd"] +[ext_resource type="Script" uid="uid://c5ihhdkosauvw" path="res://Scripts/Gdscript/punish_list_parser.gd" id="6_ft6cd"] +[ext_resource type="Texture2D" uid="uid://decrh4ixlnkgd" path="res://Textures/Close.svg" id="6_mwfav"] +[ext_resource type="Script" uid="uid://caaljvxo8tja5" path="res://Scripts/Gdscript/ban_list_exporter.gd" id="7_bb450"] [ext_resource type="PackedScene" uid="uid://dy18m2uq557to" path="res://scenes/windwos/edit_window.tscn" id="8_nfivy"] [ext_resource type="PackedScene" uid="uid://burukk5374yyu" path="res://scenes/windwos/MoreOptionsWindow.tscn" id="9_1nqs0"] [ext_resource type="PackedScene" uid="uid://gah2g6nabyf4" path="res://scenes/windwos/statistics.tscn" id="10_1iba3"] -[ext_resource type="Script" uid="uid://bt5wd8qjaevk0" path="res://search.gd" id="11_yxlcp"] -[ext_resource type="Script" uid="uid://3gmapu83dglo" path="res://save_file_parser.gd" id="12_ebg2g"] +[ext_resource type="Script" uid="uid://bt5wd8qjaevk0" path="res://Scripts/Gdscript/search.gd" id="11_yxlcp"] +[ext_resource type="Script" uid="uid://3gmapu83dglo" path="res://Scripts/Gdscript/save_file_parser.gd" id="12_ebg2g"] +[ext_resource type="Script" uid="uid://dv74d87a31oyx" path="res://Scripts/Csharp/GitIntigration.cs" id="13_qmy6f"] [sub_resource type="LabelSettings" id="LabelSettings_lgr22"] font_size = 26 @@ -28,6 +30,18 @@ stacked_outline_1/color = Color(0.8099345, 0.9946762, 7.70092e-07, 1) stacked_outline_2/size = 4 stacked_outline_2/color = Color(0.32855865, 0.41260794, 1, 1) +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mwfav"] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.5446172, 0.24615589, 0.017454231, 0.6) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +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")] layout_mode = 3 anchors_preset = 15 @@ -157,6 +171,28 @@ text = "More" layout_mode = 2 placeholder_text = "Search..." +[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=355358061] +layout_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3" unique_id=400647282] +layout_mode = 2 +text = "Filter by:" + +[node name="NameCheck" type="CheckButton" parent="MarginContainer/VBoxContainer/HBoxContainer3" unique_id=422637912] +layout_mode = 2 +button_pressed = true +text = "Name" + +[node name="UIDCheck" type="CheckButton" parent="MarginContainer/VBoxContainer/HBoxContainer3" unique_id=1437120434] +layout_mode = 2 +button_pressed = true +text = "UID" + +[node name="DescriptionCheck" type="CheckButton" parent="MarginContainer/VBoxContainer/HBoxContainer3" unique_id=1216809809] +layout_mode = 2 +button_pressed = true +text = "Description" + [node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer" unique_id=1970903622] layout_mode = 2 @@ -198,6 +234,64 @@ text = "*" 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!" +text = "Commit changes" + +[node name="Pull" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=127094888] +layout_mode = 2 +tooltip_text = "Use this when updating your local copy to the one on github. If you have local changes this wont override them" +text = "Pull changes" + +[node name="Base" type="Control" parent="MarginContainer" unique_id=1265704529] +visible = false +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 + +[node name="Control" type="Control" parent="MarginContainer/Base" unique_id=419756343] +anchors_preset = 0 +offset_left = -250.0 +offset_top = -163.0 +offset_bottom = -35.0 + +[node name="ColorRect" type="Panel" parent="MarginContainer/Base/Control" unique_id=1808786583] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_mwfav") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Base/Control" unique_id=1967441013] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/Base/Control/VBoxContainer" unique_id=984310582] +layout_mode = 2 + +[node name="Warning" type="Label" parent="MarginContainer/Base/Control/VBoxContainer/HBoxContainer" unique_id=514469174] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Error:" + +[node name="Button" type="Button" parent="MarginContainer/Base/Control/VBoxContainer/HBoxContainer" unique_id=1955287259] +layout_mode = 2 +icon = ExtResource("6_mwfav") +flat = true + +[node name="Label" type="Label" parent="MarginContainer/Base/Control/VBoxContainer" unique_id=289973316] +custom_minimum_size = Vector2(100, 100) +layout_mode = 2 +size_flags_vertical = 3 +autowrap_mode = 2 + [node name="BanListParser" type="Node" parent="." unique_id=951623750] script = ExtResource("6_ft6cd") @@ -214,10 +308,13 @@ root = NodePath("..") PunishContainer = NodePath("../MarginContainer/VBoxContainer/ScrollContainer/Tree") search_bar = NodePath("../MarginContainer/VBoxContainer/SearchBar") -[node name="Search" type="Node" parent="." unique_id=170590161 node_paths=PackedStringArray("search_bar", "punish_container")] +[node name="Search" type="Node" parent="." unique_id=170590161 node_paths=PackedStringArray("search_bar", "punish_container", "name_check", "uid_check", "description_check")] script = ExtResource("11_yxlcp") search_bar = NodePath("../MarginContainer/VBoxContainer/SearchBar") punish_container = NodePath("../MarginContainer/VBoxContainer/ScrollContainer/Tree") +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 @@ -228,8 +325,9 @@ access = 2 filters = PackedStringArray("*.txt", "*.dat") use_native_dialog = true -[node name="SaveFileParser" type="Node" parent="." unique_id=930223611] +[node name="SaveFileParser" type="Node" parent="." unique_id=930223611 node_paths=PackedStringArray("options_window")] script = ExtResource("12_ebg2g") +options_window = NodePath("../OptionsWindow") [node name="ConfirmationDialog" type="ConfirmationDialog" parent="." unique_id=416398003] oversampling_override = 1.0 @@ -241,6 +339,16 @@ ok_button_text = "Save and quit" dialog_text = "You have unsaved changes!" cancel_button_text = "Quit without saving" +[node name="Git" type="Node" parent="." unique_id=737987824 node_paths=PackedStringArray("commit_button", "options_window", "Main", "Push_error", "Push_Base", "pull_button")] +script = ExtResource("13_qmy6f") +commit_button = NodePath("../MarginContainer/VBoxContainer/HBoxContainer2/Commit") +options_window = NodePath("../OptionsWindow") +Main = NodePath("..") +Push_error = NodePath("../MarginContainer/Base/Control/VBoxContainer/Label") +Push_Base = NodePath("../MarginContainer/Base") +pull_button = NodePath("../MarginContainer/VBoxContainer/HBoxContainer2/Pull") + [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Stats" to="Statistics" method="grab_focus"] [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Stats" to="Statistics" method="show"] [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/More" to="OptionsWindow" method="grab_focus"] +[connection signal="pressed" from="MarginContainer/Base/Control/VBoxContainer/HBoxContainer/Button" to="MarginContainer/Base" method="hide"] diff --git a/scenes/punish_showcase.gd b/scenes/punish_showcase.gd index bb46a33..a0fd1c4 100644 --- a/scenes/punish_showcase.gd +++ b/scenes/punish_showcase.gd @@ -16,8 +16,8 @@ func _ready() -> void: func update() -> void: name_label.text = punishment.username uid_label.text = punishment.uid - punishment_type_display.texture = load("res://door.png") if \ - punishment.what_punishment == punishment.punishment_types.BAN else load("res://speaker.png") + punishment_type_display.texture = load("res://Textures/door.png") if \ + punishment.what_punishment == punishment.punishment_types.BAN else load("res://Textures/speaker.png") func edit(): Edit.emit(self) diff --git a/scenes/punish_showcase.tscn b/scenes/punish_showcase.tscn index b75997d..7e03b9d 100644 --- a/scenes/punish_showcase.tscn +++ b/scenes/punish_showcase.tscn @@ -1,8 +1,8 @@ [gd_scene format=3 uid="uid://bxpr2nb1hydpi"] [ext_resource type="Script" uid="uid://dxlkscqs0wpo6" path="res://scenes/punish_showcase.gd" id="1_3wpqj"] -[ext_resource type="Script" uid="uid://cafyno407e2uq" path="res://Punishment.gd" id="2_j4kex"] -[ext_resource type="Texture2D" uid="uid://cinbmowbp2btd" path="res://door.png" id="3_lw8i6"] +[ext_resource type="Script" uid="uid://cafyno407e2uq" path="res://Scripts/Gdscript/Punishment.gd" id="2_j4kex"] +[ext_resource type="Texture2D" uid="uid://cinbmowbp2btd" path="res://Textures/door.png" id="3_lw8i6"] [sub_resource type="Resource" id="Resource_j4kex"] script = ExtResource("2_j4kex") diff --git a/scenes/windwos/MoreOptionsWindow.tscn b/scenes/windwos/MoreOptionsWindow.tscn index 008b68d..5d72884 100644 --- a/scenes/windwos/MoreOptionsWindow.tscn +++ b/scenes/windwos/MoreOptionsWindow.tscn @@ -5,16 +5,27 @@ [sub_resource type="LabelSettings" id="LabelSettings_5xt3b"] font_size = 30 -[node name="OptionsWindow" type="Window" unique_id=1485451151 node_paths=PackedStringArray("dupe_clear_button", "save_v_1_button")] +[sub_resource type="LabelSettings" id="LabelSettings_gec7h"] +outline_color = Color(1, 0.7764706, 0.7764706, 1) + +[node name="OptionsWindow" type="Window" unique_id=1485451151 node_paths=PackedStringArray("use_old", "dupe_clear_button", "save_v_1_button", "repo_edit", "email_edit", "name_edit", "key_edit", "clone_repo_button", "clone_log", "reset_repo_button")] oversampling_override = 1.0 position = Vector2i(0, 36) -size = Vector2i(300, 200) +size = Vector2i(557, 397) visible = false force_native = true min_size = Vector2i(262, 199) script = ExtResource("1_5xt3b") +use_old = NodePath("MarginContainer/ScrollContainer/BoxContainer/UseOld") dupe_clear_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/DupeClearButton") save_v_1_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/SaveV1Button") +repo_edit = NodePath("MarginContainer/ScrollContainer/BoxContainer/Repo/RepoEdit") +email_edit = NodePath("MarginContainer/ScrollContainer/BoxContainer/Git Email/EmailEdit") +name_edit = NodePath("MarginContainer/ScrollContainer/BoxContainer/Git Username/NameEdit") +key_edit = NodePath("MarginContainer/ScrollContainer/BoxContainer/Git key/KeyEdit") +clone_repo_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/CloneRepo") +clone_log = NodePath("MarginContainer/ScrollContainer/BoxContainer/CloneLog") +reset_repo_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/Reset Repo") [node name="ColorRect" type="ColorRect" parent="." unique_id=1724009282] anchors_preset = 15 @@ -50,6 +61,16 @@ layout_mode = 2 size_flags_horizontal = 3 vertical = true +[node name="RichTextLabel3" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=418846341] +layout_mode = 2 +text = "General" +label_settings = SubResource("LabelSettings_5xt3b") + +[node name="UseOld" type="CheckBox" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1245550112] +layout_mode = 2 +text = "Save file with OLD ban file structure(NEEDED before TFVR 4.0)" +autowrap_mode = 2 + [node name="RichTextLabel" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=66906023] layout_mode = 2 text = "Utility" @@ -64,3 +85,72 @@ text = "Clear Dupes" layout_mode = 2 tooltip_text = "Save a version of the banlist in the legacy format" text = "save duplicate v1 file" + +[node name="RichTextLabel2" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=824466576] +layout_mode = 2 +text = "Git" +label_settings = SubResource("LabelSettings_5xt3b") + +[node name="Repo" type="HBoxContainer" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1177156648] +layout_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer/Repo" unique_id=1452601630] +layout_mode = 2 +text = "GIT Repo:" + +[node name="RepoEdit" type="LineEdit" parent="MarginContainer/ScrollContainer/BoxContainer/Repo" unique_id=74818467] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Git Email" type="HBoxContainer" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1897029584] +layout_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer/Git Email" unique_id=1643679626] +layout_mode = 2 +text = "GIT Email:" + +[node name="EmailEdit" type="LineEdit" parent="MarginContainer/ScrollContainer/BoxContainer/Git Email" unique_id=1342026395] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Git Username" type="HBoxContainer" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1185383015] +layout_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer/Git Username" unique_id=790257001] +layout_mode = 2 +text = "GIT Name:" + +[node name="NameEdit" type="LineEdit" parent="MarginContainer/ScrollContainer/BoxContainer/Git Username" unique_id=791124761] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Git key" type="HBoxContainer" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=670946792] +layout_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer/Git key" unique_id=1561518298] +layout_mode = 2 +text = "GIT Key:" + +[node name="KeyEdit" type="LineEdit" parent="MarginContainer/ScrollContainer/BoxContainer/Git key" unique_id=1089959886] +layout_mode = 2 +size_flags_horizontal = 3 +secret = true + +[node name="CloneRepo" type="Button" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1623040123] +layout_mode = 2 +text = "Clone Repo" + +[node name="CloneLog" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=876009711] +layout_mode = 2 +label_settings = SubResource("LabelSettings_gec7h") +autowrap_mode = 2 + +[node name="Reset Repo" type="Button" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1348491757] +layout_mode = 2 +text = "Reset Repo" + +[node name="ResetInfo" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1109421918] +layout_mode = 2 +text = "Reset the repo if you have a weird issue that you cannot fix by other means, this will reset all your local changes" +label_settings = SubResource("LabelSettings_gec7h") +autowrap_mode = 2 diff --git a/scenes/windwos/altshowcse.tscn b/scenes/windwos/altshowcse.tscn index 8efa6f9..8f68d15 100644 --- a/scenes/windwos/altshowcse.tscn +++ b/scenes/windwos/altshowcse.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://bv4mvou68l2sk"] -[ext_resource type="Script" uid="uid://2f384phq5272" path="res://AltShowcase.gd" id="1_7tuyd"] +[ext_resource type="Script" uid="uid://2f384phq5272" path="res://Scripts/Gdscript/AltShowcase.gd" id="1_7tuyd"] [sub_resource type="LabelSettings" id="LabelSettings_7tuyd"] font_size = 20 @@ -10,7 +10,7 @@ font_size = 15 font_color = Color(0.74558026, 0.7455802, 0.7455802, 1) [sub_resource type="LabelSettings" id="LabelSettings_y1bem"] -font_size = 27 +font_size = 18 [node name="Altshowcase" type="Control" unique_id=96967418 node_paths=PackedStringArray("name_label", "uid_label", "count_label", "search_alts_button")] custom_minimum_size = Vector2(0, 58.235) @@ -54,7 +54,7 @@ label_settings = SubResource("LabelSettings_45q1g") [node name="Count" type="Label" parent="HBoxContainer" unique_id=899914138] layout_mode = 2 -text = "67 alts" +text = "69420 alts" label_settings = SubResource("LabelSettings_y1bem") [node name="SearchAltsButton" type="Button" parent="HBoxContainer" unique_id=957758160] diff --git a/scenes/windwos/edit_window.tscn b/scenes/windwos/edit_window.tscn index adb0a9b..48c6d56 100644 --- a/scenes/windwos/edit_window.tscn +++ b/scenes/windwos/edit_window.tscn @@ -111,7 +111,9 @@ text = "Ends on:" [node name="DaysEdit" type="SpinBox" parent="margin/VBoxContainer/ScrollContainer/Container/Ends" unique_id=1346908939] layout_mode = 2 size_flags_horizontal = 3 +min_value = 1.0 max_value = 364.0 +value = 1.0 prefix = "day " [node name="YearsEdit" type="SpinBox" parent="margin/VBoxContainer/ScrollContainer/Container/Ends" unique_id=467960707] diff --git a/scenes/windwos/more_options_window.gd b/scenes/windwos/more_options_window.gd index f076542..a5de783 100644 --- a/scenes/windwos/more_options_window.gd +++ b/scenes/windwos/more_options_window.gd @@ -1,7 +1,17 @@ class_name MoreOptionsWindow extends Window +@export var use_old: CheckBox @export var dupe_clear_button: Button @export var save_v_1_button: Button +@export var repo_edit: LineEdit +@export var email_edit: LineEdit +@export var name_edit: LineEdit +@export var key_edit: LineEdit +@export var clone_repo_button: Button +@export var clone_log: Label +@export var reset_repo_button:Button + + signal remove_dupes signal save_v_one diff --git a/search.gd b/search.gd deleted file mode 100644 index 4205f0d..0000000 --- a/search.gd +++ /dev/null @@ -1,20 +0,0 @@ -extends Node - -@export var search_bar:LineEdit -@export var punish_container:Node - -func _ready() -> void: - search_bar.text_changed.connect(update) - -func update(text:String): - if text: - for child in punish_container.get_children(): - if child is PunishShowcase: - if (text.to_lower() in child.name_label.text.to_lower()) or (text.to_lower() in child.uid_label.text.to_lower()): - child.show() - else: - child.hide() - else: - for child in punish_container.get_children(): - if child is PunishShowcase: - child.show()