This repository was archived by the owner on Apr 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoneMenu.cs
More file actions
36 lines (32 loc) · 1.53 KB
/
BoneMenu.cs
File metadata and controls
36 lines (32 loc) · 1.53 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
using Object = UnityEngine.Object;
namespace MediaPlayer;
internal static class BoneMenu
{
public static void CreateMenu()
{
MenuCategory mainCat = MenuManager.CreateCategory("Weather Electric", "#6FBDFF");
MenuCategory menuCategory = mainCat.CreateCategory("Media Player", "#ff21d2");
menuCategory.CreateFunctionElement("Spawn Media Player", Color.green, Spawn);
menuCategory.CreateFunctionElement("Despawn Media Player", Color.red, Despawn);
SubPanelElement settingsCategory = menuCategory.CreateSubPanel("Settings", "#B0B0B0");
if (HelperMethods.IsAndroid()) settingsCategory.CreateBoolPreference("Show Album Art", Color.white, Preferences.ShowAlbumArt, Preferences.OwnCategory);
settingsCategory.CreateBoolPreference("Show Playing Notifications", Color.white, Preferences.NotificationsEnabled, Preferences.OwnCategory);
settingsCategory.CreateFloatPreference("Notification Duration", Color.white, 0.1f, 0.5f, 5f, Preferences.NotificationDuration, Preferences.OwnCategory);
}
private static bool _isSpawned;
private static GameObject _prefab;
private static void Spawn()
{
if (_isSpawned) return;
var player = Player.playerHead;
var location = player.position + player.forward * 1f;
_prefab = Object.Instantiate(Assets.Prefab, location, player.rotation);
_isSpawned = true;
}
private static void Despawn()
{
if (!_isSpawned) return;
Object.Destroy(_prefab);
_isSpawned = false;
}
}