Skip to content

Commit 7851659

Browse files
committed
add getvector3
1 parent 516e6ac commit 7851659

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CustomJSONData/Utils/DictionaryExtensions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Linq;
77
using System.Text;
88
using Newtonsoft.Json;
9+
using UnityEngine;
910

1011
public static class DictionaryExtensions
1112
{
@@ -50,6 +51,18 @@ public static class DictionaryExtensions
5051
return default;
5152
}
5253

54+
public static Vector3? GetVector3(this Dictionary<string, object?> dictionary, string key)
55+
{
56+
List<float>? data = dictionary.Get<List<object>>(key)?.Select(Convert.ToSingle).ToList();
57+
Vector3? final = null;
58+
if (data != null)
59+
{
60+
final = new Vector3(data[0], data[1], data[2]);
61+
}
62+
63+
return final;
64+
}
65+
5366
public static T? GetStringToEnum<T>(this Dictionary<string, object?> dictionary, string key)
5467
{
5568
if (dictionary.TryGetValue(key, out object? value) && value != null)

CustomJSONData/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json",
33
"author": "Aeroluna",
44
"description": "Lets mappers include arbitrary data in beatmaps, and lets modders access that data. Why did I make this? Good question.",
5-
"gameVersion": "1.18.0",
5+
"gameVersion": "1.18.3",
66
"dependsOn": {
77
"BSIPA": "^4.2.0"
88
},
99
"id": "CustomJSONData",
1010
"name": "CustomJSONData",
11-
"version": "2.0.7",
11+
"version": "2.0.8",
1212
"icon": "CustomJSONData.icon.png"
1313
}

0 commit comments

Comments
 (0)