Skip to content

Commit

Permalink
chore: package sources are now located in the root of the repository;
Browse files Browse the repository at this point in the history
chore: com.stansassets.foundation dependency updated to v1.0.27
  • Loading branch information
alexey-yaremenko committed May 18, 2023
1 parent 1f1d89b commit 8e3a3fd
Show file tree
Hide file tree
Showing 262 changed files with 5,500 additions and 5,733 deletions.
22 changes: 15 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
/[Uu]serSettings/
/.idea/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

Expand Down Expand Up @@ -30,6 +44,7 @@ ExportedObj/
*.mdb
*.opendb
*.VC.db
*.DS_Store

# Unity3D generated meta files
*.pidb.meta
Expand All @@ -46,10 +61,3 @@ sysinfo.txt
# Crashlytics generated file
crashlytics-build.properties

PackageSampleProject/.idea
PackageSampleProject/obj
PackageSampleProject/Logs
PackageSampleProject/Temp
PackageSampleProject/UserSettings
PackageSampleProject/ProjectSettings
PackageSampleProject/Library
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,176 +1,176 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace StansAssets.Plugins.Editor
{
public static class IMGUIReorderablList
{
static readonly Dictionary<int, bool> s_GlobalFoldoutItemsState = new Dictionary<int, bool>();

public delegate string ItemName<T>(T item);

public delegate void ItemContent<T>(T item);

public delegate void OnItemAdd();

public static void Draw<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> itemContent = null, OnItemAdd onItemAdd = null, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
if (itemContent != null)
DrawFoldout(list, itemName, itemContent, buttonsContentOverride, itemStartUI);
else
DrawLabel(list, itemName, buttonsContentOverride, itemStartUI);

if (onItemAdd != null)
using (new IMGUIBeginVertical())
{
GUILayout.Space(-7);
using (new IMGUIBeginHorizontal())
{
EditorGUILayout.Space();
var add = GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(24));
if (add)
{
onItemAdd();
return;
}

GUILayout.Space(5);
}
}
}

static void DrawFoldout<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> itemContent, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
var indentLevel = EditorGUI.indentLevel;

var space = 10;
if (indentLevel >= 1) space += EditorGUI.indentLevel * 10;

EditorGUI.indentLevel = 0;

for (var i = 0; i < list.Count; i++)
{
var item = list[i];

using (new IMGUIBeginHorizontal())
{
GUILayout.Space(space);
using (new IMGUIBeginVertical(PluginsEditorSkin.BoxStyle))
{
var foldState = GetFoldoutState(item);
using (new IMGUIBeginHorizontal())
{
itemStartUI?.Invoke(item);
foldState = EditorGUILayout.Foldout(foldState, itemName(item), true);

SetFoldoutState(item, foldState);

if (buttonsContentOverride != null)
{
buttonsContentOverride.Invoke(item);
}
else
{
var itemWasRemoved = DrawButtons(item, list);
if (itemWasRemoved) return;
}
}

if (foldState)
using (new IMGUIIndentLevel(1))
{
EditorGUILayout.Space();
itemContent(item);
EditorGUILayout.Space();
}
}

GUILayout.Space(5);
}
}

EditorGUI.indentLevel = indentLevel;
}

static void DrawLabel<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
var indentLevel = EditorGUI.indentLevel;

var space = 10;
if (indentLevel >= 1) space += EditorGUI.indentLevel * 10;

EditorGUI.indentLevel = 0;

foreach (var item in list)
using (new IMGUIBeginHorizontal())
{
GUILayout.Space(space);
using (new IMGUIBeginVertical(PluginsEditorSkin.BoxStyle))
{
using (new IMGUIBeginHorizontal())
{
itemStartUI?.Invoke(item);

EditorGUILayout.SelectableLabel(itemName(item), GUILayout.Height(16));

if (buttonsContentOverride != null)
{
buttonsContentOverride.Invoke(item);
}
else
{
var itemWasRemoved = DrawButtons(item, list);
if (itemWasRemoved) return;
}
}
}
}

EditorGUI.indentLevel = indentLevel;
}

static bool GetFoldoutState(object item)
{
if (item == null) return false;
return s_GlobalFoldoutItemsState.ContainsKey(item.GetHashCode())
&& s_GlobalFoldoutItemsState[item.GetHashCode()];
}

static void SetFoldoutState(object item, bool value)
{
if (item == null) return;
s_GlobalFoldoutItemsState[item.GetHashCode()] = value;
}

