This repository was archived by the owner on Apr 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathSettings.cs
More file actions
134 lines (129 loc) · 2.65 KB
/
Settings.cs
File metadata and controls
134 lines (129 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace api
{
internal class Settings
{
public static void SetPlayerSettings(string jsonData)
{
if (jsonData == "")
{
return;
}
Setting setting = JsonConvert.DeserializeObject<Setting>(jsonData);
Settings.playerSettings = Settings.LoadSettings();
foreach (Setting setting2 in Settings.playerSettings)
{
if (setting2.Key == setting.Key)
{
setting2.Value = setting.Value;
Settings.SaveSettings(Settings.playerSettings);
}
}
Settings.playerSettings.Add(new Setting
{
Key = setting.Key,
Value = setting.Value
});
Settings.SaveSettings(Settings.playerSettings);
}
public static List<Setting> LoadSettings()
{
return JsonConvert.DeserializeObject<List<Setting>>(File.ReadAllText(Environment.CurrentDirectory + Settings.SettingsPath));
}
public static void SaveSettings(List<Setting> settings)
{
File.WriteAllText(Environment.CurrentDirectory + Settings.SettingsPath, JsonConvert.SerializeObject(settings));
}
public static List<Setting> CreateDefaultSettings()
{
return new List<Setting>
{
new Setting
{
Key = "MOD_BLOCKED_TIME",
Value = 0f.ToString()
},
new Setting
{
Key = "MOD_BLOCKED_DURATION",
Value = 0f.ToString()
},
new Setting
{
Key = "PlayerSessionCount",
Value = 0f.ToString()
},
new Setting
{
Key = "ShowRoomCenter",
Value = 1f.ToString()
},
new Setting
{
Key = "QualitySettings",
Value = 3.ToString()
},
new Setting
{
Key = "Recroom.OOBE",
Value = 100.ToString()
},
new Setting
{
Key = "VoiceFilter",
Value = 0f.ToString()
},
new Setting
{
Key = "VIGNETTED_TELEPORT_ENABLED",
Value = 0f.ToString()
},
new Setting
{
Key = "CONTINUOUS_ROTATION_MODE",
Value = 0f.ToString()
},
new Setting
{
Key = "ROTATION_INCREMENT",
Value = 0f.ToString()
},
new Setting
{
Key = "ROTATE_IN_PLACE_ENABLED",
Value = 0f.ToString()
},
new Setting
{
Key = "TeleportBuffer",
Value = 0f.ToString()
},
new Setting
{
Key = "VoiceChat",
Value = 1f.ToString()
},
new Setting
{
Key = "PersonalBubble",
Value = 0f.ToString()
},
new Setting
{
Key = "ShowNames",
Value = 1f.ToString()
},
new Setting
{
Key = "H.264 plugin",
Value = 1f.ToString()
}
};
}
private static List<Setting> playerSettings;
public static string SettingsPath = "\\SaveData\\settings.txt";
}
}