Skip to content

Commit

Permalink
Merge pull request #70 from SideQuestVR/dev-merge
Browse files Browse the repository at this point in the history
Dev merge
mikeskydev authored Nov 18, 2024
2 parents 6224098 + ebec7ad commit 15aac66
Showing 28 changed files with 2,097 additions and 416 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Contribution Guidelines

[Back to documentation](/README.md?id=banter-sdk-contributions)

### Introduction

You can contribute by submitting your own components to be added to the Banter SDK so you can use them in your spaces. There are two types of components
55 changes: 55 additions & 0 deletions Editor/Components/BanterGrabHandleEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Banter.SDK;

namespace Banter.SDKEditor
{
[CustomEditor(typeof(BanterGrabHandle))]
public class BanterGrabHandleEditor : Editor
{
void OnEnable()
{
if (target is BanterGrabHandle)
{
var script = (BanterGrabHandle)target;
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
var path = AssetDatabase.GetAssetPath(script);
}
}
public override bool UseDefaultMargins() => false;
public override VisualElement CreateInspectorGUI()
{
var script = (BanterGrabHandle)target;
Editor editor = Editor.CreateEditor(script);
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
VisualElement myInspector = new VisualElement();

var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector");
myInspector.styleSheets.Add(_mainWindowStyleSheet);

var title = new Label("PROPERTIES SEEN BY JS");
title.style.fontSize = 14;
myInspector.Add(title);
var seeFields = new Label("grabType, grabRadius, ");
seeFields.style.unityFontStyleAndWeight = FontStyle.Bold;
seeFields.style.flexWrap = Wrap.Wrap;
seeFields.style.whiteSpace = WhiteSpace.Normal;
seeFields.style.marginBottom = 10;
seeFields.style.marginTop = 10;
seeFields.style.color = Color.gray;
myInspector.Add(seeFields);

//#if BANTER_EDITOR
var foldout = new Foldout();
foldout.text = "Available Properties";
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); });
foldout.value = false;
foldout.Add(inspectorIMGUI);
myInspector.Add(foldout);
//#endif

return myInspector;
}
}
}
11 changes: 11 additions & 0 deletions Editor/Components/BanterGrabHandleEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions Editor/Components/BanterHeldEventsEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Banter.SDK;

namespace Banter.SDKEditor
{
[CustomEditor(typeof(BanterHeldEvents))]
public class BanterHeldEventsEditor : Editor
{
void OnEnable()
{
if (target is BanterHeldEvents)
{
var script = (BanterHeldEvents)target;
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
var path = AssetDatabase.GetAssetPath(script);
}
}
public override bool UseDefaultMargins() => false;
public override VisualElement CreateInspectorGUI()
{
var script = (BanterHeldEvents)target;
Editor editor = Editor.CreateEditor(script);
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
VisualElement myInspector = new VisualElement();

var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector");
myInspector.styleSheets.Add(_mainWindowStyleSheet);

var title = new Label("PROPERTIES SEEN BY JS");
title.style.fontSize = 14;
myInspector.Add(title);
var seeFields = new Label("sensitivity, fireRate, auto, blockThumbstick, blockPrimary, blockSecondary, blockThumbstickClick, ");
seeFields.style.unityFontStyleAndWeight = FontStyle.Bold;
seeFields.style.flexWrap = Wrap.Wrap;
seeFields.style.whiteSpace = WhiteSpace.Normal;
seeFields.style.marginBottom = 10;
seeFields.style.marginTop = 10;
seeFields.style.color = Color.gray;
myInspector.Add(seeFields);

//#if BANTER_EDITOR
var foldout = new Foldout();
foldout.text = "Available Properties";
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); });
foldout.value = false;
foldout.Add(inspectorIMGUI);
myInspector.Add(foldout);
//#endif

return myInspector;
}
}
}
11 changes: 11 additions & 0 deletions Editor/Components/BanterHeldEventsEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions Editor/Components/BanterWorldObjectEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Banter.SDK;

namespace Banter.SDKEditor
{
[CustomEditor(typeof(BanterWorldObject))]
public class BanterWorldObjectEditor : Editor
{
void OnEnable()
{
if (target is BanterWorldObject)
{
var script = (BanterWorldObject)target;
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
var path = AssetDatabase.GetAssetPath(script);
}
}
public override bool UseDefaultMargins() => false;
public override VisualElement CreateInspectorGUI()
{
var script = (BanterWorldObject)target;
Editor editor = Editor.CreateEditor(script);
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector;
VisualElement myInspector = new VisualElement();

var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector");
myInspector.styleSheets.Add(_mainWindowStyleSheet);


//#if BANTER_EDITOR
var foldout = new Foldout();
foldout.text = "Available Properties";
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); });
foldout.value = false;
foldout.Add(inspectorIMGUI);
myInspector.Add(foldout);
//#endif

return myInspector;
}
}
}
11 changes: 11 additions & 0 deletions Editor/Components/BanterWorldObjectEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Editor/InitialiseOnLoad.cs
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ public static void SetupLayersAndTags()
if (ulayer == null || ulayer.stringValue != layer.Value)
{
isMissing = true;
missingLayers.Add("L" + layer.Key + ": " + layer.Value);
missingLayers.Add(layer.Value);
}
}

@@ -124,11 +124,11 @@ public static void SetupLayersAndTags()
if (utag == null || utag.stringValue != tag.Value)
{
isMissing = true;
missingTags.Add("T" + tag.Key + ": " + tag.Value);
missingTags.Add(tag.Value);
}
}

if (isMissing && EditorUtility.DisplayDialog("Missing Banter Layers/Tags", "Do you want to setup Banter layers and tags automatically?\nThese are required when using Banter specific features.\n Please back up your project first!" + (missingLayers.Count > 0 ? "\nLayers:\n" : "") + string.Join("\n", missingLayers) + (missingTags.Count > 0 ? "\nTags:\n" : "") + string.Join("\n", missingTags), "Yes", "No"))
if (isMissing && EditorUtility.DisplayDialog("Missing Banter Layers/Tags", "Do you want to setup Banter layers and tags automatically?\nThese are required when using Banter specific features.\n Please back up your project first!" + (missingLayers.Count > 0 ? "\n\nLayers:\n" : "") + string.Join(", ", missingLayers) + (missingTags.Count > 0 ? "\n\nTags:\n" : "") + string.Join(", ", missingTags), "Yes", "No"))
{
foreach (var layer in layersToAdd)
{
Loading

0 comments on commit 15aac66

Please sign in to comment.