static bool DrawButtons<T>(T currentObject, IList<T> objectsList)
{
var objectIndex = objectsList.IndexOf(currentObject);
if (objectIndex == 0) GUI.enabled = false;

var up = GUILayout.Button("↑", EditorStyles.miniButtonLeft, GUILayout.Width(20));
if (up)
{
var c = currentObject;
objectsList[objectIndex] = objectsList[objectIndex - 1];
objectsList[objectIndex - 1] = c;
}

GUI.enabled = objectIndex < objectsList.Count - 1;

var down = GUILayout.Button("↓", EditorStyles.miniButtonMid, GUILayout.Width(20));
if (down)
{
var c = currentObject;
objectsList[objectIndex] = objectsList[objectIndex + 1];
objectsList[objectIndex + 1] = c;
}

GUI.enabled = true;
var r = GUILayout.Button("-", EditorStyles.miniButtonRight, GUILayout.Width(20));
if (r) objectsList.Remove(currentObject);

return r;
}
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace StansAssets.Plugins.Editor
{
public static class IMGUIReorderablList
{
static readonly Dictionary<int, bool> s_GlobalFoldoutItemsState = new Dictionary<int, bool>();

public delegate string ItemName<T>(T item);

public delegate void ItemContent<T>(T item);

public delegate void OnItemAdd();

public static void Draw<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> itemContent = null, OnItemAdd onItemAdd = null, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
if (itemContent != null)
DrawFoldout(list, itemName, itemContent, buttonsContentOverride, itemStartUI);
else
DrawLabel(list, itemName, buttonsContentOverride, itemStartUI);

if (onItemAdd != null)
using (new IMGUIBeginVertical())
{
GUILayout.Space(-7);
using (new IMGUIBeginHorizontal())
{
EditorGUILayout.Space();
var add = GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(24));
if (add)
{
onItemAdd();
return;
}

GUILayout.Space(5);
}
}
}

static void DrawFoldout<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> itemContent, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
var indentLevel = EditorGUI.indentLevel;

var space = 10;
if (indentLevel >= 1) space += EditorGUI.indentLevel * 10;

EditorGUI.indentLevel = 0;

for (var i = 0; i < list.Count; i++)
{
var item = list[i];

using (new IMGUIBeginHorizontal())
{
GUILayout.Space(space);
using (new IMGUIBeginVertical(PluginsEditorSkin.BoxStyle))
{
var foldState = GetFoldoutState(item);
using (new IMGUIBeginHorizontal())
{
itemStartUI?.Invoke(item);
foldState = EditorGUILayout.Foldout(foldState, itemName(item), true);

SetFoldoutState(item, foldState);

if (buttonsContentOverride != null)
{
buttonsContentOverride.Invoke(item);
}
else
{
var itemWasRemoved = DrawButtons(item, list);
if (itemWasRemoved) return;
}
}

if (foldState)
using (new IMGUIIndentLevel(1))
{
EditorGUILayout.Space();
itemContent(item);
EditorGUILayout.Space();
}
}

GUILayout.Space(5);
}
}

EditorGUI.indentLevel = indentLevel;
}

static void DrawLabel<T>(IList<T> list, ItemName<T> itemName, ItemContent<T> buttonsContentOverride = null, ItemContent<T> itemStartUI = null)
{
var indentLevel = EditorGUI.indentLevel;

var space = 10;
if (indentLevel >= 1) space += EditorGUI.indentLevel * 10;

EditorGUI.indentLevel = 0;

foreach (var item in list)
using (new IMGUIBeginHorizontal())
{
GUILayout.Space(space);
using (new IMGUIBeginVertical(PluginsEditorSkin.BoxStyle))
{
using (new IMGUIBeginHorizontal())
{
itemStartUI?.Invoke(item);

EditorGUILayout.SelectableLabel(itemName(item), GUILayout.Height(16));

if (buttonsContentOverride != null)
{
buttonsContentOverride.Invoke(item);
}
else
{
var itemWasRemoved = DrawButtons(item, list);
if (itemWasRemoved) return;
}
}
}
}

EditorGUI.indentLevel = indentLevel;
}

static bool GetFoldoutState(object item)
{
if (item == null) return false;
return s_GlobalFoldoutItemsState.ContainsKey(item.GetHashCode())
&& s_GlobalFoldoutItemsState[item.GetHashCode()];
}

static void SetFoldoutState(object item, bool value)
{
if (item == null) return;
s_GlobalFoldoutItemsState[item.GetHashCode()] = value;
}

static bool DrawButtons<T>(T currentObject, IList<T> objectsList)
{
var objectIndex = objectsList.IndexOf(currentObject);
if (objectIndex == 0) GUI.enabled = false;

var up = GUILayout.Button("↑", EditorStyles.miniButtonLeft, GUILayout.Width(20));
if (up)
{
var c = currentObject;
objectsList[objectIndex] = objectsList[objectIndex - 1];
objectsList[objectIndex - 1] = c;
}

GUI.enabled = objectIndex < objectsList.Count - 1;

var down = GUILayout.Button("↓", EditorStyles.miniButtonMid, GUILayout.Width(20));
if (down)
{
var c = currentObject;
objectsList[objectIndex] = objectsList[objectIndex + 1];
objectsList[objectIndex + 1] = c;
}

GUI.enabled = true;
var r = GUILayout.Button("-", EditorStyles.miniButtonRight, GUILayout.Width(20));
if (r) objectsList.Remove(currentObject);

return r;
}
}
}
File renamed without changes.
Loading

0 comments on commit 8e3a3fd

Please sign in to comment.