Add Drop Target Bank support#333
Conversation
Codecov Report
@@ Coverage Diff @@
## master #333 +/- ##
=======================================
Coverage 83.43% 83.43%
=======================================
Files 125 125
Lines 6736 6736
=======================================
Hits 5620 5620
Misses 1116 1116
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Awesome! As discussed, no data and item classes necessary for stuff that doesn't come from VPX.
Here a few more TODO items:
- Remove
.DS_Storeand preferably add them to.gitignoreas well :) - Add a documentation page
I haven't tested it yet, but will soon once I'm done with the teleporter.
0c96bb3 to
21957d7
Compare
21957d7 to
f4a7c2a
Compare
|
@freezy - thoughts on this? I want to generate a unique name for the prefabs. Instead of This works, but can it be better: if (CreateButton("Drop Target\nBank", Icons.DropTargetBank(color: iconColor), iconSize, buttonStyle))
{
CreatePrefab<DropTargetBankComponent>("Drop Target Banks", "Prefabs/DropTargetBank");
}
public string GetNewPrefabName<T>(Dictionary<string, T> dict, string prefix)
{
var n = 0;
do
{
var elementName = $"{prefix}{++n}";
if (!dict.ContainsKey(elementName.ToLower()))
{
return elementName;
}
} while (true);
}
private void CreatePrefab<T>(string groupName, string path)
{
var converter = new VpxSceneConverter(TableComponent);
TableComponent.TableContainer.Refresh();
var itemDictionary = new Dictionary<string, T>();
foreach (var component in TableComponent.GetComponentsInChildren<T>())
{
if (component is Component)
{
itemDictionary.Add((component as Component).name.ToLower(), component);
}
}
var parentGo = converter.GetGroupParent(groupName);
var prefab = Resources.Load<GameObject>(path);
var go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
if (go) {
go.transform.SetParent(parentGo.transform, false);
}
go.name = GetNewPrefabName(itemDictionary, go.name);
Selection.activeGameObject = go;
} |
|
Yeah, that's more or less what I'm doing in |
Awesome. Yeh, still trying to understand some of the advanced C# stuff. I'll commit the updates later, and then I think all that's left is documentation! |
done! |
This PR allows for a Drop Target Bank component to be added to the table.
Basically it adds support for a reset coil and selecting the drop targets that are in the bank.
The runtime inspector has some other neat features such as dropping and resetting the targets, monitoring the reset coil and switches.
A few things are left to do on this PR:
DropTargetBankfrom the Toolbox, it creates additional ones with the same "DropTargetBank1" name,Linking Drop Target Names to theDropTargetDataLink BankSize to theDropTargetDataIsDroppedAdd test cases for DropTargetData