mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-11 02:13:43 +09:00
Added categories to save file
JSON file is divided in categories in order to keep things organized.
This commit is contained in:
parent
1bc74a3269
commit
d0a802c4a0
6 changed files with 45 additions and 64 deletions
|
@ -1,34 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bcgstwh21n44t"
|
||||
path="res://.godot/imported/godot_j8QRjOeEmU.jpg-c94dc0d7f7168435ff371c35d939922b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/godot_j8QRjOeEmU.jpg"
|
||||
dest_files=["res://.godot/imported/godot_j8QRjOeEmU.jpg-c94dc0d7f7168435ff371c35d939922b.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
|
|
@ -2,8 +2,16 @@ extends Node
|
|||
|
||||
const FILE_NAME := "settings.json"
|
||||
const FILE_PATH := "user://" + FILE_NAME
|
||||
## JSON file is divided in categories in order to keep things organized.
|
||||
const CATEGORIES_ROUTES := {
|
||||
categories.SETTINGS: "settings",
|
||||
categories.CROSSHAIR: "crosshair",
|
||||
categories.HIGH_SCORE: "high_score"
|
||||
}
|
||||
|
||||
var game_data = {}
|
||||
enum categories { SETTINGS, CROSSHAIR, HIGH_SCORE }
|
||||
|
||||
var game_data := {}
|
||||
|
||||
func _ready():
|
||||
load_all_data()
|
||||
|
@ -15,21 +23,23 @@ func load_all_data_from_param(string_json):
|
|||
if json.data != null:
|
||||
result = json.data
|
||||
game_data = result
|
||||
|
||||
|
||||
|
||||
func save_all_data_to_file_web():
|
||||
var json = JSON.stringify(game_data)
|
||||
JavaScriptBridge.download_buffer(json.to_utf8_buffer(),"open_aim_trainer.json")
|
||||
|
||||
func save_data(key, value, file_directory = FILE_PATH) :
|
||||
game_data[key] = value
|
||||
var json = JSON.stringify(game_data)
|
||||
func save_data(key, value, category: categories, file_directory = FILE_PATH):
|
||||
var category_key = CATEGORIES_ROUTES[category]
|
||||
if !game_data.has(category_key):
|
||||
game_data[category_key] = {}
|
||||
game_data[category_key][key] = value
|
||||
var json = JSON.stringify(game_data, "\t")
|
||||
var file = FileAccess.open(file_directory, FileAccess.WRITE)
|
||||
file.store_line(json)
|
||||
file.close()
|
||||
|
||||
func save_all_data(file_directory = FILE_PATH) :
|
||||
var json = JSON.stringify(game_data)
|
||||
var json = JSON.stringify(game_data, "\t")
|
||||
var file = FileAccess.open(file_directory, FileAccess.WRITE)
|
||||
file.store_line(json)
|
||||
file.close()
|
||||
|
|
|
@ -106,6 +106,21 @@ _data = {
|
|||
"kill": SubResource("Animation_jsqua")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ybjr1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8c12g"]
|
||||
resource_name = "idle"
|
||||
length = 2.0
|
||||
|
@ -123,21 +138,6 @@ tracks/0/keys = {
|
|||
"values": [Vector2(1, 1), Vector2(1.05, 1.05)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ybjr1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_y2pta"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_ybjr1"),
|
||||
|
|
|
@ -19,10 +19,15 @@ func AddGamesSensitivities():
|
|||
game.add_item(sens)
|
||||
|
||||
func _on_sensitivity_text_changed(new_text):
|
||||
DataManager.save_data("sensitivity_game", game.get_selected_id())
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(game.get_selected_id())))
|
||||
DataManager.save_data("sensitivity", float(new_text))
|
||||
DataManager.save_data("sensitivity_game", game.get_selected_id(), \
|
||||
DataManager.categories.SETTINGS)
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(game.get_selected_id())), \
|
||||
DataManager.categories.SETTINGS)
|
||||
DataManager.save_data("sensitivity", float(new_text), \
|
||||
DataManager.categories.SETTINGS)
|
||||
|
||||
func _on_game_item_selected(index):
|
||||
DataManager.save_data("sensitivity_game", index)
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(index)))
|
||||
DataManager.save_data("sensitivity_game", index, \
|
||||
DataManager.categories.SETTINGS)
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(index)), \
|
||||
DataManager.categories.SETTINGS)
|
||||
|
|
|
@ -68,7 +68,7 @@ func _on_outline_color_color_changed(color):
|
|||
change_value("OutlineColor", str(color))
|
||||
|
||||
func change_value(key, value):
|
||||
DataManager.save_data(key, value)
|
||||
DataManager.save_data(key, value, DataManager.categories.CROSSHAIR)
|
||||
emit_signal("refresh_crosshair")
|
||||
|
||||
func set_window(window):
|
||||
|
|
|
@ -18,11 +18,11 @@ func _ready():
|
|||
func _on_resolution_slider_value_changed(value: float) -> void:
|
||||
get_viewport().scaling_3d_scale = value
|
||||
update_resolution_label()
|
||||
DataManager.save_data("resolution", value)
|
||||
DataManager.save_data("resolution", value, DataManager.categories.SETTINGS)
|
||||
|
||||
func _on_fov_slider_value_changed(value):
|
||||
update_fov_label()
|
||||
DataManager.save_data("camera_fov", value)
|
||||
DataManager.save_data("camera_fov", value, DataManager.categories.SETTINGS)
|
||||
|
||||
func update_resolution_label() -> void:
|
||||
var viewport_render_size = get_viewport().size * get_viewport().scaling_3d_scale
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue