mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2025-02-17 11:18:37 +01:00
add capture setting manager
This commit is contained in:
parent
d804584bc6
commit
f860005057
2
.gitignore
vendored
2
.gitignore
vendored
@ -483,4 +483,4 @@ FodyWeavers.xsd
|
||||
# Additional files built by Visual Studio
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/unity,visualstudio,visualstudiocode
|
||||
Settings.json
|
||||
config.json
|
||||
|
@ -238,6 +238,7 @@ GameObject:
|
||||
- component: {fileID: 79544984}
|
||||
- component: {fileID: 79544983}
|
||||
- component: {fileID: 79544982}
|
||||
- component: {fileID: 79544985}
|
||||
m_Layer: 5
|
||||
m_Name: CPFPSDropdown
|
||||
m_TagString: Untagged
|
||||
@ -315,7 +316,7 @@ MonoBehaviour:
|
||||
m_Placeholder: {fileID: 0}
|
||||
m_ItemText: {fileID: 1016472457}
|
||||
m_ItemImage: {fileID: 0}
|
||||
m_Value: 1
|
||||
m_Value: 3
|
||||
m_Options:
|
||||
m_Options:
|
||||
- m_Text: 30
|
||||
@ -330,7 +331,19 @@ MonoBehaviour:
|
||||
m_Image: {fileID: 0}
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 79544985}
|
||||
m_TargetAssemblyTypeName: CaptureSettingManager, Assembly-CSharp
|
||||
m_MethodName: SetCPFPS
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_AlphaFadeSpeed: 0.15
|
||||
--- !u!114 &79544983
|
||||
MonoBehaviour:
|
||||
@ -370,6 +383,19 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 79544980}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &79544985
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 79544980}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aab0706a705f478439bdde244717e9f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
CaptureDisplay: {fileID: 2079759563}
|
||||
--- !u!1 &82439968
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5963,7 +5989,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: BitBlt
|
||||
m_text: 60
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
@ -5972,8 +5998,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
rgba: 4281675546
|
||||
m_fontColor: {r: 0.10196079, g: 0.18431373, b: 0.20784315, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@ -5990,13 +6016,13 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 14
|
||||
m_fontSizeBase: 14
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 0
|
||||
m_fontSizeMax: 0
|
||||
m_fontStyle: 0
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
@ -7651,6 +7677,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1186322796}
|
||||
- component: {fileID: 1186322797}
|
||||
- component: {fileID: 1186322798}
|
||||
m_Layer: 5
|
||||
m_Name: CP1P
|
||||
m_TagString: Untagged
|
||||
@ -7725,8 +7752,33 @@ MonoBehaviour:
|
||||
m_Group: {fileID: 0}
|
||||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1186322798}
|
||||
m_TargetAssemblyTypeName: CaptureSettingManager, Assembly-CSharp
|
||||
m_MethodName: SetCP1P
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_IsOn: 0
|
||||
--- !u!114 &1186322798
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1186322795}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aab0706a705f478439bdde244717e9f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
CaptureDisplay: {fileID: 2079759563}
|
||||
--- !u!1 &1200779468 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: -8526634141317621503, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||
@ -8809,7 +8861,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: BitBlt
|
||||
m_text: None
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
@ -8818,8 +8870,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
rgba: 4281675546
|
||||
m_fontColor: {r: 0.10196079, g: 0.18431373, b: 0.20784315, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@ -8836,13 +8888,13 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 14
|
||||
m_fontSizeBase: 14
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 0
|
||||
m_fontSizeMax: 0
|
||||
m_fontStyle: 0
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
@ -9422,14 +9474,22 @@ MonoBehaviour:
|
||||
m_Placeholder: {fileID: 0}
|
||||
m_ItemText: {fileID: 822698504}
|
||||
m_ItemImage: {fileID: 0}
|
||||
m_Value: 0
|
||||
m_Value: 3
|
||||
m_Options:
|
||||
m_Options:
|
||||
- m_Text: BitBlt
|
||||
- m_Text: 15
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: Windows Graphic Capture
|
||||
- m_Text: 30
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: Auto
|
||||
- m_Text: 45
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: 60
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: 90
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: 120
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: 144
|
||||
m_Image: {fileID: 0}
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
@ -10134,8 +10194,9 @@ GameObject:
|
||||
- component: {fileID: 1447858568}
|
||||
- component: {fileID: 1447858567}
|
||||
- component: {fileID: 1447858566}
|
||||
- component: {fileID: 1447858569}
|
||||
m_Layer: 5
|
||||
m_Name: CPModDropdown
|
||||
m_Name: CPModeDropdown
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -10214,6 +10275,10 @@ MonoBehaviour:
|
||||
m_Value: 0
|
||||
m_Options:
|
||||
m_Options:
|
||||
- m_Text: None
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: Print Window
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: BitBlt
|
||||
m_Image: {fileID: 0}
|
||||
- m_Text: Windows Graphic Capture
|
||||
@ -10222,7 +10287,19 @@ MonoBehaviour:
|
||||
m_Image: {fileID: 0}
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1447858569}
|
||||
m_TargetAssemblyTypeName: CaptureSettingManager, Assembly-CSharp
|
||||
m_MethodName: SetCPMode
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 1
|
||||
m_AlphaFadeSpeed: 0.15
|
||||
--- !u!114 &1447858567
|
||||
MonoBehaviour:
|
||||
@ -10262,6 +10339,19 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1447858564}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1447858569
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1447858564}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aab0706a705f478439bdde244717e9f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
CaptureDisplay: {fileID: 2079759563}
|
||||
--- !u!1 &1457747672
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -12102,8 +12192,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
rgba: 4281675546
|
||||
m_fontColor: {r: 0.10196079, g: 0.18431373, b: 0.20784315, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@ -12120,13 +12210,13 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 14
|
||||
m_fontSizeBase: 14
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 0
|
||||
m_fontSizeMax: 0
|
||||
m_fontStyle: 0
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
@ -12899,7 +12989,7 @@ GameObject:
|
||||
- component: {fileID: 1880181385}
|
||||
- component: {fileID: 1880181384}
|
||||
m_Layer: 5
|
||||
m_Name: NVRModDropdown
|
||||
m_Name: NVRModeDropdown
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -13388,7 +13478,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 60
|
||||
m_text: 120
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
@ -13397,8 +13487,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
rgba: 4281675546
|
||||
m_fontColor: {r: 0.10196079, g: 0.18431373, b: 0.20784315, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@ -13415,13 +13505,13 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 14
|
||||
m_fontSizeBase: 14
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 0
|
||||
m_fontSizeMax: 0
|
||||
m_fontStyle: 0
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
@ -13544,6 +13634,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1996820760}
|
||||
- component: {fileID: 1996820761}
|
||||
- component: {fileID: 1996820762}
|
||||
m_Layer: 5
|
||||
m_Name: CPDesktop
|
||||
m_TagString: Untagged
|
||||
@ -13618,8 +13709,33 @@ MonoBehaviour:
|
||||
m_Group: {fileID: 0}
|
||||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1996820762}
|
||||
m_TargetAssemblyTypeName: CaptureSettingManager, Assembly-CSharp
|
||||
m_MethodName: SetCPDesktop
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_IsOn: 0
|
||||
--- !u!114 &1996820762
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1996820759}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aab0706a705f478439bdde244717e9f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
CaptureDisplay: {fileID: 2079759563}
|
||||
--- !u!1 &2000688388
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
104
Assets/Scripts/Configurations/CaptureSettingManager.cs
Normal file
104
Assets/Scripts/Configurations/CaptureSettingManager.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using uWindowCapture;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CaptureSettingManager : MonoBehaviour
|
||||
{
|
||||
public GameObject CaptureDisplay;
|
||||
private UwcWindowTexture WindowTexture;
|
||||
private Material WindowMaterial;
|
||||
private TMP_Dropdown Dropdown;
|
||||
private Toggle Toggle;
|
||||
void Start()
|
||||
{
|
||||
WindowTexture = CaptureDisplay.GetComponent<UwcWindowTexture>();
|
||||
WindowMaterial = CaptureDisplay.GetComponent<Renderer>().material;
|
||||
Dropdown = GetComponent<TMP_Dropdown>();
|
||||
Toggle = GetComponent<Toggle>();
|
||||
switch (gameObject.name)
|
||||
{
|
||||
case "CPModeDropdown":
|
||||
GetCPMode();
|
||||
break;
|
||||
case "CPDesktop":
|
||||
GetCPDesktop();
|
||||
break;
|
||||
case "CPFPSDropdown":
|
||||
GetCPFPS();
|
||||
break;
|
||||
case "CP1P":
|
||||
GetCP1P();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void GetCPMode()
|
||||
{
|
||||
if (JsonConfig.HasKey("CaptureMode"))
|
||||
Dropdown.value = JsonConfig.GetInt("CaptureMode");
|
||||
SetCPMode();
|
||||
}
|
||||
public void GetCPDesktop()
|
||||
{
|
||||
if (JsonConfig.HasKey("CaptureDesktop"))
|
||||
Toggle.isOn = JsonConfig.GetBoolean("CaptureDesktop");
|
||||
SetCPDesktop();
|
||||
}
|
||||
public void GetCPFPS()
|
||||
{
|
||||
if (JsonConfig.HasKey("CaptureFPS"))
|
||||
Dropdown.value = JsonConfig.GetInt("CaptureFPS");
|
||||
SetCPFPS();
|
||||
|
||||
}
|
||||
public void GetCP1P()
|
||||
{
|
||||
if (JsonConfig.HasKey("Capture1P"))
|
||||
Toggle.isOn = JsonConfig.GetBoolean("Capture1P");
|
||||
SetCP1P();
|
||||
}
|
||||
|
||||
public void SetCPMode()
|
||||
{
|
||||
WindowTexture.captureMode = (CaptureMode)Dropdown.value;
|
||||
JsonConfig.SetInt("CaptureMode", Dropdown.value);
|
||||
}
|
||||
|
||||
public void SetCPDesktop()
|
||||
{
|
||||
if (Toggle.isOn)
|
||||
WindowTexture.type = WindowTextureType.Desktop;
|
||||
else
|
||||
WindowTexture.type = WindowTextureType.Window;
|
||||
JsonConfig.SetBoolean("CaptureDesktop", Toggle.isOn);
|
||||
}
|
||||
|
||||
public void SetCPFPS()
|
||||
{
|
||||
switch (Dropdown.value)
|
||||
{
|
||||
case 0:
|
||||
WindowTexture.captureFrameRate = 30;
|
||||
break;
|
||||
case 1:
|
||||
WindowTexture.captureFrameRate = 60;
|
||||
break;
|
||||
case 2:
|
||||
WindowTexture.captureFrameRate = 90;
|
||||
break;
|
||||
case 3:
|
||||
WindowTexture.captureFrameRate = 120;
|
||||
break;
|
||||
case 4:
|
||||
WindowTexture.captureFrameRate = 144;
|
||||
break;
|
||||
}
|
||||
JsonConfig.SetInt("CaptureFPS", Dropdown.value);
|
||||
}
|
||||
|
||||
public void SetCP1P()
|
||||
{
|
||||
WindowMaterial.SetTextureScale("_MainTex",new Vector2(Toggle.isOn ? 1f : 0.5f, 1));
|
||||
JsonConfig.SetBoolean("Capture1P", Toggle.isOn);
|
||||
}
|
||||
}
|
99
Assets/Scripts/Configurations/JsonConfig.cs
Normal file
99
Assets/Scripts/Configurations/JsonConfig.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
public static class JsonConfig {
|
||||
public static bool hasInitialized = false;
|
||||
private static JObject config;
|
||||
|
||||
private static void ensureInitialization() {
|
||||
if (hasInitialized)
|
||||
return;
|
||||
loadFile();
|
||||
hasInitialized = true;
|
||||
}
|
||||
|
||||
private static string getFileName() {
|
||||
return Application.dataPath + "/../config.json";
|
||||
}
|
||||
|
||||
private static void saveFile() {
|
||||
File.WriteAllText(getFileName(), config.ToString());
|
||||
}
|
||||
|
||||
private static void loadFile() {
|
||||
if (File.Exists(getFileName()))
|
||||
config = JObject.Parse(File.ReadAllText(getFileName()));
|
||||
else {
|
||||
config = new JObject();
|
||||
saveFile();
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteAll() {
|
||||
ensureInitialization();
|
||||
config.RemoveAll();
|
||||
saveFile();
|
||||
}
|
||||
public static void DeleteKey(string key) {
|
||||
ensureInitialization();
|
||||
config.Remove(key);
|
||||
saveFile();
|
||||
}
|
||||
|
||||
public static bool HasKey(string key) {
|
||||
ensureInitialization();
|
||||
return config.ContainsKey(key);
|
||||
}
|
||||
|
||||
public static void SetBoolean(string key, bool boolean) {
|
||||
ensureInitialization();
|
||||
config[key] = boolean;
|
||||
saveFile();
|
||||
}
|
||||
public static void SetString(string key, string text) {
|
||||
ensureInitialization();
|
||||
config[key] = text;
|
||||
saveFile();
|
||||
}
|
||||
public static void SetInt(string key, int number) {
|
||||
ensureInitialization();
|
||||
config[key] = number;
|
||||
saveFile();
|
||||
}
|
||||
public static void SetDouble(string key, double number) {
|
||||
ensureInitialization();
|
||||
config[key] = number;
|
||||
saveFile();
|
||||
}
|
||||
public static void SetFloatArray(string key, float[] numbers) {
|
||||
ensureInitialization();
|
||||
config[key] = JArray.FromObject(numbers);
|
||||
saveFile();
|
||||
}
|
||||
|
||||
public static bool GetBoolean(string key) {
|
||||
ensureInitialization();
|
||||
return config.Value<bool>(key);
|
||||
}
|
||||
public static string GetString(string key) {
|
||||
ensureInitialization();
|
||||
return config.Value<string>(key);
|
||||
}
|
||||
public static int GetInt(string key) {
|
||||
ensureInitialization();
|
||||
return config.Value<int>(key);
|
||||
}
|
||||
public static double GetDouble(string key) {
|
||||
ensureInitialization();
|
||||
return config.Value<double>(key);
|
||||
}
|
||||
public static float[] GetFloatArray(string key) {
|
||||
ensureInitialization();
|
||||
return config.Value<JArray>(key).ToObject<float[]>();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user