Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev merge #70

Merged
merged 21 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Down
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
Expand Up @@ -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);
}
}

Expand All @@ -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)
{
Expand Down
Loading