diff --git a/assets/config/bg2.tres b/assets/config/bg2.tres new file mode 100644 index 0000000..619fdef --- /dev/null +++ b/assets/config/bg2.tres @@ -0,0 +1,4 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://bkwb4tqap7x7i"] + +[resource] +bg_color = Color(0.188235, 0.188235, 0.188235, 1) diff --git a/assets/config/tiny.tres b/assets/config/tiny.tres new file mode 100644 index 0000000..3c17cb8 --- /dev/null +++ b/assets/config/tiny.tres @@ -0,0 +1,8 @@ +[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://xh3q8p65gbti"] + +[ext_resource type="FontFile" uid="uid://ce5fs0ro7kp8r" path="res://assets/fonts/Lexend.ttf" id="1_r577y"] + +[resource] +font = ExtResource("1_r577y") +font_size = 14 +font_color = Color(1, 1, 1, 0.501961) diff --git a/events/latest_events.xml b/events/latest_events.xml new file mode 100644 index 0000000..057684e --- /dev/null +++ b/events/latest_events.xml @@ -0,0 +1,13 @@ + + + + FunkPanion Update Week 3 + Matkap Sprites + mk_preview.png + I made these cool-ass sprites of my sona Matkap. +I thought it'd be nice to have him in here, but I didn't want to make him the default because that'd be pretty jarring. +Imagine opening an FNF thingy and then not immediately seeing an FNF character. +So instead I made this panel. Check back here for more goodies, in case I make any. +WARNING: Applying will override some of your config and save. + + diff --git a/events/week_3/matkap.png b/events/week_3/matkap.png new file mode 100644 index 0000000..c64790a Binary files /dev/null and b/events/week_3/matkap.png differ diff --git a/events/week_3/matkap.png.import b/events/week_3/matkap.png.import new file mode 100644 index 0000000..8dd0c09 --- /dev/null +++ b/events/week_3/matkap.png.import @@ -0,0 +1,3 @@ +[remap] + +importer="keep" diff --git a/events/week_3/matkap.xml b/events/week_3/matkap.xml new file mode 100644 index 0000000..c0419b2 --- /dev/null +++ b/events/week_3/matkap.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/events/week_3/mk_preview.png b/events/week_3/mk_preview.png new file mode 100644 index 0000000..08093c0 Binary files /dev/null and b/events/week_3/mk_preview.png differ diff --git a/events/week_3/mk_preview.png.import b/events/week_3/mk_preview.png.import new file mode 100644 index 0000000..65bd100 --- /dev/null +++ b/events/week_3/mk_preview.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsk0t7any1rqg" +path="res://.godot/imported/mk_preview.png-b7001c2795528e49e48dd4a8d33d4284.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://events/week_3/mk_preview.png" +dest_files=["res://.godot/imported/mk_preview.png-b7001c2795528e49e48dd4a8d33d4284.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/events/week_3/redeem.gd b/events/week_3/redeem.gd new file mode 100644 index 0000000..4249a7d --- /dev/null +++ b/events/week_3/redeem.gd @@ -0,0 +1,35 @@ +# extends AmongUs + +var config_change = { + spritesheet_data = "user://uploads/matkap.xml", + spritesheet_image = "user://uploads/matkap.png", + spritesheet_anims = { + "MAT_IDLE" = { + alias = null, + type = Config.SpritesheetAnimType.IDLE + }, + "MAT_LEFT" = { + alias = "left", + type = Config.SpritesheetAnimType.DEFAULT + }, + "MAT_DOWN" = { + alias = "down", + type = Config.SpritesheetAnimType.DEFAULT + }, + "MAT_UP" = { + alias = "up", + type = Config.SpritesheetAnimType.DEFAULT + }, + "MAT_RIGHT" = { + alias = "right", + type = Config.SpritesheetAnimType.DEFAULT + }, + } +} + +func _init() -> void: + if not DirAccess.dir_exists_absolute("user://uploads/"): + DirAccess.make_dir_absolute("user://uploads/") + + GlobalEvents.copy_fa("res://events/week_3/matkap.png", "user://uploads/matkap.png") + GlobalEvents.copy_fa("res://events/week_3/matkap.xml", "user://uploads/matkap.xml") diff --git a/export_presets.cfg b/export_presets.cfg index ddee169..8fcccaf 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ advanced_options=false dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="*.xml, *.png" +include_filter="*.xml, *.png, events/*" exclude_filter="" export_path="../export/FunkPanion/FunkPanion-win.zip" encryption_include_filters="" diff --git a/project.godot b/project.godot index 5d4d176..0fc1ce1 100644 --- a/project.godot +++ b/project.godot @@ -30,6 +30,7 @@ boot_splash/minimum_display_time=2000 GlobalInput="*res://plugins/GlobalInput/GlobalInputGDScript.tscn" GlobalConfig="*res://scenes/global_config.tscn" +GlobalEvents="*res://scenes/global_events.tscn" [display] diff --git a/scenes/config.tscn b/scenes/config.tscn index d68d9db..5ceb3d9 100644 --- a/scenes/config.tscn +++ b/scenes/config.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://b0m4v3w4sqrfs"] +[gd_scene load_steps=15 format=3 uid="uid://b0m4v3w4sqrfs"] [ext_resource type="Script" path="res://scripts/config/config_window.gd" id="1_3y2tp"] [ext_resource type="StyleBox" uid="uid://bdkv45xc5lotp" path="res://assets/config/bg.tres" id="1_kscu5"] @@ -8,6 +8,7 @@ [ext_resource type="FontFile" uid="uid://4e3o2ds5xy7p" path="res://assets/fonts/MatSymOut.ttf" id="2_pm82g"] [ext_resource type="LabelSettings" uid="uid://c2s3eclr25ots" path="res://assets/config/body.tres" id="3_gn7vd"] [ext_resource type="FontFile" uid="uid://c6ck52v6qotm" path="res://assets/fonts/B_Lexend.ttf" id="3_qguou"] +[ext_resource type="Script" path="res://scripts/config/config_events.gd" id="6_kxysx"] [ext_resource type="Script" path="res://scripts/config/config_presets.gd" id="6_th0jy"] [ext_resource type="FontVariation" uid="uid://d1apfvux6r82v" path="res://assets/config/button_icon.tres" id="8_qusr6"] [ext_resource type="Script" path="res://scripts/config/open_file_dialog.gd" id="9_1o6y4"] @@ -31,7 +32,6 @@ size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_styles/panel = ExtResource("1_kscu5") follow_focus = true -scroll_vertical = 400 horizontal_scroll_mode = 0 script = ExtResource("1_3y2tp") @@ -71,6 +71,15 @@ size_flags_horizontal = 3 text = "Config" label_settings = SubResource("LabelSettings_gk6wd") +[node name="Encounters" type="Button" parent="MarginContainer/Form/Header"] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +tooltip_text = "Open the Events & Goodies menu." +theme_override_fonts/font = ExtResource("2_pm82g") +theme_override_font_sizes/font_size = 24 +text = "featured_seasonal_and_gifts" +script = ExtResource("6_kxysx") + [node name="Button" type="Button" parent="MarginContainer/Form/Header"] custom_minimum_size = Vector2(40, 40) layout_mode = 2 @@ -619,3 +628,4 @@ select_mode = 1 [connection signal="pressed" from="MarginContainer/Form/Header/BackButton" to="." method="_on_back_button_pressed"] [connection signal="pressed" from="MarginContainer/Form/Header/BackButton" to="MarginContainer/Form" method="_on_back_button_pressed"] +[connection signal="change_config" from="MarginContainer/Form/Header/Encounters" to="MarginContainer/Form" method="_on_encounters_change_config"] diff --git a/scenes/config_events.tscn b/scenes/config_events.tscn new file mode 100644 index 0000000..4a76d7f --- /dev/null +++ b/scenes/config_events.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=5 format=3 uid="uid://dnr0jdrxiiifr"] + +[ext_resource type="StyleBox" uid="uid://bdkv45xc5lotp" path="res://assets/config/bg.tres" id="1_4psbb"] +[ext_resource type="Script" path="res://scripts/config/config_window_events.gd" id="2_jnwha"] +[ext_resource type="FontFile" uid="uid://4e3o2ds5xy7p" path="res://assets/fonts/MatSymOut.ttf" id="3_qmpng"] +[ext_resource type="LabelSettings" uid="uid://2iu8q0tylumo" path="res://assets/config/header_bold.tres" id="4_k4g4o"] + +[node name="ScrollContainer" type="ScrollContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_styles/panel = ExtResource("1_4psbb") +horizontal_scroll_mode = 0 +vertical_scroll_mode = 0 +script = ExtResource("2_jnwha") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 + +[node name="Header" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="CloseButton" type="Button" parent="MarginContainer/VBoxContainer/Header"] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme_override_fonts/font = ExtResource("3_qmpng") +theme_override_font_sizes/font_size = 24 +text = "close" +flat = true + +[node name="Header" type="Label" parent="MarginContainer/VBoxContainer/Header"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Events & Goodies" +label_settings = ExtResource("4_k4g4o") + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[connection signal="pressed" from="MarginContainer/VBoxContainer/Header/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/scenes/global_events.tscn b/scenes/global_events.tscn new file mode 100644 index 0000000..1ab8f60 --- /dev/null +++ b/scenes/global_events.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://dxdsmwmjqrrl8"] + +[ext_resource type="Script" path="res://scripts/GlobalEvents.gd" id="1_toif7"] + +[node name="Events" type="Node"] +script = ExtResource("1_toif7") diff --git a/scenes/thingy_event.gd b/scenes/thingy_event.gd new file mode 100644 index 0000000..cfe8677 --- /dev/null +++ b/scenes/thingy_event.gd @@ -0,0 +1,28 @@ +extends PanelContainer + +signal change_config(config:Dictionary) + +@onready var title = $"MarginContainer/VBoxContainer/Header/Title" +@onready var date = $"MarginContainer/VBoxContainer/Header/VBoxContainer/Date" +@onready var tagline = $"MarginContainer/VBoxContainer/Header/VBoxContainer/Tagline" +@onready var thumb = $"MarginContainer/VBoxContainer/HBoxContainer/TextureRect" +@onready var desc = $"MarginContainer/VBoxContainer/HBoxContainer/Label" + +@onready var yes = $"MarginContainer/VBoxContainer/HBoxContainer2/Yes" + +var event:Dictionary + +func do_things(): + set_event() + yes.pressed.connect(func(): + var script = load("res://events/" + event.id + "/redeem.gd").new() + if script.config_change != null: + change_config.emit(script.config_change) + ) + +func set_event(): + title.text = event.title + date.text = event.date + tagline.text = event.tagline + thumb.texture = load("res://events/" + event.id + "/" + event.thumb) + desc.text = event.desc diff --git a/scenes/thingy_event.tscn b/scenes/thingy_event.tscn new file mode 100644 index 0000000..7d021b9 --- /dev/null +++ b/scenes/thingy_event.tscn @@ -0,0 +1,100 @@ +[gd_scene load_steps=7 format=3 uid="uid://qnji76gh8bjy"] + +[ext_resource type="StyleBox" uid="uid://bkwb4tqap7x7i" path="res://assets/config/bg2.tres" id="1_uaet0"] +[ext_resource type="Script" path="res://scenes/thingy_event.gd" id="2_x0j35"] +[ext_resource type="LabelSettings" uid="uid://2iu8q0tylumo" path="res://assets/config/header_bold.tres" id="2_xndpd"] +[ext_resource type="LabelSettings" uid="uid://c2s3eclr25ots" path="res://assets/config/body.tres" id="3_40siy"] +[ext_resource type="LabelSettings" uid="uid://xh3q8p65gbti" path="res://assets/config/tiny.tres" id="4_e5d37"] +[ext_resource type="Texture2D" uid="uid://bsk0t7any1rqg" path="res://events/week_3/mk_preview.png" id="5_b74tb"] + +[node name="ThingyEvent" type="PanelContainer"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -211.5 +offset_top = -37.0 +offset_right = 211.5 +offset_bottom = 37.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +theme_override_styles/panel = ExtResource("1_uaet0") +script = ExtResource("2_x0j35") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 +theme_override_constants/margin_right = 16 +theme_override_constants/margin_bottom = 16 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 16 + +[node name="Header" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 16 + +[node name="Title" type="Label" parent="MarginContainer/VBoxContainer/Header"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +text = "Loading" +label_settings = ExtResource("2_xndpd") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/Header"] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_constants/separation = 0 +alignment = 2 + +[node name="Date" type="Label" parent="MarginContainer/VBoxContainer/Header/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +text = "Soon..." +label_settings = ExtResource("3_40siy") +horizontal_alignment = 2 + +[node name="Tagline" type="Label" parent="MarginContainer/VBoxContainer/Header/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +text = "I can hardly wait!" +label_settings = ExtResource("4_e5d37") +horizontal_alignment = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 16 + +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(300, 0) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 0 +text = "Loading..." +label_settings = ExtResource("3_40siy") +autowrap_mode = 3 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(128, 128) +layout_mode = 2 +size_flags_vertical = 0 +texture = ExtResource("5_b74tb") +expand_mode = 1 +stretch_mode = 4 + +[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 8 +alignment = 2 + +[node name="Yes" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +text = "Apply" diff --git a/scripts/GlobalEvents.gd b/scripts/GlobalEvents.gd new file mode 100644 index 0000000..ea0bfb4 --- /dev/null +++ b/scripts/GlobalEvents.gd @@ -0,0 +1,15 @@ +extends Node + +func copy_fa(from: String, to: String) -> void: + var file_from = FileAccess.get_file_as_bytes(from) + var file_to = FileAccess.open(to, FileAccess.WRITE) + file_to.store_buffer(file_from) + file_to.close() + +func _enter_tree() -> void: + print("Hello!") + +func _notification(what): + if what == NOTIFICATION_WM_CLOSE_REQUEST: + print("Goodbye!") + get_tree().quit() diff --git a/scripts/config/config_events.gd b/scripts/config/config_events.gd new file mode 100644 index 0000000..0363b04 --- /dev/null +++ b/scripts/config/config_events.gd @@ -0,0 +1,27 @@ +extends Button + +signal change_config(config:Dictionary) + +var config_events = preload("res://scenes/config_events.tscn") + +@onready var root = get_tree().root +@onready var form = $"../.." + +func _pressed() -> void: + var preset_window = Popup.new() + var cfev = config_events.instantiate() + preset_window.add_child(cfev) + root.add_child(preset_window) + preset_window.popup_centered_ratio() + + var close = func(): + preset_window.hide() + root.remove_child(preset_window) + preset_window.queue_free() + cfev.queue_free() + + cfev.close.connect(close) + cfev.change_config.connect(func(config): + close.call() + change_config.emit(config) + ) diff --git a/scripts/config/config_window_events.gd b/scripts/config/config_window_events.gd new file mode 100644 index 0000000..6d98bb8 --- /dev/null +++ b/scripts/config/config_window_events.gd @@ -0,0 +1,58 @@ +extends ScrollContainer + +signal change_config(config:Dictionary) +signal close + +var thingy_event = preload("res://scenes/thingy_event.tscn") + +var events_parser:XMLParser = XMLParser.new() +var events = [] + +@onready var vbc = $"MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + parse() + mount() + +func parse(): + var last_node_name = "" + events = [] + events_parser.open("res://events/latest_events.xml") + + while events_parser.read() != ERR_FILE_EOF: + var current = events.back() + var nt = events_parser.get_node_type() + if nt == XMLParser.NODE_TEXT: + if last_node_name == "": continue + current[last_node_name] = events_parser.get_node_data() + elif nt == XMLParser.NODE_ELEMENT: + var node_name = events_parser.get_node_name() + if node_name == "events": + continue + elif node_name == "event": + events.append({ + id = events_parser.get_named_attribute_value_safe("id"), + date = events_parser.get_named_attribute_value_safe("date"), + tagline = "", + title = "", + thumb = "", + desc = "" + }) + else: + last_node_name = node_name + else: + last_node_name = "" + +func mount(): + print(events) + for event in events: + var te = thingy_event.instantiate() + vbc.add_child(te) + te.event = event + te.do_things() + te.change_config.connect(change_config.emit) + vbc.move_child(te, 0) + +func _on_close_button_pressed() -> void: + close.emit() diff --git a/scripts/config/form_handler.gd b/scripts/config/form_handler.gd index 39e0d61..ec1c9ce 100644 --- a/scripts/config/form_handler.gd +++ b/scripts/config/form_handler.gd @@ -1,5 +1,7 @@ extends VBoxContainer +@onready var encounters = $"Header/Encounters" + @onready var osd_dwell_time = $"OSD and UI/Controls/VBoxContainer/osd_dwell_time" @onready var osd_fade_time = $"OSD and UI/Controls/VBoxContainer/osd_fade_time" @onready var osd_opacity = $"OSD and UI/Controls/VBoxContainer/osd_opacity" @@ -55,9 +57,14 @@ func _ready() -> void: fuckwith_anims() fuckwith_spritesheet_anims() +func _on_encounters_change_config(config: Dictionary) -> void: + for key in config: + GlobalConfig[key] = config[key] + GlobalConfig.save_to_file() + get_tree().reload_current_scene() + func _on_back_button_pressed() -> void: GlobalConfig.clone_config(temp_config) - GlobalConfig.save_to_file() var unlock_func = null diff --git a/scripts/config/open_file_dialog.gd b/scripts/config/open_file_dialog.gd index a0b9e9e..5f4e6cd 100644 --- a/scripts/config/open_file_dialog.gd +++ b/scripts/config/open_file_dialog.gd @@ -37,7 +37,8 @@ func _ready() -> void: if not DirAccess.dir_exists_absolute("user://uploads/"): DirAccess.make_dir_absolute("user://uploads/") var new_path = "user://uploads/".path_join(path.text.get_file()) - DirAccess.copy_absolute(path.text, new_path) + var dir = DirAccess.open(path.text.get_base_dir()) + dir.copy(path.text.get_file(), new_path) path.text = new_path file_changed.emit(new_path) ) diff --git a/scripts/menu.gd b/scripts/menu.gd index 618d19b..9e4a7d7 100644 --- a/scripts/menu.gd +++ b/scripts/menu.gd @@ -8,7 +8,7 @@ func _index_pressed(idx: int): elif idx == 1: get_tree().change_scene_to_file("res://scenes/xml_editor.tscn") elif idx == 2: - get_tree().quit() + get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST) # Called when the node enters the scene tree for the first time. func _ready() -> void: diff --git a/scripts/xmle/form_handler.gd b/scripts/xmle/form_handler.gd index 5ebd248..ac97444 100644 --- a/scripts/xmle/form_handler.gd +++ b/scripts/xmle/form_handler.gd @@ -456,7 +456,7 @@ func set_region_view() -> void: rg_oskin_prev_char.texture.region = Rect2(0,0,1,1) else: var prev_frame = cur_anim.frames[selected_frame - 1] - rg_oskin_prev_char.position = prev_frame.frame_pos + rg_oskin_prev_char.position = prev_frame.frame_pos + Vector2i.ONE rg_oskin_prev_char.texture.region = Rect2(prev_frame.pos, prev_frame.size) if selected_frame + 1 >= cur_anim.frames.size() or cur_anim.frames[selected_frame + 1] == null: @@ -464,7 +464,7 @@ func set_region_view() -> void: rg_oskin_next_char.texture.region = Rect2(0,0,1,1) else: var next_frame = cur_anim.frames[selected_frame + 1] - rg_oskin_next_char.position = next_frame.frame_pos + rg_oskin_next_char.position = next_frame.frame_pos + Vector2i.ONE rg_oskin_next_char.texture.region = Rect2(next_frame.pos, next_frame.size) character.position = Vector2i(cur_frame.frame_pos) + Vector2i.ONE