Skip to content

Commit

Permalink
add getvector3
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeroluna committed Nov 24, 2021
1 parent 516e6ac commit 7851659
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CustomJSONData/Utils/DictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using UnityEngine;

public static class DictionaryExtensions
{
Expand Down Expand Up @@ -50,6 +51,18 @@ public static class DictionaryExtensions
return default;
}

public static Vector3? GetVector3(this Dictionary<string, object?> dictionary, string key)
{
List<float>? data = dictionary.Get<List<object>>(key)?.Select(Convert.ToSingle).ToList();
Vector3? final = null;
if (data != null)
{
final = new Vector3(data[0], data[1], data[2]);
}

return final;
}

public static T? GetStringToEnum<T>(this Dictionary<string, object?> dictionary, string key)
{
if (dictionary.TryGetValue(key, out object? value) && value != null)
Expand Down
4 changes: 2 additions & 2 deletions CustomJSONData/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json",
"author": "Aeroluna",
"description": "Lets mappers include arbitrary data in beatmaps, and lets modders access that data. Why did I make this? Good question.",
"gameVersion": "1.18.0",
"gameVersion": "1.18.3",
"dependsOn": {
"BSIPA": "^4.2.0"
},
"id": "CustomJSONData",
"name": "CustomJSONData",
"version": "2.0.7",
"version": "2.0.8",
"icon": "CustomJSONData.icon.png"
}

0 comments on commit 7851659

Please sign in to comment.