Skip to content

Commit

Permalink
Remove Bolt.Addons.Community dependency and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Guyl committed Jan 15, 2021
1 parent c8cc953 commit d56fb7b
Show file tree
Hide file tree
Showing 28 changed files with 469 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Documentation~/bolt-assembly-options.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Documentation~/bolt-unit-wizard.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions Editor.meta

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

3 changes: 3 additions & 0 deletions Editor/Controls.meta

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

32 changes: 32 additions & 0 deletions Editor/Controls/UnitButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Controls
{
using Ludiq;

[Inspectable]
public class UnitButton
{
public System.Action action;
}
}
11 changes: 11 additions & 0 deletions Editor/Controls/UnitButton.cs.meta

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

37 changes: 37 additions & 0 deletions Editor/Controls/UnitButtonAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Controls
{
using System;

[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class UnitButtonAttribute : Attribute
{
public string action;

public UnitButtonAttribute(string action)
{
this.action = action;
}
}
}
11 changes: 11 additions & 0 deletions Editor/Controls/UnitButtonAttribute.cs.meta

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

69 changes: 69 additions & 0 deletions Editor/Controls/UnitButtonInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Controls
{
using UnityEngine;
using Ludiq;

[Inspector(typeof(UnitButton) )]
public class UnitButtonInspector : Inspector
{
public UnitButtonInspector(Metadata metadata) : base(metadata) { }

protected override float GetHeight(float width, GUIContent label)
{
return 16;
}

protected override void OnGUI(Rect position, GUIContent label)
{
BeginBlock(metadata, position, GUIContent.none);

var buttonPosition = new Rect(
position.x,
position.y,
position.width + 8,
16
);

if (GUI.Button(buttonPosition, "Trigger", new GUIStyle(UnityEditor.EditorStyles.miniButton)))
{
var attribute = metadata.GetAttribute<UnitButtonAttribute>(true);

if (attribute != null)
{
var method = attribute.action;

object typeObject = metadata.parent.value;
typeObject.GetType().GetMethod(method).Invoke(typeObject, new object[0] { });

}
}

if (EndBlock(metadata))
{
metadata.RecordUndo();
}
}
}
}
11 changes: 11 additions & 0 deletions Editor/Controls/UnitButtonInspector.cs.meta

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

28 changes: 28 additions & 0 deletions Editor/Controls/UnitButtonPropertyDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Controls
{
using UnityEditor;
[CustomPropertyDrawer(typeof(UnitButton))]
public class UnitButtonPropertyDrawer : PropertyDrawer { }
}
11 changes: 11 additions & 0 deletions Editor/Controls/UnitButtonPropertyDrawer.cs.meta

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

18 changes: 18 additions & 0 deletions Editor/Guyl.AtomsVS.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Guyl.AtomsVS.Editor",
"rootNamespace": "",
"references": [
"GUID:e3651765d08255f4bbce3c03079bcb7a"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Editor/Guyl.AtomsVS.Editor.asmdef.meta

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

3 changes: 3 additions & 0 deletions Editor/Utility.meta

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

71 changes: 71 additions & 0 deletions Editor/Utility/UnitButtonInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Utility
{
using UnityEngine;
using Ludiq;
using Runtime.Utility;

[Inspector(typeof(UnitButton))]
public class UnitButtonInspector : Inspector
{
public UnitButtonInspector(Metadata metadata) : base(metadata) { }

protected override float GetHeight(float width, GUIContent label)
{
return 16;
}

protected override void OnGUI(Rect position, GUIContent label)
{
BeginBlock(metadata, position, GUIContent.none);

var buttonPosition = new Rect(
position.x,
position.y,
position.width + 8,
16
);

if (GUI.Button(buttonPosition, "Trigger", new GUIStyle(UnityEditor.EditorStyles.miniButton)))
{
var attribute = metadata.GetAttribute<UnitButtonAttribute>(true);

if (attribute != null)
{
var method = attribute.action;

object typeObject = metadata.parent.value;
GraphReference reference = GraphWindow.activeReference;
typeObject.GetType().GetMethod(method).Invoke(typeObject, new object[1] { reference });

}
}

if (EndBlock(metadata))
{
metadata.RecordUndo();
}
}
}
}
3 changes: 3 additions & 0 deletions Editor/Utility/UnitButtonInspector.cs.meta

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

30 changes: 30 additions & 0 deletions Editor/Utility/UnitButtonPropertyDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// MIT License
//
// Copyright (c) 2018 RealityStop
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Guyl.AtomsVS.Editor.Utility
{
using Runtime.Utility;
using UnityEditor;

[CustomPropertyDrawer(typeof(UnitButton))]
public class UnitButtonPropertyDrawer : PropertyDrawer { }
}
3 changes: 3 additions & 0 deletions Editor/Utility/UnitButtonPropertyDrawer.cs.meta

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

Loading

0 comments on commit d56fb7b

Please sign in to comment.